1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-05-12 09:03:59 +00:00

PDF417/raster: performance large data; common.h inline, module_colour_is_set(); #209

This commit is contained in:
gitlost
2020-11-01 18:32:55 +00:00
parent 6bdd7e8509
commit 44923349f3
26 changed files with 1222 additions and 799 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

View File

@@ -32,7 +32,7 @@
#include "testcommon.h"
#include <sys/stat.h>
extern int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
extern int bmp_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
static void test_pixel_plot(int index, int debug) {
@@ -94,7 +94,7 @@ static void test_pixel_plot(int index, int debug) {
symbol->bitmap = (unsigned char *) data_buf;
ret = bmp_pixel_plot(symbol, data_buf);
ret = bmp_pixel_plot(symbol, (unsigned char *) data_buf);
assert_zero(ret, "i:%d bmp_pixel_plot ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
ret = testUtilVerifyIdentify(symbol->outfile, debug);

View File

@@ -31,7 +31,7 @@
#include "testcommon.h"
extern int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
extern int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
static void test_pixel_plot(int index, int debug) {
@@ -93,7 +93,7 @@ static void test_pixel_plot(int index, int debug) {
symbol->bitmap = (unsigned char *) data_buf;
ret = gif_pixel_plot(symbol, data_buf);
ret = gif_pixel_plot(symbol, (unsigned char *) data_buf);
assert_zero(ret, "i:%d gif_pixel_plot ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
ret = testUtilVerifyIdentify(symbol->outfile, debug);

View File

@@ -46,22 +46,30 @@ static void test_checks(int index, int debug) {
int input_mode;
int eci;
float dot_size;
int warn_level;
int ret;
char *expected;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%2d*\/", line(".") - line("'<"))
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_CODE128, "1234", -1, -1, 3, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching" },
/* 1*/ { BARCODE_CODE128, "1234", -1, -1, 0, -1, 0, "" },
/* 2*/ { BARCODE_QRCODE, "1234", -1, -1, 3, -1, 0, "" },
/* 3*/ { BARCODE_QRCODE, "1234", -1, -1, 999999 + 1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: Invalid ECI mode" },
/* 4*/ { BARCODE_CODE128, "1234", -1, -1, -1, 20.1, ZINT_ERROR_INVALID_OPTION, "Error 221: Invalid dot size" },
/* 5*/ { BARCODE_CODE128, "1234", -1, GS1_MODE, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode" },
/* 6*/ { BARCODE_GS1_128, "[21]12\0004", 8, GS1_MODE, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 262: NUL characters not permitted in GS1 mode" },
/* 7*/ { BARCODE_GS1_128, "[21]12é4", -1, GS1_MODE, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" },
/* 8*/ { BARCODE_GS1_128, "[21]12\0074", -1, GS1_MODE, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 251: Control characters are not supported by GS1" },
/* 9*/ { BARCODE_GS1_128, "[21]1234", -1, GS1_MODE, -1, -1, 0, "" },
/* 0*/ { BARCODE_CODE128, "1234", -1, -1, 3, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching" },
/* 1*/ { BARCODE_CODE128, "1234", -1, -1, 0, -1, -1, 0, "" },
/* 2*/ { BARCODE_QRCODE, "1234", -1, -1, 3, -1, -1, 0, "" },
/* 3*/ { BARCODE_QRCODE, "1234", -1, -1, 999999 + 1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: Invalid ECI mode" },
/* 4*/ { BARCODE_CODE128, "1234", -1, -1, -1, 20.1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Invalid dot size" },
/* 5*/ { BARCODE_CODE128, "1234", -1, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode" },
/* 6*/ { BARCODE_GS1_128, "[21]12\0004", 8, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 262: NUL characters not permitted in GS1 mode" },
/* 7*/ { BARCODE_GS1_128, "[21]12é4", -1, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" },
/* 8*/ { BARCODE_GS1_128, "[21]12\0074", -1, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 251: Control characters are not supported by GS1" },
/* 9*/ { BARCODE_GS1_128, "[21]1234", -1, GS1_MODE, -1, -1, -1, 0, "" },
/* 10*/ { 0, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range" },
/* 11*/ { 0, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range" },
/* 12*/ { 0, "1", -1, -1, 1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching" }, // Not supporting beats invalid ECI
/* 13*/ { 0, "1", -1, -1, 1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range" },
/* 14*/ { 0, "1", -1, -1, -1, 0.009, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Invalid dot size" },
/* 15*/ { 0, "1", -1, -1, -1, 0.009, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range" },
/* 16*/ { 0, "1", -1, -1, 1, 0.009, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Invalid dot size" }, // Invalid dot size beats invalid ECI
};
int data_size = sizeof(data) / sizeof(struct item);
@@ -82,6 +90,9 @@ static void test_checks(int index, int debug) {
if (data[i].dot_size != -1) {
symbol->dot_size = data[i].dot_size;
}
if (data[i].warn_level != -1) {
symbol->warn_level = data[i].warn_level;
}
symbol->debug |= debug;
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
@@ -384,6 +395,29 @@ static void test_bad_args(void) {
testFinish();
}
static void test_valid_id(void) {
testStart("");
int ret;
const char *name;
for (int symbol_id = -1; symbol_id < 160; symbol_id++) {
ret = ZBarcode_ValidID(symbol_id);
name = testUtilBarcodeName(symbol_id);
assert_nonnull(name, "testUtilBarcodeName(%d) NULL\n", symbol_id);
if (ret) {
assert_equal(ret, 1, "ZBarcode_Valid(%d) != 1\n", symbol_id);
assert_nonzero(*name != '\0', "testUtilBarcodeName(%d) empty when ZBarcode_Valid() true\n", symbol_id);
} else {
assert_zero(ret, "ZBarcode_Valid(%d) != 0\n", symbol_id);
assert_zero(*name, "testUtilBarcodeName(%d) non-empty when ZBarcode_Valid() false\n", symbol_id);
}
}
testFinish();
}
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
@@ -394,6 +428,7 @@ int main(int argc, char *argv[]) {
{ "test_encode_file_zero_length", test_encode_file_zero_length, 0, 0, 0 },
{ "test_encode_file_directory", test_encode_file_directory, 0, 0, 0 },
{ "test_bad_args", test_bad_args, 0, 0, 0 },
{ "test_valid_id", test_valid_id, 0, 0, 0 },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));

View File

@@ -213,6 +213,8 @@ static void test_input(int index, int generate, int debug) {
/* 22*/ { BARCODE_MICROPDF417, UNICODE_MODE, 811800, "A", ZINT_ERROR_INVALID_OPTION, 811800, 0, 0, "Error 473: Invalid ECI", "" },
/* 23*/ { BARCODE_HIBC_PDF, UNICODE_MODE, -1, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid characters in data", "" },
/* 24*/ { BARCODE_HIBC_MICPDF, UNICODE_MODE, -1, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid characters in data", "" },
/* 25*/ { BARCODE_PDF417, UNICODE_MODE, -1, "AB{} C#+ de{} {}F 12{} G{} H", 0, 0, 12, 120, "(36) 28 1 865 807 896 782 855 626 807 94 865 807 896 808 776 839 176 808 32 776 839 806 208", "" },
/* 26*/ { BARCODE_PDF417, UNICODE_MODE, -1, "{} #+ de{} 12{} {} H", 0, 0, 10, 120, "(30) 22 865 807 896 808 470 807 94 865 807 896 808 32 776 839 806 865 807 896 787 900 900", "" },
};
int data_size = ARRAY_SIZE(data);
@@ -366,19 +368,112 @@ static void test_encode(int index, int generate, int debug) {
"111111110101010001010111100111100010001100001100010100001100011101101110101100111100011010111100111110111111101000101001"
"111111110101010001110101110000110011000000101110010110001001110000101011001000111111011101011100110000111111101000101001"
},
/* 7*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction",
/* 7*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "1234567890123456789012345678901234567890123", 0, 9, 120, 1, "Numeric Compaction 43 consecutive",
"111111110101010001111101010111110011010110001110000100111101111010001101001101110000011111010101111100111111101000101001"
"111111110101010001111010100001000011010011100001000110100111101100001110000101100001011110101001000000111111101000101001"
"111111110101010001010100111100000011111010111000010110010010011111001000011010000111010101000011110000111111101000101001"
"111111110101010001101011110011111011100010001001110110011011000110001001000110011000011010111100111110111111101000101001"
"111111110101010001101011100000100010010111101000000111000010111011001001101111101000011110101110011100111111101000101001"
"111111110101010001111101011110110010001111001000100110110010111100001100011111001001011110101111101100111111101000101001"
"111111110101010001110100111011111010000110001100100110010001110111101001001110111000011101001110111110111111101000101001"
"111111110101010001111110100101110010100111100001000110000101111001101110010110000100010101111110111000111111101000101001"
"111111110101010001111110100110010011100100111110100100111110011000101001111000010001011111010011101000111111101000101001"
},
/* 8*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "12345678901234567890123456789012345678901234", 0, 9, 120, 1, "Numeric Compaction 44 consecutive",
"111111110101010001111101010111110011010110001110000100111101111010001000100011000011011111010101111100111111101000101001"
"111111110101010001111010100001000011101001100100000111010001100001001110010000001101011110101001000000111111101000101001"
"111111110101010001010100111100000011111100010110100101001100001111101010110011111000010101000011110000111111101000101001"
"111111110101010001101011110011111010010111100111100100110011100001101000111011101000011010111100111110111111101000101001"
"111111110101010001101011100000100011111000010100110110001011100100001011111001011100011110101110011100111111101000101001"
"111111110101010001111101011110110010101101111100000101110001100111001100011111001001011110101111101100111111101000101001"
"111111110101010001110100111011111010000110001100100100001011011000001000100000100100011101001110111110111111101000101001"
"111111110101010001111110100101110011100110011101000100110001011111101101001110000001010101111110111000111111101000101001"
"111111110101010001111110100110010010111001100011100101000110111110001001100001000111011111010011101000111111101000101001"
},
/* 9*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "123456789012345678901234567890123456789012345", 0, 9, 120, 1, "Numeric Compaction 45 consecutive",
"111111110101010001111101010111110011010110001110000100111101111010001000100011000011011111010101111100111111101000101001"
"111111110101010001111010100001000011101001100100000111010001100001001110010000001101011110101001000000111111101000101001"
"111111110101010001010100111100000011111100010110100101001100001111101010110011111000010101000011110000111111101000101001"
"111111110101010001101011110011111010010111100111100100110011100001101000111011101000011010111100111110111111101000101001"
"111111110101010001101011100000100011111000010100110110001011100100001011111001011100011110101110011100111111101000101001"
"111111110101010001111101011110110010101101111100000101110001100111001010110011111000011110101111101100111111101000101001"
"111111110101010001110100111011111010000110001100100100001001000010001000010001001000011101001110111110111111101000101001"
"111111110101010001111110100101110011110001001101100111101001110011101101111010111110010101111110111000111111101000101001"
"111111110101010001111110100110010011011110011001110110011100100011101100100100011111011111010011101000111111101000101001"
},
/* 10*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567", 0, 14, 120, 1, "Numeric Compaction 87 consecutive",
"111111110101010001111010100111100011111010111111010100111101111010001000100011000011011111010101111100111111101000101001"
"111111110101010001111110101000111011101001100100000111010001100001001110010000001101011111101010011100111111101000101001"
"111111110101010001010100111100000011111100010110100101001100001111101010110011111000011101010001111110111111101000101001"
"111111110101010001111101011111101010010111100111100100110011100001101000111011101000011010111100111110111111101000101001"
"111111110101010001110101110000110011111000010100110110001011100100001011111001011100011101011100011000111111101000101001"
"111111110101010001111101011110110010101101111100000101110001100111001111101001110100011101011111010000111111101000101001"
"111111110101010001101001110011110011000100011011100111101110000101101101101000010000011101001110111110111111101000101001"
"111111110101010001111101001011000010011000111110100101110000101111101100000100011101010101111110011100111111101000101001"
"111111110101010001111110100110010010000110011011110110011111010001001000011110110110010100110000111110111111101000101001"
"111111110101010001010001110111000011011110111000010100110001100000101111101011111101010100011000011000111111101000101001"
"111111110101010001110100111000110010111101101111100111110000101001101011111101011000011101001110011000111111101000101001"
"111111110101010001101000100011111011000111110010010100000100010111101011111001100100011010001101111110111111101000101001"
"111111110101010001010000010100000011110111001001100110100000100110001110111100011010011010000111011110111111101000101001"
"111111110101010001111101000100011011100101110011000111100011001101001000001011110001011110100010010000111111101000101001"
},
/* 11*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", 0, 14, 120, 1, "Numeric Compaction 88 consecutive",
"111111110101010001111010100111100011111010111111010100111101111010001000100011000011011111010101111100111111101000101001"
"111111110101010001111110101000111011101001100100000111010001100001001110010000001101011111101010011100111111101000101001"
"111111110101010001010100111100000011111100010110100101001100001111101010110011111000011101010001111110111111101000101001"
"111111110101010001111101011111101010010111100111100100110011100001101000111011101000011010111100111110111111101000101001"
"111111110101010001110101110000110011111000010100110110001011100100001011111001011100011101011100011000111111101000101001"
"111111110101010001111101011110110010101101111100000101110001100111001111011111010111011101011111010000111111101000101001"
"111111110101010001101001110011110011101100001001100110001001100011101110100110001111011101001110111110111111101000101001"
"111111110101010001111101001011000010100111110001100111110110010100001101100111100001010101111110011100111111101000101001"
"111111110101010001111110100110010011001000100111110101111110111001001011111011001000010100110000111110111111101000101001"
"111111110101010001010001110111000011111001010111110100000100011011001110110000010110010100011000011000111111101000101001"
"111111110101010001110100111000110011100010011001000100100011110100001011111101011000011101001110011000111111101000101001"
"111111110101010001101000100011111011000111110010010100011110100000101001110011011100011010001101111110111111101000101001"
"111111110101010001010000010100000011100010110011110111011001100111001110011010000110011010000111011110111111101000101001"
"111111110101010001111101000100011011110010110000110111011100111100101111010000110011011110100010010000111111101000101001"
},
/* 12*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 14, 120, 1, "Numeric Compaction 89 consecutive",
"111111110101010001111010100111100011111010111111010100111101111010001000100011000011011111010101111100111111101000101001"
"111111110101010001111110101000111011101001100100000111010001100001001110010000001101011111101010011100111111101000101001"
"111111110101010001010100111100000011111100010110100101001100001111101010110011111000011101010001111110111111101000101001"
"111111110101010001111101011111101010010111100111100100110011100001101000111011101000011010111100111110111111101000101001"
"111111110101010001110101110000110011111000010100110110001011100100001011111001011100011101011100011000111111101000101001"
"111111110101010001111101011110110010101101111100000101110001100111001111011111010111011101011111010000111111101000101001"
"111111110101010001101001110011110011101100001001100110001001100011101110100110001111011101001110111110111111101000101001"
"111111110101010001111101001011000010100111110001100111110110010100001101100111100001010101111110011100111111101000101001"
"111111110101010001111110100110010011001000100111110101111110111001001011111011001000010100110000111110111111101000101001"
"111111110101010001010001110111000011111001010111110100000100011011001110110000010110010100011000011000111111101000101001"
"111111110101010001110100111000110011100010011001000100100011110100001110101100010000011101001110011000111111101000101001"
"111111110101010001101000100011111011000111110010010110010001011111001111010011110001011010001101111110111111101000101001"
"111111110101010001010000010100000011100110011001110100111011110110001100010000100110011010000111011110111111101000101001"
"111111110101010001111101000100011011100101110001100110001001110100001010001111000001011110100010010000111111101000101001"
},
/* 13*/ { BARCODE_PDF417, -1, UNICODE_MODE, 0, 3, "AB{} C#+ de{} {}F 12{} G{} H", 0, 10, 120, 0, "Text Compaction newtable, BWIPP uses PUNCT_SHIFT better for less codewords",
"111111110101010001110101001110000011010111000111100111101010111100001000111011100100011111010101111100111111101000101001"
"111111110101010001111101010110000011100000101100010100111110100111001110001100011101011111010100110000111111101000101001"
"111111110101010001010100111100000010111111001110100100001101011100001001111101101000011010101111100000111111101000101001"
"111111110101010001010111110111110010100011101110000100011101110010001100000101001100011010111100111110111111101000101001"
"111111110101010001101011100100000010011111010011100110000010111010001111101111011101011010111000100000111111101000101001"
"111111110101010001111101011110110010111111011100100101101000011100001100111110110110011111010111000010111111101000101001"
"111111110101010001010011100111000011010111100111110110001100001000101100001101110111011101001110111110111111101000101001"
"111111110101010001101011111000111011100000101100100110100000011101001111101111011101011010111111011110111111101000101001"
"111111110101010001111110100110010010111111011100100110001111001011001011001100111100010100110111110000111111101000101001"
"111111110101010001010001100000110010000110001100100110011100110100001100100100110000010100011000011000111111101000101001"
},
/* 14*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction",
"11111111010101000111101010111100001101011011100000010000010000100010111001001100111101000010100001000011101010011100000111111101000101001"
"11111111010101000111110101001100001110010000111011010100111110000110111101001100001101111101000100011011111101010111000111111101000101001"
"11111111010101000110101001111100001010000001011110010100000010111100101000000101111001010000001011110011010100111110000111111101000101001"
"11111111010101000101011110011110001010001000001000011011000010100000111000110001001101100111000110010010101111101111100111111101000101001"
},
/* 8*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction, mod 6 == 0 (924 emitted)",
/* 15*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction, mod 6 == 0 (924 emitted)",
"11111111010101000111101010111100001101011011100000011000111000110100111001001100111101000010100001000011101010011100000111111101000101001"
"11111111010101000111110101001100001110010000111011010100111110000110111101001100001101111001010010000011111101010111000111111101000101001"
"11111111010101000110101001111100001001110000100110010011000100001110101000011001111101101000101111100011010100111110000111111101000101001"
"11111111010101000101011110011110001101000100011000010011000111001100110001100001000101110100010111000010101111101111100111111101000101001"
},
/* 9*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, 5, "ABCDEF1234567890123\177\177\177\177VWXYZ", 0, 6, 154, 1, "Text, Numeric, Byte, Text",
/* 16*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, 5, "ABCDEF1234567890123\177\177\177\177VWXYZ", 0, 6, 154, 1, "Text, Numeric, Byte, Text",
"1111111101010100011110101011110000110101110111100001111010101111000010100111001110000110100000101100001001111011110100011110101001111000111111101000101001"
"1111111101010100011110101000010000111101011001100001010011110000100011111100011101010110000010111000101111001011011000011111101010111000111111101000101001"
"1111111101010100011101010011111100110011111101100101010000001011110010100000010111100101000000101111001010000001011110010101000011110000111111101000101001"
@@ -386,7 +481,7 @@ static void test_encode(int index, int generate, int debug) {
"1111111101010100011010111000001000101111110101100001011111101011000011001011111001110111100100100100001011111101011000011101011100110000111111101000101001"
"1111111101010100011111010111100110110111110110011001101001011111000010101110011111100100100001000111101011000000101110011110101111101100111111101000101001"
},
/* 10*/ { BARCODE_PDF417COMP, -1, UNICODE_MODE, 1, 2, "PDF417 APK", 0, 6, 69, 0, "ISO 15438:2015 Figure G.1, same, BWIPP uses different encodation, same codeword count",
/* 17*/ { BARCODE_PDF417COMP, -1, UNICODE_MODE, 1, 2, "PDF417 APK", 0, 6, 69, 0, "ISO 15438:2015 Figure G.1, same, BWIPP uses different encodation, same codeword count",
"111111110101010001111010101111000011010100001100000111011101100110001"
"111111110101010001111010100010000011010000111000100111101000101000001"
"111111110101010001110101011111100010110011011110000100111110011000101"
@@ -394,7 +489,7 @@ static void test_encode(int index, int generate, int debug) {
"111111110101010001111010111000111011011000001111010110010011101000001"
"111111110101010001111010111101000011110100111101000110010010011111001"
},
/* 11*/ { BARCODE_PDF417COMP, -1, UNICODE_MODE, 4, 4, "ABCDEFG", 0, 10, 103, 1, "",
/* 18*/ { BARCODE_PDF417COMP, -1, UNICODE_MODE, 4, 4, "ABCDEFG", 0, 10, 103, 1, "",
"1111111101010100011101010011100000110101000011000001111010101111000010100111001110000110100000101100001"
"1111111101010100011110101000000100110100000011100101011111101011000010111111010110000101111110101100001"
"1111111101010100011010100111110000101111001100011001000001111010100010011111001100100111001011111001001"
@@ -406,7 +501,7 @@ static void test_encode(int index, int generate, int debug) {
"1111111101010100010100110011111000100110000110111101100111000010111010010001011110000110011111010001001"
"1111111101010100010100011000001100110001101010000001100011000110011011001001101110000111110111110101001"
},
/* 12*/ { BARCODE_HIBC_PDF, -1, UNICODE_MODE, -1, 3, "H123ABC01234567890D", 0, 8, 120, 0, "BWIPP uses different encodation, same codeword count but zint half-pad shorter",
/* 19*/ { BARCODE_HIBC_PDF, -1, UNICODE_MODE, -1, 3, "H123ABC01234567890D", 0, 8, 120, 0, "BWIPP uses different encodation, same codeword count but zint half-pad shorter",
"111111110101010001111101010111110011101011001111000100000100010010001110001110100010011111010101111100111111101000101001"
"111111110101010001111110101000111011110000010001010110101111110111101111100011101101011110101001000000111111101000101001"
"111111110101010001010100111100000011111010111101100100001111000101001100101000011111011101010001111110111111101000101001"
@@ -416,7 +511,7 @@ static void test_encode(int index, int generate, int debug) {
"111111110101010001110100111011111010100110001100000110100011100111101111010010111100011101001110111110111111101000101001"
"111111110101010001111101001011000011100001001100100111010000011001001111011000110100010101111110111000111111101000101001"
},
/* 13*/ { BARCODE_HIBC_PDF, -1, UNICODE_MODE, 1, 3, "A123BJC5D6E71", 0, 6, 120, 1, "BWIPP example",
/* 20*/ { BARCODE_HIBC_PDF, -1, UNICODE_MODE, 1, 3, "A123BJC5D6E71", 0, 6, 120, 1, "BWIPP example",
"111111110101010001111010101111000011110101101111100100000100010010001000011011100110011111010101111100111111101000101001"
"111111110101010001111010100010000011110000010001010110101111110111101111000001000101011111101010111000111111101000101001"
"111111110101010001010100111100000010110001100011110101111110111101101000111100011011010101000111100000111111101000101001"
@@ -424,7 +519,7 @@ static void test_encode(int index, int generate, int debug) {
"111111110101010001111010111000111011010111110011100110100000011100101111110101000111011101011100110000111111101000101001"
"111111110101010001111101011110110010011100110011100100011110110011001011001011100000011110101111000100111111101000101001"
},
/* 14*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "ABCDEFGHIJKLMNOPQRSTUV", 0, 20, 38, 1, "ISO 24728:2006 Figure 1 1st 1x20, same",
/* 21*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "ABCDEFGHIJKLMNOPQRSTUV", 0, 20, 38, 1, "ISO 24728:2006 Figure 1 1st 1x20, same",
"11110101001000011000110010011110101001"
"11100101001111110101011100011100101001"
"11101101001010011001111100011101101001"
@@ -446,7 +541,7 @@ static void test_encode(int index, int generate, int debug) {
"11011101001111011111011010011011101001"
"11011001001100010001110100011011001001"
},
/* 15*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 0, 20, 55, 1, "ISO 24728:2006 Figure 1 2nd 2x20, same",
/* 22*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 0, 20, 55, 1, "ISO 24728:2006 Figure 1 2nd 2x20, same",
"1111010100100001100011001001111010101111000011110101001"
"1110010100110101111110111101111101000100110011100101001"
"1110110100101101100111100001011001110011111011101101001"
@@ -468,7 +563,7 @@ static void test_encode(int index, int generate, int debug) {
"1101110100111010110011110001000001001101100011011101001"
"1101100100111100110110100001001001111001000011011001001"
},
/* 16*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN", 0, 20, 82, 1, "ISO 24728:2006 Figure 1 3rd 3x20",
/* 23*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN", 0, 20, 82, 1, "ISO 24728:2006 Figure 1 3rd 3x20",
"1100100010100001100011001001011110010111101010111100001010011100111000011100101101"
"1110100010111110100010011001011110110101000011111001101001011110010000011000101101"
"1110110010111100010111101001001110110110111011001111001001100001000111011000101001"
@@ -490,7 +585,7 @@ static void test_encode(int index, int generate, int debug) {
"1111010100101111011110100001011001000111110011010111101011110111110110011010000101"
"1110010100110010001111011001011001100111000010111011001110001011100110011011000101"
},
/* 17*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZAB", 0, 20, 99, 1, "ISO 24728:2006 Figure 1 4th 4x20, same",
/* 24*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZAB", 0, 20, 99, 1, "ISO 24728:2006 Figure 1 4th 4x20, same",
"110010001010000110001100100111101010111100001011110010101001110011100001101000001011000011100101101"
"111010001010100001111100110100101111001000001011110110111011011110011001101100111100100011000101101"
"111011001010011000010001110110011101000011101001110110110111100101100001000001010111100011000101001"
@@ -512,7 +607,7 @@ static void test_encode(int index, int generate, int debug) {
"111101010011100011101010000110001011101111001011001000111110111101011001100101110111100011010000101"
"111001010010001000001111010111100010100001001011001100100111101101111101001110100111110011011000101"
},
/* 18*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "123456789012345", 0, 14, 38, 1, "Number Compaction",
/* 25*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "123456789012345", 0, 14, 38, 1, "Number Compaction",
"11101110101011111101001100011101110101"
"11100110101110101011111100011100110101"
"11110110101000001011001100011110110101"
@@ -528,7 +623,7 @@ static void test_encode(int index, int generate, int debug) {
"11100101001101011110000110011100101001"
"11101101001101000111111001011101101001"
},
/* 19*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "\177\177\177", 0, 8, 55, 1, "Byte Compaction",
/* 26*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "\177\177\177", 0, 8, 55, 1, "Byte Compaction",
"1100100010100000100001000101010000010010000011001000101"
"1110100010111110100010001101111101000100011011101000101"
"1110110010110001111100100101100011111001001011101100101"
@@ -538,7 +633,7 @@ static void test_encode(int index, int generate, int debug) {
"1100111010111001111001100101000001001101100011001110101"
"1110111010111000101111011101110001000011010011101110101"
},
/* 20*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "\177\177\177\177\177\177", 0, 8, 55, 1, "Byte Compaction, mod 6 == 0 (924 emitted)",
/* 27*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "\177\177\177\177\177\177", 0, 8, 55, 1, "Byte Compaction, mod 6 == 0 (924 emitted)",
"1100100010110001110001101001110010011001111011001000101"
"1110100010100010001111010001110010000111011011101000101"
"1110110010101000011001111101101000101111100011101100101"
@@ -548,7 +643,7 @@ static void test_encode(int index, int generate, int debug) {
"1100111010100100010000100001110111101100001011001110101"
"1110111010111110011010100001101100001111010011101110101"
},
/* 21*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFG\177\177\177", 0, 8, 82, 1, "Text & Byte Compaction",
/* 28*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFG\177\177\177", 0, 8, 82, 1, "Text & Byte Compaction",
"1100111010100001100011001001000010110111101010111100001010011100111000011001110101"
"1110111010111110100010011001000010010110100000011100101101111110101110011101110101"
"1110011010101000000101111001000011010101000000101111001010000001011110011100110101"
@@ -558,7 +653,7 @@ static void test_encode(int index, int generate, int debug) {
"1100001010111110111010111001001100010110011100011000101101100001100110011000010101"
"1100011010110100011100001001001110010110110000111101001100011011110010011000110101"
},
/* 22*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "\177\177\177abcdefgh1234567890123", 0, 8, 99, 1, "Byte & Text & Numeric Compaction",
/* 29*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "\177\177\177abcdefgh1234567890123", 0, 8, 99, 1, "Byte & Text & Numeric Compaction",
"110011101010000010000100010101000001001000001000010110101000001001000001010000010010000011001110101"
"111011101010111111010110000110000010111001001000010010111101011100111001110100111001100011101110101"
"111001101011111001011110110101100110011110001000011010100001111000101001111110101100010011100110101"
@@ -568,7 +663,7 @@ static void test_encode(int index, int generate, int debug) {
"110000101011000011010000100100000101101100001001100010101110111110111001111001110010110011000010101"
"110001101011101110111100010100100011110100001001110010100000101111000101111001010010000011000110101"
},
/* 23*/ { BARCODE_HIBC_MICPDF, -1, UNICODE_MODE, -1, 4, "H123ABC01234567890D", 0, 8, 99, 0, "BWIPP uses different encodation, same codeword count but zint full-pad shorter",
/* 30*/ { BARCODE_HIBC_MICPDF, -1, UNICODE_MODE, -1, 4, "H123ABC01234567890D", 0, 8, 99, 0, "BWIPP uses different encodation, same codeword count but zint full-pad shorter",
"110011101010000110001100100100000100010010001000010110111000111010001001000001001100011011001110101"
"111011101011010111111011110111110001110110101000010010111101011100111001011111101001100011101110101"
"111001101011001010000111110100011110101000001000011010100111110001101001011011000111100011100110101"
@@ -578,7 +673,7 @@ static void test_encode(int index, int generate, int debug) {
"110000101010110110001000000111000101100111101001100010110111101110000101100010101100000011000010101"
"110001101011110110000011010111100100001101101001110010101101011111100001111001000110011011000110101"
},
/* 24*/ { BARCODE_HIBC_MICPDF, -1, UNICODE_MODE, -1, 1, "/EAH783", 0, 17, 38, 1, "HIBC Provider Applications Standard (PAS) example",
/* 31*/ { BARCODE_HIBC_MICPDF, -1, UNICODE_MODE, -1, 1, "/EAH783", 0, 17, 38, 1, "HIBC Provider Applications Standard (PAS) example",
"11001101001100011111001001011001101001"
"11011101001000001000100100011011101001"
"11011001001000100011110100011011001001"
@@ -597,7 +692,7 @@ static void test_encode(int index, int generate, int debug) {
"11010000101101100100001111011010000101"
"11011000101110111000100010011011000101"
},
/* 25*/ { BARCODE_PDF417, 9, DATA_MODE, -1, -1, "\342", 0, 7, 103, 1, "β",
/* 32*/ { BARCODE_PDF417, 9, DATA_MODE, -1, -1, "\342", 0, 7, 103, 1, "β",
"1111111101010100011111010101111100110101000110000001100011100011001011110101011110000111111101000101001"
"1111111101010100011111010100011000111110101000011001011111100100011011110101001000000111111101000101001"
"1111111101010100011101010111111000110110010011110001100011111001001011010100011111000111111101000101001"
@@ -606,7 +701,7 @@ static void test_encode(int index, int generate, int debug) {
"1111111101010100011110101111010000100011110001000101000110010111000011110101111000010111111101000101001"
"1111111101010100011101001110111110101110001110001001010001101100000011010011101111000111111101000101001"
},
/* 26*/ { BARCODE_MICROPDF417, 9, DATA_MODE, -1, 1, "\342\343", 0, 14, 38, 1, "βγ",
/* 33*/ { BARCODE_MICROPDF417, 9, DATA_MODE, -1, 1, "\342\343", 0, 14, 38, 1, "βγ",
"11101110101001111110010110011101110101"
"11100110101101010000111110011100110101"
"11110110101000001000010001011110110101"
@@ -976,6 +1071,106 @@ static void test_fuzz(int index, int debug) {
testFinish();
}
#include <time.h>
// Not a real test, just performance indicator
static void test_perf(int index, int debug) {
if (!(debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */
return;
}
int ret;
struct item {
int symbology;
int input_mode;
int option_1;
int option_2;
char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
};
struct item data[] = {
/* 0*/ { BARCODE_PDF417, -1, -1, -1,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz&,:#-.$/+%*=^ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM"
"NOPQRSTUVWXYZ;<>@[]_`~!||()?{}'123456789012345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJK"
"LMNOPQRSTUVWXYZ12345678912345678912345678912345678900001234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFG"
"HIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567"
"890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcde"
"fghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO",
0, 40, 307, "960 chars, text/numeric" },
/* 1*/ { BARCODE_PDF417, DATA_MODE, -1, -1,
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
"\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240",
0, 51, 358, "960 chars, byte" },
};
int data_size = ARRAY_SIZE(data);
clock_t start, total_encode = 0, total_buffer = 0, diff_encode, diff_buffer;
for (int i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
diff_encode = diff_buffer = 0;
for (int j = 0; j < 1000; j++) {
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
start = clock();
ret = ZBarcode_Buffer(symbol, 0 /*rotate_angle*/);
diff_buffer += clock() - start;
assert_zero(ret, "i:%d ZBarcode_Buffer ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
ZBarcode_Delete(symbol);
}
printf("%s: diff_encode %gms, diff_buffer %gms\n", data[i].comment, diff_encode * 1000.0 / CLOCKS_PER_SEC, diff_buffer * 1000.0 / CLOCKS_PER_SEC);
total_encode += diff_encode;
total_buffer += diff_buffer;
}
if (index != -1) {
printf("totals: encode %gms, buffer %gms\n", total_encode * 1000.0 / CLOCKS_PER_SEC, total_buffer * 1000.0 / CLOCKS_PER_SEC);
}
}
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
@@ -984,6 +1179,7 @@ int main(int argc, char *argv[]) {
{ "test_input", test_input, 1, 1, 1 },
{ "test_encode", test_encode, 1, 1, 1 },
{ "test_fuzz", test_fuzz, 1, 0, 1 },
{ "test_perf", test_perf, 1, 0, 1 },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));

View File

@@ -32,7 +32,7 @@
#include "testcommon.h"
#include <sys/stat.h>
extern int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
extern int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
static void test_pixel_plot(int index, int debug) {
@@ -91,7 +91,7 @@ static void test_pixel_plot(int index, int debug) {
symbol->bitmap = (unsigned char *) data_buf;
ret = png_pixel_plot(symbol, data_buf);
ret = png_pixel_plot(symbol, (unsigned char *) data_buf);
assert_zero(ret, "i:%d png_pixel_plot ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
ret = testUtilVerifyIdentify(symbol->outfile, debug);
@@ -118,47 +118,53 @@ static void test_print(int index, int generate, int debug) {
int symbology;
int input_mode;
int output_options;
int whitespace_width;
int show_hrt;
int option_1;
int option_2;
int height;
float scale;
char *fgcolour;
char *bgcolour;
char *data;
char *composite;
char *expected_file;
char *comment;
};
struct item data[] = {
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, BOLD_TEXT, -1, -1, -1, 0, 0, "Égjpqy", "", "../data/png/code128_egrave_bold.png", "" },
/* 1*/ { BARCODE_CODE128, UNICODE_MODE, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, 0, 0, "Égjpqy", "", "../data/png/code128_egrave_bold_box3.png", "" },
/* 2*/ { BARCODE_GS1_128_CC, -1, -1, -1, 3, -1, 0, 0, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", "../data/png/gs1_128_cc_fig12.png", "" },
/* 3*/ { BARCODE_CODABLOCKF, -1, -1, -1, 3, -1, 0, 0, "AAAAAAAAA", "", "../data/png/codablockf_3rows.png", "" },
/* 4*/ { BARCODE_EANX, -1, -1, -1, -1, -1, 0, 0, "9771384524017+12", "", "../data/png/ean13_2addon_ggs_5.2.2.5.1-2.png", "" },
/* 5*/ { BARCODE_EANX, -1, -1, -1, -1, -1, 0, 0, "9780877799306+54321", "", "../data/png/ean13_5addon_ggs_5.2.2.5.2-2.png", "" },
/* 6*/ { BARCODE_EANX_CC, -1, -1, -1, 1, -1, 0, 0, "123456789012+12", "[91]123456789012345678901", "../data/png/ean13_cc_2addon_cca_4x4.png", "" },
/* 7*/ { BARCODE_EANX_CC, -1, -1, -1, 2, -1, 0, 0, "123456789012+54321", "[91]1234567890", "../data/png/ean13_cc_5addon_ccb_3x4.png", "" },
/* 8*/ { BARCODE_EANX_CC, -1, -1, 0, 2, -1, 0, 0, "123456789012+54321", "[91]1234567890", "../data/png/ean13_cc_5addon_ccb_3x4_notext.png", "" },
/* 9*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, 0, 0, "012345678905+24", "", "../data/png/upca_2addon_ggs_5.2.6.6-5.png", "" },
/* 10*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, 0, 0, "614141234417+12345", "", "../data/png/upca_5addon.png", "" },
/* 11*/ { BARCODE_UPCA, -1, -1, 0, -1, -1, 0, 0, "614141234417+12345", "", "../data/png/upca_5addon_notext.png", "" },
/* 12*/ { BARCODE_UPCA, -1, BARCODE_BIND, -1, -1, -1, 0, 0, "614141234417+12345", "", "../data/png/upca_5addon_bind3.png", "" },
/* 13*/ { BARCODE_UPCA_CC, -1, -1, -1, 1, -1, 0, 0, "12345678901+12", "[91]123456789", "../data/png/upca_cc_2addon_cca_3x4.png", "" },
/* 14*/ { BARCODE_UPCA_CC, -1, -1, -1, 2, -1, 0, 0, "12345678901+12121", "[91]1234567890123", "../data/png/upca_cc_5addon_ccb_4x4.png", "" },
/* 15*/ { BARCODE_UPCA_CC, -1, -1, 0, 2, -1, 0, 0, "12345678901+12121", "[91]1234567890123", "../data/png/upca_cc_5addon_ccb_4x4_notext.png", "" },
/* 16*/ { BARCODE_UPCA_CC, -1, BARCODE_BIND, -1, 2, -1, 0, 0, "12345678901+12121", "[91]1234567890123", "../data/png/upca_cc_5addon_ccb_4x4_bind3.png", "" },
/* 17*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, 0, 0, "1234567+12", "", "../data/png/upce_2addon.png", "" },
/* 18*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, 0, 0, "1234567+12345", "", "../data/png/upce_5addon.png", "" },
/* 19*/ { BARCODE_UPCE_CC, -1, -1, -1, 1, -1, 0, 0, "0654321+89", "[91]1", "../data/png/upce_cc_2addon_cca_5x2.png", "" },
/* 20*/ { BARCODE_UPCE_CC, -1, -1, -1, 2, -1, 0, 0, "1876543+56789", "[91]12345", "../data/png/upce_cc_5addon_ccb_8x2.png", "" },
/* 21*/ { BARCODE_UPCE_CC, -1, -1, 0, 2, -1, 0, 0, "1876543+56789", "[91]12345", "../data/png/upce_cc_5addon_ccb_8x2_notext.png", "" },
/* 22*/ { BARCODE_EANX, -1, -1, -1, -1, -1, 0, 0, "1234567+12", "", "../data/png/ean8_2addon.png", "" },
/* 23*/ { BARCODE_EANX, -1, -1, -1, -1, -1, 0, 0, "1234567+12345", "", "../data/png/ean8_5addon.png", "" },
/* 24*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 0, "9876543+65", "[91]1234567", "../data/png/ean8_cc_2addon_cca_4x3.png", "" },
/* 25*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 0, "9876543+74083", "[91]123456789012345678", "../data/png/ean8_cc_5addon_ccb_8x3.png", "" },
/* 26*/ { BARCODE_EANX, -1, -1, -1, -1, -1, 0, 0, "12345", "", "../data/png/ean5.png", "" },
/* 27*/ { BARCODE_EANX, -1, -1, -1, -1, -1, 0, 0, "12", "", "../data/png/ean2.png", "" },
/* 28*/ { BARCODE_CODE39, -1, SMALL_TEXT, -1, -1, -1, 0, 0, "123", "", "../data/png/code39_small.png", "" },
/* 29*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, 0, 3.5, "12345", "", "../data/png/postnet_zip.png", "300 dpi, using 1/43in X, 300 / 43 / 2 = ~3.5 scale" },
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, BOLD_TEXT, -1, -1, -1, -1, 0, 0, "", "", "Égjpqy", "", "../data/png/code128_egrave_bold.png", "" },
/* 1*/ { BARCODE_CODE128, UNICODE_MODE, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, 0, 0, "", "", "Égjpqy", "", "../data/png/code128_egrave_bold_box3.png", "" },
/* 2*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, 3, -1, 0, 0, "", "", "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", "../data/png/gs1_128_cc_fig12.png", "" },
/* 3*/ { BARCODE_CODABLOCKF, -1, -1, -1, -1, 3, -1, 0, 0, "", "", "AAAAAAAAA", "", "../data/png/codablockf_3rows.png", "" },
/* 4*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9771384524017+12", "", "../data/png/ean13_2addon_ggs_5.2.2.5.1-2.png", "" },
/* 5*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9780877799306+54321", "", "../data/png/ean13_5addon_ggs_5.2.2.5.2-2.png", "" },
/* 6*/ { BARCODE_EANX_CC, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "123456789012+12", "[91]123456789012345678901", "../data/png/ean13_cc_2addon_cca_4x4.png", "" },
/* 7*/ { BARCODE_EANX_CC, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "123456789012+54321", "[91]1234567890", "../data/png/ean13_cc_5addon_ccb_3x4.png", "" },
/* 8*/ { BARCODE_EANX_CC, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "123456789012+54321", "[91]1234567890", "../data/png/ean13_cc_5addon_ccb_3x4_notext.png", "" },
/* 9*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "012345678905+24", "", "../data/png/upca_2addon_ggs_5.2.6.6-5.png", "" },
/* 10*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "614141234417+12345", "", "../data/png/upca_5addon.png", "" },
/* 11*/ { BARCODE_UPCA, -1, -1, -1, 0, -1, -1, 0, 0, "", "", "614141234417+12345", "", "../data/png/upca_5addon_notext.png", "" },
/* 12*/ { BARCODE_UPCA, -1, BARCODE_BIND, -1, -1, -1, -1, 0, 0, "", "", "614141234417+12345", "", "../data/png/upca_5addon_bind3.png", "" },
/* 13*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "12345678901+12", "[91]123456789", "../data/png/upca_cc_2addon_cca_3x4.png", "" },
/* 14*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", "../data/png/upca_cc_5addon_ccb_4x4.png", "" },
/* 15*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", "../data/png/upca_cc_5addon_ccb_4x4_notext.png", "" },
/* 16*/ { BARCODE_UPCA_CC, -1, BARCODE_BIND, -1, -1, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", "../data/png/upca_cc_5addon_ccb_4x4_bind3.png", "" },
/* 17*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12", "", "../data/png/upce_2addon.png", "" },
/* 18*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12345", "", "../data/png/upce_5addon.png", "" },
/* 19*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "0654321+89", "[91]1", "../data/png/upce_cc_2addon_cca_5x2.png", "" },
/* 20*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "1876543+56789", "[91]12345", "../data/png/upce_cc_5addon_ccb_8x2.png", "" },
/* 21*/ { BARCODE_UPCE_CC, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "1876543+56789", "[91]12345", "../data/png/upce_cc_5addon_ccb_8x2_notext.png", "" },
/* 22*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12", "", "../data/png/ean8_2addon.png", "" },
/* 23*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12345", "", "../data/png/ean8_5addon.png", "" },
/* 24*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9876543+65", "[91]1234567", "../data/png/ean8_cc_2addon_cca_4x3.png", "" },
/* 25*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9876543+74083", "[91]123456789012345678", "../data/png/ean8_cc_5addon_ccb_8x3.png", "" },
/* 26*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "12345", "", "../data/png/ean5.png", "" },
/* 27*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "12", "", "../data/png/ean2.png", "" },
/* 28*/ { BARCODE_CODE39, -1, SMALL_TEXT, -1, -1, -1, -1, 0, 0, "", "", "123", "", "../data/png/code39_small.png", "" },
/* 29*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, 0, 3.5, "", "", "12345", "", "../data/png/postnet_zip.png", "300 dpi, using 1/43in X, 300 / 43 / 2 = ~3.5 scale" },
/* 30*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, 0, 0, "", "CFCECDCC", "12345", "", "../data/png/pdf417_bgalpha.png", "" },
/* 31*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, 0, 0, "30313233", "", "12345", "", "../data/png/pdf417_fgalpha.png", "" },
/* 32*/ { BARCODE_ULTRA, -1, -1, 2, -1, -1, -1, 0, 0, "0000007F", "FF000033", "12345", "", "../data/png/ultra_alpha.png", "" },
};
int data_size = ARRAY_SIZE(data);
@@ -195,6 +201,15 @@ static void test_print(int index, int generate, int debug) {
if (data[i].output_options & (BARCODE_BOX | BARCODE_BIND)) {
symbol->border_width = 3;
}
if (data[i].whitespace_width != -1) {
symbol->whitespace_width = data[i].whitespace_width;
}
if (*data[i].fgcolour) {
strcpy(symbol->fgcolour, data[i].fgcolour);
}
if (*data[i].bgcolour) {
strcpy(symbol->bgcolour, data[i].bgcolour);
}
if (strlen(data[i].composite)) {
text = data[i].composite;
strcpy(symbol->primary, data[i].data);
@@ -211,10 +226,10 @@ static void test_print(int index, int generate, int debug) {
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
if (generate) {
printf(" /*%3d*/ { %s, %s, %s, %d, %d, %d, %d, %.5g, \"%s\", \"%s\", \"%s\", \"%s\" },\n",
printf(" /*%3d*/ { %s, %s, %s, %d, %d, %d, %d, %d, %.5g, \"%s\",\"%s\", \"%s\", \"%s\", \"%s\", \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), testUtilOutputOptionsName(data[i].output_options),
data[i].show_hrt, data[i].option_1, data[i].option_2, data[i].height, data[i].scale, testUtilEscape(data[i].data, length, escaped, escaped_size),
data[i].composite, data[i].expected_file, data[i].comment);
data[i].whitespace_width, data[i].show_hrt, data[i].option_1, data[i].option_2, data[i].height, data[i].scale, data[i].fgcolour, data[i].bgcolour,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].expected_file, data[i].comment);
ret = rename(symbol->outfile, data[i].expected_file);
assert_zero(ret, "i:%d rename(%s, %s) ret %d != 0\n", i, symbol->outfile, data[i].expected_file, ret);
if (have_identify) {

View File

@@ -281,7 +281,7 @@ static void test_buffer(int index, int generate, int debug) {
assert_zero(ret, "i:%d ZBarcode_Buffer(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
assert_nonnull(symbol->bitmap, "i:%d ZBarcode_Buffer(%s) bitmap NULL\n", i, testUtilBarcodeName(data[i].symbology));
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL);
if (generate) {
printf(" /*%3d*/ { %s, \"%s\", \"%s\", %d, %d, %d, %d, %d },\n",
@@ -383,7 +383,7 @@ static void test_upcean_hrt(int index, int debug) {
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, data[i].symbology);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL);
assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height);
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows);
@@ -500,7 +500,7 @@ static void test_row_separator(int index, int debug) {
int j, separator_bits_set;
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL);
for (j = data[i].expected_separator_row; j < data[i].expected_separator_row + data[i].expected_separator_height; j++) {
separator_bits_set = is_row_column_black(symbol, j, data[i].expected_separator_col);
@@ -580,7 +580,7 @@ static void test_stacking(int index, int debug) {
int j, separator_bits_set;
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL);
if (data[i].expected_separator_row != -1) {
for (j = data[i].expected_separator_row; j < data[i].expected_separator_row + data[i].expected_separator_height; j++) {
@@ -722,7 +722,7 @@ static void test_output_options(int index, int debug) {
if (ret < 5) {
assert_nonnull(symbol->bitmap, "i:%d (%s) symbol->bitmap NULL\n", i, testUtilBarcodeName(data[i].symbology));
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL);
assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height);
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows);
@@ -802,7 +802,7 @@ static void test_draw_string_wrap(int index, int debug) {
assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%d) symbol->bitmap_width %d != %d\n", i, data[i].symbology, symbol->bitmap_width, data[i].expected_bitmap_width);
assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%d) symbol->bitmap_height %d != %d\n", i, data[i].symbology, symbol->bitmap_height, data[i].expected_bitmap_height);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL);
ret = ZBarcode_Print(symbol, 0);
assert_zero(ret, "i:%d ZBarcode_Print(%d) ret %d != 0\n", i, data[i].symbology, ret);
@@ -868,7 +868,7 @@ static void test_code128_utf8(int index, int debug) {
assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%d) symbol->bitmap_width %d != %d\n", i, BARCODE_CODE128, symbol->bitmap_width, data[i].expected_bitmap_width);
assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%d) symbol->bitmap_height %d != %d\n", i, BARCODE_CODE128, symbol->bitmap_height, data[i].expected_bitmap_height);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL);
ret = ZBarcode_Print(symbol, 0);
assert_zero(ret, "i:%d ZBarcode_Print(%d) ret %d != 0\n", i, BARCODE_CODE128, ret);
@@ -972,7 +972,7 @@ static void test_scale(int index, int debug) {
assert_zero(ret, "i:%d ZBarcode_Buffer(%d) ret %d != 0\n", i, data[i].symbology, ret);
assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, data[i].symbology);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL);
assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %d != %d\n", i, data[i].symbology, symbol->height, data[i].expected_height);
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%d) symbol->rows %d != %d\n", i, data[i].symbology, symbol->rows, data[i].expected_rows);
@@ -1002,6 +1002,189 @@ static void test_scale(int index, int debug) {
testFinish();
}
static void test_buffer_plot(int index, int generate, int debug) {
testStart("");
int ret;
struct item {
int symbology;
int option_1;
int option_2;
int whitespace_width;
int output_options;
char *fgcolour;
char *bgcolour;
char *data;
int expected_height;
int expected_rows;
int expected_width;
int expected_bitmap_width;
int expected_bitmap_height;
char *expected_bitmap;
};
struct item data[] = {
/* 0*/ { BARCODE_PDF417, 0, 1, -1, -1, "", "", "1", 15, 5, 86, 86, 15,
"11111111010101000111101010111100001110101001110000011101010111000000111111101000101001"
"11111111010101000111101010111100001110101001110000011101010111000000111111101000101001"
"11111111010101000111101010111100001110101001110000011101010111000000111111101000101001"
"11111111010101000111111010101110001011111101001100011111101010111000111111101000101001"
"11111111010101000111111010101110001011111101001100011111101010111000111111101000101001"
"11111111010101000111111010101110001011111101001100011111101010111000111111101000101001"
"11111111010101000110101011111000001111110101101000011101010111111000111111101000101001"
"11111111010101000110101011111000001111110101101000011101010111111000111111101000101001"
"11111111010101000110101011111000001111110101101000011101010111111000111111101000101001"
"11111111010101000101011110011110001110111101100100011010111101111100111111101000101001"
"11111111010101000101011110011110001110111101100100011010111101111100111111101000101001"
"11111111010101000101011110011110001110111101100100011010111101111100111111101000101001"
"11111111010101000111010111001100001110100111000110011101011100110000111111101000101001"
"11111111010101000111010111001100001110100111000110011101011100110000111111101000101001"
"11111111010101000111010111001100001110100111000110011101011100110000111111101000101001"
},
/* 1*/ { BARCODE_PDF417, 0, 1, -1, -1, "FF0000", "00FF0099", "1", 15, 5, 86, 86, 15,
"RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRGRGRGGRRRGGGGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRGRGRGGRRRGGGGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRGRGRGGRRRGGGGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRRRRRRGRGRGRRRGGGRGRRRRRRGRGGRRGGGRRRRRRGRGRGRRRGGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRRRRRRGRGRGRRRGGGRGRRRRRRGRGGRRGGGRRRRRRGRGRGRRRGGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRRRRRRGRGRGRRRGGGRGRRRRRRGRGGRRGGGRRRRRRGRGRGRRRGGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRRGRGRGRRRRRGGGGGRRRRRRGRGRRGRGGGGRRRGRGRGRRRRRRGGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRRGRGRGRRRRRGGGGGRRRRRRGRGRRGRGGGGRRRGRGRGRRRRRRGGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRRGRGRGRRRRRGGGGGRRRRRRGRGRRGRGGGGRRRGRGRGRRRRRRGGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRGRGRRRRGGRRRRGGGRRRGRRRRGRRGGRGGGRRGRGRRRRGRRRRRGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRGRGRRRRGGRRRRGGGRRRGRRRRGRRGGRGGGRRGRGRRRRGRRRRRGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRGRGRRRRGGRRRRGGGRRRGRRRRGRRGGRGGGRRGRGRRRRGRRRRRGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRRRGRGRRRGGRRGGGGRRRGRGGRRRGGGRRGGRRRGRGRRRGGRRGGGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRRRGRGRRRGGRRGGGGRRRGRGGRRRGGGRRGGRRRGRGRRRGGRRGGGGRRRRRRRGRGGGRGRGGR"
"RRRRRRRRGRGRGRGGGRRRGRGRRRGGRRGGGGRRRGRGGRRRGGGRRGGRRRGRGRRRGGRRGGGGRRRRRRRGRGGGRGRGGR"
},
/* 2*/ { BARCODE_PDF417, 0, 1, 1, -1, "FFFF0033", "00FF00", "1", 15, 5, 86, 88, 15,
"GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYGYGYGGYYYGGGGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYGYGYGGYYYGGGGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYGYGYGGYYYGGGGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYYYYYYGYGYGYYYGGGYGYYYYYYGYGGYYGGGYYYYYYGYGYGYYYGGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYYYYYYGYGYGYYYGGGYGYYYYYYGYGGYYGGGYYYYYYGYGYGYYYGGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYYYYYYGYGYGYYYGGGYGYYYYYYGYGGYYGGGYYYYYYGYGYGYYYGGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYYGYGYGYYYYYGGGGGYYYYYYGYGYYGYGGGGYYYGYGYGYYYYYYGGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYYGYGYGYYYYYGGGGGYYYYYYGYGYYGYGGGGYYYGYGYGYYYYYYGGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYYGYGYGYYYYYGGGGGYYYYYYGYGYYGYGGGGYYYGYGYGYYYYYYGGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYGYGYYYYGGYYYYGGGYYYGYYYYGYYGGYGGGYYGYGYYYYGYYYYYGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYGYGYYYYGGYYYYGGGYYYGYYYYGYYGGYGGGYYGYGYYYYGYYYYYGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYGYGYYYYGGYYYYGGGYYYGYYYYGYYGGYGGGYYGYGYYYYGYYYYYGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYYYGYGYYYGGYYGGGGYYYGYGGYYYGGGYYGGYYYGYGYYYGGYYGGGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYYYGYGYYYGGYYGGGGYYYGYGGYYYGGGYYGGYYYGYGYYYGGYYGGGGYYYYYYYGYGGGYGYGGYG"
"GYYYYYYYYGYGYGYGGGYYYGYGYYYGGYYGGGGYYYGYGGYYYGGGYYGGYYYGYGYYYGGYYGGGGYYYYYYYGYGGGYGYGGYG"
},
/* 3*/ { BARCODE_ULTRA, -1, -1, -1, -1, "FF00007F", "00FF0000", "1", 13, 13, 13, 13, 13,
"1111111111111"
"10Y10GYCGYYC1"
"11C10MGYCGGG1"
"10G10GYCMCYC1"
"11Y10YMMGYGY1"
"10M10CGGCMYM1"
"1101010101011"
"10G10CYMGCCC1"
"11C10MCGCMMM1"
"10Y10CGCGYCY1"
"11M10GMMMMGC1"
"10C10MYYYGMY1"
"1111111111111"
},
/* 4*/ { BARCODE_ULTRA, -1, -1, 1, -1, "", "00FF0000", "1", 13, 13, 13, 15, 13,
"G1111111111111G"
"G10Y10GYCGYYC1G"
"G11C10MGYCGGG1G"
"G10G10GYCMCYC1G"
"G11Y10YMMGYGY1G"
"G10M10CGGCMYM1G"
"G1101010101011G"
"G10G10CYMGCCC1G"
"G11C10MCGCMMM1G"
"G10Y10CGCGYCY1G"
"G11M10GMMMMGC1G"
"G10C10MYYYGMY1G"
"G1111111111111G"
},
/* 5*/ { BARCODE_CHANNEL, -1, -1, 1, -1, "30313233", "CFCECDCC", "1", 5, 1, 19, 21, 5,
"CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD"
"CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD"
"CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD"
"CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD"
"CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD"
},
};
int data_size = ARRAY_SIZE(data);
int row, column;
int fg_len, bg_len;
for (int i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d\n", i);
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
int length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug);
if (data[i].whitespace_width != -1) {
symbol->whitespace_width = data[i].whitespace_width;
}
if (*data[i].fgcolour) {
strcpy(symbol->fgcolour, data[i].fgcolour);
}
if (*data[i].bgcolour) {
strcpy(symbol->bgcolour, data[i].bgcolour);
}
/* Keep dumps small */
symbol->show_hrt = 0;
symbol->scale = 0.5f;
symbol->height = 1;
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, 0);
assert_zero(ret, "i:%d ZBarcode_Buffer(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
assert_nonnull(symbol->bitmap, "i:%d ZBarcode_Buffer(%s) bitmap NULL\n", i, testUtilBarcodeName(data[i].symbology));
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL);
if (generate) {
printf(" /*%3d*/ { %s, %d, %d, %d, %s, \"%s\", \"%s\", \"%s\", %d, %d, %d, %d, %d,\n",
i, testUtilBarcodeName(data[i].symbology), data[i].option_1, data[i].option_2, data[i].whitespace_width, testUtilOutputOptionsName(data[i].output_options),
data[i].fgcolour, data[i].bgcolour, data[i].data, symbol->height, symbol->rows, symbol->width, symbol->bitmap_width, symbol->bitmap_height);
testUtilBitmapPrint(symbol, " ", "\n");
printf(" },\n");
} else {
assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height);
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width);
assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%s) symbol->bitmap_width %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_width, data[i].expected_bitmap_width);
assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%s) symbol->bitmap_height %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_height, data[i].expected_bitmap_height);
ret = testUtilBitmapCmp(symbol, data[i].expected_bitmap, &row, &column);
assert_zero(ret, "i:%d (%s) testUtilBitmapCmp ret %d != 0 column %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, column, row, data[i].data);
fg_len = strlen(data[i].fgcolour);
bg_len = strlen(data[i].bgcolour);
if (fg_len > 6 || bg_len > 6) {
assert_nonnull(symbol->alphamap, "i:%d ZBarcode_Buffer(%s) alphamap NULL\n", i, testUtilBarcodeName(data[i].symbology));
// TODO: check alphamap
} else {
assert_null(symbol->alphamap, "i:%d ZBarcode_Buffer(%s) alphamap not NULL\n", i, testUtilBarcodeName(data[i].symbology));
}
}
ZBarcode_Delete(symbol);
}
testFinish();
}
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
@@ -1014,6 +1197,7 @@ int main(int argc, char *argv[]) {
{ "test_draw_string_wrap", test_draw_string_wrap, 1, 0, 1 },
{ "test_code128_utf8", test_code128_utf8, 1, 0, 1 },
{ "test_scale", test_scale, 1, 0, 1 },
{ "test_buffer_plot", test_buffer_plot, 1, 1, 1 },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));

View File

@@ -31,7 +31,7 @@
#include "testcommon.h"
extern int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
extern int tif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
// For overview when debugging: ./test_tiff -f pixel_plot -d 5
static void test_pixel_plot(int index, int debug) {
@@ -112,7 +112,7 @@ static void test_pixel_plot(int index, int debug) {
symbol->bitmap = (unsigned char *) data_buf;
ret = tif_pixel_plot(symbol, data_buf);
ret = tif_pixel_plot(symbol, (unsigned char *) data_buf);
assert_zero(ret, "i:%d tif_pixel_plot ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
ret = testUtilVerifyIdentify(symbol->outfile, debug);

View File

@@ -42,7 +42,10 @@
#include <unistd.h>
#include <errno.h>
#ifndef COMMON_INLINE
extern int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord);
extern int module_colour_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord);
#endif
static int tests = 0;
static int failed = 0;
@@ -656,10 +659,20 @@ int testUtilSymbolCmp(const struct zint_symbol *a, const struct zint_symbol *b)
if (a->width != b->width) {
return 3;
}
for (int i = 0; i < a->rows; i++) {
for (int j = 0; j < a->width; j++) {
if (module_is_set(a, i, j) != module_is_set(b, i, j)) {
return 4;
if (a->symbology == BARCODE_ULTRA) {
for (int i = 0; i < a->rows; i++) {
for (int j = 0; j < a->width; j++) {
if (module_colour_is_set(a, i, j) != module_colour_is_set(b, i, j)) {
return 4;
}
}
}
} else {
for (int i = 0; i < a->rows; i++) {
for (int j = 0; j < a->width; j++) {
if (module_is_set(a, i, j) != module_is_set(b, i, j)) {
return 4;
}
}
}
}
@@ -884,21 +897,27 @@ int testUtilVectorCmp(const struct zint_vector *a, const struct zint_vector *b)
return 0;
}
void testUtilModulesDump(const struct zint_symbol *symbol, char *prefix, char *postfix) {
void testUtilModulesDump(const struct zint_symbol *symbol, const char *prefix, const char *postfix) {
int r;
for (r = 0; r < symbol->rows; r++) {
testUtilModulesDumpRow(symbol, r, prefix, postfix);
}
}
void testUtilModulesDumpRow(const struct zint_symbol *symbol, int row, char *prefix, char *postfix) {
void testUtilModulesDumpRow(const struct zint_symbol *symbol, int row, const char *prefix, const char *postfix) {
int w;
if (*prefix) {
fputs(prefix, stdout);
}
putchar('"');
for (w = 0; w < symbol->width; w++) {
putchar(module_is_set(symbol, row, w) + '0');
if (symbol->symbology == BARCODE_ULTRA) {
for (w = 0; w < symbol->width; w++) {
putchar(module_colour_is_set(symbol, row, w) + '0');
}
} else {
for (w = 0; w < symbol->width; w++) {
putchar(module_is_set(symbol, row, w) + '0');
}
}
putchar('"');
if (*postfix) {
@@ -910,14 +929,27 @@ int testUtilModulesCmp(const struct zint_symbol *symbol, const char *expected, i
const char *e = expected;
const char *ep = expected + strlen(expected);
int r, w = 0;
for (r = 0; r < symbol->rows && e < ep; r++) {
for (w = 0; w < symbol->width && e < ep; w++) {
if (module_is_set(symbol, r, w) + '0' != *e) {
*row = r;
*width = w;
return 1 /*fail*/;
if (symbol->symbology == BARCODE_ULTRA) {
for (r = 0; r < symbol->rows && e < ep; r++) {
for (w = 0; w < symbol->width && e < ep; w++) {
if (module_colour_is_set(symbol, r, w) + '0' != *e) {
*row = r;
*width = w;
return 1 /*fail*/;
}
e++;
}
}
} else {
for (r = 0; r < symbol->rows && e < ep; r++) {
for (w = 0; w < symbol->width && e < ep; w++) {
if (module_is_set(symbol, r, w) + '0' != *e) {
*row = r;
*width = w;
return 1 /*fail*/;
}
e++;
}
e++;
}
}
*row = r;
@@ -929,12 +961,22 @@ int testUtilModulesCmpRow(const struct zint_symbol *symbol, int row, const char
const char *e = expected;
const char *ep = expected + strlen(expected);
int w;
for (w = 0; w < symbol->width && e < ep; w++) {
if (module_is_set(symbol, row, w) + '0' != *e) {
*width = w;
return 1 /*fail*/;
if (symbol->symbology == BARCODE_ULTRA) {
for (w = 0; w < symbol->width && e < ep; w++) {
if (module_colour_is_set(symbol, row, w) + '0' != *e) {
*width = w;
return 1 /*fail*/;
}
e++;
}
} else {
for (w = 0; w < symbol->width && e < ep; w++) {
if (module_is_set(symbol, row, w) + '0' != *e) {
*width = w;
return 1 /*fail*/;
}
e++;
}
e++;
}
*width = w;
return e != ep || w != symbol->width ? 1 /*fail*/ : 0 /*success*/;
@@ -956,8 +998,14 @@ int testUtilModulesDumpHex(const struct zint_symbol *symbol, char dump[], int du
space = 0;
}
byt = byt << 1;
if (module_is_set(symbol, r, i)) {
byt += 1;
if (symbol->symbology == BARCODE_ULTRA) {
if (module_colour_is_set(symbol, r, i)) {
byt += 1;
}
} else {
if (module_is_set(symbol, r, i)) {
byt += 1;
}
}
if (d < de && ((i + 1) % 4) == 0) {
*d++ = hex[byt];
@@ -1004,35 +1052,103 @@ char *testUtilUCharArrayDump(unsigned char *array, int size, char *dump, int dum
return dump;
}
void testUtilBitmapPrint(const struct zint_symbol *symbol) {
static char colour[] = { '0', 'C', 'B', 'M', 'R', 'Y', 'G', '1' };
void testUtilBitmapPrint(const struct zint_symbol *symbol, const char *prefix, const char *postfix) {
static char colour[] = { '0', 'C', 'M', 'B', 'Y', 'G', 'R', '1' };
int row, column, i, j;
fputs(" ", stdout);
for (column = 0; column < symbol->bitmap_width; column += 10) printf("%-3d ", column);
fputs("\n ", stdout);
for (column = 0; column < symbol->bitmap_width; column++) printf("%d", column % 10);
putchar('\n');
if (!prefix) {
fputs(" ", stdout);
for (column = 0; column < symbol->bitmap_width; column += 10) printf("%-3d ", column);
fputs("\n ", stdout);
for (column = 0; column < symbol->bitmap_width; column++) printf("%d", column % 10);
putchar('\n');
}
for (row = 0; row < symbol->bitmap_height; row++) {
printf("%3d: ", row);
if (!prefix) {
printf("%3d: ", row);
} else {
if (*prefix) {
fputs(prefix, stdout);
}
putchar('"');
}
for (column = 0; column < symbol->bitmap_width; column++) {
if (symbol->output_options & OUT_BUFFER_INTERMEDIATE) {
putchar(symbol->bitmap[(row * symbol->bitmap_width) + column]);
} else {
i = ((row * symbol->bitmap_width) + column) * 3;
j = (symbol->bitmap[i] == 0) + (symbol->bitmap[i + 1] == 0) * 2 + (symbol->bitmap[i + 2] == 0) * 4;
putchar(colour[j]);
if ((symbol->bitmap[i] == 0 || symbol->bitmap[i] == 0xff) && (symbol->bitmap[i + 1] == 0 || symbol->bitmap[i + 1] == 0xff)
&& (symbol->bitmap[i + 2] == 0 || symbol->bitmap[i + 2] == 0xff)) {
j = (symbol->bitmap[i] == 0) + (symbol->bitmap[i + 1] == 0) * 2 + (symbol->bitmap[i + 2] == 0) * 4;
putchar(colour[j]);
} else {
printf("%02X%02X%02X", symbol->bitmap[i], symbol->bitmap[i + 1], symbol->bitmap[i + 2]);
}
}
}
if (!postfix) {
putchar('\n');
} else {
putchar('"');
if (*postfix) {
fputs(postfix, stdout);
}
}
putchar('\n');
}
fputs(" ", stdout);
for (column = 0; column < symbol->bitmap_width; column++) printf("%d", column % 10);
fputs("\n ", stdout);
for (column = 0; column < symbol->bitmap_width; column += 10) printf("%-3d ", column);
putchar('\n');
if (!postfix) {
fputs(" ", stdout);
for (column = 0; column < symbol->bitmap_width; column++) printf("%d", column % 10);
fputs("\n ", stdout);
for (column = 0; column < symbol->bitmap_width; column += 10) printf("%-3d ", column);
putchar('\n');
}
}
int testUtilBitmapCmp(const struct zint_symbol *symbol, const char *expected, int *row, int *column) {
static char colour[] = { '0', 'C', 'M', 'B', 'Y', 'G', 'R', '1' };
int r, c, i, j;
const char *e = expected;
const char *ep = expected + strlen(expected);
char buf[7];
for (r = 0; r < symbol->bitmap_height; r++) {
for (c = 0; c < symbol->bitmap_width; c++) {
if (symbol->output_options & OUT_BUFFER_INTERMEDIATE) {
if (*e != symbol->bitmap[(r * symbol->bitmap_width) + c]) {
*row = r;
*column = c;
return 1 /*fail*/;
}
e++;
} else {
i = ((r * symbol->bitmap_width) + c) * 3;
if ((symbol->bitmap[i] == 0 || symbol->bitmap[i] == 0xff) && (symbol->bitmap[i + 1] == 0 || symbol->bitmap[i + 1] == 0xff)
&& (symbol->bitmap[i + 2] == 0 || symbol->bitmap[i + 2] == 0xff)) {
j = (symbol->bitmap[i] == 0) + (symbol->bitmap[i + 1] == 0) * 2 + (symbol->bitmap[i + 2] == 0) * 4;
if (*e != colour[j]) {
*row = r;
*column = c;
return 1 /*fail*/;
}
e++;
} else {
sprintf(buf, "%02X%02X%02X", symbol->bitmap[i], symbol->bitmap[i + 1], symbol->bitmap[i + 2]);
if (strncmp(buf, e, 6) != 0) {
*row = r;
*column = c;
return 1 /*fail*/;
}
e += 6;
}
}
}
}
*row = r;
*column = c;
return e != ep || r != symbol->bitmap_height || c != symbol->bitmap_width ? 1 /*fail*/ : 0 /*success*/;
}
int testUtilExists(char *filename) {

View File

@@ -73,6 +73,7 @@ void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size);
#define ZINT_DEBUG_TEST_LESS_NOISY 32
#define ZINT_DEBUG_TEST_KEEP_OUTFILE 64
#define ZINT_DEBUG_TEST_BWIPP 128
#define ZINT_DEBUG_TEST_PERFORMANCE 256
extern void vector_free(struct zint_symbol *symbol); /* Free vector structures */
@@ -90,14 +91,15 @@ void testUtilStrCpyRepeat(char *buffer, char *repeat, int size);
int testUtilSymbolCmp(const struct zint_symbol *a, const struct zint_symbol *b);
struct zint_vector *testUtilVectorCpy(const struct zint_vector *in);
int testUtilVectorCmp(const struct zint_vector *a, const struct zint_vector *b);
void testUtilModulesDump(const struct zint_symbol *symbol, char *prefix, char *postfix); // TODO: should be called Print not Dump
void testUtilModulesDumpRow(const struct zint_symbol *symbol, int row, char *prefix, char *postfix); // TODO: should be called Print not Dump
void testUtilModulesDump(const struct zint_symbol *symbol, const char *prefix, const char *postfix); // TODO: should be called Print not Dump
void testUtilModulesDumpRow(const struct zint_symbol *symbol, int row, const char *prefix, const char *postfix); // TODO: should be called Print not Dump
int testUtilModulesCmp(const struct zint_symbol *symbol, const char *expected, int *width, int *row);
int testUtilModulesCmpRow(const struct zint_symbol *symbol, int row, const char *expected, int *width);
int testUtilModulesDumpHex(const struct zint_symbol *symbol, char dump[], int dump_size);
char *testUtilUIntArrayDump(unsigned int *array, int size, char *dump, int dump_size);
char *testUtilUCharArrayDump(unsigned char *array, int size, char *dump, int dump_size);
void testUtilBitmapPrint(const struct zint_symbol *symbol);
void testUtilBitmapPrint(const struct zint_symbol *symbol, const char *prefix, const char *postfix);
int testUtilBitmapCmp(const struct zint_symbol *symbol, const char *expected, int *row, int *column);
int testUtilExists(char *filename);
int testUtilCmpPngs(char *file1, char *file2);
int testUtilCmpTxts(char *txt1, char *txt2);