diff --git a/backend/code128.c b/backend/code128.c index 169b7a67..716f846e 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -1011,9 +1011,7 @@ INTERNAL int gs1_128(struct zint_symbol *symbol, unsigned char source[], int len /* Add check digit if encoding an NVE18 symbol */ INTERNAL int nve18(struct zint_symbol *symbol, unsigned char source[], int length) { - int i, count, check_digit; int error_number, zeroes; - int factor; unsigned char ean128_equiv[23]; if (length > 17) { @@ -1031,17 +1029,7 @@ INTERNAL int nve18(struct zint_symbol *symbol, unsigned char source[], int lengt memset(ean128_equiv + 4, '0', zeroes); ustrcpy(ean128_equiv + 4 + zeroes, source); - count = 0; - factor = 3; - for (i = 20; i >= 4; i--) { - count += ctoi(ean128_equiv[i]) * factor; - factor ^= 2; /* Toggles 1 and 3 */ - } - check_digit = 10 - count % 10; - if (check_digit == 10) { - check_digit = 0; - } - ean128_equiv[21] = itoc(check_digit); + ean128_equiv[21] = gs1_check_digit(ean128_equiv + 4, 17); ean128_equiv[22] = '\0'; error_number = gs1_128(symbol, ean128_equiv, 22); @@ -1051,7 +1039,6 @@ INTERNAL int nve18(struct zint_symbol *symbol, unsigned char source[], int lengt /* EAN-14 - A version of EAN-128 */ INTERNAL int ean14(struct zint_symbol *symbol, unsigned char source[], int length) { - int i, count, check_digit; int error_number, zeroes; unsigned char ean128_equiv[19]; @@ -1070,15 +1057,7 @@ INTERNAL int ean14(struct zint_symbol *symbol, unsigned char source[], int lengt memset(ean128_equiv + 4, '0', zeroes); ustrcpy(ean128_equiv + 4 + zeroes, source); - count = 0; - for (i = 16; i >= 4; i--) { - count += i & 1 ? ctoi(ean128_equiv[i]) : 3 * ctoi(ean128_equiv[i]); - } - check_digit = 10 - (count % 10); - if (check_digit == 10) { - check_digit = 0; - } - ean128_equiv[17] = itoc(check_digit); + ean128_equiv[17] = gs1_check_digit(ean128_equiv + 4, 13); ean128_equiv[18] = '\0'; error_number = gs1_128(symbol, ean128_equiv, 18); diff --git a/backend/dmatrix.c b/backend/dmatrix.c index bb9aa5fe..c4a85cdb 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -422,10 +422,11 @@ static int dm_look_ahead_test(const unsigned char source[], const int length, co if (cnt_1 < ascii_count && cnt_1 < b256_count && cnt_1 < edf_count && cnt_1 < x12_count && cnt_1 < c40_count) { /* Adjusted to avoid early exit from Base 256 if have less than break-even sequence of TEXT chars */ - if (current_mode == DM_BASE256 && position + 6 < length - && dm_text_sp_cnt(source, position, length, sp) >= 12) { - if (debug_print) printf("TEX->"); - return DM_TEXT; /* step (r)(4) */ + if (current_mode == DM_BASE256 && position + 6 < length) { + if (dm_text_sp_cnt(source, position, length, sp) >= 12) { + if (debug_print) printf("TEX->"); + return DM_TEXT; /* step (r)(4) */ + } } else { if (debug_print) printf("TEX->"); return DM_TEXT; /* step (r)(4) */ @@ -1044,7 +1045,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], symbols_left = dm_codewords_remaining(symbol, tp, process_p); - if (debug_print) printf("\nsymbols_left %d, process_p %d ", symbols_left, process_p); + if (debug_print) printf("\nsymbols_left %d, tp %d, process_p %d ", symbols_left, tp, process_p); if (current_mode == DM_C40 || current_mode == DM_TEXT) { /* NOTE: changed to follow spec exactly here, only using Shift 1 padded triplets when 2 symbol chars remain. @@ -1180,18 +1181,15 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], static void dm_add_tail(unsigned char target[], int tp, const int tail_length) { int i, prn, temp; - for (i = tail_length; i > 0; i--) { - if (i == tail_length) { - target[tp++] = 129; /* Pad */ + target[tp++] = 129; /* Pad */ + for (i = 1; i < tail_length; i++) { + /* B.1.1 253-state randomising algorithm */ + prn = ((149 * (tp + 1)) % 253) + 1; + temp = 129 + prn; + if (temp <= 254) { + target[tp++] = (unsigned char) (temp); } else { - /* B.1.1 253-state randomising algorithm */ - prn = ((149 * (tp + 1)) % 253) + 1; - temp = 129 + prn; - if (temp <= 254) { - target[tp++] = (unsigned char) (temp); - } else { - target[tp++] = (unsigned char) (temp - 254); - } + target[tp++] = (unsigned char) (temp - 254); } } } diff --git a/backend/library.c b/backend/library.c index b0e979db..c823ba5c 100644 --- a/backend/library.c +++ b/backend/library.c @@ -607,7 +607,8 @@ STATIC_UNLESS_ZINT_TEST void strip_bom(unsigned char *source, int *input_length) } } -static int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string, int *length) { +STATIC_UNLESS_ZINT_TEST int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string, + int *length) { int in_posn, out_posn; int hex1, hex2; int i, unicode; diff --git a/backend/rss.c b/backend/rss.c index 20fed411..d177f9fa 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -1330,6 +1330,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int data_chars = bp / 12; + if (debug_print) printf("Data:"); for (i = 0; i < data_chars; i++) { k = i * 12; vs = 0; @@ -1352,6 +1353,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int } v_odd = (vs - g_sum_exp[group - 1]) / t_even_exp[group - 1]; v_even = (vs - g_sum_exp[group - 1]) % t_even_exp[group - 1]; + if (debug_print) printf("%s%d", i == 0 || (i & 1) ? " " : ",", vs); getRSSwidths(widths, v_odd, modules_odd_exp[group - 1], 4, widest_odd_exp[group - 1], 0); char_widths[i][0] = widths[0]; @@ -1364,6 +1366,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int char_widths[i][5] = widths[2]; char_widths[i][7] = widths[3]; } + if (debug_print) printf("\n"); /* 7.2.6 Check character */ /* The checksum value is equal to the mod 211 residue of the weighted sum of the widths of the diff --git a/backend/tests/test_2of5.c b/backend/tests/test_2of5.c index d5a1161a..7bdeb903 100644 --- a/backend/tests/test_2of5.c +++ b/backend/tests/test_2of5.c @@ -303,12 +303,13 @@ static void test_encode(int index, int generate, int debug) { int data_size = ARRAY_SIZE(data); char escaped[1024]; - char bwipp_buf[4096]; - char bwipp_msg[1024]; + char cmp_buf[4096]; + char cmp_msg[1024]; int i, length, ret; struct zint_symbol *symbol; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_encode"); @@ -341,12 +342,23 @@ static void test_encode(int index, int generate, int debug) { assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) { - ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); + } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[8192 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); } } } diff --git a/backend/tests/test_aztec.c b/backend/tests/test_aztec.c index 98fc0d98..33434925 100644 --- a/backend/tests/test_aztec.c +++ b/backend/tests/test_aztec.c @@ -108,8 +108,6 @@ static void test_options(int index, int debug) { static void test_encode(int index, int generate, int debug) { - int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise - struct item { int symbology; int input_mode; @@ -2393,8 +2391,11 @@ static void test_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[1024]; - char bwipp_buf[32768]; - char bwipp_msg[1024]; + char cmp_buf[32768]; + char cmp_msg[1024]; + + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_encode"); @@ -2431,14 +2432,25 @@ static void test_encode(int index, int generate, int debug) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { - ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); } } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[22801 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); + } } } diff --git a/backend/tests/test_code.c b/backend/tests/test_code.c index e6a2835e..42374641 100644 --- a/backend/tests/test_code.c +++ b/backend/tests/test_code.c @@ -420,10 +420,11 @@ static void test_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[1024]; - char bwipp_buf[8192]; - char bwipp_msg[1024]; + char cmp_buf[8192]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_encode"); @@ -456,12 +457,23 @@ static void test_encode(int index, int generate, int debug) { assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) { - ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); + } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[8192 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); } } } diff --git a/backend/tests/test_code128.c b/backend/tests/test_code128.c index f48d0092..29296312 100644 --- a/backend/tests/test_code128.c +++ b/backend/tests/test_code128.c @@ -783,10 +783,11 @@ static void test_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[1024]; - char bwipp_buf[8192]; - char bwipp_msg[1024]; + char cmp_buf[8192]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_encode"); @@ -822,14 +823,25 @@ static void test_encode(int index, int generate, int debug) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { - ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); } } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[17984 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); + } } } diff --git a/backend/tests/test_dmatrix.c b/backend/tests/test_dmatrix.c index 0c01a75c..2fbce829 100644 --- a/backend/tests/test_dmatrix.c +++ b/backend/tests/test_dmatrix.c @@ -55,296 +55,298 @@ static void test_large(int index, int debug) { /* 5*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "A", 2336, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 6*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\200", 1556, 0, 144, 144 }, // Spec says 1555 but 1556 correct as only single byte count of 0 required /* 7*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\200", 1557, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { BARCODE_HIBC_DM, -1, { 0, 0, "" }, "1", 110, 0, 32, 32 }, - /* 9*/ { BARCODE_HIBC_DM, -1, { 0, 0, "" }, "1", 111, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 10*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "1", 6, 0, 10, 10 }, - /* 11*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "1", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 12*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "A", 3, 0, 10, 10 }, - /* 13*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "A", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 14*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "\200", 1, 0, 10, 10 }, - /* 15*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "\200", 2, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 16*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "1", 10, 0, 12, 12 }, - /* 17*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "1", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 18*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "A", 6, 0, 12, 12 }, - /* 19*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 20*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "\200", 3, 0, 12, 12 }, - /* 21*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "\200", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 22*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "1", 16, 0, 14, 14 }, - /* 23*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "1", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 24*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "A", 10, 0, 14, 14 }, - /* 25*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 26*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "\200", 6, 0, 14, 14 }, - /* 27*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 28*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "1", 24, 0, 16, 16 }, - /* 29*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "1", 25, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 30*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "A", 16, 0, 16, 16 }, - /* 31*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "A", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 32*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "\200", 10, 0, 16, 16 }, - /* 33*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "\200", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 34*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "1", 36, 0, 18, 18 }, - /* 35*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "1", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 36*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "A", 25, 0, 18, 18 }, - /* 37*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "A", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 38*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "\200", 16, 0, 18, 18 }, - /* 39*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 40*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "1", 44, 0, 20, 20 }, - /* 41*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 42*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "A", 31, 0, 20, 20 }, - /* 43*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 44*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "\200", 20, 0, 20, 20 }, - /* 45*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 46*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "1", 60, 0, 22, 22 }, - /* 47*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "1", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 48*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "A", 43, 0, 22, 22 }, - /* 49*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "A", 44, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 50*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "\200", 28, 0, 22, 22 }, - /* 51*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "\200", 29, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 52*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "1", 72, 0, 24, 24 }, - /* 53*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "1", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 54*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "A", 52, 0, 24, 24 }, - /* 55*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "A", 53, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 56*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "\200", 34, 0, 24, 24 }, - /* 57*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "\200", 35, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 58*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "1", 88, 0, 26, 26 }, - /* 59*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 60*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "A", 64, 0, 26, 26 }, - /* 61*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 62*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "\200", 42, 0, 26, 26 }, - /* 63*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 64*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "1", 124, 0, 32, 32 }, - /* 65*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 66*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "A", 91, 0, 32, 32 }, - /* 67*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "A", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 68*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "\200", 60, 0, 32, 32 }, - /* 69*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "\200", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 70*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "1", 172, 0, 36, 36 }, - /* 71*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "1", 173, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 72*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "A", 127, 0, 36, 36 }, - /* 73*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "A", 128, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 74*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "\200", 84, 0, 36, 36 }, - /* 75*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "\200", 85, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 76*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "1", 228, 0, 40, 40 }, - /* 77*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "1", 229, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 78*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "A", 169, 0, 40, 40 }, - /* 79*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "A", 170, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 80*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "\200", 112, 0, 40, 40 }, - /* 81*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "\200", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 82*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "1", 288, 0, 44, 44 }, - /* 83*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "1", 289, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 84*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "A", 214, 0, 44, 44 }, - /* 85*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "A", 215, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 86*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "\200", 142, 0, 44, 44 }, - /* 87*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "\200", 143, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 88*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "1", 348, 0, 48, 48 }, - /* 89*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "1", 349, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 90*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "A", 259, 0, 48, 48 }, - /* 91*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "A", 260, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 92*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "\200", 172, 0, 48, 48 }, - /* 93*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "\200", 173, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 94*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "1", 408, 0, 52, 52 }, - /* 95*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "1", 409, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 96*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "A", 304, 0, 52, 52 }, - /* 97*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "A", 305, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 98*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "\200", 202, 0, 52, 52 }, - /* 99*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "\200", 203, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*100*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "1", 560, 0, 64, 64 }, - /*101*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "1", 561, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*102*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "A", 418, 0, 64, 64 }, - /*103*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "A", 419, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*104*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "\200", 278, 0, 64, 64 }, // Spec says 277 but 278 correct as only single byte count of 0 required - /*105*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "\200", 279, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*106*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "1", 736, 0, 72, 72 }, - /*107*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "1", 737, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*108*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "A", 550, 0, 72, 72 }, - /*109*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "A", 551, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*110*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "\200", 366, 0, 72, 72 }, // Spec says 365 but 366 correct as only single byte count of 0 required - /*111*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "\200", 367, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*112*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "1", 912, 0, 80, 80 }, - /*113*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "1", 913, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*114*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "A", 682, 0, 80, 80 }, - /*115*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "A", 683, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*116*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "\200", 454, 0, 80, 80 }, // Spec says 453 but 454 correct as only single byte count of 0 required - /*117*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "\200", 455, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*118*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "1", 1152, 0, 88, 88 }, - /*119*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "1", 1153, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*120*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "A", 862, 0, 88, 88 }, - /*121*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "A", 863, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*122*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "\200", 574, 0, 88, 88 }, // Spec says 573 but 574 correct as only single byte count of 0 required - /*123*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "\200", 575, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*124*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "1", 1392, 0, 96, 96 }, - /*125*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "1", 1393, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*126*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "A", 1042, 0, 96, 96 }, - /*127*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "A", 1043, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*128*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "\200", 694, 0, 96, 96 }, // Spec says 693 but 694 correct as only single byte count of 0 required - /*129*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "\200", 695, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*130*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "1", 1632, 0, 104, 104 }, - /*131*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "1", 1633, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*132*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "A", 1222, 0, 104, 104 }, - /*133*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "A", 1223, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*134*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "\200", 814, 0, 104, 104 }, // Spec says 813 but 814 correct as only single byte count of 0 required - /*135*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "\200", 815, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*136*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "1", 2100, 0, 120, 120 }, - /*137*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "1", 2101, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*138*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "A", 1573, 0, 120, 120 }, - /*139*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "A", 1574, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*140*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "\200", 1048, 0, 120, 120 }, // Spec says 1047 but 1048 correct as only single byte count of 0 required - /*141*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "\200", 1049, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*142*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "1", 2608, 0, 132, 132 }, - /*143*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "1", 2609, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*144*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "A", 1954, 0, 132, 132 }, - /*145*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "A", 1955, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*146*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "\200", 1302, 0, 132, 132 }, // Spec says 1301 but 1302 correct as only single byte count of 0 required - /*147*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "\200", 1303, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*148*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "1", 3116, 0, 144, 144 }, - /*149*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "1", 3117, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*150*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "A", 2335, 0, 144, 144 }, - /*151*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "A", 2336, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*152*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "\200", 1556, 0, 144, 144 }, // Spec says 1555 but 1556 correct as only single byte count of 0 required - /*153*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "\200", 1557, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*154*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "1", 10, 0, 8, 18 }, - /*155*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "1", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*156*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "A", 6, 0, 8, 18 }, - /*157*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*158*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "\200", 3, 0, 8, 18 }, - /*159*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "\200", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*160*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "1", 20, 0, 8, 32 }, - /*161*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "1", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*162*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "A", 13, 0, 8, 32 }, - /*163*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*164*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "\200", 8, 0, 8, 32 }, - /*165*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "\200", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*166*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "1", 32, 0, 12, 26 }, - /*167*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "1", 33, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*168*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "A", 22, 0, 12, 26 }, - /*169*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "A", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*170*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "\200", 14, 0, 12, 26 }, - /*171*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "\200", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*172*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "1", 44, 0, 12, 36 }, - /*173*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*174*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "A", 31, 0, 12, 36 }, - /*175*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*176*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "\200", 20, 0, 12, 36 }, - /*177*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*178*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "1", 64, 0, 16, 36 }, - /*179*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*180*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "A", 46, 0, 16, 36 }, - /*181*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*182*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "\200", 30, 0, 16, 36 }, - /*183*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*184*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "1", 98, 0, 16, 48 }, - /*185*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "1", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*186*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "A", 72, 0, 16, 48 }, - /*187*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "A", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*188*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "\200", 47, 0, 16, 48 }, - /*189*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "\200", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*190*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "1", 36, 0, 8, 48 }, - /*191*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "1", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*192*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "A", 25, 0, 8, 48 }, - /*193*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "A", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*194*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "\200", 16, 0, 8, 48 }, - /*195*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*196*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "1", 48, 0, 8, 64 }, - /*197*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "1", 49, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*198*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "A", 34, 0, 8, 64 }, - /*199*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "A", 35, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*200*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "\200", 22, 0, 8, 64 }, - /*201*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "\200", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*202*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "1", 64, 0, 8, 80 }, - /*203*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*204*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "A", 46, 0, 8, 80 }, - /*205*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*206*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "\200", 30, 0, 8, 80 }, - /*207*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*208*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "1", 76, 0, 8, 96 }, - /*209*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "1", 77, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*210*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "A", 55, 0, 8, 96 }, - /*211*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*212*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "\200", 36, 0, 8, 96 }, - /*213*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*214*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "1", 98, 0, 8, 120 }, - /*215*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "1", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*216*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "A", 72, 0, 8, 120 }, - /*217*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "A", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*218*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "\200", 47, 0, 8, 120 }, - /*219*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "\200", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*220*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "1", 126, 0, 8, 144 }, - /*221*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "1", 127, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*222*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "A", 93, 0, 8, 144 }, - /*223*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "A", 94, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*224*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "\200", 61, 0, 8, 144 }, - /*225*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "\200", 62, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*226*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "1", 86, 0, 12, 64 }, - /*227*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*228*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "A", 63, 0, 12, 64 }, - /*229*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "A", 64, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*230*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "\200", 41, 0, 12, 64 }, - /*231*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "\200", 42, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*232*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "1", 128, 0, 12, 88 }, - /*233*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "1", 129, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*234*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "A", 94, 0, 12, 88 }, - /*235*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "A", 95, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*236*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "\200", 62, 0, 12, 88 }, - /*237*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "\200", 63, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*238*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "1", 124, 0, 16, 64 }, - /*239*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*240*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "A", 91, 0, 16, 64 }, - /*241*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "A", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*242*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "\200", 60, 0, 16, 64 }, - /*243*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "\200", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*244*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "1", 88, 0, 20, 36 }, - /*245*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*246*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "A", 64, 0, 20, 36 }, - /*247*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*248*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "\200", 42, 0, 20, 36 }, - /*249*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*250*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "1", 112, 0, 20, 44 }, - /*251*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*252*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "A", 82, 0, 20, 44 }, - /*253*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "A", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*254*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "\200", 54, 0, 20, 44 }, - /*255*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "\200", 55, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*256*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "1", 168, 0, 20, 64 }, // Spec says 186 but typo - /*257*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "1", 169, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*258*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "A", 124, 0, 20, 64 }, - /*259*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "A", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*260*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "\200", 82, 0, 20, 64 }, - /*261*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "\200", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*262*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "1", 144, 0, 22, 48 }, - /*263*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "1", 145, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*264*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "A", 106, 0, 22, 48 }, - /*265*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "A", 107, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*266*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "\200", 70, 0, 22, 48 }, - /*267*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "\200", 71, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*268*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "1", 160, 0, 24, 48 }, - /*269*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "1", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*270*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "A", 118, 0, 24, 48 }, - /*271*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "A", 119, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*272*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "\200", 78, 0, 24, 48 }, - /*273*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "\200", 79, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*274*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "1", 216, 0, 24, 64 }, - /*275*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "1", 217, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*276*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "A", 160, 0, 24, 64 }, - /*277*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "A", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*278*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "\200", 106, 0, 24, 64 }, - /*279*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "\200", 107, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*280*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "1", 140, 0, 26, 40 }, - /*281*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "1", 141, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*282*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "A", 103, 0, 26, 40 }, - /*283*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "A", 104, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*284*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "\200", 68, 0, 26, 40 }, - /*285*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "\200", 69, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*286*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "1", 180, 0, 26, 48 }, - /*287*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "1", 181, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*288*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "A", 133, 0, 26, 48 }, - /*289*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "A", 134, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*290*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "\200", 88, 0, 26, 48 }, - /*291*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "\200", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*292*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "1", 236, 0, 26, 64 }, - /*293*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "1", 237, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*294*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "A", 175, 0, 26, 64 }, - /*295*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "A", 176, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*296*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "\200", 116, 0, 26, 64 }, - /*297*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "\200", 117, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 8*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\001", 1558, 0, 144, 144 }, + /* 9*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\001", 1559, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 10*/ { BARCODE_HIBC_DM, -1, { 0, 0, "" }, "1", 110, 0, 32, 32 }, + /* 11*/ { BARCODE_HIBC_DM, -1, { 0, 0, "" }, "1", 111, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 12*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "1", 6, 0, 10, 10 }, + /* 13*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "1", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 14*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "A", 3, 0, 10, 10 }, + /* 15*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "A", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 16*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "\200", 1, 0, 10, 10 }, + /* 17*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "\200", 2, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 18*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "1", 10, 0, 12, 12 }, + /* 19*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "1", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 20*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "A", 6, 0, 12, 12 }, + /* 21*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 22*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "\200", 3, 0, 12, 12 }, + /* 23*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "\200", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 24*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "1", 16, 0, 14, 14 }, + /* 25*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "1", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 26*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "A", 10, 0, 14, 14 }, + /* 27*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 28*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "\200", 6, 0, 14, 14 }, + /* 29*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 30*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "1", 24, 0, 16, 16 }, + /* 31*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "1", 25, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 32*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "A", 16, 0, 16, 16 }, + /* 33*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "A", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 34*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "\200", 10, 0, 16, 16 }, + /* 35*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "\200", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 36*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "1", 36, 0, 18, 18 }, + /* 37*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "1", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 38*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "A", 25, 0, 18, 18 }, + /* 39*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "A", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 40*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "\200", 16, 0, 18, 18 }, + /* 41*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 42*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "1", 44, 0, 20, 20 }, + /* 43*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 44*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "A", 31, 0, 20, 20 }, + /* 45*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 46*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "\200", 20, 0, 20, 20 }, + /* 47*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 48*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "1", 60, 0, 22, 22 }, + /* 49*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "1", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 50*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "A", 43, 0, 22, 22 }, + /* 51*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "A", 44, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 52*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "\200", 28, 0, 22, 22 }, + /* 53*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "\200", 29, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 54*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "1", 72, 0, 24, 24 }, + /* 55*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "1", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 56*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "A", 52, 0, 24, 24 }, + /* 57*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "A", 53, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 58*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "\200", 34, 0, 24, 24 }, + /* 59*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "\200", 35, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 60*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "1", 88, 0, 26, 26 }, + /* 61*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 62*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "A", 64, 0, 26, 26 }, + /* 63*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 64*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "\200", 42, 0, 26, 26 }, + /* 65*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 66*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "1", 124, 0, 32, 32 }, + /* 67*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 68*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "A", 91, 0, 32, 32 }, + /* 69*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "A", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 70*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "\200", 60, 0, 32, 32 }, + /* 71*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "\200", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 72*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "1", 172, 0, 36, 36 }, + /* 73*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "1", 173, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 74*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "A", 127, 0, 36, 36 }, + /* 75*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "A", 128, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 76*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "\200", 84, 0, 36, 36 }, + /* 77*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "\200", 85, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 78*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "1", 228, 0, 40, 40 }, + /* 79*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "1", 229, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 80*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "A", 169, 0, 40, 40 }, + /* 81*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "A", 170, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 82*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "\200", 112, 0, 40, 40 }, + /* 83*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "\200", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 84*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "1", 288, 0, 44, 44 }, + /* 85*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "1", 289, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 86*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "A", 214, 0, 44, 44 }, + /* 87*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "A", 215, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 88*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "\200", 142, 0, 44, 44 }, + /* 89*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "\200", 143, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 90*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "1", 348, 0, 48, 48 }, + /* 91*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "1", 349, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 92*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "A", 259, 0, 48, 48 }, + /* 93*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "A", 260, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 94*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "\200", 172, 0, 48, 48 }, + /* 95*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "\200", 173, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 96*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "1", 408, 0, 52, 52 }, + /* 97*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "1", 409, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 98*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "A", 304, 0, 52, 52 }, + /* 99*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "A", 305, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*100*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "\200", 202, 0, 52, 52 }, + /*101*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "\200", 203, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*102*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "1", 560, 0, 64, 64 }, + /*103*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "1", 561, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*104*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "A", 418, 0, 64, 64 }, + /*105*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "A", 419, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*106*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "\200", 278, 0, 64, 64 }, // Spec says 277 but 278 correct as only single byte count of 0 required + /*107*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "\200", 279, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*108*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "1", 736, 0, 72, 72 }, + /*109*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "1", 737, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*110*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "A", 550, 0, 72, 72 }, + /*111*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "A", 551, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*112*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "\200", 366, 0, 72, 72 }, // Spec says 365 but 366 correct as only single byte count of 0 required + /*113*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "\200", 367, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*114*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "1", 912, 0, 80, 80 }, + /*115*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "1", 913, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*116*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "A", 682, 0, 80, 80 }, + /*117*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "A", 683, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*118*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "\200", 454, 0, 80, 80 }, // Spec says 453 but 454 correct as only single byte count of 0 required + /*119*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "\200", 455, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*120*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "1", 1152, 0, 88, 88 }, + /*121*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "1", 1153, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*122*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "A", 862, 0, 88, 88 }, + /*123*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "A", 863, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*124*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "\200", 574, 0, 88, 88 }, // Spec says 573 but 574 correct as only single byte count of 0 required + /*125*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "\200", 575, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*126*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "1", 1392, 0, 96, 96 }, + /*127*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "1", 1393, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*128*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "A", 1042, 0, 96, 96 }, + /*129*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "A", 1043, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*130*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "\200", 694, 0, 96, 96 }, // Spec says 693 but 694 correct as only single byte count of 0 required + /*131*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "\200", 695, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*132*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "1", 1632, 0, 104, 104 }, + /*133*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "1", 1633, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*134*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "A", 1222, 0, 104, 104 }, + /*135*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "A", 1223, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*136*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "\200", 814, 0, 104, 104 }, // Spec says 813 but 814 correct as only single byte count of 0 required + /*137*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "\200", 815, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*138*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "1", 2100, 0, 120, 120 }, + /*139*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "1", 2101, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*140*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "A", 1573, 0, 120, 120 }, + /*141*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "A", 1574, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*142*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "\200", 1048, 0, 120, 120 }, // Spec says 1047 but 1048 correct as only single byte count of 0 required + /*143*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "\200", 1049, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*144*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "1", 2608, 0, 132, 132 }, + /*145*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "1", 2609, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*146*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "A", 1954, 0, 132, 132 }, + /*147*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "A", 1955, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*148*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "\200", 1302, 0, 132, 132 }, // Spec says 1301 but 1302 correct as only single byte count of 0 required + /*149*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "\200", 1303, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*150*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "1", 3116, 0, 144, 144 }, + /*151*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "1", 3117, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*152*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "A", 2335, 0, 144, 144 }, + /*153*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "A", 2336, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*154*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "\200", 1556, 0, 144, 144 }, // Spec says 1555 but 1556 correct as only single byte count of 0 required + /*155*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "\200", 1557, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*156*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "1", 10, 0, 8, 18 }, + /*157*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "1", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*158*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "A", 6, 0, 8, 18 }, + /*159*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*160*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "\200", 3, 0, 8, 18 }, + /*161*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "\200", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*162*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "1", 20, 0, 8, 32 }, + /*163*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "1", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*164*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "A", 13, 0, 8, 32 }, + /*165*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*166*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "\200", 8, 0, 8, 32 }, + /*167*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "\200", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*168*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "1", 32, 0, 12, 26 }, + /*169*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "1", 33, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*170*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "A", 22, 0, 12, 26 }, + /*171*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "A", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*172*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "\200", 14, 0, 12, 26 }, + /*173*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "\200", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*174*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "1", 44, 0, 12, 36 }, + /*175*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*176*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "A", 31, 0, 12, 36 }, + /*177*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*178*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "\200", 20, 0, 12, 36 }, + /*179*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*180*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "1", 64, 0, 16, 36 }, + /*181*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*182*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "A", 46, 0, 16, 36 }, + /*183*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*184*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "\200", 30, 0, 16, 36 }, + /*185*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*186*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "1", 98, 0, 16, 48 }, + /*187*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "1", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*188*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "A", 72, 0, 16, 48 }, + /*189*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "A", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*190*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "\200", 47, 0, 16, 48 }, + /*191*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "\200", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*192*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "1", 36, 0, 8, 48 }, + /*193*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "1", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*194*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "A", 25, 0, 8, 48 }, + /*195*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "A", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*196*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "\200", 16, 0, 8, 48 }, + /*197*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*198*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "1", 48, 0, 8, 64 }, + /*199*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "1", 49, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*200*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "A", 34, 0, 8, 64 }, + /*201*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "A", 35, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*202*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "\200", 22, 0, 8, 64 }, + /*203*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "\200", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*204*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "1", 64, 0, 8, 80 }, + /*205*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*206*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "A", 46, 0, 8, 80 }, + /*207*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*208*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "\200", 30, 0, 8, 80 }, + /*209*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*210*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "1", 76, 0, 8, 96 }, + /*211*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "1", 77, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*212*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "A", 55, 0, 8, 96 }, + /*213*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*214*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "\200", 36, 0, 8, 96 }, + /*215*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*216*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "1", 98, 0, 8, 120 }, + /*217*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "1", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*218*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "A", 72, 0, 8, 120 }, + /*219*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "A", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*220*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "\200", 47, 0, 8, 120 }, + /*221*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "\200", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*222*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "1", 126, 0, 8, 144 }, + /*223*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "1", 127, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*224*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "A", 93, 0, 8, 144 }, + /*225*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "A", 94, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*226*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "\200", 61, 0, 8, 144 }, + /*227*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "\200", 62, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*228*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "1", 86, 0, 12, 64 }, + /*229*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*230*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "A", 63, 0, 12, 64 }, + /*231*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "A", 64, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*232*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "\200", 41, 0, 12, 64 }, + /*233*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "\200", 42, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*234*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "1", 128, 0, 12, 88 }, + /*235*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "1", 129, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*236*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "A", 94, 0, 12, 88 }, + /*237*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "A", 95, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*238*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "\200", 62, 0, 12, 88 }, + /*239*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "\200", 63, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*240*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "1", 124, 0, 16, 64 }, + /*241*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*242*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "A", 91, 0, 16, 64 }, + /*243*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "A", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*244*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "\200", 60, 0, 16, 64 }, + /*245*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "\200", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*246*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "1", 88, 0, 20, 36 }, + /*247*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*248*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "A", 64, 0, 20, 36 }, + /*249*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*250*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "\200", 42, 0, 20, 36 }, + /*251*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*252*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "1", 112, 0, 20, 44 }, + /*253*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*254*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "A", 82, 0, 20, 44 }, + /*255*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "A", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*256*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "\200", 54, 0, 20, 44 }, + /*257*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "\200", 55, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*258*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "1", 168, 0, 20, 64 }, // Spec says 186 but typo + /*259*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "1", 169, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*260*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "A", 124, 0, 20, 64 }, + /*261*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "A", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*262*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "\200", 82, 0, 20, 64 }, + /*263*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "\200", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*264*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "1", 144, 0, 22, 48 }, + /*265*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "1", 145, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*266*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "A", 106, 0, 22, 48 }, + /*267*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "A", 107, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*268*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "\200", 70, 0, 22, 48 }, + /*269*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "\200", 71, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*270*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "1", 160, 0, 24, 48 }, + /*271*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "1", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*272*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "A", 118, 0, 24, 48 }, + /*273*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "A", 119, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*274*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "\200", 78, 0, 24, 48 }, + /*275*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "\200", 79, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*276*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "1", 216, 0, 24, 64 }, + /*277*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "1", 217, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*278*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "A", 160, 0, 24, 64 }, + /*279*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "A", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*280*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "\200", 106, 0, 24, 64 }, + /*281*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "\200", 107, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*282*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "1", 140, 0, 26, 40 }, + /*283*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "1", 141, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*284*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "A", 103, 0, 26, 40 }, + /*285*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "A", 104, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*286*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "\200", 68, 0, 26, 40 }, + /*287*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "\200", 69, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*288*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "1", 180, 0, 26, 48 }, + /*289*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "1", 181, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*290*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "A", 133, 0, 26, 48 }, + /*291*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "A", 134, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*292*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "\200", 88, 0, 26, 48 }, + /*293*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "\200", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*294*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "1", 236, 0, 26, 64 }, + /*295*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "1", 237, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*296*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "A", 175, 0, 26, 64 }, + /*297*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "A", 176, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*298*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "\200", 116, 0, 26, 64 }, + /*299*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "\200", 117, ZINT_ERROR_TOO_LONG, -1, -1 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -486,6 +488,7 @@ static void test_options(int index, int debug) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); + debug &= ~ZINT_DEBUG_TEST; // Want real errtxt length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, data[i].output_options, data[i].data, -1, debug); if (data[i].structapp.count) { symbol->structapp = data[i].structapp; @@ -690,23 +693,29 @@ static void test_input(int index, int generate, int debug) { /*102*/ { GS1_MODE, 0, -1, -1, -1, "[90]........", 0, 0, 8, 32, 1, "E8 DC F0 BA EB AE BA EB AE 81 B1 C0 AB DA A5 92 AF E2 05 DE 56", "Can use GS1 EDIFACT if no FNC1/GS", 0 }, /*103*/ { GS1_MODE, 0, -1, -1, -1, "[90]ABCDEFGH[91]ABCD", 0, 0, 12, 26, 1, "E8 DC E6 59 E9 6D 24 80 4A AA CE 59 E9 FE 45 81 6A 05 49 36 67 C8 00 DE 35 29 C5 9A 17 EA", "GS1 C40 ok", 0 }, /*104*/ { GS1_MODE, 0, -1, -1, -1, "[90]ABCD", 0, 0, 14, 14, 1, "E8 DC 42 43 44 45 81 38 98 32 8C 23 4D 87 5A 95 04 A7", "Final ASC unlatch", 0 }, - /*105*/ { UNICODE_MODE, 0, -1, -1, -1, ">*\015>*\015>......", 0, 0, 12, 26, 0, "EE 0C A9 0C A9 FE 3F 2F 2F 2F 2F 2F 2F 81 57 ED 0F 29 C7 9D 5D 64 61 94 14 CD A8 DF 65 8D", "X12 then ASC; BWIPP different encodation", 1 }, + /*105*/ { UNICODE_MODE, 0, -1, -1, -1, ">*\015>*\015>......", 0, 0, 12, 26, 0, "EE 0C A9 0C A9 FE 3F 2F 2F 2F 2F 2F 2F 81 57 ED 0F 29 C7 9D 5D 64 61 94 14 CD A8 DF 65 8D", "X12 then ASC; BWIPP switches to ASCII earlier", 1 }, + /*106*/ { UNICODE_MODE, 0, 4, -1, -1, "ABCDEFGH", 0, 0, 16, 16, 1, "E6 59 E9 6D 24 FE 48 49 81 65 FB 93 F7 A4 EA B0 37 00 4F 4C 8A 99 0B 69", "", 0 }, + /*107*/ { UNICODE_MODE, 0, 26, -1, -1, "@@@@@@@@@_", 0, 0, 8, 32, 0, "F0 00 00 00 00 00 1F 41 41 60 63 50 E0 FE 8B 46 16 38 FE 58 AD", "BWIPP switches to ASCII later", 0 }, + /*108*/ { UNICODE_MODE, 0, 4, -1, -1, "@@@@@@@@@_", 0, 0, 16, 16, 0, "F0 00 00 00 00 00 1F 41 41 60 81 93 F9 B0 1A A1 B9 6C D3 01 38 CD 51 75", "BWIPP switches to ASCII later", 0 }, + /*109*/ { UNICODE_MODE, 0, -1, -1, -1, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", 0, 0, 26, 26, 1, "(72) F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", "", 0 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; char escaped[8192]; - char bwipp_buf[32768]; - char bwipp_msg[1024]; + char cmp_buf[32768]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_input"); for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -783,16 +792,27 @@ static void test_input(int index, int generate, int debug) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { - char modules_dump[8192]; + char modules_dump[144 * 144 + 1]; assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); - ret = testUtilBwipp(i, symbol, -1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, -1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, modules_dump); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, modules_dump); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump); } } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[144 * 144 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); + } } } @@ -2284,16 +2304,18 @@ static void test_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[8192]; - char bwipp_buf[32768]; - char bwipp_msg[1024]; + char cmp_buf[32768]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_encode"); for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -2373,14 +2395,25 @@ static void test_encode(int index, int generate, int debug) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { - ret = testUtilBwipp(i, symbol, -1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, -1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); } } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[144 * 144 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); + } } } @@ -2703,6 +2736,16 @@ static void test_minimize(int index, int debug) { /*160*/ { BARCODE_DATAMATRIX, GS1_MODE, GS1_GS_SEPARATOR, -1, "\200\200\200\200[\200\200\200[\200\200", -1, 0, 0, "" }, /*161*/ { BARCODE_DATAMATRIX, -1, -1, -1, "https://example.com/01/09506000134369", -1, 0, 0, "" }, /*162*/ { BARCODE_DATAMATRIX, -1, -1, -1, "abcdefghi1234FGHIJKLMNabc@@@@@@@@@é", -1, 0, 0, "" }, + /*163*/ { BARCODE_DATAMATRIX, -1, -1, -1, "ABCDEF", -1, 0, 0, "" }, + /*164*/ { BARCODE_DATAMATRIX, -1, -1, -1, "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", -1, 0, 0, "" }, + /*165*/ { BARCODE_DATAMATRIX, -1, -1, -1, "\200\200\200@A1^B2?C", -1, 0, 1, "" }, + /*166*/ { BARCODE_DATAMATRIX, -1, -1, -1, "@A1^@B2^@C3^\200\200\200", -1, 0, 0, "" }, + /*167*/ { BARCODE_DATAMATRIX, -1, -1, -1, "@A1^@B2^@C3^@\200\200\200", -1, 0, 0, "" }, + /*168*/ { BARCODE_DATAMATRIX, -1, -1, -1, "@A1^@B2^@C3^@D\200\200\200", -1, 0, 0, "" }, + /*169*/ { BARCODE_DATAMATRIX, -1, -1, -1, "@A1^@B2^@C3^@D4\200\200\200", -1, 0, 1, "" }, + /*170*/ { BARCODE_DATAMATRIX, -1, -1, -1, "@A1^@B2^@C3^@D4@\200\200\200", -1, 0, 0, "" }, + /*171*/ { BARCODE_DATAMATRIX, -1, -1, -1, "\200\200\200@A1^B2?C\200\200\200", -1, 0, 0, "" }, + /*172*/ { BARCODE_DATAMATRIX, -1, -1, -1, "@@@@@@@@@_", -1, 0, 0, "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -2723,6 +2766,7 @@ static void test_minimize(int index, int debug) { for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); diff --git a/backend/tests/test_dotcode.c b/backend/tests/test_dotcode.c index e50f5f31..3562f265 100644 --- a/backend/tests/test_dotcode.c +++ b/backend/tests/test_dotcode.c @@ -255,12 +255,13 @@ static void test_encode(int index, int generate, int debug) { int expected_rows; int expected_width; int bwipp_cmp; + int zxingcpp_cmp; char *comment; char *expected; }; // ISS DotCode, Rev 4.0, DRAFT 0.15, TSC Pre-PR #5, MAY 28, 2019 struct item data[] = { - /* 0*/ { GS1_MODE, 64, -1, { 0, 0, "" }, "[01]00012345678905[17]201231[10]ABC123456", -1, 0, 9, 64, 1, "ISS DotCode Rev 4.0 Figure 1 (left), same", + /* 0*/ { GS1_MODE, 64, -1, { 0, 0, "" }, "[01]00012345678905[17]201231[10]ABC123456", -1, 0, 9, 64, 1, 1, "ISS DotCode Rev 4.0 Figure 1 (left), same", "1010000000101000101010000010000010001010100010101000101000001010" "0100010001010001010001000001010100010100010001000100010101000001" "1010001010000000101010100010001010000010101000000010100010100000" @@ -271,7 +272,7 @@ static void test_encode(int index, int generate, int debug) { "0001010100010001010100010001010000010001010000000101010001010101" "1000100010001000100010100010001010001000101000101000100010000010" }, - /* 1*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[01]00012345678905[17]201231[10]ABC123456", -1, 0, 20, 29, 1, "ISS DotCode Rev 4.0 Figure 1 (right) (and Figure 10), same", + /* 1*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[01]00012345678905[17]201231[10]ABC123456", -1, 0, 20, 29, 1, 1, "ISS DotCode Rev 4.0 Figure 1 (right) (and Figure 10), same", "10101000101010100010101000101" "00010100010100010100000001010" "00001010100010000000101010000" @@ -293,7 +294,7 @@ static void test_encode(int index, int generate, int debug) { "10000010101000100000001000001" "01000100010101010000000101010" }, - /* 2*/ { GS1_MODE, -1, 1 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 5 (and Figure 6 top-left) when Mask = 0, same", + /* 2*/ { GS1_MODE, -1, 1 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, 1, "ISS DotCode Rev 4.0 Figure 5 (and Figure 6 top-left) when Mask = 0, same", "10101000100010000000001" "01000101010001010000000" "00100010001000101000100" @@ -311,7 +312,7 @@ static void test_encode(int index, int generate, int debug) { "10101000001000101010001" "01000001010101010000010" }, - /* 3*/ { GS1_MODE, -1, 2 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 top-right Mask = 1, same", + /* 3*/ { GS1_MODE, -1, 2 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, 1, "ISS DotCode Rev 4.0 Figure 6 top-right Mask = 1, same", "10000000001010001000101" "01010101000100000101000" "00100010000000100000001" @@ -329,7 +330,7 @@ static void test_encode(int index, int generate, int debug) { "10000010101010100010101" "01000101000101010101010" }, - /* 4*/ { GS1_MODE, -1, 3 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 bottom-left Mask = 2, same", + /* 4*/ { GS1_MODE, -1, 3 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, 1, "ISS DotCode Rev 4.0 Figure 6 bottom-left Mask = 2, same", "10100000101010100010001" "01000101000100000000010" "10101010001010000010000" @@ -347,7 +348,7 @@ static void test_encode(int index, int generate, int debug) { "10101010000000001010001" "01010101000001000101010" }, - /* 5*/ { GS1_MODE, -1, 4 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 bottom-right Mask = 3, same", + /* 5*/ { GS1_MODE, -1, 4 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, 1, "ISS DotCode Rev 4.0 Figure 6 bottom-right Mask = 3, same", "10000000100000001010101" "01010001010100010001000" "10001000001010101010100" @@ -365,7 +366,7 @@ static void test_encode(int index, int generate, int debug) { "10001000001010001000001" "01010100000101000100010" }, - /* 6*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 top-right, auto Mask = 1, same", + /* 6*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, 1, "ISS DotCode Rev 4.0 Figure 6 top-right, auto Mask = 1, same", "10000000001010001000101" "01010101000100000101000" "00100010000000100000001" @@ -383,7 +384,7 @@ static void test_encode(int index, int generate, int debug) { "10000010101010100010101" "01000101000101010101010" }, - /* 7*/ { UNICODE_MODE, -1, 1 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A top-left Mask = 0, same; BWIPP automatically primes mask", + /* 7*/ { UNICODE_MODE, -1, 1 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, 0, "ISS DotCode Rev 4.0 Figure 7A top-left Mask = 0, same; BWIPP automatically primes mask; ZXing-C++ can't handle zero row", "1010101010100" "0000010001010" "0000101000101" @@ -395,7 +396,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010001" "0000000000000" }, - /* 8*/ { UNICODE_MODE, -1, 2 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A top-right Mask = 1, same; BWIPP automatically primes mask", + /* 8*/ { UNICODE_MODE, -1, 2 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, 1, "ISS DotCode Rev 4.0 Figure 7A top-right Mask = 1, same; BWIPP automatically primes mask", "1010001000101" "0000000100010" "0000100000001" @@ -407,7 +408,7 @@ static void test_encode(int index, int generate, int debug) { "0000000010001" "0001000001000" }, - /* 9*/ { UNICODE_MODE, -1, 3 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A bottom-left Mask = 2, same; BWIPP automatically primes mask", + /* 9*/ { UNICODE_MODE, -1, 3 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, 1, "ISS DotCode Rev 4.0 Figure 7A bottom-left Mask = 2, same; BWIPP automatically primes mask", "1010001010100" "0001000000000" "1000100010101" @@ -419,7 +420,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010101" "0001000100000" }, - /* 10*/ { UNICODE_MODE, -1, 4 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A bottom-right Mask = 3, same; BWIPP automatically primes mask", + /* 10*/ { UNICODE_MODE, -1, 4 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, 1, "ISS DotCode Rev 4.0 Figure 7A bottom-right Mask = 3, same; BWIPP automatically primes mask", "1010001000100" "0001000001010" "1000001000000" @@ -431,7 +432,7 @@ static void test_encode(int index, int generate, int debug) { "1000001010001" "0101010101010" }, - /* 11*/ { UNICODE_MODE, -1, 5 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B top-left Mask = 0' (4), same", + /* 11*/ { UNICODE_MODE, -1, 5 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, 1, "ISS DotCode Rev 4.0 Figure 7B top-left Mask = 0' (4), same", "1010101010101" "0000010001010" "0000101000101" @@ -443,7 +444,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010001" "0100000000010" }, - /* 12*/ { UNICODE_MODE, -1, 6 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B top-right Mask = 1' (5), same", + /* 12*/ { UNICODE_MODE, -1, 6 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, 1, "ISS DotCode Rev 4.0 Figure 7B top-right Mask = 1' (5), same", "1010001000101" "0000000100010" "0000100000001" @@ -455,7 +456,7 @@ static void test_encode(int index, int generate, int debug) { "1000000010001" "0101000001010" }, - /* 13*/ { UNICODE_MODE, -1, 7 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-left Mask = 2' (6), same", + /* 13*/ { UNICODE_MODE, -1, 7 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-left Mask = 2' (6), same", "1010001010101" "0001000000000" "1000100010101" @@ -467,7 +468,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010101" "0101000100010" }, - /* 14*/ { UNICODE_MODE, -1, 8 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-right Mask = 3' (7), same", + /* 14*/ { UNICODE_MODE, -1, 8 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-right Mask = 3' (7), same", "1010001000101" "0001000001010" "1000001000000" @@ -479,7 +480,7 @@ static void test_encode(int index, int generate, int debug) { "1000001010001" "0101010101010" }, - /* 15*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-left auto Mask = 2' (6), same", + /* 15*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-left auto Mask = 2' (6), same", "1010001010101" "0001000000000" "1000100010101" @@ -491,7 +492,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010101" "0101000100010" }, - /* 16*/ { GS1_MODE, 40, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 7, 40, 1, "ISS DotCode Rev 4.0 Figure 8 top-left 7x40, Mask = 1, same", + /* 16*/ { GS1_MODE, 40, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 7, 40, 1, 1, "ISS DotCode Rev 4.0 Figure 8 top-left 7x40, Mask = 1, same", "1010101010001000100010100010101000001000" "0000010101000100010100010000010001000001" "1010001000001000001000101010001000101000" @@ -500,7 +501,7 @@ static void test_encode(int index, int generate, int debug) { "0001010001010001000100000001010100010001" "1000100010001000100010100010001010001000" }, - /* 17*/ { GS1_MODE, 18, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 17, 18, 1, "ISS DotCode Rev 4.0 Figure 8 top-right 17x18 **NOT SAME** no matter what mask; but same as BWIPP and verified manually against tec-it", + /* 17*/ { GS1_MODE, 18, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 17, 18, 1, 1, "ISS DotCode Rev 4.0 Figure 8 top-right 17x18 **NOT SAME** no matter what mask; but same as BWIPP and verified manually against tec-it", "101000001000101010" "010100000101010001" "000000101000001010" @@ -519,7 +520,7 @@ static void test_encode(int index, int generate, int debug) { "010001010001000101" "100010001000100010" }, - /* 18*/ { GS1_MODE, 35, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 8, 35, 1, "ISS DotCode Rev 4.0 Figure 8 bottom-left 8x35, Mask = 3, same", + /* 18*/ { GS1_MODE, 35, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 8, 35, 1, 1, "ISS DotCode Rev 4.0 Figure 8 bottom-left 8x35, Mask = 3, same", "10100010000000000010100000100010101" "00010101010001000000010100010100000" "10001000101010101010001010000010101" @@ -529,7 +530,7 @@ static void test_encode(int index, int generate, int debug) { "10000010101010101010000010000010001" "01000001000101000100010100010001000" }, - /* 19*/ { GS1_MODE, 17, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 18, 17, 1, "ISS DotCode Rev 4.0 Figure 8 bottom-right 18x17 **NOT SAME** no matter what mask; same as BWIPP; verified manually against tec-it", + /* 19*/ { GS1_MODE, 17, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 18, 17, 1, 1, "ISS DotCode Rev 4.0 Figure 8 bottom-right 18x17 **NOT SAME** no matter what mask; same as BWIPP; verified manually against tec-it", "10101000001000001" "01000001010100010" "00000000100010001" @@ -549,7 +550,7 @@ static void test_encode(int index, int generate, int debug) { "10101010101010101" "01010101000101010" }, - /* 20*/ { UNICODE_MODE, 35, -1, { 0, 0, "" }, "Dots can be Square!", -1, 0, 18, 35, 1, "ISS DotCode Rev 4.0 Figure 11 **NOT SAME**; same as BWIPP; verified manually against tec-it", + /* 20*/ { UNICODE_MODE, 35, -1, { 0, 0, "" }, "Dots can be Square!", -1, 0, 18, 35, 1, 1, "ISS DotCode Rev 4.0 Figure 11 **NOT SAME**; same as BWIPP; verified manually against tec-it", "10000010101000000000000000101010101" "01010101000101000100010100000001000" "00001000000010101000101010101010000" @@ -569,7 +570,7 @@ static void test_encode(int index, int generate, int debug) { "10101000101000001000100010101000101" "01000001000001000101010001000000010" }, - /* 21*/ { GS1_MODE, -1, 1 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 0, same; BWIPP automatically primes mask", + /* 21*/ { GS1_MODE, -1, 1 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 0, same; BWIPP automatically primes mask; ZXing-C++ can't handle zero col", "0000001010000" "0001010000010" "0000000010001" @@ -581,7 +582,7 @@ static void test_encode(int index, int generate, int debug) { "0010000000101" "0101000101010" }, - /* 22*/ { GS1_MODE, -1, 2 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 1, same; BWIPP automatically primes mask", + /* 22*/ { GS1_MODE, -1, 2 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 1, same; BWIPP automatically primes mask", "0000100000001" "0001010000000" "0000000000001" @@ -593,7 +594,7 @@ static void test_encode(int index, int generate, int debug) { "0010101000101" "0100010101000" }, - /* 23*/ { GS1_MODE, -1, 3 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 2, same; BWIPP automatically primes mask", + /* 23*/ { GS1_MODE, -1, 3 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 2, same; BWIPP automatically primes mask", "0000100010100" "0000000000000" "1000101010101" @@ -605,7 +606,7 @@ static void test_encode(int index, int generate, int debug) { "0000000010001" "0100000001010" }, - /* 24*/ { GS1_MODE, -1, 4 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 3, same; BWIPP automatically primes mask", + /* 24*/ { GS1_MODE, -1, 4 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 3, same; BWIPP automatically primes mask; ZXing-C++ can't handle zero col", "0000000000000" "0001010001000" "1000001010000" @@ -617,7 +618,7 @@ static void test_encode(int index, int generate, int debug) { "1000000010000" "0100000000010" }, - /* 25*/ { GS1_MODE, -1, 5 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 0' (4), same", + /* 25*/ { GS1_MODE, -1, 5 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 0' (4), same", "1000001010001" "0001010000010" "0000000010001" @@ -629,7 +630,7 @@ static void test_encode(int index, int generate, int debug) { "1010000000101" "0101000101010" }, - /* 26*/ { GS1_MODE, -1, 6 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 1' (5), same", + /* 26*/ { GS1_MODE, -1, 6 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 1' (5), same", "1000100000001" "0001010000000" "0000000000001" @@ -641,7 +642,7 @@ static void test_encode(int index, int generate, int debug) { "1010101000101" "0100010101010" }, - /* 27*/ { GS1_MODE, -1, 7 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 2' (6), same", + /* 27*/ { GS1_MODE, -1, 7 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 2' (6), same", "1000100010101" "0000000000000" "1000101010101" @@ -653,7 +654,7 @@ static void test_encode(int index, int generate, int debug) { "1000000010001" "0100000001010" }, - /* 28*/ { GS1_MODE, -1, 8 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 3' (7), same", + /* 28*/ { GS1_MODE, -1, 8 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 3' (7), same", "1000000000001" "0001010001000" "1000001010000" @@ -665,7 +666,7 @@ static void test_encode(int index, int generate, int debug) { "1000000010001" "0100000000010" }, - /* 29*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 auto Mask 0' (4); all mask scores match Table G.1", + /* 29*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, 1, "ISS DotCode Rev 4.0 Table G.1 auto Mask 0' (4); all mask scores match Table G.1", "1000001010001" "0001010000010" "0000000010001" @@ -677,7 +678,7 @@ static void test_encode(int index, int generate, int debug) { "1010000000101" "0101000101010" }, - /* 30*/ { UNICODE_MODE, 6, -1, { 0, 0, "" }, "A", -1, 0, 19, 6, 1, "ISS DotCode Rev 4.0 5.2.1.4 2) Table 4, 1 padding dot available; verified manually against tec-it", + /* 30*/ { UNICODE_MODE, 6, -1, { 0, 0, "" }, "A", -1, 0, 19, 6, 1, 1, "ISS DotCode Rev 4.0 5.2.1.4 2) Table 4, 1 padding dot available; verified manually against tec-it", "101000" "000101" "101010" @@ -698,7 +699,7 @@ static void test_encode(int index, int generate, int debug) { "010000" "101000" }, - /* 31*/ { UNICODE_MODE, 94, -1, { 0, 0, "" }, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS", -1, 0, 37, 94, 1, "Interleaved R-S; verified manually against tec-it", + /* 31*/ { UNICODE_MODE, 94, -1, { 0, 0, "" }, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS", -1, 0, 37, 94, 1, 1, "Interleaved R-S; verified manually against tec-it", "1000001010000000100010000010101010101000001000100000001010101000001000001000101010001000101010" "0101010000000101000001010001010001010100010001000001000000010101010000000101010100010001010100" "0010101000100010000010101010000000101010000010101000001000100010100000100010100010001000101000" @@ -737,7 +738,7 @@ static void test_encode(int index, int generate, int debug) { "0001000101010100000001010101000001010000010001010001000100010000010001000101010001010001000001" "0010001000001010101000000010101000101000001000001010100000101010001000000010100000001010101000" }, - /* 32*/ { GS1_MODE, 50, -1, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 7, 50, 1, "GS1 Gen Spec Figure 5.1-8.", + /* 32*/ { GS1_MODE, 50, -1, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 7, 50, 1, 1, "GS1 Gen Spec Figure 5.1-8.", "10000010101000100010101010001000000010100000100000" "01000101000101010100000100010000010001000001010101" "00001010001000101000101000100010001010100000000010" @@ -746,14 +747,14 @@ static void test_encode(int index, int generate, int debug) { "00010001010000000100010101000100010001010001000101" "10001000001010101000001000100010100010100000101010" }, - /* 33*/ { UNICODE_MODE, 200, -1, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890", -1, 0, 5, 200, 1, "Max cols", + /* 33*/ { UNICODE_MODE, 200, -1, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890", -1, 0, 5, 200, 1, 1, "Max cols", "10101000100010101010000010101000000010001000100000101010100010100000101000100010000000101000101010001010100000100000101010100000001000101000001010100010001010000010001010001010100000100010101000000010" "00010101010000000101000100010001000101000101000100010001000001010001000001010100000001000101010000000101010100010101010000010001000101010001000001000001010000010100010001010101000001000001010100000001" "10100010000000100010101000101010100000001010001000100000101000101000001000101010001000000010101010100010101000000010100010001000001010100000101000100000101010100010000000001000001010101000101010100000" "00010001010001010000000101000100010001010000010000010100010100000100010101010001000101000000010100010001010100010000010100000101000100010100000101010000000101000001010100010100010001000101000001010001" "10100010001010101000000010001000001010001010001000001010100010000000101010001010000010101010000000101000100010100010100000100010100010001010100000001010101000001010000000001000101000101010000010101010" }, - /* 34*/ { UNICODE_MODE, 19, -1, { 0, 0, "" }, "4", -1, 0, 6, 19, 1, "Mask 1 selected", + /* 34*/ { UNICODE_MODE, 19, -1, { 0, 0, "" }, "4", -1, 0, 6, 19, 1, 1, "Mask 1 selected", "1010100000101000101" "0100000000010001010" "0010101010000000000" @@ -761,7 +762,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010001010001" "0001010101010101010" }, - /* 35*/ { UNICODE_MODE, 19, 3 << 8, { 0, 0, "" }, "4", -1, 0, 6, 19, 0, "Mask 2 specified, unlit right edge mask; BWIPP automatically primes mask", + /* 35*/ { UNICODE_MODE, 19, 3 << 8, { 0, 0, "" }, "4", -1, 0, 6, 19, 0, 1, "Mask 2 specified, unlit right edge mask; BWIPP automatically primes mask", "1010101010000000100" "0000000101000100010" "1010100000001010100" @@ -769,7 +770,7 @@ static void test_encode(int index, int generate, int debug) { "1000001010100010100" "0101000100010001010" }, - /* 36*/ { UNICODE_MODE, 19, 7 << 8, { 0, 0, "" }, "4", -1, 0, 6, 19, 1, "Mask 2' specified", + /* 36*/ { UNICODE_MODE, 19, 7 << 8, { 0, 0, "" }, "4", -1, 0, 6, 19, 1, 1, "Mask 2' specified", "1010101010000000101" "0000000101000100010" "1010100000001010100" @@ -777,7 +778,7 @@ static void test_encode(int index, int generate, int debug) { "1000001010100010101" "0101000100010001010" }, - /* 37*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[10]12[20]12", -1, 0, 12, 17, 1, "Code Set C with FNC1", + /* 37*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[10]12[20]12", -1, 0, 12, 17, 1, 1, "Code Set C with FNC1", "10100000001000001" "00010100010101010" "10001000100000001" @@ -791,7 +792,7 @@ static void test_encode(int index, int generate, int debug) { "10000010100000101" "01000100010101010" }, - /* 38*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "1234\011\034\035\036", -1, 0, 14, 21, 1, "Code Set B HT FS GS RS", + /* 38*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "1234\011\034\035\036", -1, 0, 14, 21, 1, 1, "Code Set B HT FS GS RS", "100010001000001010101" "010001000001000001000" "100010100010101010001" @@ -807,7 +808,7 @@ static void test_encode(int index, int generate, int debug) { "001010101000101010001" "010101010001000101000" }, - /* 39*/ { UNICODE_MODE, 17, -1, { 0, 0, "" }, "abcd\015\012", -1, 0, 14, 17, 1, "Code Set B CRLF", + /* 39*/ { UNICODE_MODE, 17, -1, { 0, 0, "" }, "abcd\015\012", -1, 0, 14, 17, 1, 1, "Code Set B CRLF", "00001000001000101" "01000101010001000" "10100000100010101" @@ -823,7 +824,7 @@ static void test_encode(int index, int generate, int debug) { "10100000001010000" "01010001000101000" }, - /* 40*/ { DATA_MODE, -1, -1, { 0, 0, "" }, "\101\102\103\104\105\106\107\200\101\102\240\101", -1, 0, 18, 27, 1, "Code Set B Upper Shift A Upper Shift B", + /* 40*/ { DATA_MODE, -1, -1, { 0, 0, "" }, "\101\102\103\104\105\106\107\200\101\102\240\101", -1, 0, 18, 27, 1, 1, "Code Set B Upper Shift A Upper Shift B", "101010100000101000101000001" "010100010101000100010101000" "000010001010100000101010101" @@ -843,7 +844,7 @@ static void test_encode(int index, int generate, int debug) { "100010101000000010001000001" "010001000100000101000001010" }, - /* 41*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "ABCDEF\001G1234H", -1, 0, 16, 25, 1, "Code Set A 4x Shift C", + /* 41*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "ABCDEF\001G1234H", -1, 0, 16, 25, 1, 1, "Code Set A 4x Shift C", "0010101010100000100000101" "0000000100010101000001000" "1000100000101000100000101" @@ -861,7 +862,7 @@ static void test_encode(int index, int generate, int debug) { "1010101010001000101000000" "0000010100010101000101010" }, - /* 42*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "ABCDEF\001ab\011\034\035\036\001A", -1, 0, 19, 28, 1, "Code Set A 6x Shift B HT FS GS RS", + /* 42*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "ABCDEF\001ab\011\034\035\036\001A", -1, 0, 19, 28, 1, 1, "Code Set A 6x Shift B HT FS GS RS", "1000001010100010101010101010" "0101000000010100010101010001" "0010001010100000101000001010" @@ -882,7 +883,7 @@ static void test_encode(int index, int generate, int debug) { "0001010000010100000100010101" "1010100010000000101010101010" }, - /* 43*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "ABCDEF\001abcdefgA", -1, 0, 19, 28, 1, "Code Set A Latch B", + /* 43*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "ABCDEF\001abcdefgA", -1, 0, 19, 28, 1, 1, "Code Set A Latch B", "1010001010100010101010101010" "0100010101010000000100010001" "1010000010100000100010101000" @@ -903,7 +904,7 @@ static void test_encode(int index, int generate, int debug) { "0001010000010100000100010101" "1010100010000000101010101010" }, - /* 44*/ { DATA_MODE, -1, -1, { 0, 0, "" }, "\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\200", -1, 0, 20, 29, 1, "Binary Latch C", + /* 44*/ { DATA_MODE, -1, -1, { 0, 0, "" }, "\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\200", -1, 0, 20, 29, 1, 1, "Binary Latch C", "10101010000010100010101010001" "01010001000101010001000000010" "00001010101000101010001000001" @@ -925,7 +926,7 @@ static void test_encode(int index, int generate, int debug) { "10000010100010000010001000101" "01000100000100010001010101010" }, - /* 45*/ { UNICODE_MODE, -1, -1, { 11, 24, "" }, "ABCDEFG", -1, 0, 16, 23, 1, "Structured Append", + /* 45*/ { UNICODE_MODE, -1, -1, { 11, 24, "" }, "ABCDEFG", -1, 0, 16, 23, 1, 1, "Structured Append", "10101000001000101000001" "01010101000001010001010" "10101010100010000000001" @@ -943,7 +944,7 @@ static void test_encode(int index, int generate, int debug) { "10001010101000100010001" "01000001000100010101010" }, - /* 46*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "1234", -1, 0, 10, 13, 1, "", + /* 46*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "1234", -1, 0, 10, 13, 1, 1, "", "0010100000001" "0000000001010" "1000000010101" @@ -961,10 +962,11 @@ static void test_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[1024]; - char bwipp_buf[8192]; - char bwipp_msg[1024]; + char cmp_buf[8192]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_encode"); @@ -985,11 +987,11 @@ static void test_encode(int index, int generate, int debug) { assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { - printf(" /*%3d*/ { %s, %d, %s, { %d, %d, \"%s\" }, \"%s\", %d, %s, %d, %d, %d, \"%s\",\n", + printf(" /*%3d*/ { %s, %d, %s, { %d, %d, \"%s\" }, \"%s\", %d, %s, %d, %d, %d, %d, \"%s\",\n", i, testUtilInputModeName(data[i].input_mode), data[i].option_2, testUtilOption3Name(data[i].option_3), data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, - testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); + testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].zxingcpp_cmp, data[i].comment); testUtilModulesPrint(symbol, " ", "\n"); printf(" },\n"); } else { @@ -1006,12 +1008,27 @@ static void test_encode(int index, int generate, int debug) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { - ret = testUtilBwipp(i, symbol, -1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, -1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); + } + } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + if (!data[i].zxingcpp_cmp) { + if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not ZXing-C++ compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); + } else { + int cmp_len, ret_len; + char modules_dump[16384]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); } } } diff --git a/backend/tests/test_maxicode.c b/backend/tests/test_maxicode.c index 3f7f11ba..ef277ebd 100644 --- a/backend/tests/test_maxicode.c +++ b/backend/tests/test_maxicode.c @@ -883,10 +883,11 @@ static void test_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[1024]; - char bwipp_buf[8192]; - char bwipp_msg[1024]; + char cmp_buf[8192]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_encode"); @@ -928,14 +929,25 @@ static void test_encode(int index, int generate, int debug) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { - ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, data[i].primary, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, data[i].primary, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); } } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[17984 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, data[i].primary, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); + } } } diff --git a/backend/tests/test_medical.c b/backend/tests/test_medical.c index bfbbd2cd..36e56d72 100644 --- a/backend/tests/test_medical.c +++ b/backend/tests/test_medical.c @@ -258,10 +258,11 @@ static void test_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[1024]; - char bwipp_buf[8192]; - char bwipp_msg[1024]; + char cmp_buf[8192]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_encode"); @@ -294,12 +295,23 @@ static void test_encode(int index, int generate, int debug) { assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) { - ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); + } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[8192 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); } } } diff --git a/backend/tests/test_pdf417.c b/backend/tests/test_pdf417.c index 99084325..c179f90d 100644 --- a/backend/tests/test_pdf417.c +++ b/backend/tests/test_pdf417.c @@ -1651,10 +1651,11 @@ static void test_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[1024]; - char bwipp_buf[32768]; - char bwipp_msg[1024]; + char cmp_buf[32768]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_encode"); @@ -1692,14 +1693,25 @@ static void test_encode(int index, int generate, int debug) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { - ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); } } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[2710 * 8 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); + } } } diff --git a/backend/tests/test_qr.c b/backend/tests/test_qr.c index 85b4271c..4ad00de0 100644 --- a/backend/tests/test_qr.c +++ b/backend/tests/test_qr.c @@ -1507,10 +1507,11 @@ static void test_qr_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[4096]; - char bwipp_buf[32768]; - char bwipp_msg[1024]; + char cmp_buf[32768]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_qr_encode"); @@ -1552,14 +1553,25 @@ static void test_qr_encode(int index, int generate, int debug) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { - ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); } } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[32768]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); + } } } @@ -2312,8 +2324,8 @@ static void test_microqr_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[4096]; - char bwipp_buf[32768]; - char bwipp_msg[1024]; + char cmp_buf[32768]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise @@ -2351,12 +2363,12 @@ static void test_microqr_encode(int index, int generate, int debug) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { - ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); } } } @@ -3437,8 +3449,8 @@ static void test_rmqr_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[4096]; - char bwipp_buf[32768]; - char bwipp_msg[1024]; + char cmp_buf[32768]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise @@ -3476,12 +3488,12 @@ static void test_rmqr_encode(int index, int generate, int debug) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { - ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); } } } diff --git a/backend/tests/test_rss.c b/backend/tests/test_rss.c index 9e6a5137..05d341a6 100644 --- a/backend/tests/test_rss.c +++ b/backend/tests/test_rss.c @@ -122,10 +122,12 @@ static void test_binary_div_modulo_divisor(int index, int generate, int debug) { char *text; - char bwipp_buf[1024]; - char bwipp_msg[1024]; + char escaped[1024]; + char cmp_buf[1024]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_binary_div_modulo_divisor"); @@ -164,12 +166,23 @@ static void test_binary_div_modulo_divisor(int index, int generate, int debug) { assert_zero(ret, "i:%d ZBarcode_Buffer_Vector ret %d != 0\n", i, ret); if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) { - ret = testUtilBwipp(i, symbol, -1, -1, -1, text, length, symbol->primary, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, -1, -1, -1, text, length, symbol->primary, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmpRow(symbol, symbol->rows - 1, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmpRow(symbol, symbol->rows - 1, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); + } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[8192 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); } } @@ -544,7 +557,46 @@ static void test_examples(int index, int generate, int debug) { /* 49*/ { BARCODE_DBAR_EXPSTK, -1, 11, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 1, 543, 1, "Example with 22 chars, 1 row", "010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010011100111000100101111111100111010000101111011110111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010" }, - /* 50*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 41, 53, 1, "Example with 22 chars, 11 rows", + /* 50*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]1234567890123456789012345678901234567890123456789012345678901", 0, 37, 53, 1, "", + "01011100010111111010111111110000101100100000010100010" + "00000011101000000101000000001010010011011111101010000" + "00000101010101010101010101010101010101010101010100000" + "00001000001110100010100001010101001110000101100110000" + "10100111110001011101011110000000010001111010011000101" + "00001000001110100010100001010101001110000101100110000" + "00000101010101010101010101010101010101010101010100000" + "00000001110100100001010000001010010101100111000110000" + "01011110001011011110001111110000101010011000111000010" + "00000001110100100001010000001010010101100111000110000" + "00000101010101010101010101010101010101010101010100000" + "00000110001111101110100001010100001110001110111010000" + "10101001110000010001011110000001110001110001000100101" + "00000110001111101110100001010100001110001110111010000" + "00000101010101010101010101010101010101010101010100000" + "00001000011011000101010000101010010011100010001100000" + "01000111100100111010001111000000101100011101110010010" + "00001000011011000101010000101010010011100010001100000" + "00000101010101010101010101010101010101010101010100000" + "00001000110001110110100000010100001011110100001000000" + "10100111001110001001011111100001110100001011110111101" + "00001000110001110110100000010100001011110100001000000" + "00000101010101010101010101010101010101010101010100000" + "00000010011101111101010010101010010100110000100000000" + "01011101100010000010001100000000101011001111011110010" + "00000010011101111101010010101010010100110000100000000" + "00000101010101010101010101010101010101010101010100000" + "00000100010111101110100000101010001100000110011010000" + "10111011101000010001011111000000110011111001100101101" + "00000100010111101110100000101010001100000110011010000" + "00000101010101010101010101010101010101010101010100000" + "00000011000110001001000101010101010000011110011010000" + "01011100111001110110011000000000101111100001100101010" + "00000011000110001001000101010101010000011110011010000" + "00000101010101010101010101010101010101010101010100000" + "00001011100010001110100000000010001110111010001100000" + "10100100011101110001011111111100110001000101110011101" + }, + /* 51*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 41, 53, 1, "Example with 22 chars, 11 rows", "01010101111011111110111111110000101100100000010100010" "00001010000100000001000000001010010011011111101010000" "00000101010101010101010101010101010101010101010100000" @@ -587,14 +639,14 @@ static void test_examples(int index, int generate, int debug) { "00001000111010000101000101010101010100001011000110000" "01000111000101111010011000000000101011110100111000010" }, - /* 51*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 298, 1, "#200 Daniel Gredler mostly empty last row, 16 chars, 2 rows, bottom row 4 chars", + /* 52*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 298, 1, "#200 Daniel Gredler mostly empty last row, 16 chars, 2 rows, bottom row 4 chars", "0100011101110001011011111111000010110000100101111101101000000110001010111100000000101001110000001001010011111011100110001111110000101110101000011000011010011100011000101111000000111001111000111101010111110010110000100011110000001010110010000010000111011111000100101011111100001110011110011000100101" "0000100010001110100100000000101001001111011010000010010111111001110101000010101010010110001111110110101100000100011001010000001010010001010111100111100101100011100111010000101010000110000111000010101000001101001111010100001010100101001101111101111000100000111011010100000010100001100001100111010000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "0000110000010010011000010000000010111110011010001001111010011011100010010101010010101110100011111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "1010001111101101100111001111111101000001100101110110000101100100011101000000001100010001011100000110100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, - /* 52*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 9, 151, 1, "#200 16 chars, 3 rows, bottom row 4 chars", + /* 53*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 9, 151, 1, "#200 16 chars, 3 rows, bottom row 4 chars", "0100011101110001011011111111000010110000100101111101101000000110001010111100000000101001110000001001010011111011100110001111110000101110101000011000010" "0000100010001110100100000000101001001111011010000010010111111001110101000010101010010110001111110110101100000100011001010000001010010001010111100110000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" @@ -605,201 +657,201 @@ static void test_examples(int index, int generate, int debug) { "0000011111000101110101001010101001000111011001011110010001011001111101000000001000011001001000001100000000000000000000000000000000000000000000000000000" "0101100000111010001000110000000010111000100110100001101110100110000010111111110011100110110111110001010000000000000000000000000000000000000000000000000" }, - /* 53*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 200, 1, "#200 16 chars, 2 full rows", + /* 54*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 200, 1, "#200 16 chars, 2 full rows", "01000111011100010110111111110000101100001001011111011010000001100010101111000000001010011100000010010100111110111001100011111100001011101010000110000110100111000110001011110000001110011110001111010101" "00001000100011101001000000001010010011110110100000100101111110011101010000101010100101100011111101101011000001000110010100000010100100010101111001111001011000111001110100001010100001100001110000100000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "00001100000100100110000100000000101111100110100010011110100110111000100101010100101011101000111110010110111001100001100001010000001010110111000001000111101111101100101001010100001010111100101100000000" "10100011111011011001110011111111010000011001011101100001011001000111010000000011000100010111000001101001000110011110011100001111110101001000111110111000010000010011010100000011110001000011010011111010" }, - /* 54*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 249, 1, "#200 16 chars, 2 rows, bottom row 6 chars", + /* 55*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 249, 1, "#200 16 chars, 2 rows, bottom row 6 chars", "010001110111000101101111111100001011000010010111110110100000011000101011110000000010100111000000100101001111101110011000111111000010111010100001100001101001110001100010111100000011100111100011110101011111001011000010001111000000101011001000001000010" "000010001000111010010000000010100100111101101000001001011111100111010100001010101001011000111111011010110000010001100101000000101001000101011110011110010110001110011101000010101000011000011100001010100000110100111101010000101010010100110111110110000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "000001000001110110101000000101000011000011001110110100111110001011101010010101010010001110110010111100100010110011111010000000010000110010010000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "101110111110001001010111111000011100111100110001001011000001110100010001100000000101110001001101000011011101001100000101111111100111001101101111100010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, - /* 55*/ { BARCODE_DBAR_EXPSTK, -1, 7, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 347, 1, "#200 16 chars, 2 rows, bottom row 2 chars", + /* 56*/ { BARCODE_DBAR_EXPSTK, -1, 7, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 347, 1, "#200 16 chars, 2 rows, bottom row 2 chars", "01000111011100010110111111110000101100001001011111011010000001100010101111000000001010011100000010010100111110111001100011111100001011101010000110000110100111000110001011110000001110011110001111010101111100101100001000111100000010101100100000100001110111110001001010111111000011100111100110001001011000001110100010001100000000101110001001101000010" "00001000100011101001000000001010010011110110100000100101111110011101010000101010100101100011111101101011000001000110010100000010100100010101111001111001011000111001110100001010100001100001110000101010000011010011110101000010101001010011011111011110001000001110110101000000101000011000011001110110100111110001011101010010101010010001110110010110000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "00001000101100111110100000000100001100100100000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "10110111010011000001011111111001110011011011111000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, - /* 56*/ { BARCODE_DBAR_EXPSTK, -1, 8, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 1, 396, 1, "#200 16 chars, 1 row", + /* 57*/ { BARCODE_DBAR_EXPSTK, -1, 8, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 1, 396, 1, "#200 16 chars, 1 row", "010001110111000101101111111100001011000010010111110110100000011000101011110000000010100111000000100101001111101110011000111111000010111010100001100001101001110001100010111100000011100111100011110101011111001011000010001111000000101011001000001000011101111100010010101111110000111001111001100010010110000011101000100011000000001011100010011010000110111010011000001011111111001110011011011111000101" }, - /* 57*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]00012345678905[10]ABC123", 0, 1, 232, 1, "24724:2011 7.2.5.4.1, encoding method 1 '1'", + /* 58*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]00012345678905[10]ABC123", 0, 1, 232, 1, "24724:2011 7.2.5.4.1, encoding method 1 '1'", "0100011000001011011011111111000010110011000010111101011110011011111010111110000001100010110000110111000111101101011110001111110000101110001100100001010011101111110110101111111100111001011011111101110011011100101111100011110000001010" }, - /* 58*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]001750", 0, 1, 151, 1, "24724:2011 7.2.5.4.2, encoding method 3 '0100'", + /* 59*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]001750", 0, 1, 151, 1, "24724:2011 7.2.5.4.2, encoding method 3 '0100'", "0101110010000010011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110101111000110001111110000101011000010011111010" }, - /* 59*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]032767", 0, 1, 151, 1, "Encoding method 3 '0100' with weight = 32767", + /* 60*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]032767", 0, 1, 151, 1, "Encoding method 3 '0100' with weight = 32767", "0101001000111000011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110111011000110001111110000101101111101110111010" }, - /* 60*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]032768", 0, 1, 200, 1, "Possible encoding method 3 '0100' but weight > 32767 so encoding method 7 '0111000' with dummy date", + /* 61*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]032768", 0, 1, 200, 1, "Possible encoding method 3 '0100' but weight > 32767 so encoding method 7 '0111000' with dummy date", "01001100000101001110111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000110100110000110100000100110001011111111001110011001111010000101" }, - /* 61*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3202]000156", 0, 1, 151, 1, "24724:2011 7.2.5.4.3, encoding method 4 '0101'", + /* 62*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3202]000156", 0, 1, 151, 1, "24724:2011 7.2.5.4.3, encoding method 4 '0101'", "0101001000111100001011111111000010100111000100001101011110111001100010111100000011100101110001110111011110101111000110001111110000101100001000001010010" }, - /* 62*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3202]009999", 0, 1, 151, 1, "Encoding method 4 '0101' with weight = 9999", + /* 63*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3202]009999", 0, 1, 151, 1, "Encoding method 4 '0101' with weight = 9999", "0101110001000100011011111111000010100111000100001101011110111001100010111100000011100101110001110111011110110100011110001111110000101100111110010001010" }, - /* 63*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3202]010000", 0, 1, 200, 1, "Possible encoding method 4 '0101' but weight > 9999 so encoding method 8 with dummy date", + /* 64*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3202]010000", 0, 1, 200, 1, "Possible encoding method 4 '0101' but weight > 9999 so encoding method 8 with dummy date", "01001000101110000110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010000011101001100111101101001110001011111111001110011001111010000101" }, - /* 64*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3203]022767", 0, 1, 151, 1, "Encoding method 4 '0101' with weight = 22767", + /* 65*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3203]022767", 0, 1, 151, 1, "Encoding method 4 '0101' with weight = 22767", "0101110010011000001011111111000010100111000100001101011110111001100010111100000011100101110001110111011110111011000110001111110000101101111101110111010" }, - /* 65*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3203]022768", 0, 1, 200, 1, "Possible encoding method 4 '0101' but weight > 22767 so encoding method 8 with dummy date", + /* 66*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3203]022768", 0, 1, 200, 1, "Possible encoding method 4 '0101' but weight > 22767 so encoding method 8 with dummy date", "01000110111000100010111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010011100010110000100001101000001101011111111001110011001111010000101" }, - /* 66*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3922]795", 0, 1, 183, 1, "24724:2011 7.2.5.4.5, encoding method 5 '01100XX', no following AIs", + /* 67*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3922]795", 0, 1, 183, 1, "24724:2011 7.2.5.4.5, encoding method 5 '01100XX', no following AIs", "010110000010001011101111111100001010011100000101100101111001101111101011111100001110001011000011011100011110110101111000111111000010100111101110100001100011011100100010111111110011101" }, - /* 67*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3922]795[20]01", 0, 1, 200, 1, "Encoding method 5 '01100XX' with following AI", + /* 68*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3922]795[20]01", 0, 1, 200, 1, "Encoding method 5 '01100XX' with following AI", "01000110110000110010111111110000101111000100001010010111100110111110101111110000111000101100001101110001111011010111100011111100001010011110111010000110001110001011001011111111001110100111110001110101" }, - /* 68*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3932]0081234", 0, 1, 200, 1, "24724:2011 7.2.5.4.6, encoding method 6 '01101XX', no following AIs", + /* 69*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3932]0081234", 0, 1, 200, 1, "24724:2011 7.2.5.4.6, encoding method 6 '01101XX', no following AIs", "01001110000101100010111111110000101110100000110010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000011010111100100111110001011101011111111001110001101111001011101" }, - /* 69*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3932]0081234[20]01", 0, 1, 232, 1, "Encoding method 6 '01101XX' with following AI", + /* 70*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3932]0081234[20]01", 0, 1, 232, 1, "Encoding method 6 '01101XX' with following AI", "0100001101000100111011111111000010110000101000111001011110011011111010111110000001100010110000110111000111101101011110001111110000101100001101011110010011111000101110101111111100111000100110011110010011101111001000100011110000001010" }, - /* 70*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3932]A401234", ZINT_WARN_NONCOMPLIANT, 1, 232, 0, "Possible encoding method 6 '01101XX' but invalid currency code so encoding method 1; BWIPP no check (craps out)", + /* 71*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3932]A401234", ZINT_WARN_NONCOMPLIANT, 1, 232, 0, "Possible encoding method 6 '01101XX' but invalid currency code so encoding method 1; BWIPP no check (craps out)", "0100011000010011011011111111000010100100011111001101011110011011111010111110000001100010110000110111000111101101011110001111110000101100011001111001010001011011000000101111111100111001101011111110110001111001001110100011110000001010" }, - /* 71*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]90012345678908[3932]A401234", 0, 1, 232, 0, "Possible encoding method 6 '01101XX' but invalid currency code so encoding method 1; BWIPP no check (craps out)", + /* 72*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]90012345678908[3932]A401234", 0, 1, 232, 0, "Possible encoding method 6 '01101XX' but invalid currency code so encoding method 1; BWIPP no check (craps out)", "0100011000010011011011111111000010100100011111001101011110011011111010111110000001100010110000110111000111101101011110001111110000101100011001111001010001011011000000101111111100111001101011111110110001111001001110100011110000001010" }, - /* 72*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]099999[11]201209", 0, 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 and valid date", + /* 73*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]099999[11]201209", 0, 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 and valid date", "01000101111001000010111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010111100100001000100000011100101001011111111001110010000100100011101" }, - /* 73*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]099999", 0, 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 but no date", + /* 74*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]099999", 0, 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 but no date", "01000111011000010010111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010111100100001000110100100011000001011111111001110011001111010000101" }, - /* 74*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]100000[11]201209", 0, 1, 281, 1, "Possible encoding method 7 '0111000' but weight > 99999 so encoding method 1", + /* 75*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]100000[11]201209", 0, 1, 281, 1, "Possible encoding method 7 '0111000' but weight > 99999 so encoding method 1", "01010011110001110010111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001010010110001110000110010000011110101011111111001110000011100110101100001001110100011000110000000010100101100000100001011100011001111010111111111001101" }, - /* 75*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]099999[11]200000", ZINT_WARN_NONCOMPLIANT, 1, 281, 0, "Possible encoding method 7 '0111000' with weight <= 99999 but date invalid so encoding method 1; BWIPP requires `dontlint` (GS1NOCHECK_MODE)", + /* 76*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]099999[11]200000", ZINT_WARN_NONCOMPLIANT, 1, 281, 0, "Possible encoding method 7 '0111000' with weight <= 99999 but date invalid so encoding method 1; BWIPP requires `dontlint` (GS1NOCHECK_MODE)", "01011001110001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001010010110001110000110010011110100001011111111001110110011100010111100001001110100011000110000000010101100001000000101010111101111110010111111111001101" }, - /* 76*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]90012345678908[3102]099999[11]200000", 0, 1, 281, 1, "Possible encoding method 7 '0111000' with weight <= 99999 but date invalid so encoding method 1", + /* 77*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]90012345678908[3102]099999[11]200000", 0, 1, 281, 1, "Possible encoding method 7 '0111000' with weight <= 99999 but date invalid so encoding method 1", "01011001110001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001010010110001110000110010011110100001011111111001110110011100010111100001001110100011000110000000010101100001000000101010111101111110010111111111001101" }, - /* 77*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]099999[11]201209", 0, 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 and valid date", + /* 78*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]099999[11]201209", 0, 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 and valid date", "01001000001101001110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000100001101100111010111001110001011111111001110010000100100011101" }, - /* 78*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]099999", 0, 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 but no date", + /* 79*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]099999", 0, 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 but no date", "01000101110010000110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000100001101100111010000111011101011111111001110011001111010000101" }, - /* 79*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]100000[11]201209", 0, 1, 281, 1, "Possible encoding method 8 '0111001' but weight > 99999 so encoding method 1", + /* 80*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]100000[11]201209", 0, 1, 281, 1, "Possible encoding method 8 '0111001' but weight > 99999 so encoding method 1", "01011101100011000110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001011101010000110000111011110001100101011111111001110000011100110101100001001110100011000110000000010100101100000100001011100011001111010111111111001101" }, - /* 80*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]099999[11]000000", ZINT_WARN_NONCOMPLIANT, 1, 281, 0, "Possible encoding method 8 '0111001' but date invalid so encoding method 1; BWIPP requires `dontlint` (GS1NOCHECK_MODE)", + /* 81*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]099999[11]000000", ZINT_WARN_NONCOMPLIANT, 1, 281, 0, "Possible encoding method 8 '0111001' but date invalid so encoding method 1; BWIPP requires `dontlint` (GS1NOCHECK_MODE)", "01011110100001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001011101010000110000111000011110101101011111111001110110011100010111100001110100001011000110000000010101100001000000101010111101111110010111111111001101" }, - /* 81*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]90012345678908[3201]099999[11]000000", 0, 1, 281, 1, "Possible encoding method 8 '0111001' but date invalid so encoding method 1", + /* 82*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]90012345678908[3201]099999[11]000000", 0, 1, 281, 1, "Possible encoding method 8 '0111001' but date invalid so encoding method 1", "01011110100001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001011101010000110000111000011110101101011111111001110110011100010111100001110100001011000110000000010101100001000000101010111101111110010111111111001101" }, - /* 82*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3100]099999[13]201209", 0, 1, 200, 1, "Encoding method 9 '0111010' with weight <= 99999 and valid date", + /* 83*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3100]099999[13]201209", 0, 1, 200, 1, "Encoding method 9 '0111010' with weight <= 99999 and valid date", "01001000001101001110111111110000101111001010000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000111000001010111010000110110001011111111001110010000100100011101" }, - /* 83*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3204]099999[13]201209", 0, 1, 200, 1, "Encoding method 10 '0111011' with weight <= 99999 and valid date", + /* 84*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3204]099999[13]201209", 0, 1, 200, 1, "Encoding method 10 '0111011' with weight <= 99999 and valid date", "01001000111000010110111111110000101100101000001110010111100110111110101111110000111000101100001101110001111011010111100011111100001010011101000011110101110000101111101011111111001110010000100100011101" }, - /* 84*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]012233[15]991231", 0, 1, 200, 1, "24724:2011 7.2.5.4.4, encoding method 11 '0111100' with weight <= 99999 and valid date", + /* 85*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]012233[15]991231", 0, 1, 200, 1, "24724:2011 7.2.5.4.4, encoding method 11 '0111100' with weight <= 99999 and valid date", "01001100000100111010111111110000101011100100000110010111100110111110101111110000111000101100001101110001111011010111100011111100001011000011010110000111001100110001001011111111001110001101111010000101" }, - /* 85*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3205]099999[15]201209", 0, 1, 200, 1, "Encoding method 12 '0111101' with weight <= 99999 and valid date", + /* 86*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3205]099999[15]201209", 0, 1, 200, 1, "Encoding method 12 '0111101' with weight <= 99999 and valid date", "01001110000010011010111111110000101000001101110100010111100110111110101111110000111000101100001101110001111011010111100011111100001011110011010001100101001100011000001011111111001110010000100100011101" }, - /* 86*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3105]099999[17]201209", 0, 1, 200, 1, "Encoding method 13 '0111110' with weight <= 99999 and valid date", + /* 87*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3105]099999[17]201209", 0, 1, 200, 1, "Encoding method 13 '0111110' with weight <= 99999 and valid date", "01000111010000110010111111110000101110000100110100010111100110111110101111110000111000101100001101110001111011010111100011111100001011110011010001100101001100011000001011111111001110010000100100011101" }, - /* 87*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3200]099999[17]201209", 0, 1, 200, 1, "Encoding method 14 '0111111' with weight <= 99999 and valid date", + /* 88*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3200]099999[17]201209", 0, 1, 200, 1, "Encoding method 14 '0111111' with weight <= 99999 and valid date", "01001110000010100110111111110000101111000100010100010111100110111110101111110000111000101100001101110001111011010111100011111100001011000111000001010111010000110110001011111111001110010000100100011101" }, - /* 88*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[8110]106141416543213500110000310123196000", 0, 5, 200, 1, "North American Coupon Application Guideline (NACAG) Figure 1 (& Appendix C: Example 6)", + /* 89*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[8110]106141416543213500110000310123196000", 0, 5, 200, 1, "North American Coupon Application Guideline (NACAG) Figure 1 (& Appendix C: Example 6)", "01001100101110001110111111110000101000001101000001010111100110111000101111100000011011010001000000110000111100001010100011111100001010000010101111000111010000011001101011111111001110000001101101000101" "00000011010001110001000000001010010111110010111110101000011001000111010000010101000100101110111111001111000011110101010100000010100101111101010000111000101111100110010100000000100001111110010010110000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "00000100010110000110100000001010101010111100111101110010110001110011101000000000100010000011010010000100011110111011001000101010101010011101111111010000000000000000000000000000000000000000000000000000" "00100011101001111001001111110000010101000011000010001101001110001100010111111111001101111100101101111011100001000100110011000000000101100010000000101010000000000000000000000000000000000000000000000000" }, - /* 89*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141416543213500110000310123196000", 0, 5, 200, 1, "NACAG Figure 1 (& Appendix C: Example 6) specifying max rows", + /* 90*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141416543213500110000310123196000", 0, 5, 200, 1, "NACAG Figure 1 (& Appendix C: Example 6) specifying max rows", "01001100101110001110111111110000101000001101000001010111100110111000101111100000011011010001000000110000111100001010100011111100001010000010101111000111010000011001101011111111001110000001101101000101" "00000011010001110001000000001010010111110010111110101000011001000111010000010101000100101110111111001111000011110101010100000010100101111101010000111000101111100110010100000000100001111110010010110000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "00000100010110000110100000001010101010111100111101110010110001110011101000000000100010000011010010000100011110111011001000101010101010011101111111010000000000000000000000000000000000000000000000000000" "00100011101001111001001111110000010101000011000010001101001110001100010111111111001101111100101101111011100001000100110011000000000101100010000000101010000000000000000000000000000000000000000000000000" }, - /* 90*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[8110]10614141011111275110111", 0, 5, 151, 1, "NACAG Figure 3", + /* 91*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[8110]10614141011111275110111", 0, 5, 151, 1, "NACAG Figure 3", "0101011110011100001011111111000010100000110100000101011110011011100010111110000001101101000100000011000011100001101010001111110000101010000011000111010" "0000100001100011110100000000101001011111001011111010100001100100011101000001010100010010111011111100111100011110010101010000001010010101111100111000000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "0000001000100001011010000000010000111001101101100001100111100100100010100001010100100001101011111000000000000000000000000000000000000000000000000000000" "1011110111011110100101111111100111000110010010011110011000011011011100011110000001011110010100000100100000000000000000000000000000000000000000000000000" }, - /* 91*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]10614141011111275110111", 0, 5, 151, 1, "NACAG Figure 3 specifying max rows", + /* 92*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]10614141011111275110111", 0, 5, 151, 1, "NACAG Figure 3 specifying max rows", "0101011110011100001011111111000010100000110100000101011110011011100010111110000001101101000100000011000011100001101010001111110000101010000011000111010" "0000100001100011110100000000101001011111001011111010100001100100011101000001010100010010111011111100111100011110010101010000001010010101111100111000000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "0000001000100001011010000000010000111001101101100001100111100100100010100001010100100001101011111000000000000000000000000000000000000000000000000000000" "1011110111011110100101111111100111000110010010011110011000011011011100011110000001011110010100000100100000000000000000000000000000000000000000000000000" }, - /* 92*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[8110]106141410222223100110222111101231023456721104561045678991201", 0, 5, 298, 1, "NACAG Figure 4", + /* 93*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[8110]106141410222223100110222111101231023456721104561045678991201", 0, 5, 298, 1, "NACAG Figure 4", "0100101111101001111011111111000010110010000011001101011110011011100010111100000000101101000100000011000011100001101010001111110000101011000011100001010111000011011110101111000000111010011111000101110001110110011001100011110000001011100110000101000110101111110111001011111111001110011010011100001101" "0000010000010110000100000000101001001101111100110010100001100100011101000010101010010010111011111100111100011110010101010000001010010100111100011110101000111100100001010000101010000101100000111010001110001001100110010100001010100100011001111010111001010000001000110100000000100001100101100011110000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "0000011010011011100010100101010100100111000100000101010000111000110010100000101010001111000101110100011001110001101000100000001010101011011110000111010111110001101011101000000000100011110100100010000110101100111000001000101010101000000000000000000000000000000000000000000000000000000000000000000000" "0010000101100100011100011000000001011000111011111010101111000111001101011111000000110000111010001011100110001110010111001111110000010100100001111000101000001110010100010111111111001100001011011101111001010011000111110011000000000101000000000000000000000000000000000000000000000000000000000000000000" }, - /* 93*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141410222223100110222111101231023456721104561045678991201", 0, 5, 298, 1, "NACAG Figure 4, specifying max rows", + /* 94*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141410222223100110222111101231023456721104561045678991201", 0, 5, 298, 1, "NACAG Figure 4, specifying max rows", "0100101111101001111011111111000010110010000011001101011110011011100010111100000000101101000100000011000011100001101010001111110000101011000011100001010111000011011110101111000000111010011111000101110001110110011001100011110000001011100110000101000110101111110111001011111111001110011010011100001101" "0000010000010110000100000000101001001101111100110010100001100100011101000010101010010010111011111100111100011110010101010000001010010100111100011110101000111100100001010000101010000101100000111010001110001001100110010100001010100100011001111010111001010000001000110100000000100001100101100011110000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "0000011010011011100010100101010100100111000100000101010000111000110010100000101010001111000101110100011001110001101000100000001010101011011110000111010111110001101011101000000000100011110100100010000110101100111000001000101010101000000000000000000000000000000000000000000000000000000000000000000000" "0010000101100100011100011000000001011000111011111010101111000111001101011111000000110000111010001011100110001110010111001111110000010100100001111000101000001110010100010111111111001100001011011101111001010011000111110011000000000101000000000000000000000000000000000000000000000000000000000000000000" }, - /* 94*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]1061414165432131501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 1", + /* 95*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]1061414165432131501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 1", "010111101100011011101111111100001011001000001100110101111001101110001011110000000010110100010000001100001111000010101000111111000010100000101011110001110100000110011010111100000011101001111000101111000111011001001110001111000000101011001000001110010" "000000010011100100010000000010100100110111110011001010000110010001110100001010101001001011101111110011110000111101010101000000101001011111010100001110001011111001100101000010101000010110000111010000111000100110110001010000101010010100110111110000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "000001110000100101101000000101000011110100100011100111100001001101001010010101010010011111110101101100010010110011111010000010101000111101010000010001110001001100110010001010101010100011000111001011000010011010000010100000000010000000000000000000000" "101110001111011010010111111000011100001011011100011000011110110010110001100000000101100000001010010011101101001100000101111100000011000010101111101110001110110011001100110000000001011100111000110100111101100101111101011111111100110100000000000000000" }, - /* 95*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]1061414165432131501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 1, specifying max row", + /* 96*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]1061414165432131501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 1, specifying max row", "010111101100011011101111111100001011001000001100110101111001101110001011110000000010110100010000001100001111000010101000111111000010100000101011110001110100000110011010111100000011101001111000101111000111011001001110001111000000101011001000001110010" "000000010011100100010000000010100100110111110011001010000110010001110100001010101001001011101111110011110000111101010101000000101001011111010100001110001011111001100101000010101000010110000111010000111000100110110001010000101010010100110111110000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "000001110000100101101000000101000011110100100011100111100001001101001010010101010010011111110101101100010010110011111010000010101000111101010000010001110001001100110010001010101010100011000111001011000010011010000010100000000010000000000000000000000" "101110001111011010010111111000011100001011011100011000011110110010110001100000000101100000001010010011101101001100000101111100000011000010101111101110001110110011001100110000000001011100111000110100111101100101111101011111111100110100000000000000000" }, - /* 96*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[8110]106141410012342501106501013085093101231", 0, 5, 200, 1, "NACAG Appendix C: Example 2", + /* 97*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[8110]106141410012342501106501013085093101231", 0, 5, 200, 1, "NACAG Appendix C: Example 2", "01001100101110001110111111110000101000001101000001010111100110111000101111100000011011010001000000110000111000011010100011111100001010000110011000110111001110000010101011111111001110011110010001100101" "00000011010001110001000000001010010111110010111110101000011001000111010000010101000100101110111111001111000111100101010100000010100101111001100111001000110001111101010100000000100001100001101110010000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "00000100100001001110100000001010101011111101001011110000110001001011101000000000100010111000110010000111011001101000001000101010101010011011001000010000000000000000000000000000000000000000000000000000" "00100011011110110001001111110000010100000010110100001111001110110100010111111111001101000111001101111000100110010111110011000000000101100100110111100010000000000000000000000000000000000000000000000000" }, - /* 97*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]106141410012471011076011110850921108609310123191000", 0, 5, 249, 1, "NACAG Appendix C: Example 3", + /* 98*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]106141410012471011076011110850921108609310123191000", 0, 5, 249, 1, "NACAG Appendix C: Example 3", "010101111101111000101111111100001010000011000101000101111001101110001011110000000010110100010000001100001110000110101000111111000010100001100110001101001000010000111010111100000011100011100011011001011100001001101110001111000000101001100010000111010" "000010000010000111010000000010100101111100111010111010000110010001110100001010101001001011101111110011110001111001010101000000101001011110011001110010110111101111000101000010101000011100011100100110100011110110010001010000101010010110011101111000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "000010000001000010101000000101000011110111011110110111101101011100001010010101010010101000011111011101111101110011001010000010101000101001111001110001000001100110001010000000101010100111111101101000000000000000000000000000000000000000000000000000000" "101001111110111101010111111000011100001000100001001000010010100011110001100000000101010111100000100010000010001100110101111100000011010110000110001110111110011001110100111111000001011000000010010100100000000000000000000000000000000000000000000000000" }, - /* 98*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[8110]106141411234562891101201212085010048000214025610048000310123191000", 0, 5, 298, 1, "NACAG Appendix C: Example 4", + /* 99*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[8110]106141411234562891101201212085010048000214025610048000310123191000", 0, 5, 298, 1, "NACAG Appendix C: Example 4", "0100111111001110101011111111000010100000110001010001011110011011100010111100000000101101000100000011000011100001101010001111110000101010011000111000010101110001000000101111000000111001000001001110010011000011011101100011110000001010000010010110000100011001011000001011111111001110001110101100111101" "0000000000110001010100000000101001011111001110101110100001100100011101000010101010010010111011111100111100011110010101010000001010010101100111000111101010001110111111010000101010000110111110110001101100111100100010010100001010100101111101101001111011100110100111110100000000100001110001010011000000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "0000001110011100111010100101010100101001111011111101000100011101100010100000101010001110110010001000010111101100001110100000001010101000011101111010110010111110001001101000000000100011100001011000010111001010111000001000101010101010001111001001100000000000000000000000000000000000000000000000000000" "0010110001100011000100011000000001010110000100000010111011100010011101011111000000110001001101110111101000010011110001001111110000010111100010000101001101000001110110010111111111001100011110100111101000110101000111110011000000000101110000110110011010000000000000000000000000000000000000000000000000" }, - /* 99*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]1061414154321031501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 5", + /*100*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]1061414154321031501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 5", "010100111111010011101111111100001011001000001100110101111001101110001011110000000010110100010000001100001111000010101000111111000010101100100000001001100011101011000010111100000011101001111000101111000111011001001110001111000000101011001000001110010" "000011000000101100010000000010100100110111110011001010000110010001110100001010101001001011101111110011110000111101010101000000101001010011011111110110011100010100111101000010101000010110000111010000111000100110110001010000101010010100110111110000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" @@ -811,10 +863,12 @@ static void test_examples(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char bwipp_buf[4096]; - char bwipp_msg[1024]; + char escaped[4096]; + char cmp_buf[16384]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_examples"); @@ -851,14 +905,25 @@ static void test_examples(int index, int generate, int debug) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { - ret = testUtilBwipp(i, symbol, -1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, -1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); } } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[8192 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); + } } ZBarcode_Delete(symbol); diff --git a/backend/tests/test_upcean.c b/backend/tests/test_upcean.c index f98bc64f..0f49d5ee 100644 --- a/backend/tests/test_upcean.c +++ b/backend/tests/test_upcean.c @@ -37,64 +37,73 @@ static void test_upce_input(int index, int debug) { int symbology; char *data; int ret; + + char *hrt; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { BARCODE_UPCE, "12345", 0 }, // equivalent: 00123400005, hrt: 00123457, Check digit: 7 - /* 1*/ { BARCODE_UPCE_CHK, "12345", ZINT_ERROR_INVALID_CHECK }, - /* 2*/ { BARCODE_UPCE_CHK, "12344", 0 }, // equivalent: 00012000003, hrt: 00012344, Check digit: 4 - /* 3*/ { BARCODE_UPCE, "123456", 0 }, // equivalent: 01234500006, hrt: 01234565, Check digit: 5 - /* 4*/ { BARCODE_UPCE_CHK, "123456", ZINT_ERROR_INVALID_CHECK }, - /* 5*/ { BARCODE_UPCE_CHK, "123457", 0 }, // equivalent: 00123400005, hrt: 00123457, Check digit: 7 - /* 6*/ { BARCODE_UPCE, "1234567", 0 }, // equivalent: 12345600007, hrt: 12345670, Check digit: 0 - /* 7*/ { BARCODE_UPCE_CHK, "1234567", ZINT_ERROR_INVALID_CHECK }, - /* 8*/ { BARCODE_UPCE_CHK, "1234565", 0 }, // equivalent: 01234500006, hrt: 01234565, Check digit: 5 - /* 9*/ { BARCODE_UPCE, "12345678", ZINT_ERROR_INVALID_CHECK }, - /* 10*/ { BARCODE_UPCE, "12345670", 0 }, // equivalent: 12345600007, hrt: 12345670, Check digit: 0 - /* 11*/ { BARCODE_UPCE_CHK, "12345678", ZINT_ERROR_INVALID_CHECK }, - /* 12*/ { BARCODE_UPCE_CHK, "12345670", 0 }, // equivalent: 12345600007, hrt: 12345670, Check digit: 0 - /* 13*/ { BARCODE_UPCE, "123456789", ZINT_ERROR_TOO_LONG }, - /* 14*/ { BARCODE_UPCE_CHK, "123456789", ZINT_ERROR_TOO_LONG }, - /* 15*/ { BARCODE_UPCE, "123456A", ZINT_ERROR_INVALID_DATA }, - /* 16*/ { BARCODE_UPCE, "1234567A", ZINT_ERROR_INVALID_DATA }, - /* 17*/ { BARCODE_UPCE, "12345678A", ZINT_ERROR_INVALID_DATA }, - /* 18*/ { BARCODE_UPCE_CHK, "123456A", ZINT_ERROR_INVALID_DATA }, - /* 19*/ { BARCODE_UPCE_CHK, "1234567A", ZINT_ERROR_INVALID_DATA }, - /* 20*/ { BARCODE_UPCE_CHK, "12345678A", ZINT_ERROR_INVALID_DATA }, - /* 21*/ { BARCODE_UPCE, "2345678", 0 }, // 2 ignored, equivalent: 03456700008, hrt: 03456781, Check digit: 1 - /* 22*/ { BARCODE_UPCE_CHK, "23456781", 0 }, // 2 ignored, equivalent: 03456700008, hrt: 03456781, Check digit: 1 - /* 23*/ { BARCODE_UPCE, "123455", 0 }, // equivalent: 01234500005, hrt: 01234558, Check digit: 8 (BS 797 Rule 3 (a)) - /* 24*/ { BARCODE_UPCE_CHK, "1234558", 0 }, // equivalent: 01234500005, hrt: 01234558, Check digit: 8 (BS 797 Rule 3 (a)) - /* 25*/ { BARCODE_UPCE, "456784", 0 }, // equivalent: 04567000008, hrt: 04567840, Check digit: 0 (BS 797 Rule 3 (b)) - /* 26*/ { BARCODE_UPCE_CHK, "4567840", 0 }, // equivalent: 04567000008, hrt: 04567840, Check digit: 0 (BS 797 Rule 3 (b)) - /* 27*/ { BARCODE_UPCE, "345670", 0 }, // equivalent: 03400000567, hrt: 03456703, Check digit: 3 (BS 797 Rule 3 (c)) - /* 28*/ { BARCODE_UPCE_CHK, "3456703", 0 }, // equivalent: 03400000567, hrt: 03456703, Check digit: 3 (BS 797 Rule 3 (c)) - /* 29*/ { BARCODE_UPCE, "984753", 0 }, // equivalent: 09840000075, hrt: 09847531, Check digit: 1 (BS 797 Rule 3 (d)) - /* 30*/ { BARCODE_UPCE_CHK, "9847531", 0 }, // equivalent: 09840000075, hrt: 09847531, Check digit: 1 (BS 797 Rule 3 (d)) - /* 31*/ { BARCODE_UPCE, "120453", ZINT_ERROR_INVALID_DATA }, // If last digit (emode) 3, 3rd can't be 0, 1 or 2 (BS 787 Table 5 NOTE 1) - /* 32*/ { BARCODE_UPCE, "121453", ZINT_ERROR_INVALID_DATA }, // If last digit (emode) 3, 3rd can't be 0, 1 or 2 (BS 787 Table 5 NOTE 1) - /* 33*/ { BARCODE_UPCE, "122453", ZINT_ERROR_INVALID_DATA }, // If last digit (emode) 3, 3rd can't be 0, 1 or 2 (BS 787 Table 5 NOTE 1) - /* 34*/ { BARCODE_UPCE, "123453", 0 }, - /* 35*/ { BARCODE_UPCE, "123054", ZINT_ERROR_INVALID_DATA }, // If last digit (emode) 4, 4th can't be 0 (BS 787 Table 5 NOTE 2) - /* 36*/ { BARCODE_UPCE, "123154", 0 }, - /* 37*/ { BARCODE_UPCE, "123405", ZINT_ERROR_INVALID_DATA }, // If last digit (emode) 5, 5th can't be 0 (BS 787 Table 5 NOTE 3) - /* 38*/ { BARCODE_UPCE, "123455", 0 }, - /* 39*/ { BARCODE_UPCE, "123406", ZINT_ERROR_INVALID_DATA }, // If last digit (emode) 6, 5th can't be 0 (BS 787 Table 5 NOTE 3) - /* 40*/ { BARCODE_UPCE, "123456", 0 }, - /* 41*/ { BARCODE_UPCE, "123407", ZINT_ERROR_INVALID_DATA }, // If last digit (emode) 7, 5th can't be 0 (BS 787 Table 5 NOTE 3) - /* 42*/ { BARCODE_UPCE, "123457", 0 }, - /* 43*/ { BARCODE_UPCE, "123408", ZINT_ERROR_INVALID_DATA }, // If last digit (emode) 8, 5th can't be 0 (BS 787 Table 5 NOTE 3) - /* 44*/ { BARCODE_UPCE, "123458", 0 }, - /* 45*/ { BARCODE_UPCE, "123409", ZINT_ERROR_INVALID_DATA }, // If last digit (emode) 9, 5th can't be 0 (BS 787 Table 5 NOTE 3) - /* 46*/ { BARCODE_UPCE, "123459", 0 }, - /* 47*/ { BARCODE_UPCE, "000000", 0 }, - /* 48*/ { BARCODE_UPCE, "000001", 0 }, - /* 49*/ { BARCODE_UPCE, "000002", 0 }, + /* 0*/ { BARCODE_UPCE, "12345", 0, "00123457" }, // equivalent: 00123400005, Check digit: 7 + /* 1*/ { BARCODE_UPCE_CHK, "12345", ZINT_ERROR_INVALID_CHECK, "" }, + /* 2*/ { BARCODE_UPCE_CHK, "12344", 0, "00012344" }, // equivalent: 00012000003, Check digit: 4 + /* 3*/ { BARCODE_UPCE, "123456", 0, "01234565" }, // equivalent: 01234500006, Check digit: 5 + /* 4*/ { BARCODE_UPCE_CHK, "123456", ZINT_ERROR_INVALID_CHECK, "" }, + /* 5*/ { BARCODE_UPCE_CHK, "123457", 0, "00123457" }, // equivalent: 00123400005, Check digit: 7 + /* 6*/ { BARCODE_UPCE, "1234567", 0, "12345670" }, // equivalent: 12345600007, Check digit: 0 + /* 7*/ { BARCODE_UPCE_CHK, "1234567", ZINT_ERROR_INVALID_CHECK, "" }, + /* 8*/ { BARCODE_UPCE_CHK, "1234565", 0, "01234565" }, // equivalent: 01234500006, Check digit: 5 + /* 9*/ { BARCODE_UPCE, "12345678", ZINT_ERROR_INVALID_CHECK, "" }, + /* 10*/ { BARCODE_UPCE, "12345670", 0, "12345670" }, // equivalent: 12345600007, Check digit: 0 + /* 11*/ { BARCODE_UPCE_CHK, "12345678", ZINT_ERROR_INVALID_CHECK, "" }, + /* 12*/ { BARCODE_UPCE_CHK, "12345670", 0, "12345670" }, // equivalent: 12345600007, Check digit: 0 + /* 13*/ { BARCODE_UPCE, "123456789", ZINT_ERROR_TOO_LONG, "" }, + /* 14*/ { BARCODE_UPCE_CHK, "123456789", ZINT_ERROR_TOO_LONG, "" }, + /* 15*/ { BARCODE_UPCE, "123456A", ZINT_ERROR_INVALID_DATA, "" }, + /* 16*/ { BARCODE_UPCE, "1234567A", ZINT_ERROR_INVALID_DATA, "" }, + /* 17*/ { BARCODE_UPCE, "12345678A", ZINT_ERROR_INVALID_DATA, "" }, + /* 18*/ { BARCODE_UPCE_CHK, "123456A", ZINT_ERROR_INVALID_DATA, "" }, + /* 19*/ { BARCODE_UPCE_CHK, "1234567A", ZINT_ERROR_INVALID_DATA, "" }, + /* 20*/ { BARCODE_UPCE_CHK, "12345678A", ZINT_ERROR_INVALID_DATA, "" }, + /* 21*/ { BARCODE_UPCE, "2345678", 0, "03456781" }, // 2 ignored, equivalent: 03456700008, Check digit: 1 + /* 22*/ { BARCODE_UPCE_CHK, "23456781", 0, "03456781" }, // 2 ignored, equivalent: 03456700008, Check digit: 1 + /* 23*/ { BARCODE_UPCE, "123455", 0, "01234558" }, // equivalent: 01234500005, Check digit: 8 (BS 797 Rule 3 (a)) + /* 24*/ { BARCODE_UPCE_CHK, "1234558", 0, "01234558" }, // equivalent: 01234500005, Check digit: 8 (BS 797 Rule 3 (a)) + /* 25*/ { BARCODE_UPCE, "456784", 0, "04567840" }, // equivalent: 04567000008, Check digit: 0 (BS 797 Rule 3 (b)) + /* 26*/ { BARCODE_UPCE_CHK, "4567840", 0, "04567840" }, // equivalent: 04567000008, Check digit: 0 (BS 797 Rule 3 (b)) + /* 27*/ { BARCODE_UPCE, "345670", 0, "03456703" }, // equivalent: 03400000567, Check digit: 3 (BS 797 Rule 3 (c)) + /* 28*/ { BARCODE_UPCE_CHK, "3456703", 0, "03456703" }, // equivalent: 03400000567, Check digit: 3 (BS 797 Rule 3 (c)) + /* 29*/ { BARCODE_UPCE, "984753", 0, "09847531" }, // equivalent: 09840000075, Check digit: 1 (BS 797 Rule 3 (d)) + /* 30*/ { BARCODE_UPCE_CHK, "9847531", 0, "09847531" }, // equivalent: 09840000075, Check digit: 1 (BS 797 Rule 3 (d)) + /* 31*/ { BARCODE_UPCE, "120453", ZINT_ERROR_INVALID_DATA, "" }, // If last digit (emode) 3, 3rd can't be 0, 1 or 2 (BS 787 Table 5 NOTE 1) + /* 32*/ { BARCODE_UPCE, "121453", ZINT_ERROR_INVALID_DATA, "" }, // If last digit (emode) 3, 3rd can't be 0, 1 or 2 (BS 787 Table 5 NOTE 1) + /* 33*/ { BARCODE_UPCE, "122453", ZINT_ERROR_INVALID_DATA, "" }, // If last digit (emode) 3, 3rd can't be 0, 1 or 2 (BS 787 Table 5 NOTE 1) + /* 34*/ { BARCODE_UPCE, "123453", 0, "01234531" }, + /* 35*/ { BARCODE_UPCE, "123054", ZINT_ERROR_INVALID_DATA, "" }, // If last digit (emode) 4, 4th can't be 0 (BS 787 Table 5 NOTE 2) + /* 36*/ { BARCODE_UPCE, "123154", 0, "01231542" }, + /* 37*/ { BARCODE_UPCE, "123405", ZINT_ERROR_INVALID_DATA, "" }, // If last digit (emode) 5, 5th can't be 0 (BS 787 Table 5 NOTE 3) + /* 38*/ { BARCODE_UPCE, "123455", 0, "01234558" }, + /* 39*/ { BARCODE_UPCE, "123406", ZINT_ERROR_INVALID_DATA, "" }, // If last digit (emode) 6, 5th can't be 0 (BS 787 Table 5 NOTE 3) + /* 40*/ { BARCODE_UPCE, "123456", 0, "01234565" }, + /* 41*/ { BARCODE_UPCE, "123407", ZINT_ERROR_INVALID_DATA, "" }, // If last digit (emode) 7, 5th can't be 0 (BS 787 Table 5 NOTE 3) + /* 42*/ { BARCODE_UPCE, "123457", 0, "01234572" }, + /* 43*/ { BARCODE_UPCE, "123408", ZINT_ERROR_INVALID_DATA, "" }, // If last digit (emode) 8, 5th can't be 0 (BS 787 Table 5 NOTE 3) + /* 44*/ { BARCODE_UPCE, "123458", 0, "01234589" }, + /* 45*/ { BARCODE_UPCE, "123409", ZINT_ERROR_INVALID_DATA, "" }, // If last digit (emode) 9, 5th can't be 0 (BS 787 Table 5 NOTE 3) + /* 46*/ { BARCODE_UPCE, "123459", 0, "01234596" }, + /* 47*/ { BARCODE_UPCE, "000000", 0, "00000000" }, + /* 48*/ { BARCODE_UPCE, "000001", 0, "00000019" }, + /* 49*/ { BARCODE_UPCE, "000002", 0, "00000028" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; + char escaped[4096]; + char cmp_buf[4096]; + char cmp_msg[1024]; + + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise + testStart("test_upce_input"); for (i = 0; i < data_size; i++) { @@ -109,6 +118,30 @@ static void test_upce_input(int index, int debug) { ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + if (ret < ZINT_ERROR) { + if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) { + char modules_dump[8192 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].hrt, (int) strlen(data[i].hrt), NULL, cmp_buf, sizeof(cmp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump); + } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[8192 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].hrt, (int) strlen(data[i].hrt), NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); + } + } + ZBarcode_Delete(symbol); } @@ -857,10 +890,10 @@ static void test_encode(int index, int generate, int debug) { /* 28*/ { BARCODE_UPCA, 12, "21098765432+12121", 0, 1, 154, "Example of UPC-A with 5-digit add-on, addon_gap 12", "1010010011001100100011010001011011011101110110101010100001001110101110010000101101100111010010100000000000010110011001010010011010110011010011011010011001" }, - /* 29*/ { BARCODE_UPCE_CHK, 8, "06543217+21", 0, 1, 79, "Example of UPC-A with 2-digit add-on, addon_gap 8", + /* 29*/ { BARCODE_UPCE_CHK, 8, "06543217+21", 0, 1, 79, "Example of UPC-E with 2-digit add-on, addon_gap 8", "1010000101011000100111010111101001101100110010101010000000010110010011010110011" }, - /* 30*/ { BARCODE_UPCE, 11, "1654321+12121", 0, 1, 109, "Example of UPC-A with 5-digit add-on, addon_gap 11", + /* 30*/ { BARCODE_UPCE, 11, "1654321+12121", 0, 1, 109, "Example of UPC-E with 5-digit add-on, addon_gap 11", "1010101111011100101000110111101001101101100110101010000000000010110011001010010011010110011010011011010011001" }, /* 31*/ { BARCODE_ISBNX, -1, "9789295055124", 0, 1, 95, "ISBN Users' Manual 7th Ed. 13.2", @@ -883,10 +916,12 @@ static void test_encode(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char bwipp_buf[4096]; - char bwipp_msg[1024]; + char escaped[4096]; + char cmp_buf[4096]; + char cmp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise testStart("test_encode"); @@ -918,12 +953,23 @@ static void test_encode(int index, int generate, int debug) { assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) { - ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); - ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", - i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); + } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, debug)) { + int cmp_len, ret_len; + char modules_dump[8192 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); } } } diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index 02b2c6c0..c6c9a60f 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -2014,8 +2014,8 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol }; static const int data_size = ARRAY_SIZE(data); - int symbology = symbol->symbology; - int gs1 = (symbol->input_mode & 0x07) == GS1_MODE; + const int symbology = symbol->symbology; + const int gs1 = (symbol->input_mode & 0x07) == GS1_MODE; if (symbology < 0 || symbology >= data_size) { fprintf(stderr, "testUtilBwippName: unknown symbology (%d)\n", symbology); @@ -2972,35 +2972,35 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int } /* Compare bwipp_dump.ps output to test suite module dump */ -int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, char *bwipp_buf, const char *expected) { - int bwipp_len = (int) strlen(bwipp_buf); +int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, char *cmp_buf, const char *expected) { + int cmp_len = (int) strlen(cmp_buf); int expected_len = (int) strlen(expected); int ret_memcmp; int i; (void)symbol; - if (bwipp_len != expected_len) { - sprintf(msg, "bwipp_len %d != expected_len %d", bwipp_len, expected_len); + if (cmp_len != expected_len) { + sprintf(msg, "cmp_len %d != expected_len %d", cmp_len, expected_len); return 2; } if (symbol->symbology == BARCODE_ULTRA) { static const char map[] = { '8', '1', '2', '3', '4', '5', '6', '7', '8', '7' }; - for (i = 0; i < bwipp_len; i++) { - if (bwipp_buf[i] >= '0' && bwipp_buf[i] <= '9') { - bwipp_buf[i] = map[bwipp_buf[i] - '0']; + for (i = 0; i < cmp_len; i++) { + if (cmp_buf[i] >= '0' && cmp_buf[i] <= '9') { + cmp_buf[i] = map[cmp_buf[i] - '0']; } } } - ret_memcmp = memcmp(bwipp_buf, expected, expected_len); + ret_memcmp = memcmp(cmp_buf, expected, expected_len); if (ret_memcmp != 0) { for (i = 0; i < expected_len; i++) { - if (bwipp_buf[i] != expected[i]) { + if (cmp_buf[i] != expected[i]) { break; } } - sprintf(msg, "bwipp memcmp %d != 0, at %d, len %d", ret_memcmp, i, expected_len); + sprintf(msg, "memcmp %d != 0, at %d, len %d", ret_memcmp, i, expected_len); return ret_memcmp; } @@ -3008,28 +3008,644 @@ int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, char *bwipp_bu } /* Compare bwipp_dump.ps output to single row module dump (see testUtilModulesPrintRow) */ -int testUtilBwippCmpRow(const struct zint_symbol *symbol, int row, char *msg, const char *bwipp_buf, +int testUtilBwippCmpRow(const struct zint_symbol *symbol, int row, char *msg, const char *cmp_buf, const char *expected) { - int bwipp_len = (int) strlen(bwipp_buf); + int cmp_len = (int) strlen(cmp_buf); int expected_len = (int) strlen(expected); int ret_memcmp; int i, j; (void)symbol; - if (bwipp_len != expected_len * symbol->rows) { - sprintf(msg, "bwipp_len %d != expected_len %d * symbol->rows %d", bwipp_len, expected_len, symbol->rows); + if (cmp_len != expected_len * symbol->rows) { + sprintf(msg, "cmp_len %d != expected_len %d * symbol->rows %d", cmp_len, expected_len, symbol->rows); return 2; } - ret_memcmp = memcmp(bwipp_buf + expected_len * row, expected, expected_len); + ret_memcmp = memcmp(cmp_buf + expected_len * row, expected, expected_len); if (ret_memcmp != 0) { for (i = 0, j = expected_len * row; i < expected_len; i++, j++) { - if (bwipp_buf[j] != expected[i]) { + if (cmp_buf[j] != expected[i]) { break; } } - sprintf(msg, "bwipp memcmp %d != 0, at %d (%d), len %d", ret_memcmp, i, j, expected_len); + sprintf(msg, "memcmp %d != 0, at %d (%d), len %d", ret_memcmp, i, j, expected_len); + return ret_memcmp; + } + + return 0; +} + +/* Whether ZXing-C++ Decoder available on system */ +/* Requires the "diagnostics2" branch from https://github.com/gitlost/zxing-cpp built with BUILD_EXAMPLE_DECODER + and "zintcppdecoder" placed in PATH, e.g.: + git clone --branch diagnostics2 https://github.com/gitlost/zxing-cpp zxing-cpp-diagnostics2 + cd zxing-cpp-diagnostics2 + mkdir build; cd build + cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_EXAMPLE_DECODER=ON .. + make && sudo make install + */ +int testUtilHaveZXingCPPDecoder(void) { + return system("zxingcppdecoder " DEV_NULL_STDERR) == 0; +} + +/* Map Zint symbology to ZXing-C++ format name */ +static const char *testUtilZXingCPPName(int index, const struct zint_symbol *symbol, const char *source, + const int debug) { + struct item { + const char *name; + int define; + int val; + }; + static const struct item data[] = { + { "", -1, 0, }, + { "", BARCODE_CODE11, 1, }, + { "", BARCODE_C25STANDARD, 2, }, + { "ITF", BARCODE_C25INTER, 3, }, + { "", BARCODE_C25IATA, 4, }, + { "", -1, 5, }, + { "", BARCODE_C25LOGIC, 6, }, + { "", BARCODE_C25IND, 7, }, + { "Code39", BARCODE_CODE39, 8, }, + { "Code39", BARCODE_EXCODE39, 9, }, // TODO: Code39 with specially encoded chars + { "", -1, 10, }, + { "", -1, 11, }, + { "", -1, 12, }, + { "EAN-13", BARCODE_EANX, 13, }, + { "EAN-13", BARCODE_EANX_CHK, 14, }, + { "", -1, 15, }, + { "Code128", BARCODE_GS1_128, 16, }, + { "", -1, 17, }, + { "Codabar", BARCODE_CODABAR, 18, }, + { "", -1, 19, }, + { "Code128", BARCODE_CODE128, 20, }, + { "ITF", BARCODE_DPLEIT, 21, }, + { "ITF", BARCODE_DPIDENT, 22, }, + { "", BARCODE_CODE16K, 23, }, + { "", BARCODE_CODE49, 24, }, + { "Code93", BARCODE_CODE93, 25, }, + { "", -1, 26, }, + { "", -1, 27, }, + { "", BARCODE_FLAT, 28, }, + { "DataBar", BARCODE_DBAR_OMN, 29, }, + { "", BARCODE_DBAR_LTD, 30, }, + { "DataBarExpanded", BARCODE_DBAR_EXP, 31, }, + { "", BARCODE_TELEPEN, 32, }, + { "", -1, 33, }, + { "UPC-A", BARCODE_UPCA, 34, }, + { "UPC-A", BARCODE_UPCA_CHK, 35, }, + { "", -1, 36, }, + { "UPC-E", BARCODE_UPCE, 37, }, + { "UPC-E", BARCODE_UPCE_CHK, 38, }, + { "", -1, 39, }, + { "", BARCODE_POSTNET, 40, }, + { "", -1, 41, }, + { "", -1, 42, }, + { "", -1, 43, }, + { "", -1, 44, }, + { "", -1, 45, }, + { "", -1, 46, }, + { "", BARCODE_MSI_PLESSEY, 47, }, + { "", -1, 48, }, + { "", BARCODE_FIM, 49, }, + { "Code39", BARCODE_LOGMARS, 50, }, + { "", BARCODE_PHARMA, 51, }, + { "", BARCODE_PZN, 52, }, // TODO: Code39 with prefix and mod-11 checksum + { "", BARCODE_PHARMA_TWO, 53, }, + { "", -1, 54, }, + { "PDF417", BARCODE_PDF417, 55, }, + { "PDF417", BARCODE_PDF417COMP, 56, }, + { "MaxiCode", BARCODE_MAXICODE, 57, }, + { "QRCode", BARCODE_QRCODE, 58, }, + { "", -1, 59, }, + { "Code128", BARCODE_CODE128B, 60, }, + { "", -1, 61, }, + { "", -1, 62, }, + { "", BARCODE_AUSPOST, 63, }, + { "", -1, 64, }, + { "", -1, 65, }, + { "", BARCODE_AUSREPLY, 66, }, + { "", BARCODE_AUSROUTE, 67, }, + { "", BARCODE_AUSREDIRECT, 68, }, + { "EAN-13", BARCODE_ISBNX, 69, }, + { "", BARCODE_RM4SCC, 70, }, + { "DataMatrix", BARCODE_DATAMATRIX, 71, }, + { "Code128", BARCODE_EAN14, 72, }, + { "Code39", BARCODE_VIN, 73, }, + { "", BARCODE_CODABLOCKF, 74, }, + { "Code128", BARCODE_NVE18, 75, }, + { "", BARCODE_JAPANPOST, 76, }, + { "", BARCODE_KOREAPOST, 77, }, + { "", -1, 78, }, + { "", BARCODE_DBAR_STK, 79, }, + { "DataBar", BARCODE_DBAR_OMNSTK, 80, }, + { "DataBarExpanded", BARCODE_DBAR_EXPSTK, 81, }, + { "", BARCODE_PLANET, 82, }, + { "", -1, 83, }, + { "", BARCODE_MICROPDF417, 84, }, + { "", BARCODE_USPS_IMAIL, 85, }, + { "", BARCODE_PLESSEY, 86, }, + { "", BARCODE_TELEPEN_NUM, 87, }, + { "", -1, 88, }, + { "ITF", BARCODE_ITF14, 89, }, + { "", BARCODE_KIX, 90, }, + { "", -1, 91, }, + { "Aztec", BARCODE_AZTEC, 92, }, + { "", BARCODE_DAFT, 93, }, + { "", -1, 94, }, + { "", -1, 95, }, + { "Code128", BARCODE_DPD, 96, }, + { "", BARCODE_MICROQR, 97, }, + { "Code128", BARCODE_HIBC_128, 98, }, + { "Code39", BARCODE_HIBC_39, 99, }, + { "", -1, 100, }, + { "", -1, 101, }, + { "DataMatrix", BARCODE_HIBC_DM, 102, }, + { "", -1, 103, }, + { "QRCode", BARCODE_HIBC_QR, 104, }, + { "", -1, 105, }, + { "PDF417", BARCODE_HIBC_PDF, 106, }, + { "", -1, 107, }, + { "", BARCODE_HIBC_MICPDF, 108, }, + { "", -1, 109, }, + { "", BARCODE_HIBC_BLOCKF, 110, }, + { "", -1, 111, }, + { "Aztec", BARCODE_HIBC_AZTEC, 112, }, + { "", -1, 113, }, + { "", -1, 114, }, + { "DotCode", BARCODE_DOTCODE, 115, }, + { "", BARCODE_HANXIN, 116, }, + { "", -1, 117, }, + { "", -1, 118, }, + { "", -1, 119, }, + { "", -1, 120, }, + { "", BARCODE_MAILMARK, 121, }, + { "", -1, 122, }, + { "", -1, 123, }, + { "", -1, 124, }, + { "", -1, 125, }, + { "", -1, 126, }, + { "", -1, 127, }, + { "", BARCODE_AZRUNE, 128, }, + { "", BARCODE_CODE32, 129, }, // Code39 based + { "", BARCODE_EANX_CC, 130, }, + { "", BARCODE_GS1_128_CC, 131, }, + { "", BARCODE_DBAR_OMN_CC, 132, }, + { "", BARCODE_DBAR_LTD_CC, 133, }, + { "", BARCODE_DBAR_EXP_CC, 134, }, + { "", BARCODE_UPCA_CC, 135, }, + { "", BARCODE_UPCE_CC, 136, }, + { "", BARCODE_DBAR_STK_CC, 137, }, + { "", BARCODE_DBAR_OMNSTK_CC, 138, }, + { "", BARCODE_DBAR_EXPSTK_CC, 139, }, + { "", BARCODE_CHANNEL, 140, }, + { "", BARCODE_CODEONE, 141, }, + { "", BARCODE_GRIDMATRIX, 142, }, + { "", BARCODE_UPNQR, 143, }, + { "", BARCODE_ULTRA, 144, }, + { "", BARCODE_RMQR, 145, }, + }; + static const int data_size = ARRAY_SIZE(data); + + const int symbology = symbol->symbology; + + if (symbology < 0 || symbology >= data_size) { + fprintf(stderr, "testUtilZXingCPPName: unknown symbology (%d)\n", symbology); + abort(); + } + // Self-check + if (data[symbology].val != symbology || (data[symbology].define != -1 && data[symbology].define != symbology)) { + fprintf(stderr, "testUtilZXingCPPName: data table out of sync (%d)\n", symbology); + abort(); + } + if (data[symbology].name[0] == '\0') { + if (debug & ZINT_DEBUG_TEST_PRINT) { + printf("i:%d %s no ZXint-C++ mapping\n", index, testUtilBarcodeName(symbology)); + } + return NULL; + } + + if (symbology == BARCODE_QRCODE || symbology == BARCODE_HIBC_QR || symbology == BARCODE_MICROQR + || symbology == BARCODE_RMQR) { + const int full_multibyte = (symbol->option_3 & 0xFF) == ZINT_FULL_MULTIBYTE; + if (full_multibyte) { // TODO: Support in ZXing-C++ + printf("i:%d %s not ZXing-C++ compatible, ZINT_FULL_MULTIBYTE not supported\n", + index, testUtilBarcodeName(symbology)); + return NULL; + } + } else if (is_extendable(symbology)) { + if (symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK) { + const int length = (int) strlen(source); + if (length < 9) { + if (length < 6) { + printf("i:%d %s not ZXing-C++ compatible, EAN-5/EAN-2 not supported\n", + index, testUtilBarcodeName(symbology)); + return NULL; + } + return "EAN-8"; + } + if (strchr(source, '+') != NULL && length < 15) { + printf("i:%d %s not ZXing-C++ compatible, EAN-8 with add-on not supported yet\n", + index, testUtilBarcodeName(symbology)); + return NULL; + } + } + } + + return data[symbology].name; +} + +/* Whether can use ZXing-C++ to check a symbology with given options */ +int testUtilCanZXingCPP(int index, const struct zint_symbol *symbol, const char *source, const int debug) { + return testUtilZXingCPPName(index, symbol, source, debug) != NULL; +} + +int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, char *bits, char *buffer, + const int buffer_size, int *p_cmp_len) { + const char *cmd_fmt = "zxingcppdecoder -width %d -textonly -format %s -zint '%d,%d' -bits '%s'"; + + const int length = (int) strlen(bits); + const int width = symbol->width; + const int symbology = symbol->symbology; + char *cmd = (char *) testutil_alloca(length + 1024); + const char *zxingcpp_barcode = NULL; + const int data_mode = (symbol->input_mode & 0x07) == DATA_MODE; + + FILE *fp = NULL; + int cnt; + + buffer[0] = '\0'; + + zxingcpp_barcode = testUtilZXingCPPName(index, symbol, source, 0 /*debug*/); + if (!zxingcpp_barcode) { + fprintf(stderr, "i:%d testUtilZXingCPP: no mapping for %s\n", index, testUtilBarcodeName(symbology)); + return -1; + } + sprintf(cmd, cmd_fmt, width, zxingcpp_barcode, symbology, symbol->option_2, bits); + + if (symbol->debug & ZINT_DEBUG_TEST_PRINT) { + printf("i:%d testUtilZXingCPP: cmd %s\n", index, cmd); + } + + fp = testutil_popen(cmd, "r"); + if (!fp) { + fprintf(stderr, "i:%d testUtilZXingCPP: failed to run '%s'\n", index, cmd); + return -1; + } + + cnt = (int) fread(buffer, 1, buffer_size, fp); + if (cnt == buffer_size) { + fprintf(stderr, "i:%d testUtilZXingCPP: buffer too small, %d bytes, cnt %d (%s)\n", + index, buffer_size, cnt, cmd); + testutil_pclose(fp); + return -1; + } + buffer[cnt] = '\0'; + + if (fgetc(fp) != EOF) { + fprintf(stderr, "i:%d testUtilZXingCPP: failed to read full stream (%s)\n", index, cmd); + testutil_pclose(fp); + return -1; + } + + testutil_pclose(fp); + + if (data_mode && is_eci_convertible(symbol->eci)) { + int error_number; + const int eci_length = get_eci_length(symbol->eci, (const unsigned char *) buffer, cnt); + unsigned char *preprocessed = (unsigned char *) testutil_alloca(eci_length + 1); + + if (eci_length >= buffer_size) { + fprintf(stderr, "i:%d testUtilZXingCPP: buffer too small, %d bytes, eci_length %d (%s)\n", + index, buffer_size, eci_length, cmd); + return -1; + } + error_number = utf8_to_eci(symbol->eci, (const unsigned char *) buffer, preprocessed, &cnt); + if (error_number == 0) { + memcpy(buffer, preprocessed, cnt); + } else { + if (symbol->eci != 0) { + fprintf(stderr, "i:%d testUtilZXingCPP: utf8_to_eci == %d (%s)\n", index, error_number, cmd); + return -1; + } else { + int i; + unsigned int *vals = (unsigned int *) testutil_alloca(sizeof(int) * (cnt + 1)); + error_number = utf8_to_unicode(symbol, (const unsigned char *) buffer, vals, &cnt, 1); + if (error_number != 0) { + fprintf(stderr, "i:%d testUtilZXingCPP: utf8_to_unicode == %d (%s)\n", index, error_number, cmd); + return -1; + } + for (i = 0; i < cnt; i++) { + buffer[i] = (char) vals[i]; + } + buffer[cnt] = '\0'; + } + } + } + + *p_cmp_len = cnt; + + return 0; +} + +STATIC_UNLESS_ZINT_TEST int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string, + int *length); + +#include "../gs1.h" + +static const char TECHNETIUM[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; /* Same as SILVER (CODE39) */ + +int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, int cmp_len, + const char *expected, int expected_len, const char *primary, char *ret_buf, int *p_ret_len) { + const int symbology = symbol->symbology; + + const int gs1 = (symbol->input_mode & 0x07) == GS1_MODE; + const int is_escaped = symbol->input_mode & ESCAPE_MODE; + const int is_hibc = symbology >= BARCODE_HIBC_128 && symbology <= BARCODE_HIBC_AZTEC; + const int have_c25checkdigit = symbol->option_2 == 1 || symbol->option_2 == 2; + const int have_c25inter = (symbology == BARCODE_C25INTER && ((expected_len & 1) || have_c25checkdigit)) + || symbology == BARCODE_ITF14 || symbology == BARCODE_DPLEIT || symbology == BARCODE_DPIDENT; + const int is_dbar_exp = symbology == BARCODE_DBAR_EXP || symbology == BARCODE_DBAR_EXPSTK; + const int is_upcean = is_extendable(symbology); + + char *reduced = gs1 ? (char *) alloca(expected_len + 1) : NULL; + char *escaped = is_escaped ? (char *) alloca(expected_len + 1) : NULL; + char *hibc = is_hibc ? (char *) alloca(expected_len + 2 + 1) : NULL; + char *maxi = symbology == BARCODE_MAXICODE && primary ? (char *) alloca(expected_len + strlen(primary) + 6 + 9 + 1) : NULL; + char *vin = symbology == BARCODE_VIN && (symbol->option_2 & 1) ? (char *) alloca(expected_len + 1 + 1) : NULL; + char *c25inter = have_c25inter ? (char *) alloca(expected_len + 13 + 1 + 1) : NULL; + char *dbar_exp = is_dbar_exp ? (char *) alloca(expected_len + 1) : NULL; + char *upcean = is_upcean ? (char *) alloca(expected_len + 1 + 1) : NULL; + char *ean14_nve18 = symbology == BARCODE_EAN14 || symbology == BARCODE_NVE18 ? (char *) alloca(expected_len + 3 + 1) : NULL; + + int ret; + int ret_memcmp; + int i; + + if (ret_buf) { + ret_buf[0] = '\0'; + } + if (p_ret_len) { + *p_ret_len = 0; + } + + if (is_escaped) { + memcpy(escaped, expected, expected_len); + ret = escape_char_process(symbol, (unsigned char *) escaped, &expected_len); + if (ret != 0) { + sprintf(msg, "escape_char_process %d != 0", ret); + return 3; + } + expected = escaped; + } + if (gs1 && symbology != BARCODE_EAN14 && symbology != BARCODE_NVE18) { + ret = gs1_verify(symbol, (const unsigned char *) expected, expected_len, (unsigned char *) reduced); + if (ret != 0) { + sprintf(msg, "gs1_verify %d != 0", ret); + return 4; + } + expected_len = (int) strlen(reduced); + for (i = 0; i < expected_len; i++) { + if (reduced[i] == '[') { + reduced[i] = 29; + } + } + expected = reduced; + if (primary) { + // TODO: + } + } else if (is_hibc) { + int counter; + int posns[110]; + hibc[0] = '+'; + memcpy(hibc + 1, expected, expected_len); + to_upper((unsigned char *) (hibc + 1), expected_len); + if (!is_sane_lookup(TECHNETIUM, sizeof(TECHNETIUM) - 1, (unsigned char *) (hibc + 1), expected_len, posns)) { + sprintf(msg, "HIBC is_sane_lookup(TECHNETIUM) failed"); + return 5; + } + counter = 41; + for (i = 0; i < expected_len && i < 110; i++) { + counter += posns[i]; + } + counter = counter % 43; + hibc[++expected_len] = TECHNETIUM[counter]; + hibc[++expected_len] = '\0'; + expected = hibc; + } + if (symbology == BARCODE_MAXICODE) { + if (symbol->primary && symbol->primary[0]) { + int primary_len = (int) strlen(primary); + int maxi_len = 0; + if (symbol->option_2 >= 1 && symbol->option_2 <= 100) { + sprintf(maxi, "[)>\03601\035%02d", symbol->option_2 - 1); + maxi_len = (int) strlen(maxi); + } + sprintf(maxi + maxi_len, "%-6.*s\035%.*s\035%.*s\035", primary_len - 6, primary, + 3, primary + primary_len - 6, 3, primary + primary_len - 3); + maxi_len = (int) strlen(maxi); + memcpy(maxi + maxi_len, expected, expected_len); + expected = maxi; + expected_len += maxi_len; + } + } else if (symbology == BARCODE_CODABAR) { + // Start A/B/C/D and stop A/B/C/D chars not returned by ZXing-C++ + expected++; + expected_len -= 2; + if (symbol->option_2 == 1 || symbol->option_2 == 2) { + cmp_len--; // Too messy to calc the check digit so ignore + } + } else if (symbology == BARCODE_VIN) { + if (symbol->option_2 & 1) { + vin[0] = 'I'; + memcpy(vin + 1, expected, expected_len); + vin[++expected_len] = '\0'; + expected = vin; + } + } else if (have_c25inter) { + if (symbology == BARCODE_C25INTER) { + if ((expected_len & 1) || have_c25checkdigit) { + if (((expected_len & 1) && !have_c25checkdigit) || (!(expected_len & 1) && have_c25checkdigit)) { + c25inter[0] = '0'; + memcpy(c25inter + 1, expected, expected_len); + expected_len++; + } else { + memcpy(c25inter, expected, expected_len); + } + if (have_c25checkdigit) { + c25inter[expected_len] = gs1_check_digit((const unsigned char *) c25inter, expected_len); + expected_len++; + } + c25inter[expected_len] = '\0'; + printf("c25inter %s\n", c25inter); + expected = c25inter; + } + } else if (symbology == BARCODE_DPLEIT || symbology == BARCODE_DPIDENT) { + const int len = symbology == BARCODE_DPLEIT ? 13 : 11; + int zeroes = len - expected_len; + unsigned int count = 0; + int factor = 4; + for (i = 0; i < zeroes; i++) { + c25inter[i] = '0'; + } + memcpy(c25inter + zeroes, expected, expected_len); + expected_len += zeroes; + for (i = len - 1; i >= 0; i--) { + count += factor * ctoi(c25inter[i]); + factor ^= 0x0D; /* Toggles 4 and 9 */ + } + c25inter[expected_len] = itoc((10 - (count % 10)) % 10); + c25inter[++expected_len] = '\0'; + expected = c25inter; + } else if (symbology == BARCODE_ITF14) { + int zeroes = 13 - expected_len; + for (i = 0; i < zeroes; i++) { + c25inter[i] = '0'; + } + memcpy(c25inter + zeroes, expected, expected_len); + expected_len += zeroes; + c25inter[expected_len] = gs1_check_digit((const unsigned char *) c25inter, 13); + c25inter[++expected_len] = '\0'; + expected = c25inter; + } + } else if (symbology == BARCODE_DBAR_OMN || symbology == BARCODE_DBAR_OMNSTK) { + if (expected_len == 13) { + cmp_len--; // Too messy to calc the check digit so ignore + } + } else if (is_dbar_exp) { + for (i = 0; i < expected_len; i++) { + if (expected[i] == '[') { + dbar_exp[i] = '('; + } else if (expected[i] == ']') { + dbar_exp[i] = ')'; + } else { + dbar_exp[i] = expected[i]; + } + } + expected = dbar_exp; + } else if (is_upcean) { + if (symbology == BARCODE_UPCA && (expected_len == 11 || expected_len == 14 || expected_len == 17)) { + memcpy(upcean, expected, 11); + upcean[11] = gs1_check_digit((const unsigned char *) upcean, 11); + if (expected_len == 14) { + upcean[12] = ' '; + memcpy(upcean + 13, expected + 12, 2); + } else if (expected_len == 17) { + upcean[12] = ' '; + memcpy(upcean + 13, expected + 12, 5); + } + expected_len++; + upcean[expected_len] = '\0'; + expected = upcean; + } else if (symbology == BARCODE_UPCA_CHK && (expected_len == 15 || expected_len == 18)) { + memcpy(upcean, expected, expected_len); + upcean[12] = ' '; + expected = upcean; + } else if (symbology == BARCODE_UPCE && (expected_len == 7 || expected_len == 10 || expected_len == 13)) { + char equivalent[11]; + memcpy(upcean, expected, 7); + memcpy(equivalent, upcean, 3); + memset(equivalent + 3, '0', 8); + switch (upcean[6]) { + case '0': case '1': case '2': + equivalent[3] = upcean[6]; + equivalent[8] = upcean[3]; + equivalent[9] = upcean[4]; + equivalent[10] = upcean[5]; + break; + case '3': + equivalent[3] = upcean[3]; + equivalent[9] = upcean[4]; + equivalent[10] = upcean[5]; + break; + case '4': + equivalent[3] = upcean[3]; + equivalent[4] = upcean[4]; + equivalent[10] = upcean[5]; + break; + case '5': case '6': case '7': case '8': case '9': + equivalent[3] = upcean[3]; + equivalent[4] = upcean[4]; + equivalent[5] = upcean[5]; + equivalent[10] = upcean[6]; + break; + } + upcean[7] = gs1_check_digit((const unsigned char *) equivalent, 11); + if (expected_len == 10) { + upcean[8] = ' '; + memcpy(upcean + 9, expected + 8, 2); + } else if (expected_len == 13) { + upcean[8] = ' '; + memcpy(upcean + 9, expected + 8, 5); + } + expected_len++; + upcean[expected_len] = '\0'; + expected = upcean; + } else if (symbology == BARCODE_UPCE_CHK && (expected_len == 11 || expected_len == 14)) { + memcpy(upcean, expected, expected_len); + upcean[8] = ' '; + expected = upcean; + } else if (symbology == BARCODE_EANX && (expected_len == 12 || expected_len == 15 || expected_len == 18)) { + memcpy(upcean, expected, 12); + upcean[12] = gs1_check_digit((const unsigned char *) upcean, 12); + if (expected_len == 15) { + upcean[13] = ' '; + memcpy(upcean + 14, expected + 13, 2); + } else if (expected_len == 18) { + upcean[13] = ' '; + memcpy(upcean + 14, expected + 13, 5); + } + expected_len++; + upcean[expected_len] = '\0'; + expected = upcean; + } else if (symbology == BARCODE_EANX && (expected_len == 16 || expected_len == 19)) { + memcpy(upcean, expected, expected_len); + upcean[13] = ' '; + expected = upcean; + } else if (symbology == BARCODE_EANX && expected_len == 7) { + memcpy(upcean, expected, 7); + upcean[7] = gs1_check_digit((const unsigned char *) upcean, 7); + expected_len++; + upcean[expected_len] = '\0'; + expected = upcean; + } else if ((symbology == BARCODE_EANX_CHK || symbology == BARCODE_ISBNX) && (expected_len == 16 || expected_len == 19)) { + memcpy(upcean, expected, expected_len); + upcean[13] = ' '; + expected = upcean; + } + + } else if (symbology == BARCODE_EAN14 || symbology == BARCODE_NVE18) { + ean14_nve18[0] = '0'; + ean14_nve18[1] = symbology == BARCODE_NVE18 ? '0' : '1'; + memcpy(ean14_nve18 + 2, expected, expected_len); + if (symbology == BARCODE_NVE18) { + ean14_nve18[19] = gs1_check_digit((unsigned char *) (ean14_nve18 + 2), 17); + } else { + ean14_nve18[15] = gs1_check_digit((unsigned char *) (ean14_nve18 + 2), 13); + } + expected = ean14_nve18; + expected_len += 3; + } + + if (ret_buf) { + memcpy(ret_buf, expected, expected_len); + } + if (p_ret_len) { + *p_ret_len = expected_len; + } + + if (cmp_len != expected_len) { + sprintf(msg, "cmp_len %d != expected_len %d", cmp_len, expected_len); + return 2; + } + ret_memcmp = memcmp(cmp_buf, expected, expected_len); + if (ret_memcmp != 0) { + for (i = 0; i < expected_len; i++) { + if (cmp_buf[i] != expected[i]) { + break; + } + } + sprintf(msg, "memcmp %d != 0, at %d, len %d", ret_memcmp, i, expected_len); return ret_memcmp; } diff --git a/backend/tests/testcommon.h b/backend/tests/testcommon.h index 20951959..bc54c514 100644 --- a/backend/tests/testcommon.h +++ b/backend/tests/testcommon.h @@ -42,6 +42,7 @@ #define ZINT_DEBUG_TEST_BWIPP 128 #define ZINT_DEBUG_TEST_PERFORMANCE 256 #define ZINT_DEBUG_TEST_MINIMIZE 512 +#define ZINT_DEBUG_TEST_ZXINGCPP 1024 #ifdef _MSC_VER #define testutil_popen(command, mode) _popen(command, mode) @@ -172,10 +173,17 @@ int testUtilCanBwipp(int index, const struct zint_symbol *symbol, int option_1, int debug); int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int option_2, int option_3, const char *data, int length, const char *primary, char *buffer, int buffer_size); -int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, char *bwipp_buf, const char *expected); -int testUtilBwippCmpRow(const struct zint_symbol *symbol, int row, char *msg, const char *bwipp_buf, +int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, char *cmp_buf, const char *expected); +int testUtilBwippCmpRow(const struct zint_symbol *symbol, int row, char *msg, const char *cmp_buf, const char *expected); +int testUtilHaveZXingCPPDecoder(void); +int testUtilCanZXingCPP(int index, const struct zint_symbol *symbol, const char *data, const int debug); +int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, char *bits, char *buffer, + const int buffer_size, int *p_cmp_len); +int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, int cmp_len, + const char *expected, int expected_len, const char *primary, char *ret_buf, int *p_ret_len); + #ifdef __cplusplus } #endif diff --git a/backend/tests/tools/run_bwipp_tests.sh b/backend/tests/tools/run_bwipp_tests.sh index 6b8e0e80..46040f88 100755 --- a/backend/tests/tools/run_bwipp_tests.sh +++ b/backend/tests/tools/run_bwipp_tests.sh @@ -38,5 +38,6 @@ run_bwipp_test "test_qr" "microqr_encode" run_bwipp_test "test_qr" "rmqr_encode" run_bwipp_test "test_rss" run_bwipp_test "test_telepen" "encode" +run_bwipp_test "test_upcean" "upce_input" run_bwipp_test "test_upcean" "encode" run_bwipp_test "test_ultra" "encode" diff --git a/backend/tests/tools/run_zxingcpp_tests.sh b/backend/tests/tools/run_zxingcpp_tests.sh new file mode 100755 index 00000000..8351d52e --- /dev/null +++ b/backend/tests/tools/run_zxingcpp_tests.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Copyright (C) 2021 Robin Stuart +# vim: set ts=4 sw=4 et : +set -e + +function run_zxingcpp_test() { + echo -e "\n$1 -f $2" + backend/tests/$1 -f "$2" -d $(expr 1024 + 16 + 32) || exit 1 +} + +run_zxingcpp_test "test_2of5" "encode" +run_zxingcpp_test "test_aztec" "encode" +run_zxingcpp_test "test_code" "encode" +run_zxingcpp_test "test_code128" "encode" +run_zxingcpp_test "test_dmatrix" "input" +run_zxingcpp_test "test_dmatrix" "encode" +run_zxingcpp_test "test_dotcode" "encode" +run_zxingcpp_test "test_maxicode" "encode" +run_zxingcpp_test "test_medical" "encode" +run_zxingcpp_test "test_pdf417" "encode" +run_zxingcpp_test "test_qr" "qr_encode" +run_zxingcpp_test "test_rss" "binary_div_modulo_divisor" +run_zxingcpp_test "test_rss" "examples" +run_zxingcpp_test "test_upcean" "upce_input" +run_zxingcpp_test "test_upcean" "encode" diff --git a/frontend/main.c b/frontend/main.c index f230743f..daf20ec6 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -1379,7 +1379,8 @@ int main(int argc, char **argv) { } if (data_arg_num) { - const unsigned int cap = ZBarcode_Cap(my_symbol->symbology, ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | + const int symbology = my_symbol->symbology; + const unsigned int cap = ZBarcode_Cap(symbology, ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK); if (fullmultibyte && (cap & ZINT_CAP_FULL_MULTIBYTE)) { my_symbol->option_3 = ZINT_FULL_MULTIBYTE; @@ -1394,12 +1395,11 @@ int main(int argc, char **argv) { my_symbol->option_2 = addon_gap; } if (rows) { - if (my_symbol->symbology == BARCODE_PDF417 || my_symbol->symbology == BARCODE_PDF417COMP - || my_symbol->symbology == BARCODE_HIBC_PDF || my_symbol->symbology == BARCODE_DBAR_EXPSTK - || my_symbol->symbology == BARCODE_DBAR_EXPSTK_CC) { + if (symbology == BARCODE_PDF417 || symbology == BARCODE_PDF417COMP || symbology == BARCODE_HIBC_PDF + || symbology == BARCODE_DBAR_EXPSTK || symbology == BARCODE_DBAR_EXPSTK_CC) { my_symbol->option_3 = rows; - } else if (my_symbol->symbology == BARCODE_CODABLOCKF || my_symbol->symbology == BARCODE_HIBC_BLOCKF - || my_symbol->symbology == BARCODE_CODE16K || my_symbol->symbology == BARCODE_CODE49) { + } else if (symbology == BARCODE_CODABLOCKF || symbology == BARCODE_HIBC_BLOCKF + || symbology == BARCODE_CODE16K || symbology == BARCODE_CODE49) { my_symbol->option_1 = rows; } } @@ -1418,9 +1418,9 @@ int main(int argc, char **argv) { strcpy(filetype, no_png ? "gif" : "png"); } } - if (((my_symbol->symbology != BARCODE_MAXICODE && my_symbol->scale < 0.5f) || my_symbol->scale < 0.2f) + if (((symbology != BARCODE_MAXICODE && my_symbol->scale < 0.5f) || my_symbol->scale < 0.2f) && is_raster(filetype, no_png)) { - const int min = my_symbol->symbology != BARCODE_MAXICODE ? 5 : 2; + const int min = symbology != BARCODE_MAXICODE ? 5 : 2; fprintf(stderr, "Warning 145: Scaling less than 0.%d will be set to 0.%d for '%s' output\n", min, min, filetype); fflush(stderr); @@ -1434,9 +1434,9 @@ int main(int argc, char **argv) { if (filetype[0] != '\0') { set_extension(my_symbol->outfile, filetype); } - if (((my_symbol->symbology != BARCODE_MAXICODE && my_symbol->scale < 0.5f) || my_symbol->scale < 0.2f) + if (((symbology != BARCODE_MAXICODE && my_symbol->scale < 0.5f) || my_symbol->scale < 0.2f) && is_raster(get_extension(my_symbol->outfile), no_png)) { - const int min = my_symbol->symbology != BARCODE_MAXICODE ? 5 : 2; + const int min = symbology != BARCODE_MAXICODE ? 5 : 2; fprintf(stderr, "Warning 146: Scaling less than 0.%d will be set to 0.%d for '%s' output\n", min, min, get_extension(my_symbol->outfile)); fflush(stderr); diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 2849e2ed..b3861b58 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -367,12 +367,14 @@ bool MainWindow::save() QFileDialog save_dialog; QString pathname; QString suffix; + QStringList suffixes; save_dialog.setAcceptMode(QFileDialog::AcceptSave); save_dialog.setWindowTitle(tr("Save Barcode Image")); save_dialog.setDirectory(settings.value(QSL("studio/default_dir"), QDir::toNativeSeparators(QDir::homePath())).toString()); + suffixes << QSL("eps") << QSL("gif") << QSL("svg") << QSL("bmp") << QSL("pcx") << QSL("emf") << QSL("tif"); #ifdef NO_PNG suffix = settings.value(QSL("studio/default_suffix"), QSL("gif")).toString(); save_dialog.setNameFilter(tr( @@ -385,6 +387,7 @@ bool MainWindow::save() "Portable Network Graphic (*.png);;Encapsulated PostScript (*.eps);;Graphics Interchange Format (*.gif)" ";;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx)" ";;Enhanced Metafile (*.emf);;Tagged Image File Format (*.tif)")); + suffixes << QSL("png"); #endif if (QString::compare(suffix, QSL("png"), Qt::CaseInsensitive) == 0) @@ -413,6 +416,11 @@ bool MainWindow::save() pathname.append(suffix); } else { suffix = pathname.right(pathname.length() - (pathname.lastIndexOf('.') + 1)); + if (!suffixes.contains(suffix, Qt::CaseInsensitive)) { + /*: %1 is suffix of filename */ + QMessageBox::critical(this, tr("Save Error"), tr("Unknown output format \"%1\"").arg(suffix)); + return false; + } } } else { return false; @@ -426,13 +434,14 @@ bool MainWindow::save() QMessageBox::warning(this, tr("Save Warning"), m_bc.bc.error_message()); } - int lastSeparator = pathname.lastIndexOf(QDir::separator()); - QString dirname = pathname.mid(0, lastSeparator); + QString nativePathname = QDir::toNativeSeparators(pathname); + int lastSeparator = nativePathname.lastIndexOf(QDir::separator()); + QString dirname = nativePathname.mid(0, lastSeparator); if (dirname.isEmpty()) { /*: %1 is path saved to */ - statusBar->showMessage(tr("Saved as \"%1\"").arg(pathname), 0 /*No timeout*/); + statusBar->showMessage(tr("Saved as \"%1\"").arg(nativePathname), 0 /*No timeout*/); } else { - QString filename = pathname.right(pathname.length() - (lastSeparator + 1)); + QString filename = nativePathname.right(nativePathname.length() - (lastSeparator + 1)); /*: %1 is base filename saved to, %2 is directory saved in */ statusBar->showMessage(tr("Saved as \"%1\" in \"%2\"").arg(filename).arg(dirname), 0 /*No timeout*/); }