AZTEC: fix bit-stuffing; AZTECRUNE: fix >= 128; DATAMATRIX: eod shift -> 0 pad; Qt6

This commit is contained in:
gitlost
2020-10-26 12:21:43 +00:00
parent 90012ab23f
commit 943ba79866
53 changed files with 2324 additions and 913 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -15,42 +15,42 @@ newpath
100.00 0.00 TB 0.00 130.00 TR
TE
0.00 0.00 0.00 setrgbcolor
4.00 96.00 4.00 TD
24.00 96.00 4.00 TD
64.00 96.00 4.00 TD
84.00 96.00 4.00 TD
104.00 96.00 4.00 TD
124.00 96.00 4.00 TD
34.00 86.00 4.00 TD
4.00 76.00 4.00 TD
44.00 76.00 4.00 TD
84.00 76.00 4.00 TD
104.00 76.00 4.00 TD
124.00 76.00 4.00 TD
14.00 66.00 4.00 TD
74.00 66.00 4.00 TD
94.00 66.00 4.00 TD
44.00 56.00 4.00 TD
64.00 56.00 4.00 TD
104.00 56.00 4.00 TD
14.00 46.00 4.00 TD
54.00 46.00 4.00 TD
114.00 46.00 4.00 TD
4.00 36.00 4.00 TD
44.00 36.00 4.00 TD
64.00 36.00 4.00 TD
84.00 36.00 4.00 TD
124.00 36.00 4.00 TD
14.00 26.00 4.00 TD
34.00 26.00 4.00 TD
54.00 26.00 4.00 TD
94.00 26.00 4.00 TD
4.00 16.00 4.00 TD
44.00 16.00 4.00 TD
84.00 16.00 4.00 TD
104.00 16.00 4.00 TD
124.00 16.00 4.00 TD
14.00 6.00 4.00 TD
34.00 6.00 4.00 TD
74.00 6.00 4.00 TD
114.00 6.00 4.00 TD
5.00 95.00 4.00 TD
25.00 95.00 4.00 TD
65.00 95.00 4.00 TD
85.00 95.00 4.00 TD
105.00 95.00 4.00 TD
125.00 95.00 4.00 TD
35.00 85.00 4.00 TD
5.00 75.00 4.00 TD
45.00 75.00 4.00 TD
85.00 75.00 4.00 TD
105.00 75.00 4.00 TD
125.00 75.00 4.00 TD
15.00 65.00 4.00 TD
75.00 65.00 4.00 TD
95.00 65.00 4.00 TD
45.00 55.00 4.00 TD
65.00 55.00 4.00 TD
105.00 55.00 4.00 TD
15.00 45.00 4.00 TD
55.00 45.00 4.00 TD
115.00 45.00 4.00 TD
5.00 35.00 4.00 TD
45.00 35.00 4.00 TD
65.00 35.00 4.00 TD
85.00 35.00 4.00 TD
125.00 35.00 4.00 TD
15.00 25.00 4.00 TD
35.00 25.00 4.00 TD
55.00 25.00 4.00 TD
95.00 25.00 4.00 TD
5.00 15.00 4.00 TD
45.00 15.00 4.00 TD
85.00 15.00 4.00 TD
105.00 15.00 4.00 TD
125.00 15.00 4.00 TD
15.00 5.00 4.00 TD
35.00 5.00 4.00 TD
75.00 5.00 4.00 TD
115.00 5.00 4.00 TD

Binary file not shown.

Before

Width:  |  Height:  |  Size: 688 B

After

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 682 B

View File

@ -8,44 +8,44 @@
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="130" height="100" fill="#FFFFFF" />
<circle cx="4.00" cy="4.00" r="4.00" />
<circle cx="24.00" cy="4.00" r="4.00" />
<circle cx="64.00" cy="4.00" r="4.00" />
<circle cx="84.00" cy="4.00" r="4.00" />
<circle cx="104.00" cy="4.00" r="4.00" />
<circle cx="124.00" cy="4.00" r="4.00" />
<circle cx="34.00" cy="14.00" r="4.00" />
<circle cx="4.00" cy="24.00" r="4.00" />
<circle cx="44.00" cy="24.00" r="4.00" />
<circle cx="84.00" cy="24.00" r="4.00" />
<circle cx="104.00" cy="24.00" r="4.00" />
<circle cx="124.00" cy="24.00" r="4.00" />
<circle cx="14.00" cy="34.00" r="4.00" />
<circle cx="74.00" cy="34.00" r="4.00" />
<circle cx="94.00" cy="34.00" r="4.00" />
<circle cx="44.00" cy="44.00" r="4.00" />
<circle cx="64.00" cy="44.00" r="4.00" />
<circle cx="104.00" cy="44.00" r="4.00" />
<circle cx="14.00" cy="54.00" r="4.00" />
<circle cx="54.00" cy="54.00" r="4.00" />
<circle cx="114.00" cy="54.00" r="4.00" />
<circle cx="4.00" cy="64.00" r="4.00" />
<circle cx="44.00" cy="64.00" r="4.00" />
<circle cx="64.00" cy="64.00" r="4.00" />
<circle cx="84.00" cy="64.00" r="4.00" />
<circle cx="124.00" cy="64.00" r="4.00" />
<circle cx="14.00" cy="74.00" r="4.00" />
<circle cx="34.00" cy="74.00" r="4.00" />
<circle cx="54.00" cy="74.00" r="4.00" />
<circle cx="94.00" cy="74.00" r="4.00" />
<circle cx="4.00" cy="84.00" r="4.00" />
<circle cx="44.00" cy="84.00" r="4.00" />
<circle cx="84.00" cy="84.00" r="4.00" />
<circle cx="104.00" cy="84.00" r="4.00" />
<circle cx="124.00" cy="84.00" r="4.00" />
<circle cx="14.00" cy="94.00" r="4.00" />
<circle cx="34.00" cy="94.00" r="4.00" />
<circle cx="74.00" cy="94.00" r="4.00" />
<circle cx="114.00" cy="94.00" r="4.00" />
<circle cx="5.00" cy="5.00" r="4.00" />
<circle cx="25.00" cy="5.00" r="4.00" />
<circle cx="65.00" cy="5.00" r="4.00" />
<circle cx="85.00" cy="5.00" r="4.00" />
<circle cx="105.00" cy="5.00" r="4.00" />
<circle cx="125.00" cy="5.00" r="4.00" />
<circle cx="35.00" cy="15.00" r="4.00" />
<circle cx="5.00" cy="25.00" r="4.00" />
<circle cx="45.00" cy="25.00" r="4.00" />
<circle cx="85.00" cy="25.00" r="4.00" />
<circle cx="105.00" cy="25.00" r="4.00" />
<circle cx="125.00" cy="25.00" r="4.00" />
<circle cx="15.00" cy="35.00" r="4.00" />
<circle cx="75.00" cy="35.00" r="4.00" />
<circle cx="95.00" cy="35.00" r="4.00" />
<circle cx="45.00" cy="45.00" r="4.00" />
<circle cx="65.00" cy="45.00" r="4.00" />
<circle cx="105.00" cy="45.00" r="4.00" />
<circle cx="15.00" cy="55.00" r="4.00" />
<circle cx="55.00" cy="55.00" r="4.00" />
<circle cx="115.00" cy="55.00" r="4.00" />
<circle cx="5.00" cy="65.00" r="4.00" />
<circle cx="45.00" cy="65.00" r="4.00" />
<circle cx="65.00" cy="65.00" r="4.00" />
<circle cx="85.00" cy="65.00" r="4.00" />
<circle cx="125.00" cy="65.00" r="4.00" />
<circle cx="15.00" cy="75.00" r="4.00" />
<circle cx="35.00" cy="75.00" r="4.00" />
<circle cx="55.00" cy="75.00" r="4.00" />
<circle cx="95.00" cy="75.00" r="4.00" />
<circle cx="5.00" cy="85.00" r="4.00" />
<circle cx="45.00" cy="85.00" r="4.00" />
<circle cx="85.00" cy="85.00" r="4.00" />
<circle cx="105.00" cy="85.00" r="4.00" />
<circle cx="125.00" cy="85.00" r="4.00" />
<circle cx="15.00" cy="95.00" r="4.00" />
<circle cx="35.00" cy="95.00" r="4.00" />
<circle cx="75.00" cy="95.00" r="4.00" />
<circle cx="115.00" cy="95.00" r="4.00" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -282,7 +282,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, -1, -1, -1, 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);

View File

@ -282,7 +282,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, -1, -1, -1, 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);

File diff suppressed because it is too large Load Diff

View File

@ -380,7 +380,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, data[i].option_2, -1, debug)) {
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));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);

View File

@ -444,7 +444,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, data[i].option_1, data[i].option_2, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, 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 {

View File

@ -368,7 +368,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, data[i].option_2, -1, debug)) {
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));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);

View File

@ -234,7 +234,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, data[i].option_2, -1, debug)) {
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));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);

View File

@ -665,7 +665,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, 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 {

View File

@ -278,7 +278,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, -1, -1, -1, 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);

View File

@ -212,7 +212,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, -1, -1, -1, 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);

View File

@ -1265,7 +1265,7 @@ static void test_examples(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
@ -1431,7 +1431,7 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
@ -1561,7 +1561,7 @@ static void test_ean128_cc_shift(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, 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 {
@ -2112,7 +2112,7 @@ static void test_encodation_0(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
@ -2251,7 +2251,7 @@ static void test_encodation_10(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
@ -2633,7 +2633,7 @@ static void test_encodation_11(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
@ -2786,7 +2786,7 @@ static void test_addongap(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, data[i].option_2, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) {
ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);

View File

@ -92,19 +92,19 @@ static void test_buffer(int index, int debug) {
int ret;
struct item {
char *data;
int eci;
int input_mode;
int output_options;
char *data;
int ret;
char *comment;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { "1", 16383, UNICODE_MODE, READER_INIT, 0, "" },
/* 1*/ { "000106j 05 Galeria A Nação0000000000", 3, UNICODE_MODE, 0, 0, "From Okapi, consecutive use of upper shift; ticket #176" },
/* 0*/ { 16383, UNICODE_MODE, READER_INIT, "1", 0, "" },
/* 1*/ { 3, UNICODE_MODE, 0, "000106j 05 Galeria A Nação0000000000", 0, "From Okapi, consecutive use of upper shift; #176" },
};
int data_size = sizeof(data) / sizeof(struct item);
int data_size = ARRAY_SIZE(data);
for (int i = 0; i < data_size; i++) {
@ -113,13 +113,7 @@ static void test_buffer(int index, int debug) {
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
symbol->symbology = BARCODE_DATAMATRIX;
symbol->input_mode = data[i].input_mode;
symbol->eci = data[i].eci;
symbol->output_options = data[i].output_options;
symbol->debug |= debug;
int length = strlen(data[i].data);
int length = testUtilSetSymbol(symbol, BARCODE_DATAMATRIX, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, -1, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret);
@ -130,6 +124,118 @@ static void test_buffer(int index, int debug) {
testFinish();
}
static void test_options(int index, int debug) {
testStart("");
int ret;
struct item {
int symbology;
int option_1;
int option_2;
int option_3;
char *data;
int ret;
int expected_rows;
int expected_width;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_DATAMATRIX, -1, -1, -1, "1", 0, 10, 10 },
/* 1*/ { BARCODE_DATAMATRIX, 2, -1, -1, "1", ZINT_ERROR_INVALID_OPTION, -1, -1 },
/* 2*/ { BARCODE_DATAMATRIX, -1, 1, -1, "1", 0, 10, 10 },
/* 3*/ { BARCODE_DATAMATRIX, -1, 2, -1, "1", 0, 12, 12 },
/* 4*/ { BARCODE_DATAMATRIX, -1, 48, -1, "1", 0, 26, 64 },
/* 5*/ { BARCODE_DATAMATRIX, -1, 49, -1, "1", 0, 10, 10 }, // Ignored
/* 6*/ { BARCODE_DATAMATRIX, -1, -1, -1, "ABCDEFGHIJK", 0, 8, 32 },
/* 7*/ { BARCODE_DATAMATRIX, -1, -1, DM_SQUARE, "ABCDEFGHIJK", 0, 16, 16 },
/* 8*/ { BARCODE_DATAMATRIX, -1, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", 0, 32, 32 },
/* 9*/ { BARCODE_DATAMATRIX, -1, -1, DM_DMRE, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", 0, 20, 44 },
/* 10*/ { BARCODE_DATAMATRIX, -1, -1, 9999, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", 0, 32, 32 }, // Ignored
};
int data_size = ARRAY_SIZE(data);
for (int i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, 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 (%s)\n", i, symbol->rows, data[i].expected_rows, symbol->errtxt);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, symbol->errtxt);
}
ZBarcode_Delete(symbol);
}
testFinish();
}
static void test_reader_init(int index, int generate, int debug) {
testStart("");
int ret;
struct item {
int symbology;
int input_mode;
int output_options;
char *data;
int ret;
int expected_rows;
int expected_width;
char *expected;
char *comment;
};
struct item data[] = {
/* 0*/ { BARCODE_DATAMATRIX, UNICODE_MODE, READER_INIT, "A", 0, 10, 10, "EA 42 81 19 A4 53 21 DF", "TODO: Check this" },
/* 1*/ { BARCODE_DATAMATRIX, GS1_MODE, READER_INIT, "[91]A", ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 521: Cannot encode in GS1 mode and Reader Initialisation at the same time", "" },
};
int data_size = ARRAY_SIZE(data);
char escaped[1024];
for (int i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt
int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
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, %s, %s, \"%s\", %s, %d, %d, \"%s\", \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), testUtilOutputOptionsName(data[i].output_options),
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, symbol->errtxt, data[i].comment);
} else {
if (ret < 5) {
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);
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
}
}
ZBarcode_Delete(symbol);
}
testFinish();
}
static void test_input(int index, int generate, int debug) {
testStart("");
@ -138,7 +244,6 @@ static void test_input(int index, int generate, int debug) {
struct item {
int input_mode;
int eci;
int option_1;
int option_2;
int option_3;
char *data;
@ -151,16 +256,78 @@ static void test_input(int index, int generate, int debug) {
char *comment;
};
struct item data[] = {
/* 0*/ { UNICODE_MODE, 0, -1, -1, -1, "0466010592130100000k*AGUATY80", 0, 0, 18, 18, "(32) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 93 B0 1C 3C 76 FB D4 AB 16 11", "" },
/* 1*/ { UNICODE_MODE, 0, -1, 5, -1, "0466010592130100000k*AGUATY80", 0, 0, 18, 18, "(32) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 93 B0 1C 3C 76 FB D4 AB 16 11", "" },
/* 2*/ { UNICODE_MODE, 0, -1, -1, -1, "0466010592130100000k*AGUATY8", 0, 0, 18, 18, "(32) 86 C4 83 87 DE 8F 83 82 82 E6 19 5C 07 B7 82 5F D4 3D 65 B5 97 30 00 FC 2C 4C 30 52", "" },
/* 3*/ { UNICODE_MODE, 0, -1, -1, -1, "0466010592130100000k*AGUATY80U", 0, 0, 20, 20, "(40) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 FE 56 81 76 4F AB 22 B8 6F 0A", "" },
/* 4*/ { UNICODE_MODE, 0, -1, 5, -1, "0466010592130100000k*AGUATY80U", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 522: Input too long for selected symbol size", "" },
/* 5*/ { UNICODE_MODE, 0, -1, 6, -1, "0466010592130100000k*AGUATY80U", 0, 0, 20, 20, "(40) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 FE 56 81 76 4F AB 22 B8 6F 0A", "" },
/* 6*/ { UNICODE_MODE, 0, -1, -1, -1, "0466010592130100000k*AGUATY80UA", 0, 0, 20, 20, "(40) 86 C4 83 87 DE 8F 83 82 82 31 6C E6 07 B7 82 5F D4 3D 1E 5F FE 81 1E 1B B0 FE E7 54", "" },
/* 7*/ { UNICODE_MODE, 0, -1, -1, -1, "A*0>B1*", 0, 0, 14, 14, "EE 57 AD 0E DE FE 2B 81 F8 05 75 94 1E 5F 24 0C A0 D3", "X12 symbols_left 3, process_p 1" },
/* 8*/ { UNICODE_MODE, 0, -1, -1, -1, "A*0>B1*2", 0, 0, 14, 14, "EE 57 AD 0E DE FE 2B 33 E7 BB FB 78 F9 F5 4B 11 BB 5A", "X12 symbols_left 3, process_p 2" },
/* 9*/ { UNICODE_MODE, 0, -1, -1, -1, "A*0>B1*2>", 0, 0, 14, 14, "EE 57 AD 0E DE 07 33 FE 75 99 1B 4D 76 0E 9E 49 E0 37", "X12 symbols_left 1, process_p 0" },
/* 0*/ { UNICODE_MODE, 0, -1, -1, "0466010592130100000k*AGUATY80", 0, 0, 18, 18, "(32) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 93 B0 1C 3C 76 FB D4 AB 16 11", "#208" },
/* 1*/ { UNICODE_MODE, 0, 5, -1, "0466010592130100000k*AGUATY80", 0, 0, 18, 18, "(32) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 93 B0 1C 3C 76 FB D4 AB 16 11", "" },
/* 2*/ { UNICODE_MODE, 0, -1, -1, "0466010592130100000k*AGUATY8", 0, 0, 18, 18, "(32) 86 C4 83 87 DE 8F 83 82 82 E6 19 5C 07 B7 82 5F D4 3D 65 B5 97 30 00 FC 2C 4C 30 52", "" },
/* 3*/ { UNICODE_MODE, 0, -1, -1, "0466010592130100000k*AGUATY80U", 0, 0, 20, 20, "(40) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 FE 56 81 76 4F AB 22 B8 6F 0A", "" },
/* 4*/ { UNICODE_MODE, 0, 5, -1, "0466010592130100000k*AGUATY80U", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 522: Input too long for selected symbol size", "" },
/* 5*/ { UNICODE_MODE, 0, 6, -1, "0466010592130100000k*AGUATY80U", 0, 0, 20, 20, "(40) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 FE 56 81 76 4F AB 22 B8 6F 0A", "" },
/* 6*/ { UNICODE_MODE, 0, -1, -1, "0466010592130100000k*AGUATY80UA", 0, 0, 20, 20, "(40) 86 C4 83 87 DE 8F 83 82 82 31 6C E6 07 B7 82 5F D4 3D 1E 5F FE 81 1E 1B B0 FE E7 54", "" },
/* 7*/ { UNICODE_MODE, 0, -1, -1, "A*0>B1*", 0, 0, 14, 14, "EE 57 AD 0E DE FE 2B 81 F8 05 75 94 1E 5F 24 0C A0 D3", "X12 symbols_left 3, process_p 1" },
/* 8*/ { UNICODE_MODE, 0, -1, -1, "A*0>B1*2", 0, 0, 14, 14, "EE 57 AD 0E DE FE 2B 33 E7 BB FB 78 F9 F5 4B 11 BB 5A", "X12 symbols_left 3, process_p 2" },
/* 9*/ { UNICODE_MODE, 0, -1, -1, "A*0>B1*2>", 0, 0, 14, 14, "EE 57 AD 0E DE 07 33 FE 75 99 1B 4D 76 0E 9E 49 E0 37", "X12 symbols_left 1, process_p 0" },
/* 10*/ { UNICODE_MODE, 0, -1, -1, "ABCDEF", 0, 0, 12, 12, "E6 59 E9 6D 24 3D 15 EF AA 21 F9 59", "C40 last_shift 0, symbols_left 0, process_p 0" },
/* 11*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFG", 0, 0, 14, 14, "E6 59 E9 6D 24 FE 48 81 8C 7E 09 5E 10 64 BC 5F 4C 91", "C40 last_shift 0, symbols_left 3, process_p 1" },
/* 12*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGH", 0, 0, 14, 14, "E6 59 E9 6D 24 80 49 FE DD 85 9E 5B E9 8F 4D F3 02 9C", "C40 last_shift 0, symbols_left 3, process_p 2" },
/* 13*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHI", 0, 0, 14, 14, "E6 59 E9 6D 24 80 5F FE 01 DE 20 9F AA C2 FF 8F 08 97", "C40 last_shift 0, symbols_left 1, process_p 0" },
/* 14*/ { UNICODE_MODE, 0, -1, -1, "ABCDEF\001G", 0, 0, 14, 14, "E6 59 E9 6D 24 00 3D FE 5D 5A F5 0A 8A 4E 1D 63 07 B9", "C40 last_shift 0, symbols_left 1, process_p 0" },
/* 15*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFG\001", 0, 0, 14, 14, "E6 59 E9 6D 24 7D 02 FE 14 A3 27 63 01 2F B1 94 FE FA", "C40 last_shift 0, symbols_left 1, process_p 0" },
/* 16*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFG\001H", 0, 0, 14, 14, "E6 59 E9 6D 24 7D 02 49 C2 E6 DD 06 89 51 BA 8E 9D 1F", "C40 last_shift 0, symbols_left 1, process_p 1" },
/* 17*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGH\001", 0, 0, 14, 14, "E6 59 E9 6D 24 80 49 02 4F 4D 86 23 5F 1B F9 8C 67 7E", "C40 last_shift 1, symbols_left 1, process_p 1" },
/* 18*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGH\001I", 0, 0, 8, 32, "E6 59 E9 6D 24 80 49 09 B1 FE 27 19 F1 CA B7 85 D0 25 0D 5E 24", "C40 last_shift 1, symbols_left 3, process_p 2" },
/* 19*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHI\001", 0, 0, 8, 32, "E6 59 E9 6D 24 80 5F FE 02 81 47 6C 3E 49 D3 FA 46 47 53 6E E5", "Switches to ASC for last char" },
/* 20*/ { UNICODE_MODE, 0, -1, -1, "ABCDEF+G", 0, 0, 14, 14, "E6 59 E9 6D 24 07 E5 FE 6B 35 71 7F 3D 57 59 46 F7 B9", "C40 last_shift 0, symbols_left 1, process_p 0" },
/* 21*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFG+", 0, 0, 14, 14, "E6 59 E9 6D 24 7D 33 FE 33 F5 97 60 73 48 13 2E E5 74", "C40 last_shift 0, symbols_left 1, process_p 0" },
/* 22*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFG+H", 0, 0, 14, 14, "E6 59 E9 6D 24 7D 33 49 E5 B0 6D 05 FB 36 18 34 86 91", "C40 last_shift 0, symbols_left 1, process_p 1" },
/* 23*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGH+", 0, 0, 14, 14, "E6 59 E9 6D 24 80 49 2C 67 1F 09 CA 1A CD 0D 55 80 21", "C40 last_shift 2, symbols_left 1, process_p 1" },
/* 24*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGH+I", 0, 0, 8, 32, "E6 59 E9 6D 24 80 4A 41 F1 FE 41 81 CF 13 E2 64 43 2F E1 D1 11", "C40 last_shift 2, symbols_left 3, process_p 2" },
/* 25*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHI+", 0, 0, 8, 32, "E6 59 E9 6D 24 80 5F FE 2C 81 F8 BC 8D 12 17 7E 22 27 DE 7F E2", "Switches to ASC for last char" },
/* 26*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFjG", 0, 0, 14, 14, "E6 59 E9 6D 24 0E 25 FE DA 14 D7 15 47 69 9D 4A 54 6D", "C40 last_shift 0, symbols_left 1, process_p 0" },
/* 27*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGj", 0, 0, 14, 14, "E6 59 E9 6D 24 7D 5B FE B5 F3 24 0A 99 26 D6 CC A8 40", "C40 last_shift 0, symbols_left 1, process_p 0" },
/* 28*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGjH", 0, 0, 14, 14, "E6 59 E9 6D 24 7D 5B 49 63 B6 DE 6F 11 58 DD D6 CB A5", "C40 last_shift 0, symbols_left 1, process_p 1" },
/* 29*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHj", 0, 0, 14, 14, "E6 59 E9 6D 24 80 49 6B 12 00 5B FD B0 3A D9 DF 26 B6", "C40 last_shift 3, symbols_left 1, process_p 1" },
/* 30*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHjI", 0, 0, 8, 32, "E6 59 E9 6D 24 80 4B 41 F1 FE FB 10 AC 51 A1 56 8F 20 98 18 1B", "C40 last_shift 3, symbols_left 3, process_p 2" },
/* 31*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHIj", 0, 0, 8, 32, "E6 59 E9 6D 24 80 5F FE 6B 81 17 79 06 42 7E 96 B2 70 79 F8 3C", "Switches to ASC for last char" },
/* 32*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHIJÊ", 0, 0, 16, 16, "E6 59 E9 6D 24 80 5F FE 4B EB 4B 81 DD D9 F9 C9 C5 38 F3 4B DB 80 92 A7", "Switches to ASC for last 2 chars" },
/* 33*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHIJKÊ", 0, 0, 16, 16, "E6 59 E9 6D 24 80 5F 93 82 BF 19 FE E7 50 32 B4 0B CC 8C 07 D2 78 8D F5", "C40 last_shift 0, symbols_left 3, process_p 2" },
/* 34*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHIJKª", 0, 0, 16, 16, "E6 59 E9 6D 24 80 5F 93 82 BB B2 FE 11 5C 60 32 A6 DE FC 7B 30 F1 03 56", "C40 last_shift 0, symbols_left 1, process_p 0" },
/* 35*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHIJKê", 0, 0, 16, 16, "E6 59 E9 6D 24 80 5F 93 82 BB DB FE 78 43 69 3C C2 FE F5 2E 1B 4F B6 04", "C40 last_shift 0, symbols_left 1, process_p 0" },
/* 36*/ { UNICODE_MODE, 0, -1, -1, "abcdef", 0, 0, 12, 12, "EF 59 E9 6D 24 E2 CC D9 B4 55 E2 6A", "TEX last_shift 0, symbols_left 0, process_p 0" },
/* 37*/ { UNICODE_MODE, 0, -1, -1, "abcdefg", 0, 0, 14, 14, "EF 59 E9 6D 24 FE 68 81 A9 65 CD 3A A2 E9 E0 B7 E1 E5", "TEX last_shift 0, symbols_left 3, process_p 1" },
/* 38*/ { UNICODE_MODE, 0, -1, -1, "abcdefgh", 0, 0, 14, 14, "EF 59 E9 6D 24 80 49 FE 06 E4 44 D2 32 58 90 31 E9 F8", "TEX last_shift 0, symbols_left 3, process_p 2" },
/* 39*/ { UNICODE_MODE, 0, -1, -1, "abcdefghi", 0, 0, 14, 14, "EF 59 E9 6D 24 80 5F FE DA BF FA 16 71 15 22 4D E3 F3", "TEX last_shift 0, symbols_left 1, process_p 0" },
/* 40*/ { UNICODE_MODE, 0, -1, -1, "abcdef\001g", 0, 0, 14, 14, "EF 59 E9 6D 24 00 3D FE 86 3B 2F 83 51 99 C0 A1 EC DD", "TEX last_shift 0, symbols_left 1, process_p 0" },
/* 41*/ { UNICODE_MODE, 0, -1, -1, "abcdefg\001", 0, 0, 14, 14, "EF 59 E9 6D 24 7D 02 FE CF C2 FD EA DA F8 6C 56 15 9E", "TEX last_shift 0, symbols_left 1, process_p 0" },
/* 42*/ { UNICODE_MODE, 0, -1, -1, "abcdefg\001h", 0, 0, 14, 14, "EF 59 E9 6D 24 7D 02 69 7A 9B EB A4 5E DE 99 25 01 8C", "TEX last_shift 0, symbols_left 1, process_p 1" },
/* 43*/ { UNICODE_MODE, 0, -1, -1, "abcdefgh\001", 0, 0, 14, 14, "EF 59 E9 6D 24 80 49 02 94 2C 5C AA 84 CC 24 4E 8C 1A", "TEX last_shift 1, symbols_left 1, process_p 1" },
/* 44*/ { UNICODE_MODE, 0, -1, -1, "abcdefgh\001i", 0, 0, 8, 32, "EF 59 E9 6D 24 80 49 09 B1 FE 2D DE FF 05 A9 AE 0B 91 4B C5 70", "TEX last_shift 1, symbols_left 3, process_p 2" },
/* 45*/ { UNICODE_MODE, 0, -1, -1, "abcdefghi\001", 0, 0, 8, 32, "EF 59 E9 6D 24 80 5F FE 02 81 4D AB 30 86 CD D1 9D F3 15 F5 B1", "Switches to ASC for last char" },
/* 46*/ { UNICODE_MODE, 0, -1, -1, "abcdefJg", 0, 0, 14, 14, "EF 59 E9 6D 24 0E 25 FE 01 75 0D 9C 9C BE 40 88 BF 09", "TEX last_shift 0, symbols_left 1, process_p 0" },
/* 47*/ { UNICODE_MODE, 0, -1, -1, "abcdefgJ", 0, 0, 14, 14, "EF 59 E9 6D 24 7D 5B FE 6E 92 FE 83 42 F1 0B 0E 43 24", "TEX last_shift 0, symbols_left 1, process_p 0" },
/* 48*/ { UNICODE_MODE, 0, -1, -1, "abcdefgJh", 0, 0, 14, 14, "EF 59 E9 6D 24 7D 5B 69 DB CB E8 CD C6 D7 FE 7D 57 36", "TEX last_shift 0, symbols_left 1, process_p 1" },
/* 49*/ { UNICODE_MODE, 0, -1, -1, "abcdefghJ", 0, 0, 14, 14, "EF 59 E9 6D 24 80 49 4B AA 7D 6D 5F 67 B5 FA 74 BA 25", "TEX last_shift 3, symbols_left 1, process_p 1" },
/* 50*/ { UNICODE_MODE, 0, -1, -1, "abcdefghJi", 0, 0, 8, 32, "EF 59 E9 6D 24 80 4B 41 F1 FE F1 D7 A2 9E BF 7D 54 94 DE 83 4F", "TEX last_shift 3, symbols_left 3, process_p 2" },
/* 51*/ { UNICODE_MODE, 0, -1, -1, "abcdefghiJ", 0, 0, 8, 32, "EF 59 E9 6D 24 80 5F FE 4B 81 B3 A5 20 E3 DC F9 74 40 09 30 46", "Switches to ASC for last char" },
/* 52*/ { UNICODE_MODE, 0, -1, -1, "abcdefghijkÊ", 0, 0, 16, 16, "EF 59 E9 6D 24 80 5F 93 82 BB DB FE 3E C8 EC 73 58 A7 42 46 10 49 25 99", "TEX last_shift 0, symbols_left 1, process_p 0" },
/* 53*/ { UNICODE_MODE, 0, -1, -1, "abcdefghijkª", 0, 0, 16, 16, "EF 59 E9 6D 24 80 5F 93 82 BB B2 FE 57 D7 E5 7D 3C 87 4B 13 3B F7 90 CB", "TEX last_shift 0, symbols_left 1, process_p 0" },
/* 54*/ { UNICODE_MODE, 0, -1, -1, "abcdefghijkê", 0, 0, 16, 16, "EF 59 E9 6D 24 80 5F 93 82 BF 19 FE A1 DB B7 FB 91 95 3B 6F D9 7E 1E 68", "TEX last_shift 2, symbols_left 3, process_p 2" },
/* 55*/ { UNICODE_MODE, 0, -1, -1, "@AB@CD@E", 0, 0, 14, 14, "F0 00 10 80 0C 40 05 81 45 D9 9B 1F BC 09 CD E4 7F F4", "EDIFACT symbols_left 1, process_p 0" },
/* 56*/ { UNICODE_MODE, 0, -1, -1, "@AB@CD@EF", 0, 0, 14, 14, "F0 00 10 80 0C 40 05 47 AC D8 F1 F0 DE 6C 30 5E 30 D4", "EDIFACT symbols_left 1, process_p 1" },
/* 57*/ { UNICODE_MODE, 0, -1, -1, "@AB@CD@EF@", 0, 0, 8, 32, "F0 00 10 80 0C 40 05 18 07 C0 6C 60 CA 7E 7B F3 38 A1 9D D0 CC", "EDIFACT symbols_left 3, process_p 2" },
/* 58*/ { UNICODE_MODE, 0, -1, -1, "@AB@CD@EF@G", 0, 0, 8, 32, "F0 00 10 80 0C 40 05 18 01 DF 71 FB 95 EA E6 4B 36 E0 23 9B 4C", "EDIFACT symbols_left 3, process_p 3" },
/* 59*/ { UNICODE_MODE, 0, -1, -1, "@AB@CD@EF@GH", 0, 0, 8, 32, "F0 00 10 80 0C 40 05 18 01 C8 77 0F 96 AD 39 FB F3 04 3B BF 99", "EDIFACT symbols_left 0, process_p 0" },
/* 60*/ { UNICODE_MODE, 0, -1, -1, "@AB@CD@EF@GH@", 0, 0, 16, 16, "F0 00 10 80 0C 40 05 18 01 C8 41 81 4A 43 1E F1 26 2E 4B EB B8 6A 2B 64", "EDIFACT symbols_left 2, process_p 1" },
/* 61*/ { UNICODE_MODE, 0, -1, -1, "@AB@CD@EF@GH@I", 0, 0, 16, 16, "F0 00 10 80 0C 40 05 18 01 C8 41 4A 49 B3 34 91 8C 2A C4 0E 16 2F 45 9B", "EDIFACT symbols_left 2, process_p 2" },
/* 62*/ { DATA_MODE, 0, -1, -1, "\377\376", 0, 0, 12, 12, "EB 80 EB 7F 81 6F A8 0F 21 6F 5F 88", "FN4 A7F FN4 A7E" },
/* 63*/ { DATA_MODE, 0, -1, -1, "\377\376\375", 0, 0, 12, 12, "E7 2F C0 55 E9 52 B7 8D 38 76 E8 6E", "BAS BFF BFE BFD" },
/* 64*/ { DATA_MODE, 3, -1, -1, "\101\102\103\104\300\105\310", 0, 3, 16, 16, "F1 04 E7 5E 2D C4 5B F1 03 1D 36 81 64 0E C0 77 9A 18 52 B2 F9 F0 04 39", "ECI 4 BAS B41 B42 B43 B44 BC0 B45 BC8" },
/* 65*/ { UNICODE_MODE, 26, -1, -1, "ABCDÀEÈ", 0, 26, 12, 26, "F1 1B E7 60 2D C4 5B F1 06 58 B3 C7 21 81 57 ED 3D C0 12 2E 6C 80 58 CC 2C 05 0D 31 FC 2D", "ECI 27 BAS B41 B42 B43 B44 BC3 B80 B45 BC3 B88" },
/* 66*/ { UNICODE_MODE, 0, -1, -1, "β", ZINT_WARN_USES_ECI, 9, 12, 12, "Warning F1 0A EB 63 81 41 56 DA C0 3D 2D CC", "ECI 10 FN4 A62" },
/* 67*/ { UNICODE_MODE, 127, -1, -1, "A", 0, 127, 12, 12, "F1 80 01 42 81 14 A2 86 07 F5 27 30", "ECI 128 A41" },
/* 68*/ { UNICODE_MODE, 16382, -1, -1, "A", 0, 16382, 12, 12, "F1 BF FE 42 81 29 57 AA A0 92 B2 45", "ECI 16383 A41" },
/* 69*/ { UNICODE_MODE, 810899, -1, -1, "A", 0, 810899, 12, 12, "F1 CC 51 05 42 BB A5 A7 8A C6 6E 0F", "ECI 810900 A41" },
/* 70*/ { UNICODE_MODE, 26, -1, -1, "abcdefghi1234FGHIJKLMNabc@@@@@@@@@é", 0, 26, 24, 24, "(60) F1 1B EF 59 E9 6D 24 80 5F FE 8E A4 E6 79 F6 8D 31 A0 6C FE 62 63 64 F0 00 00 00 00", "Mix of modes TEX ASC C40 ASC EDI BAS" },
/* 71*/ { UNICODE_MODE | ESCAPE_MODE, -1, -1, -1, "[)>\\R05\\GA\\R\\E", 0, 0, 10, 10, "EC 42 81 5D 17 49 F6 B6", "Macro05 A41" },
};
int data_size = ARRAY_SIZE(data);
@ -175,14 +342,14 @@ static void test_input(int index, int generate, int debug) {
symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt
int length = testUtilSetSymbol(symbol, BARCODE_DATAMATRIX, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
int length = testUtilSetSymbol(symbol, BARCODE_DATAMATRIX, data[i].input_mode, data[i].eci, -1 /*option_1*/, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret);
if (generate) {
printf(" /*%3d*/ { %s, %d, %d, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\", \"%s\" },\n",
i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, data[i].option_2, data[i].option_3, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
printf(" /*%3d*/ { %s, %d, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\", \"%s\" },\n",
i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_2, data[i].option_3, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilErrorName(data[i].ret), ret < 5 ? symbol->eci : -1, symbol->rows, symbol->width, symbol->errtxt, data[i].comment);
} else {
if (ret < 5) {
@ -203,20 +370,28 @@ static void test_encode(int index, int generate, int debug) {
testStart("");
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise
int ret;
struct item {
int symbology;
int input_mode;
int eci;
int output_options;
int option_2;
int option_3;
char *data;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
};
// Verified manually against ISO/IEC 16022:2006, GS1 General Specifications 20.0 (GGS), ANSI/HIBC LIC 2.6-2016 (HIBC/LIC) and ANSI/HIBC PAS 1.3-2010 (HIBC/PAS), with noted exceptions
struct item data[] = {
/* 0*/ { BARCODE_DATAMATRIX, -1, "1234abcd", 0, 14, 14, "",
/* 0*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, "1234abcd", 0, 14, 14, 1, "",
"10101010101010"
"11001010001111"
"11000101100100"
@ -232,7 +407,7 @@ static void test_encode(int index, int generate, int debug) {
"10011111000100"
"11111111111111"
},
/* 1*/ { BARCODE_DATAMATRIX, -1, "A1B2C3D4E5F6G7H8I9J0K1L2", 0, 18, 18, "ISO 16022:2006 Figure 1",
/* 1*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, "A1B2C3D4E5F6G7H8I9J0K1L2", 0, 18, 18, 1, "ISO 16022:2006 Figure 1",
"101010101010101010"
"101000101010001111"
"101100000111000010"
@ -252,7 +427,7 @@ static void test_encode(int index, int generate, int debug) {
"100011000000100100"
"111111111111111111"
},
/* 2*/ { BARCODE_DATAMATRIX, -1, "123456", 0, 10, 10, "ISO 16022:2006 Figure O.2",
/* 2*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, "123456", 0, 10, 10, 1, "ISO 16022:2006 Figure O.2",
"1010101010"
"1100101101"
"1100000100"
@ -264,7 +439,7 @@ static void test_encode(int index, int generate, int debug) {
"1001110100"
"1111111111"
},
/* 3*/ { BARCODE_DATAMATRIX, -1, "30Q324343430794<OQQ", 0, 16, 16, "ISO 16022:2006 Figure R.1",
/* 3*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, "30Q324343430794<OQQ", 0, 16, 16, 1, "ISO 16022:2006 Figure R.1",
"1010101010101010"
"1010101010000001"
"1010101011101100"
@ -282,7 +457,7 @@ static void test_encode(int index, int generate, int debug) {
"1110010010100010"
"1111111111111111"
},
/* 4*/ { BARCODE_DATAMATRIX, GS1_MODE, "[01]09501101530003[17]150119[10]AB-123", 0, 20, 20, "GS1 General Specfications 20.0 Figure 2.6.14-3",
/* 4*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, -1, "[01]09501101530003[17]150119[10]AB-123", 0, 20, 20, 1, "GGS Figure 2.6.14-3",
"10101010101010101010"
"11001111010100000111"
"10001010001001010100"
@ -304,7 +479,7 @@ static void test_encode(int index, int generate, int debug) {
"10011011100101011010"
"11111111111111111111"
},
/* 5*/ { BARCODE_DATAMATRIX, GS1_MODE, "[01]04012345678901[21]ABCDEFG123456789", 0, 20, 20, "GS1 General Specfications 20.0 Figure 2.6.14-4",
/* 5*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, -1, "[01]04012345678901[21]ABCDEFG123456789", 0, 20, 20, 1, "GGS Figure 2.6.14-4",
"10101010101010101010"
"11011000001101000111"
"10001001100001110100"
@ -326,7 +501,7 @@ static void test_encode(int index, int generate, int debug) {
"10001000100001111010"
"11111111111111111111"
},
/* 6*/ { BARCODE_DATAMATRIX, GS1_MODE, "[01]04012345678901[17]170101[10]ABC123", 0, 20, 20, "GS1 General Specfications 20.0 Figure 4.15-1",
/* 6*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, -1, "[01]04012345678901[17]170101[10]ABC123", 0, 20, 20, 1, "GGS Figure 4.15-1 (and 5.1-6)",
"10101010101010101010"
"11011000010100000111"
"10001001100001010100"
@ -348,7 +523,41 @@ static void test_encode(int index, int generate, int debug) {
"10001000000101111010"
"11111111111111111111"
},
/* 7*/ { BARCODE_DATAMATRIX, GS1_MODE, "[01]09504000059101[21]12345678p901[10]1234567p[17]141120[8200]http://www.gs1.org/demo/", 0, 32, 32, "GS1 General Specfications 20.0 Figure 4.15.1-2 **NOT SMAE** TODO: investigate",
/* 7*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, GS1_GS_SEPARATOR, -1, -1, "[01]09504000059101[21]12345678p901[10]1234567p[17]141120[8200]http://www.gs1.org/demo/", 0, 32, 32, 1, "GGS Figure 4.15.1-1; BWIPP does not support GS1_GS_SEPARATOR",
"10101010101010101010101010101010"
"11001111010000111101100000101001"
"10001010011111001011011001000010"
"10111011001001111101111101000101"
"11100101000010001000011011011110"
"10000101001101111010111000100101"
"10010001000100101000000010011110"
"10010110011101011000101100101111"
"11101010110010001100011100110100"
"11011100110110111101010000001001"
"10001010000101001100001111001110"
"10110011010101111000011101111101"
"11101100100110101110111010101110"
"11100100000001111000001111101001"
"10100010111011101110111100110100"
"11111111111111111111111111111111"
"10101010101010101010101010101010"
"11100011100111111000011111010111"
"11001100001100001001110100001010"
"10111011010001111010100110101101"
"11101011010011001101110011011010"
"10010000011010011110111111111011"
"11000101110110101110001110011000"
"10000010111010011001011100011111"
"10110011101000001100011001110010"
"10111010000110011100110100001001"
"10010001100011101101100010101110"
"11101001011010111000000100111001"
"10000010111010001001110111010000"
"11001101000110011110000111010101"
"10111100011001001010011100011000"
"11111111111111111111111111111111"
},
/* 8*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, -1, "[01]09504000059101[21]12345678p901[10]1234567p[17]141120[8200]http://www.gs1.org/demo/", 0, 32, 32, 0, "GGS Figure 4.15.1-2; BWIPP different encodation (does not use 0 padded Text)",
"10101010101010101010101010101010"
"11001111010000111101100000101001"
"10001010011111001011011001000010"
@ -358,31 +567,191 @@ static void test_encode(int index, int generate, int debug) {
"10010001110100101000000010011110"
"10010110101101011000101100101111"
"11101010000010001100011100110100"
"11011100110110111101010000001001"
"10001010000101001100000111011010"
"10110011010101111000011001111001"
"11101100100110101110010100010110"
"11100100000001111000101100010101"
"10100010111011101100011101011010"
"11011100110110111101010000000001"
"10001010000101001100000111001010"
"10110011010101111000011101001001"
"11101100100110101110111101100110"
"11100100000001111000010101110111"
"10100010111011101101011111011100"
"11111111111111111111111111111111"
"10101010101010101010101010101010"
"11111011100111111011101011111111"
"11010100001100001001011001001010"
"10100011010010011101010101001101"
"11101011010000101011001110001110"
"10010000011001111110010000110111"
"11000101110110101010001111101000"
"10000010110111111010001011110011"
"10110011100010101010001011101000"
"10111010000000111100111100110001"
"10010000110001101101001110110110"
"11101001001110011001101111101001"
"10000000111100001100000010010000"
"11001101001100011110110001010101"
"10110100011001101010010100011000"
"11111011100111111011010111011111"
"11010100001100101101010101100010"
"10100011010001111101001011000101"
"11101011010011101001011111100010"
"10010000011001011100110010100111"
"11000101110000001000000000001100"
"10000010110010111010010010011001"
"10110011010000001010100111110000"
"10111010001101111111010011010001"
"10010000001110101110101110001110"
"11101010000000111000010000000001"
"10000101011111101011001111101100"
"11000111011001111110111101000101"
"10111010011011101010011100011000"
"11111111111111111111111111111111"
},
/* 8*/ { BARCODE_HIBC_DM, -1, "A123BJC5D6E71", 0, 16, 16, "**NOT SAME** ANSI/HIBC 2.6 - 2016 Figure 3 TODO: investigate",
/* 9*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, -1, "[01]09512345678901[15]170810[21]abcde", 0, 20, 20, 1, "GGS Figure 5.6.2-1",
"10101010101010101010"
"11001111010111100111"
"10001010100101010100"
"10110111010010011001"
"11100010010101101110"
"10101100101000111101"
"11111010011000000110"
"10010011100000101101"
"10101001101011000010"
"11000110000100011111"
"10001011010001100010"
"10110000101001000011"
"11110011011001011100"
"11011101001000101011"
"11111101001000110110"
"11011100110000101111"
"11000100001111110000"
"11011111110010101101"
"10011010101001110010"
"11111111111111111111"
},
/* 10*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, -1, "[01]00012345678905[17]040115", 0, 12, 26, 1, "GGS Figure 5.6.2-1 (left)",
"10101010101010101010101010"
"11001000010011010100111111"
"10001001100010001111001010"
"10110111011000001001001111"
"11100010100100100010001100"
"10101100110101011101101001"
"11111000111110101001010010"
"10011111101010111001100001"
"10101110101000110000010010"
"11001101010110000111100111"
"10001001100010100010100000"
"11111111111111111111111111"
},
/* 11*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, DM_SQUARE, "[01]00012345678905[17]040115", 0, 18, 18, 1, "GGS Figure 5.6.2-1 (right)",
"101010101010101010"
"110010000100010101"
"100010011010111110"
"101101110001101111"
"111000100010101100"
"101011001100010001"
"111110000010101010"
"100101100110101101"
"101010101001110110"
"110011110001110011"
"100000111010111100"
"111100000000010111"
"111011010101010010"
"111111111001001011"
"100011100101010000"
"111100011101000011"
"100000101110000100"
"111111111111111111"
},
/* 12*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, -1, "[01]00012345678905[17]180401[21]ABCDEFGHIJKL12345678[91]ABCDEFGHI123456789[92]abcdefghi", 0, 32, 32, 0, "GGS Figure 5.6.3.2-3 (left) **NOT SAME** different encodation; BWIP different encodation, same no. of codewords",
"10101010101010101010101010101010"
"11001000010111111000100110101011"
"10001001100001101100110010100010"
"10110111001101111110011001000111"
"11100010001100101100101001011110"
"10101101101011111110000000100101"
"11111010010010101101000010011110"
"10010100101111011101101100101111"
"10101000101101101111111100110100"
"11001110011000111111110000001001"
"10001010001010101101001111001110"
"11110001000000111101011100101101"
"11010001111011001000011010000010"
"11011100101001111001000111111111"
"10111100101001101111011101000010"
"11111111111111111111111111111111"
"10101010101010101010101010101010"
"11010100111011111001101111100111"
"11100111010011001011100001001010"
"11111001010111011101111000110011"
"11110000000010101101001110000110"
"11101110000001111011101000010101"
"11110101001101101101110000001000"
"10101011000111111010111001100111"
"11000101010010001100000011101010"
"11111101110111011001111011001101"
"11010111011010001000011101001010"
"10100111111110111101010111100011"
"10111011111010001001001100101110"
"10010101001110111101000101111101"
"11110110001001001010110111010110"
"11111111111111111111111111111111"
},
/* 13*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, 30, -1, "[01]00012345678905[17]180401[21]ABCDEFGHIJKL12345678[91]abcdefghi", 0, 16, 48, 1, "GGS Figure 5.6.3.2-3 (right) **NOT SAME** different encodation",
"101010101010101010101010101010101010101010101010"
"110010000101111001000011101101100100111011001111"
"100010011000011101111100100100011000110010111100"
"101101110011011100100111100111101110111110100011"
"111000100011001100111010101000011110001110111110"
"101011011010110100101101100100010101101110101111"
"111110100100100101111000101001100001101001001010"
"100101001011111001111001110110100101101100010111"
"101010001011111100111100100010000000011110001100"
"110011100101101010111011110111110111100111011001"
"100010100011010010111100100100101000001000011110"
"111100010010101101110001100001000001010110001001"
"110100001000101000011100101010101100011001001010"
"110111001110010000011111101111000110100011011011"
"101110001010001011101010101101111111111000000100"
"111111111111111111111111111111111111111111111111"
},
/* 14*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, DM_SQUARE, "[00]395011010013000129[403]123+1021JK+0320+12[421]5281500KM", 0, 24, 24, 1, "GGS Figure 6.6.5-6 **NOT SAME** figure has unnecessary FNC1 at end of data",
"101010101010101010101010"
"110001110100011010101101"
"100010100100101000011000"
"101000110001001011100001"
"111010110110100001100010"
"100001001001010100001111"
"100110110111100000000100"
"100101110011001001100001"
"110000010110101011100010"
"110011001100011101110101"
"100000100011111010000000"
"101010110110011011000001"
"111010001001101000110000"
"110001000100011110101101"
"101011011101110000101000"
"110111000100011101011111"
"110101001010111101000010"
"110000111110111111111001"
"100101110010001010110110"
"111011010010000000100111"
"100110111101001000000100"
"101111000010010011111101"
"111001011011101100011010"
"111111111111111111111111"
},
/* 15*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, -1, "[00]093123450000000012[421]0362770[401]931234518430GR[403]MEL", 0, 24, 24, 1, "GGS Figure 6.6.5-7 **NOT SAME** different encodation",
"101010101010101010101010"
"110011100101100110110101"
"100010001001111010000100"
"101001110100001011100011"
"111000110111000001101010"
"101011010010100110000111"
"101110011000011000001100"
"100101101011010001101001"
"110000100101011011101110"
"110010010110101101110001"
"100010101101001011010000"
"101010001000100000011001"
"101000101010000010000100"
"100110101110101100010101"
"100010010000111001000000"
"101000001001111000011011"
"111110000111001110000010"
"110001110101001101101111"
"110111110101100111101110"
"110100010010101011110101"
"110011000001011110100010"
"100111010001010011000101"
"101110011001110010101010"
"111111111111111111111111"
},
/* 16*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, -1, "A123BJC5D6E71", 0, 16, 16, 1, "HIBC/LIC Figure 3 **NOT SAME** different encodation, same no. of codewords",
"1010101010101010"
"1110000011011011"
"1100001110001000"
@ -400,7 +769,7 @@ static void test_encode(int index, int generate, int debug) {
"1100101101000010"
"1111111111111111"
},
/* 9*/ { BARCODE_HIBC_DM, -1, "A123BJC5D6E71/$$52001510X3", 0, 20, 20, "**NOT SAME** ANSI/HIBC 2.6 - 2016 Section 4.3.3 TODO: investigate",
/* 17*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, -1, "A123BJC5D6E71/$$52001510X3", 0, 20, 20, 1, "HIBC/LIC Section 4.3.3 **NOT SAME** different encodation; also figure has weird CRLF after check digit",
"10101010101010101010"
"11100000100101100001"
"11000011111010101100"
@ -422,7 +791,7 @@ static void test_encode(int index, int generate, int debug) {
"10110110110000011010"
"11111111111111111111"
},
/* 10*/ { BARCODE_HIBC_DM, -1, "H123ABC01234567890", 0, 12, 26, "ANSI/HIBC 2.6 - 2016 Figure C2, same",
/* 18*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, -1, "H123ABC01234567890", 0, 12, 26, 1, "HIBC/LIC Figure C2, same",
"10101010101010101010101010"
"10111011011011110101001101"
"10010110000001001100110100"
@ -436,9 +805,223 @@ static void test_encode(int index, int generate, int debug) {
"10010010001100110000011010"
"11111111111111111111111111"
},
/* 19*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, DM_SQUARE, "/ACMRN123456/V200912190833", 0, 20, 20, 1, "HIBC/PAS Section 2.2 Patient Id, same",
"10101010101010101010"
"10001000010011001001"
"11100110001010110100"
"10000010111001010101"
"11011100101010111100"
"10010001110010100001"
"11011110100100100110"
"10110000100000101111"
"11111100011100001000"
"11001011011010001101"
"11001010111110110000"
"11000001111100001111"
"11110010001100000100"
"10011011100010110011"
"11111100110000111110"
"11000110111111110001"
"11000001011001100110"
"10101010010101100101"
"10000100100110010010"
"11111111111111111111"
},
/* 20*/ { BARCODE_DATAMATRIX, DATA_MODE | ESCAPE_MODE, -1, -1, -1, -1, "[)>\\R06\\G+/ACMRN123456/V2009121908334\\R\\E", 0, 20, 20, 1, "HIBC/PAS Section 2.2 Patient Id Macro, same",
"10101010101010101010"
"10000000001110001111"
"11010101001010011100"
"11000000011100110101"
"11011001101011001100"
"11001100000100010001"
"11110111101011000100"
"11010010001101100001"
"11110010010110011110"
"11010010010000010011"
"10010001100010110000"
"11101100100001000111"
"11101010000011111100"
"11000010000101001011"
"11001110111110010010"
"11000010110100011101"
"11001011001001011100"
"10010110010000010101"
"11100110001010111010"
"11111111111111111111"
},
/* 21*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, -1, "/EO523201", 0, 14, 14, 1, "HIBC/PAS Section 2.2 Purchase Order, same",
"10101010101010"
"10011001010101"
"11101000011010"
"10001100011101"
"11101100101100"
"10100001101111"
"10010001010110"
"10000001011001"
"11100000010100"
"11011010100101"
"10111110101110"
"11110000101101"
"10010010000100"
"11111111111111"
},
/* 22*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, DM_SQUARE, "/EU720060FF0/O523201", 0, 18, 18, 1, "HIBC/PAS Section 2.2 2nd Purchase Order, same",
"101010101010101010"
"100110010100100001"
"111011110110010110"
"100000101110011001"
"111001001010000100"
"100000000000011101"
"100101100000101110"
"111000000111111011"
"110110111000101010"
"101001000111000111"
"100011110101010110"
"111111001101010011"
"100000000001101000"
"110100100011011111"
"111000100110101110"
"111010100101000011"
"111000010011001010"
"111111111111111111"
},
/* 23*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, -1, "/EU720060FF0/O523201/Z34H159/M9842431340", 0, 22, 22, 1, "HIBC/PAS Section 2.2 3rd Purchase Order (left), same",
"1010101010101010101010"
"1001100101001000000011"
"1110111101100001111010"
"1000001011101100111111"
"1110010010010000111100"
"1000000000011100000111"
"1001011010011000001110"
"1110000010001001101001"
"1101100110001010100100"
"1010010011011101000101"
"1000100011010000001110"
"1111010100101000010111"
"1000001001011011101110"
"1111110111111101100011"
"1001010110011010000000"
"1101010100110100010011"
"1001010011000110000000"
"1111001010100101110111"
"1100110010110011010000"
"1100001011100001000111"
"1010110000010001001000"
"1111111111111111111111"
},
/* 24*/ { BARCODE_DATAMATRIX, DATA_MODE | ESCAPE_MODE, -1, -1, -1, -1, "[)>\\R06\\G+/EU720060FF0/O523201/Z34H159/M9842431340V\\R\\E", 0, 22, 22, 1, "HIBC/PAS Section 2.2 3rd Purchase Order (right), same",
"1010101010101010101010"
"1000000000111010011101"
"1101011100101001011100"
"1100010000000001101001"
"1111110110000111100000"
"1100100000110011001101"
"1001011001000010000110"
"1000100101110111110111"
"1100001001110111111100"
"1011111001001010001101"
"1000011000010100101010"
"1111001101110100101101"
"1110001101101100001100"
"1001010101111010110011"
"1000110111011100101010"
"1111110011011111010101"
"1101000011100111101110"
"1011000010010100110111"
"1001110101111101000000"
"1110101001011011000111"
"1001110110011101101000"
"1111111111111111111111"
},
/* 25*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, -1, "/E+/KN12345", 0, 16, 16, 1, "HIBC/PAS Section 2.2 Asset Tag **NOT SAME** check digit 'A' in figure is for '/KN12345', but actual data is as given here, when check digit is 'J'",
"1010101010101010"
"1001101010001111"
"1110001000101100"
"1000110100101101"
"1101000000110010"
"1000101001000001"
"1110000111001100"
"1010001101111101"
"1111101010101000"
"1101100101010001"
"1100001011010010"
"1100001111001001"
"1100010100000110"
"1010001101001101"
"1001000000000010"
"1111111111111111"
},
/* 26*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, -1, "/LAH123/NC903", 0, 16, 16, 1, "HIBC/PAS Section 2.2 Surgical Instrument, same",
"1010101010101010"
"1001010001010001"
"1110010100000100"
"1000001100000011"
"1110001100101000"
"1000111111100001"
"1011001110000100"
"1100110000001101"
"1000001110010000"
"1011001110111111"
"1001011010011010"
"1111000110111011"
"1010010101000100"
"1011001110110101"
"1100000101010010"
"1111111111111111"
},
/* 27*/ { BARCODE_DATAMATRIX, DATA_MODE, 3, -1, -1, -1, "\101\300", 0, 12, 12, 1, "",
"101010101010"
"100010101111"
"100001011110"
"110000010001"
"101100110000"
"110010100111"
"101011011100"
"110100111101"
"101100110100"
"101011100101"
"100011011010"
"111111111111"
},
/* 28*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 26, -1, -1, -1, "", 0, 14, 14, 1, "",
"10101010101010"
"10001010100001"
"10110101100100"
"10110001000101"
"10111000100010"
"11101011110011"
"10011100001100"
"10001100101111"
"10110110111110"
"10000111010001"
"10000001111000"
"11110100110001"
"11000110001100"
"11111111111111"
},
/* 29*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, -1, -1, -1, "abcdefgh+", 0, 14, 14, 0, "TEX last_shift 2, symbols_left 1, process_p 1; BWIPP different encodation (does not use 0 padded Text)",
"10101010101010"
"10100110111011"
"10110010100010"
"10011000100101"
"11101000000000"
"11000110110111"
"11000010110100"
"10101011010111"
"10111110000100"
"11011001001111"
"11110111100000"
"11001011110101"
"10010111010100"
"11111111111111"
},
};
int data_size = ARRAY_SIZE(data);
char escaped[1024];
char bwipp_buf[8192];
char bwipp_msg[1024];
for (int i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
@ -446,15 +1029,16 @@ static void test_encode(int index, int generate, int debug) {
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, -1 /*option_1*/, data[i].option_2, data[i].option_3, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret);
if (generate) {
printf(" /*%3d*/ { %s, %s, \"%s\", %s, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
data[i].data, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
printf(" /*%3d*/ { %s, %s, %d, %s, %d, %s, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].eci, testUtilOutputOptionsName(data[i].output_options),
data[i].option_2, testUtilOption3Name(data[i].option_3), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
testUtilModulesDump(symbol, " ", "\n");
printf(" },\n");
} else {
@ -462,10 +1046,21 @@ static void test_encode(int index, int generate, int debug) {
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);
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);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, 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, -1, data[i].option_2, 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);
}
}
}
}
@ -481,6 +1076,8 @@ int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
{ "test_large", test_large, 1, 0, 1 },
{ "test_buffer", test_buffer, 1, 0, 1 },
{ "test_options", test_options, 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 },
};

View File

@ -213,7 +213,7 @@ static void test_gs1_reduce(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, -1, -1, debug)) {
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));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);

View File

@ -267,7 +267,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, -1, -1, -1, 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);

View File

@ -283,7 +283,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, data[i].option_2, -1, debug)) {
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));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);

View File

@ -186,7 +186,7 @@ static void test_input(int index, int generate, int debug) {
char *comment;
};
// é U+00E9 (\351, 233), UTF-8 C3A9
// β U+03B2 in ISO 8859-7 Greek (but not other ISO 8859 or Win page), in Shift JIS 0x83C0, UTF-8 CEB2
// β U+03B2 in ISO 8859-7 Greek (but not other ISO 8859 or Win page) (\342, 226), UTF-8 CEB2
struct item data[] = {
/* 0*/ { BARCODE_PDF417, UNICODE_MODE, -1, "é", 0, 0, 6, 103, "(12) 4 913 233 900 398 878 279 350 217 295 231 77", "" },
/* 1*/ { BARCODE_PDF417, UNICODE_MODE, 3, "é", 0, 3, 7, 103, "(14) 6 927 3 913 233 900 162 81 551 529 607 384 164 108", "" },
@ -261,6 +261,7 @@ static void test_encode(int index, int generate, int debug) {
int ret;
struct item {
int symbology;
int eci;
int input_mode;
int option_1;
int option_2;
@ -274,7 +275,7 @@ static void test_encode(int index, int generate, int debug) {
char *expected;
};
struct item data[] = {
/* 0*/ { BARCODE_PDF417, UNICODE_MODE, 1, 2, "PDF417 Symbology Standard", 0, 10, 103, 0, "ISO 15438:2015 Figure 1, same, BWIPP uses different encodation, same codeword count",
/* 0*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 2, "PDF417 Symbology Standard", 0, 10, 103, 0, "ISO 15438:2015 Figure 1, same, BWIPP uses different encodation, same codeword count",
"1111111101010100011101010011100000111010110011110001110111011001100011110101011110000111111101000101001"
"1111111101010100011111010100110000110100001110001001111010001010000011111010100110000111111101000101001"
"1111111101010100011101010111111000101100110111100001110111111000101011010100111110000111111101000101001"
@ -286,14 +287,14 @@ static void test_encode(int index, int generate, int debug) {
"1111111101010100011010011011111100110000101001111101101111100010001010100110011111000111111101000101001"
"1111111101010100010100011000001100100010111101111001100011100011001011010001100011100111111101000101001"
},
/* 1*/ { BARCODE_PDF417, UNICODE_MODE, 1, 2, "PDF417", 0, 5, 103, 1, "ISO 15438:2015 Annex Q example for generating ECC",
/* 1*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 2, "PDF417", 0, 5, 103, 1, "ISO 15438:2015 Annex Q example for generating ECC",
"1111111101010100011110101011110000110101000110000001110111011001100011110101011110000111111101000101001"
"1111111101010100011111101010011100110100001110001001111010001010000011111101010111000111111101000101001"
"1111111101010100011101010111111000101100110011110001100011111001001011101010011111100111111101000101001"
"1111111101010100010101111001111000101011101110000001100001101000100010101111001111000111111101000101001"
"1111111101010100011101011100011000100001101011111101111110110001011011101011100110000111111101000101001"
},
/* 2*/ { BARCODE_PDF417, UNICODE_MODE, 0, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ ", 0, 17, 86, 1, "Text Compaction Alpha",
/* 2*/ { BARCODE_PDF417, -1, UNICODE_MODE, 0, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ ", 0, 17, 86, 1, "Text Compaction Alpha",
"11111111010101000111110101001111101101011001110000011101010111000000111111101000101001"
"11111111010101000111111010101110001111110101011100011110101000100000111111101000101001"
"11111111010101000110101011111000001010011001111100011101010111111000111111101000101001"
@ -312,7 +313,7 @@ static void test_encode(int index, int generate, int debug) {
"11111111010101000110010110111000001100011000100001011100101000111000111111101000101001"
"11111111010101000101000111100100001110000101100010010100011110000100111111101000101001"
},
/* 3*/ { BARCODE_PDF417, UNICODE_MODE, 1, 1, "abcdefghijklmnopqrstuvwxyz ", 0, 19, 86, 1, "Text Compaction Lower",
/* 3*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 1, "abcdefghijklmnopqrstuvwxyz ", 0, 19, 86, 1, "Text Compaction Lower",
"11111111010101000110101000110000001101011001110000011101010111000000111111101000101001"
"11111111010101000111110101001100001100000101110010011111010100011000111111101000101001"
"11111111010101000110101011111000001111101011110110011010100111110000111111101000101001"
@ -333,14 +334,14 @@ static void test_encode(int index, int generate, int debug) {
"11111111010101000111111001011101101010000001001111010010111001111110111111101000101001"
"11111111010101000111011010000110001000100111001110011110110100111000111111101000101001"
},
/* 4*/ { BARCODE_PDF417, UNICODE_MODE, 1, 4, "0123456&\015\011,:#-.$/+%*=^ 789", 0, 5, 137, 1, "Text Compaction Mixed",
/* 4*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "0123456&\015\011,:#-.$/+%*=^ 789", 0, 5, 137, 1, "Text Compaction Mixed",
"11111111010101000111101010111100001110101100111100010000110111001100110101111001111101010001110111000011101010011100000111111101000101001"
"11111111010101000111111010100111001010001111000001011101101111001100110110011110010001110010000011010011111101010111000111111101000101001"
"11111111010101000110101001111100001100111010000111011011110010110000100000101011110001101111101010000011101010011111100111111101000101001"
"11111111010101000101011110011110001000010000100001010010011000011000110010000100110001000011000110010010101111101111100111111101000101001"
"11111111010101000111010111000110001001111001001111010000101111101100100011110010111101001111110110111011101011100110000111111101000101001"
},
/* 5*/ { BARCODE_PDF417, UNICODE_MODE, 3, 2, ";<>@[\\]_'~!\015\011,:\012-.$/\"|*()?{", 0, 16, 103, 1, "Text Compaction Punctuation",
/* 5*/ { BARCODE_PDF417, -1, UNICODE_MODE, 3, 2, ";<>@[\\]_'~!\015\011,:\012-.$/\"|*()?{", 0, 16, 103, 1, "Text Compaction Punctuation",
"1111111101010100011111010100111110111010110011110001000111011100100011110101011110000111111101000101001"
"1111111101010100011111010100001100111111010101110001101011111101111011110101000100000111111101000101001"
"1111111101010100011101010111111000101000001000111101011011001111000011010100001111100111111101000101001"
@ -358,26 +359,26 @@ static void test_encode(int index, int generate, int debug) {
"1111111101010100011101000011111010111111010001101001011000010011100010010101111000000111111101000101001"
"1111111101010100011001011011100000110011001100001101100100101100000011110010100011110111111101000101001"
},
/* 6*/ { BARCODE_PDF417, UNICODE_MODE, 2, 3, "12345678901234", 0, 5, 120, 1, "Numeric Compaction",
/* 6*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "12345678901234", 0, 5, 120, 1, "Numeric Compaction",
"111111110101010001111010101111000011101010001110000100111101111010001001011100001110011111010101111100111111101000101001"
"111111110101010001111110101000111011010000001110010111111011010011001111010100000010011111101010111000111111101000101001"
"111111110101010001010100111100000010111000110011100101110011000011101110001111110101011101010001111110111111101000101001"
"111111110101010001010111100111100010001100001100010100001100011101101110101100111100011010111100111110111111101000101001"
"111111110101010001110101110000110011000000101110010110001001110000101011001000111111011101011100110000111111101000101001"
},
/* 7*/ { BARCODE_PDF417, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction",
/* 7*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction",
"11111111010101000111101010111100001101011011100000010000010000100010111001001100111101000010100001000011101010011100000111111101000101001"
"11111111010101000111110101001100001110010000111011010100111110000110111101001100001101111101000100011011111101010111000111111101000101001"
"11111111010101000110101001111100001010000001011110010100000010111100101000000101111001010000001011110011010100111110000111111101000101001"
"11111111010101000101011110011110001010001000001000011011000010100000111000110001001101100111000110010010101111101111100111111101000101001"
},
/* 8*/ { BARCODE_PDF417, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction, mod 6 == 0 (924 emitted)",
/* 8*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction, mod 6 == 0 (924 emitted)",
"11111111010101000111101010111100001101011011100000011000111000110100111001001100111101000010100001000011101010011100000111111101000101001"
"11111111010101000111110101001100001110010000111011010100111110000110111101001100001101111001010010000011111101010111000111111101000101001"
"11111111010101000110101001111100001001110000100110010011000100001110101000011001111101101000101111100011010100111110000111111101000101001"
"11111111010101000101011110011110001101000100011000010011000111001100110001100001000101110100010111000010101111101111100111111101000101001"
},
/* 9*/ { BARCODE_PDF417, UNICODE_MODE, -1, 5, "ABCDEF1234567890123\177\177\177\177VWXYZ", 0, 6, 154, 1, "Text, Numeric, Byte, Text",
/* 9*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, 5, "ABCDEF1234567890123\177\177\177\177VWXYZ", 0, 6, 154, 1, "Text, Numeric, Byte, Text",
"1111111101010100011110101011110000110101110111100001111010101111000010100111001110000110100000101100001001111011110100011110101001111000111111101000101001"
"1111111101010100011110101000010000111101011001100001010011110000100011111100011101010110000010111000101111001011011000011111101010111000111111101000101001"
"1111111101010100011101010011111100110011111101100101010000001011110010100000010111100101000000101111001010000001011110010101000011110000111111101000101001"
@ -385,7 +386,7 @@ static void test_encode(int index, int generate, int debug) {
"1111111101010100011010111000001000101111110101100001011111101011000011001011111001110111100100100100001011111101011000011101011100110000111111101000101001"
"1111111101010100011111010111100110110111110110011001101001011111000010101110011111100100100001000111101011000000101110011110101111101100111111101000101001"
},
/* 10*/ { BARCODE_PDF417COMP, UNICODE_MODE, 1, 2, "PDF417 APK", 0, 6, 69, 0, "ISO 15438:2015 Figure G.1, same, BWIPP uses different encodation, same codeword count",
/* 10*/ { BARCODE_PDF417COMP, -1, UNICODE_MODE, 1, 2, "PDF417 APK", 0, 6, 69, 0, "ISO 15438:2015 Figure G.1, same, BWIPP uses different encodation, same codeword count",
"111111110101010001111010101111000011010100001100000111011101100110001"
"111111110101010001111010100010000011010000111000100111101000101000001"
"111111110101010001110101011111100010110011011110000100111110011000101"
@ -393,7 +394,7 @@ static void test_encode(int index, int generate, int debug) {
"111111110101010001111010111000111011011000001111010110010011101000001"
"111111110101010001111010111101000011110100111101000110010010011111001"
},
/* 11*/ { BARCODE_PDF417COMP, UNICODE_MODE, 4, 4, "ABCDEFG", 0, 10, 103, 1, "",
/* 11*/ { BARCODE_PDF417COMP, -1, UNICODE_MODE, 4, 4, "ABCDEFG", 0, 10, 103, 1, "",
"1111111101010100011101010011100000110101000011000001111010101111000010100111001110000110100000101100001"
"1111111101010100011110101000000100110100000011100101011111101011000010111111010110000101111110101100001"
"1111111101010100011010100111110000101111001100011001000001111010100010011111001100100111001011111001001"
@ -405,7 +406,7 @@ static void test_encode(int index, int generate, int debug) {
"1111111101010100010100110011111000100110000110111101100111000010111010010001011110000110011111010001001"
"1111111101010100010100011000001100110001101010000001100011000110011011001001101110000111110111110101001"
},
/* 12*/ { BARCODE_HIBC_PDF, UNICODE_MODE, -1, 3, "H123ABC01234567890D", 0, 8, 120, 0, "BWIPP uses different encodation, same codeword count but zint half-pad shorter",
/* 12*/ { BARCODE_HIBC_PDF, -1, UNICODE_MODE, -1, 3, "H123ABC01234567890D", 0, 8, 120, 0, "BWIPP uses different encodation, same codeword count but zint half-pad shorter",
"111111110101010001111101010111110011101011001111000100000100010010001110001110100010011111010101111100111111101000101001"
"111111110101010001111110101000111011110000010001010110101111110111101111100011101101011110101001000000111111101000101001"
"111111110101010001010100111100000011111010111101100100001111000101001100101000011111011101010001111110111111101000101001"
@ -415,7 +416,7 @@ static void test_encode(int index, int generate, int debug) {
"111111110101010001110100111011111010100110001100000110100011100111101111010010111100011101001110111110111111101000101001"
"111111110101010001111101001011000011100001001100100111010000011001001111011000110100010101111110111000111111101000101001"
},
/* 13*/ { BARCODE_HIBC_PDF, UNICODE_MODE, 1, 3, "A123BJC5D6E71", 0, 6, 120, 1, "BWIPP example",
/* 13*/ { BARCODE_HIBC_PDF, -1, UNICODE_MODE, 1, 3, "A123BJC5D6E71", 0, 6, 120, 1, "BWIPP example",
"111111110101010001111010101111000011110101101111100100000100010010001000011011100110011111010101111100111111101000101001"
"111111110101010001111010100010000011110000010001010110101111110111101111000001000101011111101010111000111111101000101001"
"111111110101010001010100111100000010110001100011110101111110111101101000111100011011010101000111100000111111101000101001"
@ -423,7 +424,7 @@ static void test_encode(int index, int generate, int debug) {
"111111110101010001111010111000111011010111110011100110100000011100101111110101000111011101011100110000111111101000101001"
"111111110101010001111101011110110010011100110011100100011110110011001011001011100000011110101111000100111111101000101001"
},
/* 14*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, 1, "ABCDEFGHIJKLMNOPQRSTUV", 0, 20, 38, 1, "ISO 24728:2006 Figure 1 1st 1x20, same",
/* 14*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "ABCDEFGHIJKLMNOPQRSTUV", 0, 20, 38, 1, "ISO 24728:2006 Figure 1 1st 1x20, same",
"11110101001000011000110010011110101001"
"11100101001111110101011100011100101001"
"11101101001010011001111100011101101001"
@ -445,7 +446,7 @@ static void test_encode(int index, int generate, int debug) {
"11011101001111011111011010011011101001"
"11011001001100010001110100011011001001"
},
/* 15*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, 2, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 0, 20, 55, 1, "ISO 24728:2006 Figure 1 2nd 2x20, same",
/* 15*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 0, 20, 55, 1, "ISO 24728:2006 Figure 1 2nd 2x20, same",
"1111010100100001100011001001111010101111000011110101001"
"1110010100110101111110111101111101000100110011100101001"
"1110110100101101100111100001011001110011111011101101001"
@ -467,7 +468,7 @@ static void test_encode(int index, int generate, int debug) {
"1101110100111010110011110001000001001101100011011101001"
"1101100100111100110110100001001001111001000011011001001"
},
/* 16*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN", 0, 20, 82, 1, "ISO 24728:2006 Figure 1 3rd 3x20",
/* 16*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN", 0, 20, 82, 1, "ISO 24728:2006 Figure 1 3rd 3x20",
"1100100010100001100011001001011110010111101010111100001010011100111000011100101101"
"1110100010111110100010011001011110110101000011111001101001011110010000011000101101"
"1110110010111100010111101001001110110110111011001111001001100001000111011000101001"
@ -489,7 +490,7 @@ static void test_encode(int index, int generate, int debug) {
"1111010100101111011110100001011001000111110011010111101011110111110110011010000101"
"1110010100110010001111011001011001100111000010111011001110001011100110011011000101"
},
/* 17*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZAB", 0, 20, 99, 1, "ISO 24728:2006 Figure 1 4th 4x20, same",
/* 17*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZAB", 0, 20, 99, 1, "ISO 24728:2006 Figure 1 4th 4x20, same",
"110010001010000110001100100111101010111100001011110010101001110011100001101000001011000011100101101"
"111010001010100001111100110100101111001000001011110110111011011110011001101100111100100011000101101"
"111011001010011000010001110110011101000011101001110110110111100101100001000001010111100011000101001"
@ -511,7 +512,7 @@ static void test_encode(int index, int generate, int debug) {
"111101010011100011101010000110001011101111001011001000111110111101011001100101110111100011010000101"
"111001010010001000001111010111100010100001001011001100100111101101111101001110100111110011011000101"
},
/* 18*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, 1, "123456789012345", 0, 14, 38, 1, "Number Compaction",
/* 18*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "123456789012345", 0, 14, 38, 1, "Number Compaction",
"11101110101011111101001100011101110101"
"11100110101110101011111100011100110101"
"11110110101000001011001100011110110101"
@ -527,7 +528,7 @@ static void test_encode(int index, int generate, int debug) {
"11100101001101011110000110011100101001"
"11101101001101000111111001011101101001"
},
/* 19*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, 2, "\177\177\177", 0, 8, 55, 1, "Byte Compaction",
/* 19*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "\177\177\177", 0, 8, 55, 1, "Byte Compaction",
"1100100010100000100001000101010000010010000011001000101"
"1110100010111110100010001101111101000100011011101000101"
"1110110010110001111100100101100011111001001011101100101"
@ -537,7 +538,7 @@ static void test_encode(int index, int generate, int debug) {
"1100111010111001111001100101000001001101100011001110101"
"1110111010111000101111011101110001000011010011101110101"
},
/* 20*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, 2, "\177\177\177\177\177\177", 0, 8, 55, 1, "Byte Compaction, mod 6 == 0 (924 emitted)",
/* 20*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "\177\177\177\177\177\177", 0, 8, 55, 1, "Byte Compaction, mod 6 == 0 (924 emitted)",
"1100100010110001110001101001110010011001111011001000101"
"1110100010100010001111010001110010000111011011101000101"
"1110110010101000011001111101101000101111100011101100101"
@ -547,7 +548,7 @@ static void test_encode(int index, int generate, int debug) {
"1100111010100100010000100001110111101100001011001110101"
"1110111010111110011010100001101100001111010011101110101"
},
/* 21*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, 3, "ABCDEFG\177\177\177", 0, 8, 82, 1, "Text & Byte Compaction",
/* 21*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFG\177\177\177", 0, 8, 82, 1, "Text & Byte Compaction",
"1100111010100001100011001001000010110111101010111100001010011100111000011001110101"
"1110111010111110100010011001000010010110100000011100101101111110101110011101110101"
"1110011010101000000101111001000011010101000000101111001010000001011110011100110101"
@ -557,7 +558,7 @@ static void test_encode(int index, int generate, int debug) {
"1100001010111110111010111001001100010110011100011000101101100001100110011000010101"
"1100011010110100011100001001001110010110110000111101001100011011110010011000110101"
},
/* 22*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, 4, "\177\177\177abcdefgh1234567890123", 0, 8, 99, 1, "Byte & Text & Numeric Compaction",
/* 22*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "\177\177\177abcdefgh1234567890123", 0, 8, 99, 1, "Byte & Text & Numeric Compaction",
"110011101010000010000100010101000001001000001000010110101000001001000001010000010010000011001110101"
"111011101010111111010110000110000010111001001000010010111101011100111001110100111001100011101110101"
"111001101011111001011110110101100110011110001000011010100001111000101001111110101100010011100110101"
@ -567,7 +568,7 @@ static void test_encode(int index, int generate, int debug) {
"110000101011000011010000100100000101101100001001100010101110111110111001111001110010110011000010101"
"110001101011101110111100010100100011110100001001110010100000101111000101111001010010000011000110101"
},
/* 23*/ { BARCODE_HIBC_MICPDF, UNICODE_MODE, -1, 4, "H123ABC01234567890D", 0, 8, 99, 0, "BWIPP uses different encodation, same codeword count but zint full-pad shorter",
/* 23*/ { BARCODE_HIBC_MICPDF, -1, UNICODE_MODE, -1, 4, "H123ABC01234567890D", 0, 8, 99, 0, "BWIPP uses different encodation, same codeword count but zint full-pad shorter",
"110011101010000110001100100100000100010010001000010110111000111010001001000001001100011011001110101"
"111011101011010111111011110111110001110110101000010010111101011100111001011111101001100011101110101"
"111001101011001010000111110100011110101000001000011010100111110001101001011011000111100011100110101"
@ -577,7 +578,7 @@ static void test_encode(int index, int generate, int debug) {
"110000101010110110001000000111000101100111101001100010110111101110000101100010101100000011000010101"
"110001101011110110000011010111100100001101101001110010101101011111100001111001000110011011000110101"
},
/* 24*/ { BARCODE_HIBC_MICPDF, UNICODE_MODE, -1, 1, "/EAH783", 0, 17, 38, 1, "HIBC Provider Applications Standard (PAS) example",
/* 24*/ { BARCODE_HIBC_MICPDF, -1, UNICODE_MODE, -1, 1, "/EAH783", 0, 17, 38, 1, "HIBC Provider Applications Standard (PAS) example",
"11001101001100011111001001011001101001"
"11011101001000001000100100011011101001"
"11011001001000100011110100011011001001"
@ -596,6 +597,31 @@ static void test_encode(int index, int generate, int debug) {
"11010000101101100100001111011010000101"
"11011000101110111000100010011011000101"
},
/* 25*/ { BARCODE_PDF417, 9, DATA_MODE, -1, -1, "\342", 0, 7, 103, 1, "β",
"1111111101010100011111010101111100110101000110000001100011100011001011110101011110000111111101000101001"
"1111111101010100011111010100011000111110101000011001011111100100011011110101001000000111111101000101001"
"1111111101010100011101010111111000110110010011110001100011111001001011010100011111000111111101000101001"
"1111111101010100011010111100111110100110011100110001010001100001100010101111001111000111111101000101001"
"1111111101010100011010111000010000110110001111000101111110010010111011110101110011100111111101000101001"
"1111111101010100011110101111010000100011110001000101000110010111000011110101111000010111111101000101001"
"1111111101010100011101001110111110101110001110001001010001101100000011010011101111000111111101000101001"
},
/* 26*/ { BARCODE_MICROPDF417, 9, DATA_MODE, -1, 1, "\342\343", 0, 14, 38, 1, "βγ",
"11101110101001111110010110011101110101"
"11100110101101010000111110011100110101"
"11110110101000001000010001011110110101"
"11110010101111001011001100011110010101"
"11100010101110110010011111011100010101"
"11000010101000011000110010011000010101"
"11000110101011111101011000011000110101"
"11000100101001111000101000011000100101"
"11100100101000100000101000011100100101"
"11110100101101110010111111011110100101"
"11110101101101100101111000011110101101"
"11110101001101011100111100011110101001"
"11100101001011100101111100011100101001"
"11101101001101001001111100011101101001"
},
};
int data_size = sizeof(data) / sizeof(struct item);
@ -610,24 +636,14 @@ static void test_encode(int index, int generate, int debug) {
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
symbol->symbology = data[i].symbology;
symbol->input_mode = data[i].input_mode;
if (data[i].option_1 != -1) {
symbol->option_1 = data[i].option_1;
}
if (data[i].option_2 != -1) {
symbol->option_2 = data[i].option_2;
}
symbol->debug |= debug;
int length = strlen(data[i].data);
int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
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, %s, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2,
printf(" /*%3d*/ { %s, %d, %s, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), data[i].eci, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2,
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret),
symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
testUtilModulesDump(symbol, " ", "\n");
@ -641,7 +657,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, data[i].option_1, data[i].option_2, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, 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 {

View File

@ -406,7 +406,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, -1, -1, -1, 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);

View File

@ -219,7 +219,7 @@ static void test_buffer(int index, int generate, int debug) {
/* 95*/ { BARCODE_HIBC_MICPDF, "1234567890", "", 28, 14, 38, 76, 56 },
/* 96*/ { BARCODE_HIBC_BLOCKF, "1234567890", "", 30, 3, 101, 242, 64 },
/* 97*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38, 38 },
/* 98*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 32, 22 },
/* 98*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 33, 23 },
/* 99*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46, 46 },
/*100*/ { BARCODE_MAILMARK, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 },
/*101*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 },
@ -660,35 +660,41 @@ static void test_output_options(int index, int debug) {
/* 27*/ { BARCODE_QRCODE, 5, 6, BARCODE_BIND, 0, "A123", 0, 21, 21, 21, 62, 66, 1, 0, 0 },
/* 28*/ { BARCODE_QRCODE, 5, 6, BARCODE_BIND, 0, "A123", 0, 21, 21, 21, 62, 66, 0, 12, 0 },
/* 29*/ { BARCODE_QRCODE, 5, 6, BARCODE_BOX, 0, "A123", 0, 21, 21, 21, 86, 66, 1, 12, 0 },
/* 30*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 42, 42, 1, 0, 0 },
/* 31*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 42, 42, 0, 1, 1 },
/* 32*/ { BARCODE_QRCODE, -1, 4, BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 42, 42, 1, 0, 0 },
/* 33*/ { BARCODE_QRCODE, -1, 4, BARCODE_BIND | BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 42, 58, -1, -1, -1 }, // TODO: fix (bind/box in dotty mode)
/* 34*/ { BARCODE_QRCODE, 1, 4, BARCODE_BOX | BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 62, 58, -1, -1, -1 }, // TODO: fix (bind/box in dotty mode)
/* 35*/ { BARCODE_QRCODE, -1, -1, OUT_BUFFER_INTERMEDIATE, 0, "A123", 0, 21, 21, 21, 42, 42, 0, 2, 2 },
/* 36*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE | OUT_BUFFER_INTERMEDIATE, 0, "A123", 0, 21, 21, 21, 42, 42, 1, 0, 0 },
/* 37*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE | OUT_BUFFER_INTERMEDIATE, 180, "A123", 0, 21, 21, 21, 42, 42, 0, 40, 1 },
/* 38*/ { BARCODE_MAXICODE, -1, -1, -1, 0, "A123", 0, 165, 33, 30, 300, 300, 0, 0, 0 },
/* 39*/ { BARCODE_MAXICODE, -1, -1, -1, 270, "A123", 0, 165, 33, 30, 300, 300, 0, 0, 0 },
/* 40*/ { BARCODE_MAXICODE, -1, 5, -1, 0, "A123", 0, 165, 33, 30, 300, 300, 0, 0, 0 },
/* 41*/ { BARCODE_MAXICODE, -1, 5, BARCODE_BIND, 0, "A123", 0, 165, 33, 30, 300, 320, 1, 0, 0 },
/* 42*/ { BARCODE_MAXICODE, -1, 5, BARCODE_BIND, 0, "A123", 0, 165, 33, 30, 300, 320, 0, 10, 0 },
/* 43*/ { BARCODE_MAXICODE, -1, 5, BARCODE_BOX, 0, "A123", 0, 165, 33, 30, 320, 320, 1, 10, 0 },
/* 44*/ { BARCODE_MAXICODE, -1, -1, -1, 0, "A123", 0, 165, 33, 30, 300, 300, 1, 0, 14 },
/* 45*/ { BARCODE_MAXICODE, 6, -1, -1, 0, "A123", 0, 165, 33, 30, 324, 300, 0, 0, 14 },
/* 46*/ { BARCODE_MAXICODE, 6, 5, BARCODE_BIND, 0, "A123", 0, 165, 33, 30, 324, 320, 1, 10, 25 },
/* 47*/ { BARCODE_MAXICODE, 6, 5, BARCODE_BIND, 0, "A123", 0, 165, 33, 30, 324, 320, 0, 10, 9 },
/* 48*/ { BARCODE_MAXICODE, 6, 5, BARCODE_BOX, 0, "A123", 0, 165, 33, 30, 344, 320, 1, 10, 9 },
/* 49*/ { BARCODE_MAXICODE, -1, -1, BARCODE_DOTTY_MODE, 0, "A123", ZINT_ERROR_INVALID_OPTION, -1, -1, -1, -1, -1, -1, -1, -1 },
/* 50*/ { BARCODE_MAXICODE, -1, -1, OUT_BUFFER_INTERMEDIATE, 0, "A123", 0, 165, 33, 30, 300, 300, 0, 0, 0 },
/* 51*/ { BARCODE_MAXICODE, -1, -1, OUT_BUFFER_INTERMEDIATE, 0, "A123", 0, 165, 33, 30, 300, 300, 1, 0, 14 },
/* 52*/ { BARCODE_MAXICODE, -1, -1, OUT_BUFFER_INTERMEDIATE, 270, "A123", 0, 165, 33, 30, 300, 300, 0, 0, 0 },
/* 53*/ { BARCODE_ITF14, -1, -1, -1, 0, "123", 0, 50, 1, 135, 330, 136, 1, 110, 0 },
/* 54*/ { BARCODE_ITF14, -1, -1, -1, 90, "123", 0, 50, 1, 135, 136, 330, 1, 0, 110 },
/* 55*/ { BARCODE_ITF14, -1, 0, -1, 0, "123", 0, 50, 1, 135, 330, 136, 1, 110, 0 },
/* 56*/ { BARCODE_ITF14, -1, 0, BARCODE_BOX, 0, "123", 0, 50, 1, 135, 310, 116, 0, 100, 0 },
/* 57*/ { BARCODE_ITF14, -1, -1, OUT_BUFFER_INTERMEDIATE, 0, "123", 0, 50, 1, 135, 330, 136, 1, 110, 0 },
/* 58*/ { BARCODE_ITF14, -1, -1, OUT_BUFFER_INTERMEDIATE, 90, "123", 0, 50, 1, 135, 136, 330, 1, 0, 110 },
/* 30*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 43, 43, 1, 1, 1 },
/* 31*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 43, 43, 0, 2, 2 },
/* 32*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 43, 43, 1, 41, 1 },
/* 33*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 43, 43, 0, 40, 2 },
/* 34*/ { BARCODE_QRCODE, -1, 4, BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 43, 43, 1, 1, 1 },
/* 35*/ { BARCODE_QRCODE, -1, 4, BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 43, 43, 0, 2, 2 },
/* 36*/ { BARCODE_QRCODE, -1, 4, BARCODE_BIND | BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 43, 59, -1, -1, -1 }, // TODO: fix (bind/box in dotty mode)
/* 37*/ { BARCODE_QRCODE, 1, 4, BARCODE_BOX | BARCODE_DOTTY_MODE, 0, "A123", 0, 21, 21, 21, 63, 59, -1, -1, -1 }, // TODO: fix (bind/box in dotty mode)
/* 38*/ { BARCODE_QRCODE, -1, -1, OUT_BUFFER_INTERMEDIATE, 0, "A123", 0, 21, 21, 21, 42, 42, 1, 1, 1 },
/* 39*/ { BARCODE_QRCODE, -1, -1, OUT_BUFFER_INTERMEDIATE, 0, "A123", 0, 21, 21, 21, 42, 42, 0, 2, 2 },
/* 40*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE | OUT_BUFFER_INTERMEDIATE, 0, "A123", 0, 21, 21, 21, 43, 43, 1, 1, 1 },
/* 41*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE | OUT_BUFFER_INTERMEDIATE, 0, "A123", 0, 21, 21, 21, 43, 43, 0, 2, 2 },
/* 42*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE | OUT_BUFFER_INTERMEDIATE, 180, "A123", 0, 21, 21, 21, 43, 43, 1, 41, 1 },
/* 43*/ { BARCODE_QRCODE, -1, -1, BARCODE_DOTTY_MODE | OUT_BUFFER_INTERMEDIATE, 180, "A123", 0, 21, 21, 21, 43, 43, 0, 40, 2 },
/* 44*/ { BARCODE_MAXICODE, -1, -1, -1, 0, "A123", 0, 165, 33, 30, 300, 300, 0, 0, 0 },
/* 45*/ { BARCODE_MAXICODE, -1, -1, -1, 270, "A123", 0, 165, 33, 30, 300, 300, 0, 0, 0 },
/* 46*/ { BARCODE_MAXICODE, -1, 5, -1, 0, "A123", 0, 165, 33, 30, 300, 300, 0, 0, 0 },
/* 47*/ { BARCODE_MAXICODE, -1, 5, BARCODE_BIND, 0, "A123", 0, 165, 33, 30, 300, 320, 1, 0, 0 },
/* 48*/ { BARCODE_MAXICODE, -1, 5, BARCODE_BIND, 0, "A123", 0, 165, 33, 30, 300, 320, 0, 10, 0 },
/* 49*/ { BARCODE_MAXICODE, -1, 5, BARCODE_BOX, 0, "A123", 0, 165, 33, 30, 320, 320, 1, 10, 0 },
/* 50*/ { BARCODE_MAXICODE, -1, -1, -1, 0, "A123", 0, 165, 33, 30, 300, 300, 1, 0, 14 },
/* 51*/ { BARCODE_MAXICODE, 6, -1, -1, 0, "A123", 0, 165, 33, 30, 324, 300, 0, 0, 14 },
/* 52*/ { BARCODE_MAXICODE, 6, 5, BARCODE_BIND, 0, "A123", 0, 165, 33, 30, 324, 320, 1, 10, 25 },
/* 53*/ { BARCODE_MAXICODE, 6, 5, BARCODE_BIND, 0, "A123", 0, 165, 33, 30, 324, 320, 0, 10, 9 },
/* 54*/ { BARCODE_MAXICODE, 6, 5, BARCODE_BOX, 0, "A123", 0, 165, 33, 30, 344, 320, 1, 10, 9 },
/* 55*/ { BARCODE_MAXICODE, -1, -1, BARCODE_DOTTY_MODE, 0, "A123", ZINT_ERROR_INVALID_OPTION, -1, -1, -1, -1, -1, -1, -1, -1 },
/* 56*/ { BARCODE_MAXICODE, -1, -1, OUT_BUFFER_INTERMEDIATE, 0, "A123", 0, 165, 33, 30, 300, 300, 0, 0, 0 },
/* 57*/ { BARCODE_MAXICODE, -1, -1, OUT_BUFFER_INTERMEDIATE, 0, "A123", 0, 165, 33, 30, 300, 300, 1, 0, 14 },
/* 58*/ { BARCODE_MAXICODE, -1, -1, OUT_BUFFER_INTERMEDIATE, 270, "A123", 0, 165, 33, 30, 300, 300, 0, 0, 0 },
/* 59*/ { BARCODE_ITF14, -1, -1, -1, 0, "123", 0, 50, 1, 135, 330, 136, 1, 110, 0 },
/* 60*/ { BARCODE_ITF14, -1, -1, -1, 90, "123", 0, 50, 1, 135, 136, 330, 1, 0, 110 },
/* 61*/ { BARCODE_ITF14, -1, 0, -1, 0, "123", 0, 50, 1, 135, 330, 136, 1, 110, 0 },
/* 62*/ { BARCODE_ITF14, -1, 0, BARCODE_BOX, 0, "123", 0, 50, 1, 135, 310, 116, 0, 100, 0 },
/* 63*/ { BARCODE_ITF14, -1, -1, OUT_BUFFER_INTERMEDIATE, 0, "123", 0, 50, 1, 135, 330, 136, 1, 110, 0 },
/* 64*/ { BARCODE_ITF14, -1, -1, OUT_BUFFER_INTERMEDIATE, 90, "123", 0, 50, 1, 135, 136, 330, 1, 0, 110 },
};
int data_size = ARRAY_SIZE(data);

View File

@ -164,7 +164,7 @@ static void test_binary_div_modulo_divisor(int index, int generate, int debug) {
ret = ZBarcode_Buffer_Vector(symbol, 0);
assert_zero(ret, "i:%d ZBarcode_Buffer_Vector ret %d != 0\n", i, ret);
if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, -1, -1, debug)) {
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));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
@ -663,7 +663,7 @@ static void test_examples(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, data[i].option_2, -1, debug)) {
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));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);

View File

@ -258,7 +258,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, -1, -1, -1, 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);

View File

@ -696,7 +696,7 @@ static void test_encode(int index, int generate, int debug) {
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(symbol->symbology, -1, data[i].option_2, -1, debug)) {
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));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);

View File

@ -1427,7 +1427,7 @@ int testUtilVerifyLibreOffice(char *filename, int debug) {
char cmd[512 + 128];
char svg[512];
char *slash, *dot;
char buf[32768];
char buf[16384];
char *b = buf, *be = buf + sizeof(buf) - 1;
FILE *fp;
int len;
@ -1536,7 +1536,7 @@ int testUtilVerifyVnu(char *filename, int debug) {
return system(buf);
}
static const char *testUtilBwippName(int symbology, int option_1, int option_2, int option_3, int *linear_row_height, int *gs1_cvt) {
static const char *testUtilBwippName(int index, const struct zint_symbol *symbol, int option_1, int option_2, int option_3, int debug, int *linear_row_height, int *gs1_cvt) {
struct item {
const char *name;
int define;
@ -1619,7 +1619,7 @@ static const char *testUtilBwippName(int symbology, int option_1, int option_2,
{ "", BARCODE_AUSREDIRECT, 68, 0, 0, 0, 0, 0, },
{ "isbn", BARCODE_ISBNX, 69, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
{ "royalmail", BARCODE_RM4SCC, 70, 0, 0, 0, 0, 0, },
{ "datamatrix", BARCODE_DATAMATRIX, 71, 0, 0, 0, 0, 0, },
{ "datamatrix", BARCODE_DATAMATRIX, 71, 0, 1, 1, 0, 0, },
{ "ean14", BARCODE_EAN14, 72, 0, 0, 0, 0, 1 /*gs1_cvt*/, },
{ "code39", BARCODE_VIN, 73, 0, 0, 0, 0, 0, },
{ "codablockf", BARCODE_CODABLOCKF, 74, 1, 1, 0, 10 /*linear_row_height*/, 0, },
@ -1640,7 +1640,7 @@ static const char *testUtilBwippName(int symbology, int option_1, int option_2,
{ "itf14", BARCODE_ITF14, 89, 0, 0, 0, 0, 0, },
{ "kix", BARCODE_KIX, 90, 0, 0, 0, 0, 0, },
{ "", -1, 91, 0, 0, 0, 0, 0, },
{ "azteccode", BARCODE_AZTEC, 92, 0, 0, 0, 0, 0, },
{ "azteccode", BARCODE_AZTEC, 92, 0, 1, 0, 0, 0, },
{ "daft", BARCODE_DAFT, 93, 0, 0, 0, 0, 0, },
{ "", -1, 94, 0, 0, 0, 0, 0, },
{ "", -1, 95, 0, 0, 0, 0, 0, },
@ -1650,7 +1650,7 @@ static const char *testUtilBwippName(int symbology, int option_1, int option_2,
{ "hibccode39", BARCODE_HIBC_39, 99, 0, 0, 0, 0, 0, },
{ "", -1, 100, 0, 0, 0, 0, 0, },
{ "", -1, 101, 0, 0, 0, 0, 0, },
{ "hibcdatamatrix", BARCODE_HIBC_DM, 102, 0, 0, 0, 0, 0, },
{ "hibcdatamatrix", BARCODE_HIBC_DM, 102, 0, 1, 1, 0, 0, },
{ "", -1, 103, 0, 0, 0, 0, 0, },
{ "hibcqrcode", BARCODE_HIBC_QR, 104, 0, 0, 0, 0, 0, },
{ "", -1, 105, 0, 0, 0, 0, 0, },
@ -1660,7 +1660,7 @@ static const char *testUtilBwippName(int symbology, int option_1, int option_2,
{ "", -1, 109, 0, 0, 0, 0, 0, },
{ "hibccodablockf", BARCODE_HIBC_BLOCKF, 110, 1, 1, 0, 10 /*linear_row_height*/, 0, },
{ "", -1, 111, 0, 0, 0, 0, 0, },
{ "hibcazteccode", BARCODE_HIBC_AZTEC, 112, 0, 0, 0, 0, 0, },
{ "hibcazteccode", BARCODE_HIBC_AZTEC, 112, 1, 0, 1, 0, 0, },
{ "", -1, 113, 0, 0, 0, 0, 0, },
{ "", -1, 114, 0, 0, 0, 0, 0, },
{ "dotcode", BARCODE_DOTCODE, 115, 0, 0, 0, 0, 0, },
@ -1697,27 +1697,43 @@ static const char *testUtilBwippName(int symbology, int option_1, int option_2,
};
static const int data_size = ARRAY_SIZE(data);
int symbology = symbol->symbology;
int gs1 = (symbol->input_mode & 0x07) == GS1_MODE;
if (symbology < 0 || symbology >= data_size) {
return NULL;
fprintf(stderr, "testUtilBwippName: unknown symbology (%d)\n", symbology);
abort();
}
if (data[symbology].val != symbology || (data[symbology].define != -1 && data[symbology].define != symbology)) { // Self-check
fprintf(stderr, "testUtilBwippName: 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 BWIPP mapping\n", index, testUtilBarcodeName(symbology));
}
return NULL;
}
if ((option_1 != -1 && !data[symbology].can_option_1) || (option_2 != -1 && !data[symbology].can_option_2)
|| (option_3 != -1 && !data[symbology].can_option_3)) {
if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d %s not BWIPP compatible, options not supported, option_1 %d, option_2 %d, option_3 %d\n", index, testUtilBarcodeName(symbology), option_1, option_2, option_3);
}
return NULL;
}
if (symbology == BARCODE_CODE11) {
if (option_2 != 1 && option_2 != 2) { /* 2 check digits (Zint default) not supported */
if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d %s not BWIPP compatible, 2 check digits not supported, option_1 %d, option_2 %d\n", index, testUtilBarcodeName(symbology), option_1, option_2);
}
return NULL;
}
} else if (symbology == BARCODE_CODABLOCKF || symbology == BARCODE_HIBC_BLOCKF) {
if (option_1 == 1) { /* Single row i.e. CODE128 not supported */
if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d %s not BWIPP compatible, single row not supported, option_1 %d\n", index, testUtilBarcodeName(symbology), option_1);
}
return NULL;
}
}
@ -1728,19 +1744,31 @@ static const char *testUtilBwippName(int symbology, int option_1, int option_2,
if (gs1_cvt) {
*gs1_cvt = data[symbology].gs1_cvt;
}
if (gs1) {
if (symbology == BARCODE_DATAMATRIX) {
if (symbol->output_options & GS1_GS_SEPARATOR) { /* Not supported */
if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d %s not BWIPP compatible, GS1_GS_SEPARATOR not supported\n", index, testUtilBarcodeName(symbology));
}
return NULL;
}
if (gs1_cvt) {
*gs1_cvt = 1;
}
return "gs1datamatrix";
} else if (symbology == BARCODE_AZTEC) {
if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d %s not BWIPP compatible, GS1_MODE not supported\n", index, testUtilBarcodeName(symbology));
}
return NULL;
}
}
return data[symbology].name;
}
int testUtilCanBwipp(int symbology, int option_1, int option_2, int option_3, int debug) {
if (testUtilBwippName(symbology, option_1, option_2, option_3, NULL, NULL) != NULL) {
return 1;
}
if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("testUtilCanBwipp: not supported %s, option_1 %d, option_2 %d, option_3 %d\n", testUtilBarcodeName(symbology), option_1, option_2, option_3);
}
return 0;
int testUtilCanBwipp(int index, const struct zint_symbol *symbol, int option_1, int option_2, int option_3, int debug) {
return testUtilBwippName(index, symbol, option_1, option_2, option_3, debug, NULL, NULL) != NULL;
}
static void testUtilBwippCvtGS1Data(char *bwipp_data, int upcean, int *addon_posn) {
@ -1763,21 +1791,59 @@ static void testUtilBwippCvtGS1Data(char *bwipp_data, int upcean, int *addon_pos
}
}
static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const char *data, int length, int *parse) {
static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const char *data, int length, int zint_escape_mode, int eci, int *parse, int *parsefnc) {
char *b = bwipp_data;
char *be = b + bwipp_data_size;
unsigned char *d = (unsigned char *) data;
unsigned char *de = (unsigned char *) data + length;
*parse = 0;
*parse = *parsefnc = 0;
if (eci) {
sprintf(bwipp_data, "^ECI%06d", eci);
*parsefnc = 1;
b = bwipp_data + 10;
}
while (b < be && d < de) {
/* Have to escape double quote otherwise Ghostscript gives "Unterminated quote in @-file" for some reason */
/* Escape single quote also to avoid having to do proper shell escaping TODO: proper shell escaping */
if (*d < 0x20 || *d >= 0x7F || *d == '^' || *d == '"' || *d == '\'') {
if (b + 4 >= be) {
fprintf(stderr, "testUtilBwippEscape: bwipp_data buffer full\n");
return NULL;
}
sprintf(b, "^%03u", *d++);
b += 4;
*parse = 1;
} else if (zint_escape_mode && *d == '\\' && d + 1 < de) {
int val;
switch (*++d) {
case '0': val = 0x00; /* Null */ break;
case 'E': val = 0x04; /* End of Transmission */ break;
case 'a': val = 0x07; /* Bell */ break;
case 'b': val = 0x08; /* Backspace */ break;
case 't': val = 0x09; /* Horizontal tab */ break;
case 'n': val = 0x0a; /* Line feed */ break;
case 'v': val = 0x0b; /* Vertical tab */ break;
case 'f': val = 0x0c; /* Form feed */ break;
case 'r': val = 0x0d; /* Carriage return */ break;
case 'e': val = 0x1b; /* Escape */ break;
case 'G': val = 0x1d; /* Group Separator */ break;
case 'R': val = 0x1e; /* Record Separator */ break;
//case 'x': val = 0; /* TODO: implement */ break;
case '\\': val = '\\'; break;
//case 'u': val = 0; /* TODO: implement */ break;
default: fprintf(stderr, "testUtilBwippEscape: unknown escape %c\n", *d); return NULL; break;
}
if (b + 4 >= be) {
fprintf(stderr, "testUtilBwippEscape: bwipp_data buffer full\n");
return NULL;
}
sprintf(b, "^%03d", val);
b += 4;
d++;
*parse = 1;
} else {
*b++ = *d++;
}
@ -1838,7 +1904,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
char *b = buffer;
char *be = buffer + buffer_size;
int r, h;
int parse;
int parse, parsefnc;
int upcean = is_extendable(symbology);
int upca = symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC;
@ -1846,7 +1912,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
bwipp_data[0] = bwipp_opts_buf[0] = '\0';
bwipp_barcode = testUtilBwippName(symbology, option_1, option_2, option_3, &linear_row_height, &gs1_cvt);
bwipp_barcode = testUtilBwippName(index, symbol, option_1, option_2, option_3, 0, &linear_row_height, &gs1_cvt);
if (!bwipp_barcode) {
fprintf(stderr, "i:%d testUtilBwipp: no mapping for %s, option_1 %d, option_2 %d, option_3 %d\n", index, testUtilBarcodeName(symbology), option_1, option_2, option_3);
return -1;
@ -1924,11 +1990,18 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
}
}
} else {
testUtilBwippEscape(bwipp_data, sizeof(bwipp_data), data, data_len, &parse);
int eci = symbol->eci >= 3 && ZBarcode_Cap(symbology, ZINT_CAP_ECI) ? symbol->eci : 0;
if (testUtilBwippEscape(bwipp_data, sizeof(bwipp_data), data, data_len, symbol->input_mode & ESCAPE_MODE, eci, &parse, &parsefnc) == NULL) {
return -1;
}
if (parse) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sparse", strlen(bwipp_opts_buf) ? " " : "");
bwipp_opts = bwipp_opts_buf;
}
if (parsefnc) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sparsefnc", strlen(bwipp_opts_buf) ? " " : "");
bwipp_opts = bwipp_opts_buf;
}
if (symbology == BARCODE_CODE93) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sincludecheck", strlen(bwipp_opts_buf) ? " " : "");
@ -2010,12 +2083,69 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
for (r = 0; r < symbol->rows; r++) bwipp_row_height[r] = 8; /* Change from 10 */
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%ssepheight=0", strlen(bwipp_opts_buf) ? " " : "");
bwipp_opts = bwipp_opts_buf;
} else if (symbology == BARCODE_AZTEC || symbology == BARCODE_HIBC_AZTEC) {
int compact = 0;
if (option_1 >= 1 && option_1 <= 4) {
int eclevel;
if (option_1 == 1) {
eclevel = 10;
} else if (option_1 == 2) {
eclevel = 23;
} else if (option_1 == 3) {
eclevel = 36;
} else {
eclevel = 50;
}
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%seclevel=%d", strlen(bwipp_opts_buf) ? " " : "", eclevel);
bwipp_opts = bwipp_opts_buf;
}
if (option_2 >= 1) {
int layers;
if (option_2 <= 4) {
compact = 1;
layers = option_2;
} else {
layers = option_2 - 4;
}
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%slayers=%d", strlen(bwipp_opts_buf) ? " " : "", layers);
bwipp_opts = bwipp_opts_buf;
}
if (symbol->output_options & READER_INIT) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sreaderinit", strlen(bwipp_opts_buf) ? " " : "");
bwipp_opts = bwipp_opts_buf;
}
if (symbology == BARCODE_HIBC_AZTEC) {
compact = 1;
}
if (compact) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sformat=compact", strlen(bwipp_opts_buf) ? " " : "");
bwipp_opts = bwipp_opts_buf;
}
}
}
if (symbology == BARCODE_DATAMATRIX || symbology == BARCODE_HIBC_DM) {
#include "../dmatrix.h"
(void)matrixrsblock; (void)matrixdatablock; (void)matrixbytes; (void)matrixFW; (void)matrixFH;
(void)isDMRE; (void)text_value; (void)text_shift; (void)c40_value; (void)c40_shift;
if (option_2 >= 1 && option_2 <= (int) sizeof(intsymbol)) {
int idx = intsymbol[option_2 - 1];
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%srows=%d columns=%d", strlen(bwipp_opts_buf) ? " " : "", matrixH[idx], matrixW[idx]);
bwipp_opts = bwipp_opts_buf;
}
if (option_3 != DM_SQUARE && symbol->width != symbol->height) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sformat=rectangle", strlen(bwipp_opts_buf) ? " " : "");
bwipp_opts = bwipp_opts_buf;
}
if (option_3 != -1) {
bwipp_opts = bwipp_opts_buf;
}
}
}
if ((option_1 != -1 || option_2 != -1 || option_3 != -1) && !bwipp_opts) {
fprintf(stderr, "i:%d testUtilBwipp: no mapping option_1 %d, option_2 %d, option_3 %d for symbology %s\n", index, option_1, option_2, option_3, testUtilBarcodeName(symbology));
fprintf(stderr, "i:%d testUtilBwipp: no BWIPP options set option_1 %d, option_2 %d, option_3 %d for symbology %s\n", index, option_1, option_2, option_3, testUtilBarcodeName(symbology));
return -1;
}

View File

@ -112,7 +112,7 @@ int testUtilHaveGhostscript();
int testUtilVerifyGhostscript(char *filename, int debug);
int testUtilHaveVnu();
int testUtilVerifyVnu(char *filename, int debug);
int testUtilCanBwipp(int symbology, int option_1, int option_2, int option_3, int debug);
int testUtilCanBwipp(int index, const struct zint_symbol *symbol, int option_1, int option_2, int option_3, 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, const char *bwipp_buf, const char *expected);
int testUtilBwippCmpRow(const struct zint_symbol *symbol, int row, char *msg, const char *bwipp_buf, const char *expected);

View File

@ -1,5 +1,5 @@
--- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2020-10-02 20:03:59.411955883 +0100
+++ ../tools/bwipp_dump.ps 2020-10-03 01:47:30.454223200 +0100
--- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2020-10-26 01:13:25.080992540 +0000
+++ ../tools/bwipp_dump.ps 2020-10-26 11:19:21.268222231 +0000
@@ -29,6 +29,8 @@
% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
% IN THE SOFTWARE.
@ -9,7 +9,7 @@
% --BEGIN TEMPLATE--
% --BEGIN RESOURCE preamble--
@@ -25404,34 +25406,80 @@
@@ -24466,34 +24468,80 @@
pop
} ifelse
@ -109,7 +109,7 @@
end
@@ -25490,7 +25538,7 @@
@@ -24552,7 +24600,7 @@
pop
} ifelse
@ -118,7 +118,7 @@
% Get the result of encoding with ean8 and gs1-cc
options (lintype) (ean8) put
@@ -25498,29 +25546,75 @@
@@ -24560,29 +24608,75 @@
options (dontdraw) true put
% Plot the linear part
@ -214,7 +214,7 @@
end
@@ -25579,34 +25673,80 @@
@@ -24641,34 +24735,80 @@
pop
} ifelse
@ -314,7 +314,7 @@
end
@@ -25680,34 +25820,80 @@
@@ -24742,34 +24882,80 @@
/opt options
>> def
@ -414,7 +414,7 @@
end
@@ -25766,7 +25952,7 @@
@@ -24828,7 +25014,7 @@
pop
} ifelse
@ -423,7 +423,7 @@
options (lintype) (databaromni) put
options (linkage) true put
@@ -25777,7 +25963,7 @@
@@ -24839,7 +25025,7 @@
linear options //databaromni exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -432,7 +432,7 @@
% Plot the separator
/sepfinder {
@@ -25808,20 +25994,66 @@
@@ -24870,20 +25056,66 @@
sep 0 [0 0 0] putinterval
sep sep length 4 sub [0 0 0 0] putinterval
18 sepfinder 64 sepfinder
@ -511,7 +511,7 @@
end
@@ -25879,7 +26111,7 @@
@@ -24941,7 +25173,7 @@
pop
} ifelse
@ -520,7 +520,7 @@
options (lintype) (databarstacked) put
options (linkage) true put
@@ -25890,7 +26122,7 @@
@@ -24952,7 +25184,7 @@
linear options //databarstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -529,7 +529,7 @@
% Plot the separator
/sepfinder {
@@ -25918,20 +26150,52 @@
@@ -24980,20 +25212,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -594,7 +594,7 @@
end
@@ -25989,7 +26253,7 @@
@@ -25051,7 +25315,7 @@
pop
} ifelse
@ -603,7 +603,7 @@
options (lintype) (databarstackedomni) put
options (linkage) true put
@@ -26000,7 +26264,7 @@
@@ -25062,7 +25326,7 @@
linear options //databarstackedomni exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -612,7 +612,7 @@
% Plot the separator
/sepfinder {
@@ -26028,20 +26292,52 @@
@@ -25090,20 +25354,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -677,7 +677,7 @@
end
@@ -26214,7 +26510,7 @@
@@ -25276,7 +25572,7 @@
pop
} ifelse
@ -686,7 +686,7 @@
options (lintype) (databarlimited) put
options (linkage) true put
@@ -26225,7 +26521,7 @@
@@ -25287,7 +25583,7 @@
linear options //databarlimited exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -695,7 +695,7 @@
% Plot the separator
mark
@@ -26233,22 +26529,68 @@
@@ -25295,22 +25591,68 @@
counttomark 1 sub array astore /sep exch def pop pop
sep 0 [0 0 0] putinterval
sep sep length 9 sub [0 0 0 0 0 0 0 0 0] putinterval % 4 + 5 right guard spaces
@ -778,7 +778,7 @@
end
@@ -26307,7 +26649,7 @@
@@ -25369,7 +25711,7 @@
pop
} ifelse
@ -787,7 +787,7 @@
options (lintype) (databarexpanded) put
options (linkage) true put
@@ -26318,7 +26660,7 @@
@@ -25380,7 +25722,7 @@
linear options //databarexpanded exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -796,7 +796,7 @@
% Plot the separator
/sepfinder {
@@ -26347,20 +26689,60 @@
@@ -25409,20 +25751,60 @@
18 98 bot length 13 sub {} for
69 98 bot length 13 sub {} for
] {sepfinder} forall
@ -869,7 +869,7 @@
end
@@ -26418,7 +26800,7 @@
@@ -25480,7 +25862,7 @@
pop
} ifelse
@ -878,7 +878,7 @@
options (lintype) (databarexpandedstacked) put
options (linkage) true put
@@ -26429,7 +26811,7 @@
@@ -25491,7 +25873,7 @@
linear options //databarexpandedstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -887,14 +887,7 @@
% Plot the separator
/sepfinder {
@@ -26449,27 +26831,55 @@
} for
} bind def
/sep [ bot {1 exch sub} forall ] def
- sep 0 [ 0 0 0 ] putinterval
+ sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
[ % Finder pattern module positions
@@ -25517,21 +25899,49 @@
19 98 bot length 13 sub {} for
70 98 bot length 13 sub {} for
] {sepfinder} forall
@ -957,7 +950,7 @@
end
@@ -26528,7 +26938,7 @@
@@ -25590,7 +26000,7 @@
pop
} ifelse
@ -966,7 +959,7 @@
options (inkspread) (0) put
options (dontdraw) true put
@@ -26555,35 +26965,87 @@
@@ -25617,35 +26027,87 @@
linear << options {} forall >> //gs1-128 exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -1068,7 +1061,7 @@
end
@@ -27881,3 +28343,176 @@
@@ -26919,3 +27381,176 @@
% --END ENCODER hibcazteccode--
% --END TEMPLATE--

View File

@ -15,6 +15,7 @@ function run_bwipp_test() {
run_bwipp_test "test_2of5" "encode"
run_bwipp_test "test_auspost" "encode"
run_bwipp_test "test_aztec" "encode"
run_bwipp_test "test_channel" "encode"
run_bwipp_test "test_codablock" "encode"
run_bwipp_test "test_code" "encode"
@ -23,6 +24,7 @@ run_bwipp_test "test_code128" "encode"
run_bwipp_test "test_code16k" "encode"
run_bwipp_test "test_code49" "encode"
run_bwipp_test "test_composite"
run_bwipp_test "test_dmatrix" "encode"
run_bwipp_test "test_gs1" "gs1_reduce"
run_bwipp_test "test_imail" "encode"
run_bwipp_test "test_medical" "encode"