mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow
RMQR: update to new draft ISO/IEC JTC1/SC31N000 (Draft 2019-6-24); allow for righthand vertical timing pattern in populate_grid() ULTRA: update max size and min cols based on BWIPP 2021-07-14 update backend_tcl/zint_tcl.dsp: use /MD instead of /MT for tcl lib compat; change include/lib path to more standard one manual.txt: highlight that rMQR is still in development GUI: use cross-platform smaller font func instead of explicit values for notes
This commit is contained in:
@ -31,6 +31,83 @@
|
||||
|
||||
#include "testcommon.h"
|
||||
|
||||
static void test_large(int index, int debug) {
|
||||
|
||||
struct item {
|
||||
int option_1;
|
||||
int option_3;
|
||||
char *pattern;
|
||||
int length;
|
||||
int ret;
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
};
|
||||
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
|
||||
struct item data[] = {
|
||||
/* 0*/ { -1, -1, "1", 252, 0, 31, 66 }, // Default EC2
|
||||
/* 1*/ { -1, -1, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 2*/ { -1, -1, "1", ZINT_MAX_DATA_LEN, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 3*/ { -1, -1, "A", 252, 0, 31, 66 },
|
||||
/* 4*/ { -1, -1, "A", 253, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 5*/ { -1, -1, "\200", 252, 0, 31, 66 },
|
||||
/* 6*/ { -1, -1, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 7*/ { -1, -1, "\001", 252, 0, 31, 66 },
|
||||
/* 8*/ { -1, -1, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 9*/ { -1, ULTRA_COMPRESSION, "1", 504, 0, 31, 66 },
|
||||
/* 10*/ { -1, ULTRA_COMPRESSION, "1", 505, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 11*/ { -1, ULTRA_COMPRESSION, "A", 375, 0, 31, 66 },
|
||||
/* 12*/ { -1, ULTRA_COMPRESSION, "A", 376, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 13*/ { -1, ULTRA_COMPRESSION, "\200", 252, 0, 31, 66 },
|
||||
/* 14*/ { -1, ULTRA_COMPRESSION, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 15*/ { -1, ULTRA_COMPRESSION, "\001", 252, 0, 31, 66 },
|
||||
/* 16*/ { -1, ULTRA_COMPRESSION, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 17*/ { 1, -1, "1", 276, 0, 31, 66 },
|
||||
/* 18*/ { 1, -1, "1", 277, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 19*/ { 2, -1, "1", 263, 0, 31, 66 },
|
||||
/* 20*/ { 2, -1, "1", 264, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 21*/ { 3, -1, "1", 252, 0, 31, 66 },
|
||||
/* 22*/ { 3, -1, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 23*/ { 4, -1, "1", 234, 0, 31, 66 },
|
||||
/* 24*/ { 4, -1, "1", 235, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 25*/ { 5, -1, "1", 220, 0, 31, 66 },
|
||||
/* 26*/ { 5, -1, "1", 221, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 27*/ { 6, -1, "1", 202, 0, 31, 66 },
|
||||
/* 28*/ { 6, -1, "1", 203, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol;
|
||||
|
||||
char data_buf[ZINT_MAX_DATA_LEN + 1];
|
||||
|
||||
testStart("test_large");
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (index != -1 && i != index) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length);
|
||||
assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf));
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_ULTRA, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, -1, data[i].option_3, -1 /*output_options*/, data_buf, data[i].length, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_reader_init(int index, int generate, int debug) {
|
||||
|
||||
struct item {
|
||||
@ -59,6 +136,7 @@ static void test_reader_init(int index, int generate, 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");
|
||||
@ -111,14 +189,14 @@ static void test_input(int index, int generate, int debug) {
|
||||
/* 6*/ { UNICODE_MODE, 0, -1, -1, "ABC", 0, "(4) 257 65 66 67", "" },
|
||||
/* 7*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ABC", 0, "(4) 272 65 66 67", "" },
|
||||
/* 8*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ULTRACODE_123456789!", 0, "(17) 272 85 76 84 82 65 67 79 68 69 95 140 162 184 206 57 33", "" },
|
||||
/* 9*/ { UNICODE_MODE, 0, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(250) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "249 chars EC2" },
|
||||
/* 10*/ { UNICODE_MODE, 0, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "250 chars EC2" },
|
||||
/* 11*/ { UNICODE_MODE, 0, 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(274) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "273 chars EC0" },
|
||||
/* 12*/ { UNICODE_MODE, 0, 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "274 chars EC0" },
|
||||
/* 9*/ { UNICODE_MODE, 0, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "252 chars EC2" },
|
||||
/* 10*/ { UNICODE_MODE, 0, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "253 chars EC2" },
|
||||
/* 11*/ { UNICODE_MODE, 0, 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(277) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "276 chars EC0" },
|
||||
/* 12*/ { UNICODE_MODE, 0, 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "277 chars EC0" },
|
||||
/* 13*/ { UNICODE_MODE, 0, -1, -1, "é", 0, "(2) 257 233", "" },
|
||||
/* 14*/ { UNICODE_MODE, 0, -1, -1, "β", ZINT_WARN_USES_ECI, "Warning (2) 263 226", "" },
|
||||
/* 15*/ { UNICODE_MODE, 9, -1, -1, "β", 0, "(2) 263 226", "" },
|
||||
/* 16*/ { UNICODE_MODE, 9, -1, -1, "βAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(250) 263 226 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "249 chars EC2" },
|
||||
/* 16*/ { UNICODE_MODE, 9, -1, -1, "βAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 263 226 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "249 chars EC2" },
|
||||
/* 17*/ { UNICODE_MODE, 9, -1, ULTRA_COMPRESSION, "A", 0, "(2) 272 65", "Note ECI ignored and not outputted if ULTRA_COMPRESSION and all ASCII" },
|
||||
/* 18*/ { UNICODE_MODE, 15, -1, -1, "Ŗ", 0, "(2) 268 170", "" },
|
||||
/* 19*/ { DATA_MODE, 898, -1, -1, "\001\002\003\004\377", 0, "(7) 278 130 1 2 3 4 255", "" },
|
||||
@ -148,6 +226,14 @@ static void test_input(int index, int generate, int debug) {
|
||||
/* 43*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "Atel:aAa", 0, "(8) 272 275 6 89 275 148 0 42", "Mode: c (8)" },
|
||||
/* 44*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "tel:AAaa", 0, "(8) 272 275 271 161 6 28 262 118", "Mode: c (8)" },
|
||||
/* 45*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "AAaatel:aA", 0, "(10) 272 276 0 42 0 41 118 46 6 156", "Mode: c (10)" },
|
||||
/* 46*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "émailto:étel:éfile:éhttp://éhttps://éftp://", 0, "(18) 257 233 276 282 233 277 282 233 278 282 233 279 282 233 280 282 233 281", "Mode: 8ccccccc8cccc8ccccc8ccccccc8cccccccc8cccccc (43)" },
|
||||
/* 47*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "éhttp://www.url.com", 0, "(9) 257 233 279 269 186 113 81 45 252", "Mode: 8cccccccccccccccccc (19)" },
|
||||
/* 48*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "éhttps://www.url.com", 0, "(9) 257 233 280 269 186 113 81 45 252", "Mode: 8ccccccccccccccccccc (20)" },
|
||||
/* 49*/ { UNICODE_MODE, 0, -1, -1, "http://url.com", 0, "(8) 281 117 114 108 46 99 111 109", "Mode: 8888888 (7)" },
|
||||
/* 50*/ { UNICODE_MODE, 0, -1, -1, "https://url.com", 0, "(8) 282 117 114 108 46 99 111 109", "Mode: 8888888 (7)" },
|
||||
/* 51*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "http://url.com", 0, "(6) 281 262 133 216 269 251", "Mode: ccccccc (7)" },
|
||||
/* 52*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "https://url.com", 0, "(6) 282 262 133 216 269 251", "Mode: ccccccc (7)" },
|
||||
/* 53*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "{", 0, "(2) 272 123", "Mode: a (1)" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@ -160,6 +246,7 @@ static void test_input(int index, int generate, 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");
|
||||
@ -197,11 +284,14 @@ static void test_encode(int index, int generate, int debug) {
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
int bwipp_cmp;
|
||||
char *comment;
|
||||
char *expected;
|
||||
};
|
||||
// Based on AIMD/TSC15032-43 (v 0.99c), with values updated from BWIPP update 2021-07-14
|
||||
// https://github.com/bwipp/postscriptbarcode/commit/4255810845fa8d45c6192dd30aee1fdad1aaf0cc
|
||||
struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ULTRACODE_123456789!", 0, 13, 22, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** different compression",
|
||||
/* 0*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ULTRACODE_123456789!", 0, 13, 22, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** different compression",
|
||||
"7777777777777777777777"
|
||||
"7857865353533131551857"
|
||||
"7767853515611616136717"
|
||||
@ -216,7 +306,7 @@ static void test_encode(int index, int generate, int debug) {
|
||||
"7817851653331136333857"
|
||||
"7777777777777777777777"
|
||||
},
|
||||
/* 1*/ { UNICODE_MODE, 0, -1, -1, "ULTRACODE_123456789!", 0, 13, 24, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** no compression; verified against bwipp",
|
||||
/* 1*/ { UNICODE_MODE, 0, -1, -1, "ULTRACODE_123456789!", 0, 13, 24, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** no compression",
|
||||
"777777777777777777777777"
|
||||
"785786533153313111181157"
|
||||
"776783361661161666676617"
|
||||
@ -231,7 +321,7 @@ static void test_encode(int index, int generate, int debug) {
|
||||
"781786166533113663683357"
|
||||
"777777777777777777777777"
|
||||
},
|
||||
/* 2*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, 19, 23, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** different compression",
|
||||
/* 2*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** different compression",
|
||||
"77777777777777777777777"
|
||||
"78878663151561555158557"
|
||||
"77878315565635366667617"
|
||||
@ -252,7 +342,7 @@ static void test_encode(int index, int generate, int debug) {
|
||||
"78878333656153153368617"
|
||||
"77777777777777777777777"
|
||||
},
|
||||
/* 3*/ { DATA_MODE, 0, -1, -1, "\110\105\111\115\101\123\315\320\101\040\113\105\116\116\101\122\101\110\301\123\113\323\114\101\040\315\123\114\101\116\104\123", 0, 19, 23, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** no compression; verified against bwipp",
|
||||
/* 3*/ { DATA_MODE, 0, -1, -1, "\110\105\111\115\101\123\315\320\101\040\113\105\116\116\101\122\101\110\301\123\113\323\114\101\040\315\123\114\101\116\104\123", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** no compression",
|
||||
"77777777777777777777777"
|
||||
"78878633151153313358137"
|
||||
"77878315666661161167617"
|
||||
@ -273,7 +363,7 @@ static void test_encode(int index, int generate, int debug) {
|
||||
"78878361115516163138317"
|
||||
"77777777777777777777777"
|
||||
},
|
||||
/* 4*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, "אולטרה-קוד1234", 0, 13, 19, "AIMD/TSC15032-43 Figure G.3 Same except DCC correct whereas DCC in Figure G.3 is incorrent",
|
||||
/* 4*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, "אולטרה-קוד1234", 0, 13, 19, 1, "AIMD/TSC15032-43 Figure G.3 Same except DCC correct whereas DCC in Figure G.3 is incorrent",
|
||||
"7777777777777777777"
|
||||
"7857865565566616657"
|
||||
"7737853333613351517"
|
||||
@ -288,7 +378,7 @@ static void test_encode(int index, int generate, int debug) {
|
||||
"7817851316355311357"
|
||||
"7777777777777777777"
|
||||
},
|
||||
/* 5*/ { DATA_MODE, 0, -1, -1, "\340\345\354\350\370\344\055\367\345\343\061\062\063\064", 0, 13, 20, "AIMD/TSC15032-43 Figure G.3 **NOT SAME** no compression; verified against bwipp",
|
||||
/* 5*/ { DATA_MODE, 0, -1, -1, "\340\345\354\350\370\344\055\367\345\343\061\062\063\064", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.3 **NOT SAME** no compression",
|
||||
"77777777777777777777"
|
||||
"78578611115666161157"
|
||||
"77678333656133516617"
|
||||
@ -303,7 +393,7 @@ static void test_encode(int index, int generate, int debug) {
|
||||
"78178613653553116357"
|
||||
"77777777777777777777"
|
||||
},
|
||||
/* 6*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "https://aimglobal.org/jcrv3tX", 0, 13, 20, "AIMD/TSC15032-43 Figure G.4a **NOT SAME** different compression; also DCC incorrect in figure",
|
||||
/* 6*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "https://aimglobal.org/jcrv3tX", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.4a **NOT SAME** different compression; also DCC incorrect in figure",
|
||||
"77777777777777777777"
|
||||
"78578655115631563137"
|
||||
"77678563356513315617"
|
||||
@ -318,7 +408,7 @@ static void test_encode(int index, int generate, int debug) {
|
||||
"78178163363613633157"
|
||||
"77777777777777777777"
|
||||
},
|
||||
/* 7*/ { GS1_MODE, 0, -1, -1, "[01]03453120000011[17]121125[10]ABCD1234", 0, 13, 23, "AIMD/TSC15032-43 Figure G.6 **NOT SAME** different compression and ECC; also DCC incorrect in figure",
|
||||
/* 7*/ { GS1_MODE, 0, -1, -1, "[01]03453120000011[17]121125[10]ABCD1234", 0, 13, 23, 1, "AIMD/TSC15032-43 Figure G.6 **NOT SAME** different compression and ECC; also DCC incorrect in figure",
|
||||
"77777777777777777777777"
|
||||
"78578616535355353318157"
|
||||
"77678553116631616667617"
|
||||
@ -333,7 +423,7 @@ static void test_encode(int index, int generate, int debug) {
|
||||
"78178335533356531518357"
|
||||
"77777777777777777777777"
|
||||
},
|
||||
/* 8*/ { UNICODE_MODE, 0, -1, -1, "A", 0, 13, 13, "Verified against bwipp",
|
||||
/* 8*/ { UNICODE_MODE, 0, -1, -1, "A", 0, 13, 13, 1, "",
|
||||
"7777777777777"
|
||||
"7857863335517"
|
||||
"7717835163667"
|
||||
@ -348,7 +438,22 @@ static void test_encode(int index, int generate, int debug) {
|
||||
"7817833536357"
|
||||
"7777777777777"
|
||||
},
|
||||
/* 9*/ { UNICODE_MODE, 0, 2, -1, "12345678901234567890123", 0, 13, 25, "Length 23 == 26 MCC (C) with EC1 so 7 ECC by Table 12",
|
||||
/* 9*/ { UNICODE_MODE, 0, 2, -1, "1234567890123456789012", 0, 13, 24, 1, "Length 22 == 25 MCC (C) with EC1 so 6 ECC by Table 12",
|
||||
"777777777777777777777777"
|
||||
"785786663111111111181117"
|
||||
"776783555536666666676667"
|
||||
"783786113311333113383117"
|
||||
"776785365155115351175357"
|
||||
"783781136666363663683667"
|
||||
"778787878787878787878787"
|
||||
"786781313511111111181117"
|
||||
"775785135666666666676637"
|
||||
"781781666511333113383157"
|
||||
"776783531656155561575517"
|
||||
"781786155535516355186337"
|
||||
"777777777777777777777777"
|
||||
},
|
||||
/* 10*/ { UNICODE_MODE, 0, 2, -1, "12345678901234567890123", 0, 13, 25, 1, "Length 23 == 26 MCC (C) with EC1 so 7 ECC by Table 12",
|
||||
"7777777777777777777777777"
|
||||
"7857863655511111111811117"
|
||||
"7767831563666666666766667"
|
||||
@ -363,7 +468,7 @@ static void test_encode(int index, int generate, int debug) {
|
||||
"7817835653363636636836657"
|
||||
"7777777777777777777777777"
|
||||
},
|
||||
/* 10*/ { UNICODE_MODE, 0, 1, -1, "1", 0, 13, 11, "Figure 3a min 2-row, EC0; verified against bwipp",
|
||||
/* 11*/ { UNICODE_MODE, 0, 1, -1, "1", 0, 13, 11, 1, "Figure 3a min 2-row, EC0",
|
||||
"77777777777"
|
||||
"78578661517"
|
||||
"77178355667"
|
||||
@ -378,114 +483,230 @@ static void test_encode(int index, int generate, int debug) {
|
||||
"78178365567"
|
||||
"77777777777"
|
||||
},
|
||||
/* 11*/ { UNICODE_MODE, 0, 6, -1, "123456789012345678901", 0, 13, 27, "Figure 3a max 2-row, EC5",
|
||||
"777777777777777777777777777"
|
||||
"785786316551651111181111117"
|
||||
"771783535313166666676666667"
|
||||
"783786166556351133381133317"
|
||||
"771785311313665615575615557"
|
||||
"786781655165353551683551637"
|
||||
"778787878787878787878787877"
|
||||
"783781165561111111181111117"
|
||||
"771785336136536666676666637"
|
||||
"783781113655351333181333157"
|
||||
"775783635331635115375115367"
|
||||
"781785553563556363686363637"
|
||||
"777777777777777777777777777"
|
||||
/* 12*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012", 0, 13, 28, 0, "Figure 3a max 2-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 3 rows instead",
|
||||
"7777777777777777777777777777"
|
||||
"7857863331131511111811111157"
|
||||
"7717835613316666666766666617"
|
||||
"7837866555153511333811333157"
|
||||
"7757853333361656155756155517"
|
||||
"7867816166656535516835516357"
|
||||
"7787878787878787878787878787"
|
||||
"7837816551551111111811111117"
|
||||
"7717855165135366666766666637"
|
||||
"7837813613616513331813331157"
|
||||
"7767836165151351153751153567"
|
||||
"7817863633563563636863636637"
|
||||
"7777777777777777777777777777"
|
||||
},
|
||||
/* 12*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012", 0, 19, 36, "Figure 3b max 3-row, EC5",
|
||||
"777777777777777777777777777777777777"
|
||||
"788786363653513111181111111111111117"
|
||||
"778783511165156356676666666666666667"
|
||||
"788786155316333511383133133113313317"
|
||||
"775785516633156156175515515361551557"
|
||||
"781781335356661335686653331656665337"
|
||||
"773787878787878787878787878787878787"
|
||||
"785781313116156311181111111111111117"
|
||||
"776786665563633166676666666666666667"
|
||||
"788783316155566513381133133133113317"
|
||||
"773785165316651651573615515515361557"
|
||||
"781781556535515533186566653331656667"
|
||||
"773787878787878787878787878787878787"
|
||||
"786781333331113511181111111111111117"
|
||||
"771785161113336666676666666666666657"
|
||||
"788783313565163513381331133133133137"
|
||||
"778785661613551651575153615515515317"
|
||||
"788783155555336565383316566653331637"
|
||||
"777777777777777777777777777777777777"
|
||||
/* 13*/ { UNICODE_MODE, 0, 1, -1, "12345678901234567890123456789012345", 0, 19, 22, 1, "Figure 3b min 3-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)",
|
||||
"7777777777777777777777"
|
||||
"7887866511111111111817"
|
||||
"7787833666666666666767"
|
||||
"7887861513313311331837"
|
||||
"7757855651551536155717"
|
||||
"7837811565333165666857"
|
||||
"7717878787878787878787"
|
||||
"7857811111111111111857"
|
||||
"7737855366666666666717"
|
||||
"7887863113313313311857"
|
||||
"7767816361551551536717"
|
||||
"7817831556665333165857"
|
||||
"7757878787878787878787"
|
||||
"7867811111111111111817"
|
||||
"7717855666666666666737"
|
||||
"7887816133113313313817"
|
||||
"7787863515361551551757"
|
||||
"7887831331656665333867"
|
||||
"7777777777777777777777"
|
||||
},
|
||||
/* 13*/ { UNICODE_MODE, 0, 6, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", 0, 25, 49, "Figure 3c max 4-row, EC5",
|
||||
"7777777777777777777777777777777777777777777777777"
|
||||
"7887861565635135151811111111111111181111111111117"
|
||||
"7787835151513316566766666666666666676666666666667"
|
||||
"7887861536666531351831331313313133183133131331317"
|
||||
"7787856653153315566755156551565515675515655156557"
|
||||
"7887813366335656655813565135651356581356513565137"
|
||||
"7787878787878787878787878787878787878787878787877"
|
||||
"7857836636366363311811111111111111181111111111117"
|
||||
"7737855565651635656766666666666666676666666666667"
|
||||
"7817861653316513563831313313133131383131331313317"
|
||||
"7757856561153165131755131551315513175513155131557"
|
||||
"7867863135615536653836663366633666383666336663367"
|
||||
"7787878787878787878787878787878787878787878787877"
|
||||
"7837856156651155111811111111111111181111111111117"
|
||||
"7717815565563561566766666666666666676666666666667"
|
||||
"7867866631136356613831313313133131383131331313317"
|
||||
"7737831365663161551756551565515655175655156551567"
|
||||
"7817865156355516135865135651356513586513565135657"
|
||||
"7787878787878787878787878787878787878787878787877"
|
||||
"7887853555355533511811111111111111181111111111117"
|
||||
"7787835616631351166766666666666666676666666666657"
|
||||
"7887863363316563613813313133131331381331313313167"
|
||||
"7787831111653311551731551315513155173155131551357"
|
||||
"7887816565561165166863366633666336686336663366637"
|
||||
"7777777777777777777777777777777777777777777777777"
|
||||
/* 14*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012345", 0, 19, 38, 0, "Figure 3b max 3-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 4 rows instead",
|
||||
"77777777777777777777777777777777777777"
|
||||
"78878611311563611118111111111111111817"
|
||||
"77878366156351555667666666666666666767"
|
||||
"78878633333136131138313313311331331837"
|
||||
"77578551555353555617551551536155155717"
|
||||
"78178136611516613568665333165666533837"
|
||||
"77678787878787878787878787878787878787"
|
||||
"78178111165636331118111111111111111817"
|
||||
"77678663533553616667666666666666666767"
|
||||
"78878336161116361338113313313311331837"
|
||||
"77378611355661535157361551551536155717"
|
||||
"78178166536313613318656665333165666857"
|
||||
"77578787878787878787878787878787878787"
|
||||
"78678313563533551118111111111111111817"
|
||||
"77178535616651666667666666666666666757"
|
||||
"78878153331316151338133113313313311837"
|
||||
"77878611116665665157515361551551536717"
|
||||
"78878166553313356538331656665333165837"
|
||||
"77777777777777777777777777777777777777"
|
||||
},
|
||||
/* 14*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 31, 66, "Figure 3d max 5-row, EC5 **NOT SAME** Max columns due to 282 limit is 60 not 61 as shown",
|
||||
/* 15*/ { UNICODE_MODE, 0, 1, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 25, 30, 1, "Figure 3c min 4-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)",
|
||||
"777777777777777777777777777777"
|
||||
"788786511111111111181111111117"
|
||||
"778783166666666666676666666667"
|
||||
"788786513313133131383131331317"
|
||||
"778785351565515655175655156557"
|
||||
"788781135651356513586513565137"
|
||||
"778787878787878787878787878787"
|
||||
"785783311111111111181111111117"
|
||||
"771781166666666666676666666667"
|
||||
"786786613133131331381331313317"
|
||||
"775781351315513155173155131557"
|
||||
"783783566633666336686336663367"
|
||||
"778787878787878787878787878787"
|
||||
"786783511111111111181111111157"
|
||||
"771786666666666666676666666617"
|
||||
"785785513133131331381331313357"
|
||||
"773781665515655156575156551517"
|
||||
"781785551356513565183565135657"
|
||||
"778787878787878787878787878787"
|
||||
"788781111111111111181111111117"
|
||||
"778785366666666666676666666637"
|
||||
"788781133131331313381313313117"
|
||||
"778786315513155131575131551357"
|
||||
"788785533666336663386663366667"
|
||||
"777777777777777777777777777777"
|
||||
},
|
||||
/* 16*/ { UNICODE_MODE, 0, 6, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456", 0, 25, 50, 0, "Figure 3c max 4-row **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 5 rows instead",
|
||||
"77777777777777777777777777777777777777777777777777"
|
||||
"78878631533313135518111111111111111811111111111117"
|
||||
"77878315116161313667666666666666666766666666666667"
|
||||
"78878656365333166518313313133131331831331313313137"
|
||||
"77878561133666533667551565515655156755156551565517"
|
||||
"78878156661531351558135651356513565813565135651357"
|
||||
"77878787878787878787878787878787878787878787878787"
|
||||
"78578313331353336118111111111111111811111111111117"
|
||||
"77378661116566653567666666666666666766666666666667"
|
||||
"78578136563115335638313133131331313831313313133137"
|
||||
"77378311656551166317551315513155131755131551315517"
|
||||
"78678653535336613538366633666336663836663366633667"
|
||||
"77878787878787878787878787878787878787878787878787"
|
||||
"78378336656556111118111111111111111811111111111157"
|
||||
"77578153161313353667666666666666666766666666666617"
|
||||
"78178566535655535138313133131331313831313313133157"
|
||||
"77378635316136611517565515655156551756551565515617"
|
||||
"78178551133613153358651356513565135865135651356557"
|
||||
"77878787878787878787878787878787878787878787878787"
|
||||
"78878655635551355118111111111111111811111111111117"
|
||||
"77878313113333563667666666666666666766666666666657"
|
||||
"78878161551515631138133131331313313813313133131367"
|
||||
"77878316165363313517315513155131551731551315513157"
|
||||
"78878633351651561668633666336663366863366633666337"
|
||||
"77777777777777777777777777777777777777777777777777"
|
||||
},
|
||||
/* 17*/ { UNICODE_MODE, 0, 1, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 31, 42, 1, "Figure 3d min 5-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)",
|
||||
"777777777777777777777777777777777777777777"
|
||||
"788786511111111111181111111111111118111117"
|
||||
"778783366666666666676666666666666667666667"
|
||||
"788786113131313131381313131313131318313137"
|
||||
"778785365656565656576565656565656567565657"
|
||||
"788781553535353535385353535353535358353537"
|
||||
"778787878787878787878787878787878787878787"
|
||||
"788785511111111111181111111111111118111117"
|
||||
"778781666666666666676666666666666667666667"
|
||||
"788786533333333333383333333333333338333337"
|
||||
"775785615151515151571515151515151517515157"
|
||||
"783783536363636363683636363636363638636367"
|
||||
"776787878787878787878787878787878787878787"
|
||||
"781781111111111111181111111111111118111157"
|
||||
"773785366666666666676666666666666667666617"
|
||||
"788783131313131313183131313131313138131357"
|
||||
"776786313131313131371313131313131317313117"
|
||||
"783785556565656565685656565656565658656557"
|
||||
"771787878787878787878787878787878787878787"
|
||||
"785781111111111111181111111111111118111157"
|
||||
"771783666666666666676666666666666667666617"
|
||||
"788785131313131313183131313131313138131357"
|
||||
"778781515151515151571515151515151517515117"
|
||||
"788786363636363636386363636363636368363657"
|
||||
"778787878787878787878787878787878787878787"
|
||||
"788781111111111111181111111111111118111117"
|
||||
"778786666666666666676666666666666667666637"
|
||||
"788783131313131313183131313131313138131317"
|
||||
"778785555555555555575555555555555557555557"
|
||||
"788783616161616161681616161616161618616167"
|
||||
"777777777777777777777777777777777777777777"
|
||||
},
|
||||
/* 18*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 31, 66, 1, "Figure 3d max 5-row, EC5 **NOT SAME** Max columns due to 282 limit is 60 not 61 as shown",
|
||||
"777777777777777777777777777777777777777777777777777777777777777777"
|
||||
"788786655166656555386351111111111118111111111111111811111111111117"
|
||||
"778783331611363336575566666666666667666666666666666766666666666667"
|
||||
"788786555153116611183153333333333338333333333333333833333333333337"
|
||||
"778785361635661566576361515151515157151515151515151751515151515157"
|
||||
"788781513513555315383653636363636368363636363636363863636363636367"
|
||||
"788786563656553165385551111111111118111111111111111811111111111117"
|
||||
"778783136511335313673366666666666667666666666666666766666666666667"
|
||||
"788786315633661531381153333333333338333333333333333833333333333337"
|
||||
"778785666366116365673661515151515157151515151515151751515151515157"
|
||||
"788781333151633111586553636363636368363636363636363863636363636367"
|
||||
"778787878787878787878787878787878787878787878787878787878787878787"
|
||||
"788785316656355536686131111111111118111111111111111811111111111157"
|
||||
"778786653365566155373316666666666667666666666666666766666666666617"
|
||||
"788783361516133633685633131313131318313131313131313813131313131357"
|
||||
"775785513161356156176361313131313137131313131313131731313131313117"
|
||||
"786786166533165615383615656565656568565656565656565865656565656557"
|
||||
"788785511663631513386131111111111118111111111111111811111111111117"
|
||||
"778786665351353656571616666666666667666666666666666766666666666667"
|
||||
"788783551116166363183533131313131318313131313131313813131313131317"
|
||||
"775786313333613536571361313131313137131313131313131731313131313137"
|
||||
"786785666615135615686615656565656568565656565656565865656565656567"
|
||||
"775787878787878787878787878787878787878787878787878787878787878787"
|
||||
"781783651151633136586611111111111118111111111111111811111111111157"
|
||||
"776786533613515615373566666666666667666666666666666766666666666617"
|
||||
"788781365531653133181613131313131318313131313131313813131313131357"
|
||||
"773783113156366615576151515151515157151515151515151751515151515117"
|
||||
"786786351535111563385536363636363638636363636363636836363636363657"
|
||||
"773787878787878787878787878787878787878787878787878787878787878787"
|
||||
"785785611111515333685311111111111118111111111111111811111111111157"
|
||||
"771783336366133651571166666666666667666666666666666766666666666617"
|
||||
"788786513535351316183313131313131318313131313131313813131313131357"
|
||||
"778783131151115535575555555555555557555555555555555755555555555517"
|
||||
"788785665366536111386661616161616168161616161616161861616161616157"
|
||||
"783785665636551563586511111111111118111111111111111811111111111117"
|
||||
"776781516115365616671166666666666667666666666666666766666666666667"
|
||||
"788785631666611363586313131313131318313131313131313813131313131317"
|
||||
"773786116553355536673151515151515157151515151515151751515151515157"
|
||||
"786783553131613115381536363636363638636363636363636836363636363637"
|
||||
"775787878787878787878787878787878787878787878787878787878787878787"
|
||||
"783786611351531316585111111111111118111111111111111811111111111117"
|
||||
"771783536663313553371666666666666667666666666666666766666666666667"
|
||||
"788785665115635111683313131313131318313131313131313813131313131317"
|
||||
"778783133333563566376155555555555557555555555555555755555555555557"
|
||||
"788785356111611131583661616161616168161616161616161861616161616167"
|
||||
"778787878787878787878787878787878787878787878787878787878787878787"
|
||||
"788786355163151355683611111111111118111111111111111811111111111137"
|
||||
"778783563615515136176566666666666667666666666666666766666666666617"
|
||||
"788785655136333561585613131313131318313131313131313813131313131357"
|
||||
"778781136561611613373365656565656567565656565656565765656565656517"
|
||||
"788783663313553565586153535353535358353535353535353853535353535357"
|
||||
"788785665536116356681611111111111118111111111111111811111111111137"
|
||||
"778786511361333635576566666666666667666666666666666766666666666617"
|
||||
"788783666116561361181613131313131318313131313131313813131313131357"
|
||||
"778785533633353533375565656565656567565656565656565765656565656517"
|
||||
"788786316551515665186353535353535358353535353535353853535353535357"
|
||||
"777777777777777777777777777777777777777777777777777777777777777777"
|
||||
},
|
||||
/* 19*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, -1, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 27, 0, "06 Macro; not supported by BWIPP",
|
||||
"777777777777777777777777777"
|
||||
"785786311655611111181311157"
|
||||
"771783153516566666676156617"
|
||||
"783786565165331131183633357"
|
||||
"771785613316555615571311517"
|
||||
"786781336155113553683636357"
|
||||
"778787878787878787878787877"
|
||||
"783781136511131113183331117"
|
||||
"771785651653616651671116637"
|
||||
"783781163535161335185653357"
|
||||
"775786355661515113676165537"
|
||||
"781783531133356335585331617"
|
||||
"777777777777777777777777777"
|
||||
},
|
||||
/* 20*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, ULTRA_COMPRESSION, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 23, 0, "06 Macro; not supported by BWIPP",
|
||||
"77777777777777777777777"
|
||||
"78578613335635131318557"
|
||||
"77678536566511516157617"
|
||||
"78378311615366353638157"
|
||||
"77578533166515131317617"
|
||||
"78378356655653353638357"
|
||||
"77878787878787878787877"
|
||||
"78678151311551153338617"
|
||||
"77578333653116611117137"
|
||||
"78178611511333155658357"
|
||||
"77378555366511536167517"
|
||||
"78178116153635315338657"
|
||||
"77777777777777777777777"
|
||||
},
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol;
|
||||
|
||||
char escaped[1024];
|
||||
char bwipp_buf[32768];
|
||||
char bwipp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP 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");
|
||||
@ -496,20 +717,32 @@ 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, %d, %s, \"%s\", %s, %d, %d, \"%s\",\n",
|
||||
printf(" /*%3d*/ { %s, %d, %d, %s, \"%s\", %s, %d, %d, %d, \"%s\",\n",
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, testUtilOption3Name(data[i].option_3),
|
||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
|
||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret),
|
||||
symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
|
||||
testUtilModulesPrint(symbol, " ", "\n");
|
||||
printf(" },\n");
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
int width, row;
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
|
||||
if (ret == 0) {
|
||||
int width, row;
|
||||
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
|
||||
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
|
||||
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
|
||||
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, data[i].option_1, -1, data[i].option_3, 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, -1, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -523,6 +756,7 @@ static void test_encode(int index, int generate, int debug) {
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
|
||||
{ "test_large", test_large, 1, 0, 1 },
|
||||
{ "test_reader_init", test_reader_init, 1, 1, 1 },
|
||||
{ "test_input", test_input, 1, 1, 1 },
|
||||
{ "test_encode", test_encode, 1, 1, 1 },
|
||||
|
Reference in New Issue
Block a user