tests: BWIPP: update CODE128/MAXICODE to use "newencoder"

BWIPP: update to latest
AZTEC/CODE16K/DATAMATRIX: harmonize GS1 and READER_INIT error
  messages
This commit is contained in:
gitlost 2024-11-12 11:25:22 +00:00
parent 88155343bf
commit c9909d3d91
13 changed files with 155 additions and 121 deletions

View File

@ -879,8 +879,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int
unsigned int *ecc_part;
if (gs1 && reader_init) {
return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 501,
"Cannot encode in GS1 and Reader Initialisation mode at the same time");
return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 501, "Cannot use Reader Initialisation in GS1 mode");
}
if (symbol->structapp.count) {

View File

@ -345,8 +345,7 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
if (symbol->output_options & READER_INIT) {
if (gs1) {
return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 422,
"Cannot use both GS1 mode and Reader Initialisation");
return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 422, "Cannot use Reader Initialisation in GS1 mode");
}
if (m == 2) {
m = 5;

View File

@ -884,18 +884,31 @@ INTERNAL void segs_cpy(const struct zint_symbol *symbol, const struct zint_seg s
}
}
/* Helper for ZINT_DEBUG_PRINT to put all but graphical ASCII in angle brackets */
/* Helper for ZINT_DEBUG_PRINT to put all but graphical ASCII in hex escapes. Output to `buf` if non-NULL, else
stdout */
INTERNAL char *debug_print_escape(const unsigned char *source, const int first_len, char *buf) {
int i, j = 0;
int i;
if (buf) {
int j = 0;
for (i = 0; i < first_len; i++) {
const unsigned char ch = source[i];
if (ch < 32 || ch >= 127) {
j += sprintf(buf + j, "<%03o>", ch & 0xFF);
j += sprintf(buf + j, "\\x%02X", ch & 0xFF);
} else {
buf[j++] = ch;
}
}
buf[j] = '\0';
} else {
for (i = 0; i < first_len; i++) {
const unsigned char ch = source[i];
if (ch < 32 || ch >= 127) {
printf("\\x%02X", ch & 0xFF);
} else {
fputc(ch, stdout);
}
}
}
return buf;
}

View File

@ -313,7 +313,8 @@ INTERNAL void segs_cpy(const struct zint_symbol *symbol, const struct zint_seg s
struct zint_seg local_segs[]);
/* Helper for ZINT_DEBUG_PRINT to put all but graphical ASCII in angle brackets */
/* Helper for ZINT_DEBUG_PRINT to put all but graphical ASCII in hex escapes. Output to `buf` if non-NULL, else
stdout */
INTERNAL char *debug_print_escape(const unsigned char *source, const int first_len, char *buf);
#ifdef ZINT_TEST

View File

@ -1759,8 +1759,7 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
if (symbol->output_options & READER_INIT) {
if (gs1) {
return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 521,
"Cannot encode in GS1 mode and Reader Initialisation at the same time");
return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 521, "Cannot use Reader Initialisation in GS1 mode");
}
if (symbol->structapp.count) {
return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 727,

View File

@ -265,7 +265,7 @@ static void test_options(const testCtx *const p_ctx) {
/* 5*/ { BARCODE_AZTEC, -1, -1, -1, 36, { 0, 0, "" }, "1234567890", 0, 151, 151, "" },
/* 6*/ { BARCODE_AZTEC, -1, -1, -1, 37, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 510: Version '37' out of range (1 to 36)" },
/* 7*/ { BARCODE_AZTEC, -1, -1, -1, -2, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 510: Version '-2' out of range (1 to 36)" },
/* 8*/ { BARCODE_AZTEC, GS1_MODE, READER_INIT, -1, -1, { 0, 0, "" }, "[91]A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 501: Cannot encode in GS1 and Reader Initialisation mode at the same time" },
/* 8*/ { BARCODE_AZTEC, GS1_MODE, READER_INIT, -1, -1, { 0, 0, "" }, "[91]A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 501: Cannot use Reader Initialisation in GS1 mode" },
/* 9*/ { BARCODE_AZTEC, GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[91]A", 0, 15, 15, "" },
/* 10*/ { BARCODE_AZTEC, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(91)A", 0, 15, 15, "" },
/* 11*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 26, { 0, 0, "" }, "A", 0, 109, 109, "" }, /* 22 layers */

View File

@ -332,74 +332,74 @@ static void test_input(const testCtx *const p_ctx) {
/* 34*/ { UNICODE_MODE, "12\037", -1, 0, 68, 0, "(6) 105 12 101 95 89 106", "StartC 12 CodeA US; BWIPP StartA, same codeword count" },
/* 35*/ { UNICODE_MODE, "a\037a", -1, 0, 79, 1, "(7) 104 65 98 95 65 86 106", "StartB a Shift US a" },
/* 36*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^Aa\037a", -1, 0, 90, 0, "(8) 103 98 65 95 98 65 97 106", "StartA ShB a <US> ShB a; BWIPP no manual mode" },
/* 37*/ { UNICODE_MODE, "1234\037a", -1, 0, 101, 1, "(9) 105 12 34 101 95 100 65 7 106", "StartC 12 34 CodeA US CodeB a" },
/* 38*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "1234\037\\^Ba", -1, 0, 101, 1, "(9) 105 12 34 101 95 100 65 7 106", "StartC 12 34 CodeA US CodeB a" },
/* 37*/ { UNICODE_MODE, "1234\037a", -1, 0, 101, 0, "(9) 105 12 34 101 95 100 65 7 106", "StartC 12 34 CodeA US CodeB a; BWIPP different encodation" },
/* 38*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "1234\037\\^Ba", -1, 0, 101, 0, "(9) 105 12 34 101 95 100 65 7 106", "StartC 12 34 CodeA US CodeB a; BWIPP different encodation" },
/* 39*/ { UNICODE_MODE, "\037AAa\037", -1, 0, 101, 1, "(9) 103 95 33 33 98 65 95 2 106", "StartA US A A Shift a US" },
/* 40*/ { UNICODE_MODE, "\037AAaa\037", -1, 0, 123, 0, "(11) 103 95 100 33 33 65 65 101 95 30 106", "StartA US CodeB A A a a CodeA US; BWIPP different encodation" },
/* 41*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\037AAaa\\^A\037", -1, 0, 123, 0, "(11) 103 95 100 33 33 65 65 101 95 30 106", "StartA <US> CodeB A A a a CodeA <US>; BWIPP no manual mode" },
/* 42*/ { UNICODE_MODE, "AAAa12345aAA", -1, 0, 167, 0, "(15) 104 33 33 33 65 99 12 34 100 21 65 33 33 57 106", "StartB A A A a CodeC 12 34 CodeB 5 a A A; BWIPP different encodation" },
/* 43*/ { UNICODE_MODE, "a\037Aa\037\037a\037aa\037a", -1, 0, 222, 0, "(20) 104 65 101 95 33 98 65 95 95 100 65 98 95 65 65 98 95 65 42 106", "StartB a CodeA US A ShB a US US CodeB a ShA US a a ShA US a; BWIPP different encodation" },
/* 44*/ { UNICODE_MODE, "\000\037ß", 4, 0, 79, 1, "(7) 103 64 95 101 63 88 106", "StartA NUL US FNC4 ß" },
/* 45*/ { UNICODE_MODE, "\000\037é", 4, 0, 90, 0, "(8) 103 64 95 100 100 73 83 106", "StartA NUL US CodeB FNC4 é; BWIPP different encodation (FNC4 before CodeB)" },
/* 46*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\000\037\\^Bé", 7, 0, 90, 0, "(8) 103 64 95 100 100 73 83 106", "StartA NUL US CodeB FNC4 é; BWIPP different encodation (FNC4 before CodeB)" },
/* 47*/ { UNICODE_MODE, "\000\037éa", 5, 0, 101, 0, "(9) 103 64 95 100 100 73 65 61 106", "StartA NUL US CodeB FNC4 é a; BWIPP different encodation (FNC4 before CodeB)" },
/* 45*/ { UNICODE_MODE, "\000\037é", 4, 0, 90, 1, "(8) 103 64 95 100 100 73 83 106", "StartA NUL US CodeB FNC4 é" },
/* 46*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\000\037\\^Bé", 7, 0, 90, 1, "(8) 103 64 95 100 100 73 83 106", "StartA NUL US CodeB FNC4 é" },
/* 47*/ { UNICODE_MODE, "\000\037éa", 5, 0, 101, 1, "(9) 103 64 95 100 100 73 65 61 106", "StartA NUL US CodeB FNC4 é a" },
/* 48*/ { UNICODE_MODE, "abß", -1, 0, 79, 1, "(7) 104 65 66 100 63 29 106", "StartB a b FNC4 ß" },
/* 49*/ { DATA_MODE, "\141\142\237", -1, 0, 90, 0, "(8) 104 65 66 101 101 95 41 106", "StartB a b CodeA FNC4 APC; BWIPP different encodation" },
/* 50*/ { DATA_MODE, "\141\142\237\037", -1, 0, 101, 0, "(9) 104 65 66 101 101 95 95 96 106", "StartB a b CodeA FNC4 APC US; BWIPP different encodation" },
/* 50*/ { DATA_MODE, "\141\142\237\037", -1, 0, 101, 1, "(9) 104 65 66 101 101 95 95 96 106", "StartB a b CodeA FNC4 APC US" },
/* 51*/ { UNICODE_MODE, "ééé", -1, 0, 90, 1, "(8) 104 100 100 73 73 73 44 106", "StartB LatchFNC4 é é é" },
/* 52*/ { UNICODE_MODE, "aéééb", -1, 0, 123, 1, "(11) 104 65 100 73 100 73 100 73 66 5 106", "StartB a FNC4 é (4) b" },
/* 53*/ { UNICODE_MODE, "aééééb", -1, 0, 134, 0, "(12) 104 65 100 100 73 73 73 73 100 66 64 106", "StartB a Latch é (4) Shift b; BWIPP different encodation" },
/* 53*/ { UNICODE_MODE, "aééééb", -1, 0, 134, 1, "(12) 104 65 100 100 73 73 73 73 100 66 64 106", "StartB a Latch é (4) Shift b" },
/* 54*/ { UNICODE_MODE, "aéééééb", -1, 0, 145, 1, "(13) 104 65 100 100 73 73 73 73 73 100 66 93 106", "StartB a Latch é (5) Shift b" },
/* 55*/ { UNICODE_MODE, "aééééébc", -1, 0, 167, 1, "(15) 104 65 100 100 73 73 73 73 73 100 66 100 67 40 106", "StartB a Latch é (5) Shift b Shift c" },
/* 55*/ { UNICODE_MODE, "aééééébc", -1, 0, 167, 0, "(15) 104 65 100 100 73 73 73 73 73 100 66 100 67 40 106", "StartB a Latch é (5) Shift b Shift c; BWIPP different encodation" },
/* 56*/ { UNICODE_MODE, "aééééébcd", -1, 0, 178, 1, "(16) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 66 106", "StartB a Latch é (5) Unlatch b c d" },
/* 57*/ { UNICODE_MODE, "aééééébcde", -1, 0, 189, 1, "(17) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 2 106", "StartB a Latch é (5) Unlatch b c d e" },
/* 58*/ { UNICODE_MODE, "aééééébcdeé", -1, 0, 211, 0, "(19) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 100 73 95 106", "StartB a Latch é (5) Unlatch b c d e FNC4 é; BWIPP different encodation" },
/* 59*/ { UNICODE_MODE, "aééééébcdeéé", -1, 0, 233, 0, "(21) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 100 73 100 73 19 106", "StartB a Latch é (5) Unlatch b c d e FNC4 é (2); BWIPP different encodation" },
/* 60*/ { UNICODE_MODE, "aééééébcdeééé", -1, 0, 244, 1, "(22) 104 65 100 100 73 73 73 73 73 100 66 100 67 100 68 100 69 73 73 73 83 106", "StartB a Latch é (5) Shift b Shift c Shift d Shift e é (3)" },
/* 58*/ { UNICODE_MODE, "aééééébcdeé", -1, 0, 211, 1, "(19) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 100 73 95 106", "StartB a Latch é (5) Unlatch b c d e FNC4 é" },
/* 59*/ { UNICODE_MODE, "aééééébcdeéé", -1, 0, 233, 1, "(21) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 100 73 100 73 19 106", "StartB a Latch é (5) Unlatch b c d e FNC4 é (2)" },
/* 60*/ { UNICODE_MODE, "aééééébcdeééé", -1, 0, 244, 0, "(22) 104 65 100 100 73 73 73 73 73 100 66 100 67 100 68 100 69 73 73 73 83 106", "StartB a Latch é (5) Shift b Shift c Shift d Shift e é (3); BWIPP different encodation" },
/* 61*/ { UNICODE_MODE, "aééééébcdefééé", -1, 0, 255, 1, "(23) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 70 100 100 73 73 73 67 106", "StartB a Latch é (5) Unlatch b c d e f Latch é (3)" },
/* 62*/ { DATA_MODE, "\200\200\200\200\200\101\060\060\060\060\101\200", -1, 0, 211, 0, "(19) 103 101 101 64 64 64 64 64 101 33 99 0 0 101 101 33 64 4 106", "StartA FNC4 FNC4 PAD (5) FNC4 A CodeC 00 00 CodeA FNC4 A PAD; BWIPP different encodation (BWIPP 1 longer)" },
/* 63*/ { UNICODE_MODE, "ÁÁÁÁÁÁ99999999999999", -1, 0, 211, 0, "(19) 104 100 100 33 33 33 33 33 33 99 99 99 99 99 99 99 99 63 106", "Okapi code128/extended-mode-exit-before-code-set-c.png (chose different solution); BWIPP different encodation" },
/* 64*/ { UNICODE_MODE, "ÁÁÁÁÁÁ99999999999999Á", -1, 0, 233, 0, "(21) 104 100 100 33 33 33 33 33 33 99 99 99 99 99 99 99 99 100 33 91 106", "Above with trailing non-shifted (as still latched) extended; BWIPP different encodation" },
/* 65*/ { DATA_MODE, "@g(\202\202\202\202\2025555\202\202\202\202\202\202\202\202", -1, 0, 288, 0, "(26) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 101 66 66 66 66 66 66 66 66 10 106", "Okapi code128/extended-mode-with-short-embedded-code-set-c.png (chose different solution); BWIPP different encodation" },
/* 66*/ { DATA_MODE, "@g(\202\202\202\202\20255555\202\202\202\202\202\202\202", -1, 0, 299, 0, "(27) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 101 101 21 66 66 66 66 66 66 66 50 106", "Above with extra 5; BWIPP different encodation" },
/* 67*/ { DATA_MODE, "@g(\202\202\202\202\202555555\202\202\202\202\202\202\202", -1, 0, 288, 0, "(26) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 55 101 66 66 66 66 66 66 66 86 106", "Above with extra 55, one less \\202; BWIPP different encodation" },
/* 68*/ { DATA_MODE, "@g(\202\202\202\202\202555\202\202\202\202\202\202\202\202", -1, 0, 310, 0, "(28) 104 32 71 8 101 101 101 66 66 66 66 66 101 21 101 21 101 21 66 66 66 66 66 66 66 66 5", "Above less one 5; BWIPP different encodation" },
/* 69*/ { UNICODE_MODE, "±±±±1234AA", -1, 0, 189, 0, "(17) 104 100 100 17 17 17 17 99 12 34 100 100 33 100 33 89 106", "BWIPP PR #275 (extended ASCII treated as digits)" },
/* 62*/ { DATA_MODE, "\200\200\200\200\200\101\060\060\060\060\101\200", -1, 0, 211, 1, "(19) 103 101 101 64 64 64 64 64 101 33 99 0 0 101 101 33 64 4 106", "StartA FNC4 FNC4 PAD (5) FNC4 A CodeC 00 00 CodeA FNC4 A PAD" },
/* 63*/ { UNICODE_MODE, "ÁÁÁÁÁÁ99999999999999", -1, 0, 211, 1, "(19) 104 100 100 33 33 33 33 33 33 99 99 99 99 99 99 99 99 63 106", "Okapi code128/extended-mode-exit-before-code-set-c.png (chose different solution)" },
/* 64*/ { UNICODE_MODE, "ÁÁÁÁÁÁ99999999999999Á", -1, 0, 233, 1, "(21) 104 100 100 33 33 33 33 33 33 99 99 99 99 99 99 99 99 100 33 91 106", "Above with trailing non-shifted (as still latched) extended" },
/* 65*/ { DATA_MODE, "@g(\202\202\202\202\2025555\202\202\202\202\202\202\202\202", -1, 0, 288, 1, "(26) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 101 66 66 66 66 66 66 66 66 10 106", "Okapi code128/extended-mode-with-short-embedded-code-set-c.png (chose different solution)" },
/* 66*/ { DATA_MODE, "@g(\202\202\202\202\20255555\202\202\202\202\202\202\202", -1, 0, 299, 1, "(27) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 101 101 21 66 66 66 66 66 66 66 50 106", "Above with extra 5" },
/* 67*/ { DATA_MODE, "@g(\202\202\202\202\202555555\202\202\202\202\202\202\202", -1, 0, 288, 1, "(26) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 55 101 66 66 66 66 66 66 66 86 106", "Above with extra 55, one less \\202" },
/* 68*/ { DATA_MODE, "@g(\202\202\202\202\202555\202\202\202\202\202\202\202\202", -1, 0, 310, 0, "(28) 104 32 71 8 101 101 101 66 66 66 66 66 101 21 101 21 101 21 66 66 66 66 66 66 66 66 5", "Above less one 5; BWIPP different encodation (BWIPP 1 shorter)" },
/* 69*/ { UNICODE_MODE, "±±±±1234AA", -1, 0, 189, 0, "(17) 104 100 100 17 17 17 17 99 12 34 100 100 33 100 33 89 106", "BWIPP different encodation" },
/* 70*/ { UNICODE_MODE, "ÁÁèÁÁFç7Z", -1, 0, 189, 0, "(17) 104 100 100 33 33 72 33 33 100 38 71 100 100 23 58 95 106", "Okapi code128/extended-mode-shift.png; BWIPP different encodation" },
/* 71*/ { UNICODE_MODE, "m\nm\nm", -1, 0, 112, 1, "(10) 104 77 98 74 77 98 74 77 11 106", "Okapi code128/code-set-b-a-b-a-b.png" },
/* 72*/ { UNICODE_MODE, "c\naDEF", -1, 0, 112, 1, "(10) 104 67 98 74 65 36 37 38 75 106", "Okapi bug-36-1.png" },
/* 73*/ { UNICODE_MODE, "\na\nDEF", -1, 0, 112, 1, "(10) 103 74 98 65 74 36 37 38 90 106", "Okapi bug-36-2.png" },
/* 74*/ { UNICODE_MODE, "ÿ\012àa\0121\012àAà", -1, 0, 222, 0, "(20) 104 100 95 98 74 100 64 65 101 74 17 74 100 100 64 33 100 64 30 106", "BWIPP different encodation, ShA instead of CodeA" },
/* 75*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "ÿ\012àa\\^A\0121\012\\^BàAà", -1, 0, 222, 0, "(20) 104 100 95 98 74 100 64 65 101 74 17 74 100 100 64 33 100 64 30 106", "BWIPP different encodation, FNC4 before CodeB" },
/* 76*/ { UNICODE_MODE, "ÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 376, 0, "(34) 104 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64 36", "BWIPP different encodation, CodeA instead of ShA, same width" },
/* 75*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "ÿ\012àa\\^A\0121\012\\^BàAà", -1, 0, 222, 0, "(20) 104 100 95 98 74 100 64 65 101 74 17 74 100 100 64 33 100 64 30 106", "BWIPP different encodation, ShA instead of CodeA" },
/* 76*/ { UNICODE_MODE, "ÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 376, 0, "(34) 104 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64 36", "BWIPP different encodation" },
/* 77*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "ÿ1234\012à\\^Aa\0121\012\\^C7890\\^BàAàDà\012à", -1, 0, 376, 0, "(34) 104 100 95 99 12 34 101 74 101 98 64 98 65 74 17 74 99 78 90 100 100 64 33 100 64 36", "BWIPP no manual mode" },
/* 78*/ { UNICODE_MODE, "yÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 387, 0, "(35) 104 89 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64", "BWIPP different encodation, CodeA instead of ShA, same width" },
/* 79*/ { UNICODE_MODE, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 387, 0, "(35) 104 100 95 89 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64", "BWIPP different encodation, CodeA instead of ShA, same width" },
/* 80*/ { UNICODE_MODE, "ÿÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 398, 0, "(36) 104 100 95 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33", "BWIPP different encodation, CodeA instead of ShA, same width" },
/* 81*/ { UNICODE_MODE, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 662, 0, "(60) 104 100 95 99 12 34 56 78 101 74 100 100 64 99 12 34 56 78 100 65 66 67 68 69 70 101", "BWIPP different encodation, CodeA instead of ShA, same width" },
/* 82*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 200, 0, "(18) 104 0 100 100 1 1 1 1 100 0 1 1 1 1 100 0 91 106", "StartB <SP> Latch <A0> (4) FNC4 <SP> <A0> (4) FNC4 <SP>, adapted from BWIPP PR #272; BWIPP pending PR #275" },
/* 83*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 222, 0, "(20) 104 0 100 100 1 1 1 1 100 0 100 0 1 1 1 1 100 0 63 106", "2 middle spaces; BWIPP pending PR #275" },
/* 84*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 244, 0, "(22) 104 0 100 100 1 1 1 1 100 0 100 0 100 0 1 1 1 1 100 0 29 106", "3 middle spaces; BWIPP pending PR #275" },
/* 85*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 266, 0, "(24) 104 0 100 100 1 1 1 1 100 0 100 0 100 0 100 0 1 1 1 1 100 0 92 106", "4 middle spaces (no unlatch); BWIPP pending PR #275" },
/* 86*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 277, 0, "(25) 104 0 100 100 1 1 1 1 100 100 0 0 0 0 0 100 100 1 1 1 1 100 0 81 106", "5 middle spaces (unlatch); BWIPP pending PR #275" },
/* 87*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, " 12\\^1 ", -1, 0, 90, 0, "(8) 104 0 17 18 102 0 85 106", "BWIPP PR #272" },
/* 88*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, " 1234\\^1567", -1, 0, 123, 0, "(11) 104 0 99 12 34 102 56 100 23 41 106", "BWIPP PR #272" },
/* 89*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "123\\^14567", -1, 0, 101, 0, "(9) 104 17 99 23 102 45 67 84 106", "BWIPP PR #272" },
/* 78*/ { UNICODE_MODE, "yÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 387, 0, "(35) 104 89 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64", "BWIPP different encodation" },
/* 79*/ { UNICODE_MODE, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 387, 0, "(35) 104 100 95 89 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64", "BWIPP different encodation" },
/* 80*/ { UNICODE_MODE, "ÿÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 398, 0, "(36) 104 100 95 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33", "BWIPP different encodation" },
/* 81*/ { UNICODE_MODE, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 662, 0, "(60) 104 100 95 99 12 34 56 78 101 74 100 100 64 99 12 34 56 78 100 65 66 67 68 69 70 101", "BWIPP different encodation" },
/* 82*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 200, 1, "(18) 104 0 100 100 1 1 1 1 100 0 1 1 1 1 100 0 91 106", "StartB <SP> Latch <A0> (4) FNC4 <SP> <A0> (4) FNC4 <SP>, adapted from BWIPP PR #272" },
/* 83*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 222, 1, "(20) 104 0 100 100 1 1 1 1 100 0 100 0 1 1 1 1 100 0 63 106", "2 middle spaces" },
/* 84*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 244, 1, "(22) 104 0 100 100 1 1 1 1 100 0 100 0 100 0 1 1 1 1 100 0 29 106", "3 middle spaces" },
/* 85*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 266, 0, "(24) 104 0 100 100 1 1 1 1 100 0 100 0 100 0 100 0 1 1 1 1 100 0 92 106", "4 middle spaces (no unlatch); BWIPP different encodation" },
/* 86*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 277, 0, "(25) 104 0 100 100 1 1 1 1 100 100 0 0 0 0 0 100 100 1 1 1 1 100 0 81 106", "5 middle spaces (unlatch); BWIPP different encodation" },
/* 87*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, " 12\\^1 ", -1, 0, 90, 1, "(8) 104 0 17 18 102 0 85 106", "BWIPP PR #272" },
/* 88*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, " 1234\\^1567", -1, 0, 123, 1, "(11) 104 0 99 12 34 102 56 100 23 41 106", "BWIPP PR #272" },
/* 89*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "123\\^14567", -1, 0, 101, 1, "(9) 104 17 99 23 102 45 67 84 106", "BWIPP PR #272" },
/* 90*/ { DATA_MODE | ESCAPE_MODE | EXTRA_ESCAPE_MODE, "\\d031\\d031_\\d127\\d159\\d031\\d159\\d159\\d159\\d15912345``\\d255\\d000\\d127\\d255\\d224\\d224\\d159`", -1, 0, 442, 0, "(40) 103 95 95 63 98 95 101 95 95 101 101 95 95 95 95 99 12 34 100 100 100 21 64 64 100 95", "Code set limit chars; BWIPP different encodation" },
/* 91*/ { DATA_MODE, "\200\200\200\200\200A0000A\200", -1, 0, 211, 0, "(19) 103 101 101 64 64 64 64 64 101 33 99 0 0 101 101 33 64 4 106", "BWIPP different encodation" },
/* 91*/ { DATA_MODE, "\200\200\200\200\200A0000A\200", -1, 0, 211, 1, "(19) 103 101 101 64 64 64 64 64 101 33 99 0 0 101 101 33 64 4 106", "" },
/* 92*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^1345\\^167\\^18", -1, 0, 145, 1, "(13) 105 12 102 34 100 21 102 22 23 102 24 49 106", "" },
/* 93*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B\\^A12\\^C34\\^A\\^B5\\^C67\\^A\\^B\\^CA\\^B\\^A", -1, 0, 145, 0, "(13) 103 17 18 99 34 100 21 99 67 100 33 69 106", "BWIPP no manual mode" },
/* 94*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^C1234ABC12\012", -1, 0, 145, 0, "(13) 105 12 34 100 33 34 35 99 12 101 74 36 106", "StartC 12 34 CodeB A B C CodeC 12 CodeA <LF>; BWIPP no manual mode" },
/* 95*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "A\\^", -1, 0, 68, 1, "(6) 104 33 60 62 31 106", "StartC 12 34 CodeB A B C CodeC 12 CodeA LF" },
/* 96*/ { UNICODE_MODE, "A\0121234A12\012", -1, 0, 145, 1, "(13) 103 33 74 99 12 34 101 33 17 18 74 99 106", "StartA A <LF> CodeC 12 34 CodeA A 1 2 <LF>; Okapi c128/improved-lookahead-mode-a.png" },
/* 96*/ { UNICODE_MODE, "A\0121234A12\012", -1, 0, 145, 0, "(13) 103 33 74 99 12 34 101 33 17 18 74 99 106", "StartA A <LF> CodeC 12 34 CodeA A 1 2 <LF>; Okapi c128/improved-lookahead-mode-a.png; BWIPP different encodation" },
/* 97*/ { UNICODE_MODE, "21*\015\012M0", -1, 0, 112, 0, "(10) 105 21 101 10 77 74 45 16 79 106", "StartC 21 CodeA * <CR> <LF> M 0; Okapi c128/improved-lookahead-rule-1c.png; BWIPP different encodation, same width" },
/* 98*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^112345\\^11234\\^112345", -1, 0, 178, 0, "(16) 104 102 17 99 23 45 102 12 34 102 12 34 100 21 72 106", "Okapi code128/fnc1-mode-c-fnc1-in-middle.png; BWIPP different encodation (BWIPP 2 longer)" },
/* 98*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^112345\\^11234\\^112345", -1, 0, 178, 1, "(16) 104 102 17 99 23 45 102 12 34 102 12 34 100 21 72 106", "Okapi code128/fnc1-mode-c-fnc1-in-middle.png" },
/* 99*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^1SN123456789012", -1, 0, 145, 1, "(13) 104 102 51 46 99 12 34 56 78 90 12 65 106", "StartB FNC1 S N CodeC 12 34 56 78 90 12" },
/*100*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B\\^1SN123456789012", -1, 0, 200, 0, "(18) 104 102 51 46 17 18 19 20 21 22 23 24 25 16 17 18 56 106", "StartB FNC1 S N 1 2 3 4 5 6 7 8 9 0 1 2; BWIPP no manual mode" },
/*101*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "A\\^1BC\\^1DEF\\^1", -1, 0, 134, 1, "(12) 104 33 102 34 35 102 36 37 38 102 9 106", "StartB A FNC1 B C FNC1 D E F FNC1" },
/*102*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^C12\\^1", -1, 0, 57, 0, "(5) 105 12 102 12 106", "StartC 12 FNC1; BWIPP no manual mode" },
/*103*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^13", -1, 0, 79, 1, "(7) 105 12 102 100 19 79 106", "StartC 12 FNC1 CodeB 3" },
/*104*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^13\\^1", -1, 0, 90, 1, "(8) 105 12 102 100 19 102 74 106", "StartC 12 FNC1 CodeB 3 FNC1" },
/*103*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^13", -1, 0, 79, 0, "(7) 105 12 102 100 19 79 106", "StartC 12 FNC1 CodeB 3; BWIPP different encodation, StartB so FNC1 not recognized as AIM" },
/*104*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^13\\^1", -1, 0, 90, 0, "(8) 105 12 102 100 19 102 74 106", "StartC 12 FNC1 CodeB 3 FNC1; BWIPP different encodation, StartB so FNC1 not recognized as AIM" },
/*105*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "1\\^123", -1, 0, 79, 0, "(7) 104 17 99 102 23 99 106", "StartB 1 CodeC FNC1 23; BWIPP different encodation (same codeword count)" },
/*106*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^134", -1, 0, 68, 1, "(6) 105 12 102 34 11 106", "StartC 12 FNC1 34" },
/*107*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^134\\^1", -1, 0, 79, 1, "(7) 105 12 102 34 102 7 106", "StartC 12 FNC1 34 FNC1" },
@ -497,27 +497,27 @@ static void test_gs1_128_input(const testCtx *const p_ctx) {
static const struct item data[] = {
/* 0*/ { GS1_MODE, "[90]1[90]1", 0, 123, 0, "(11) 105 102 90 100 17 102 25 99 1 56 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01; BWIPP different encodation (same width)" },
/* 1*/ { GS1_MODE | GS1PARENS_MODE, "(90)1(90)1", 0, 123, 0, "(11) 105 102 90 100 17 102 25 99 1 56 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01; BWIPP different encodation (same width)" },
/* 2*/ { GS1_MODE, "[90]1[90]12", 0, 112, 0, "(10) 104 102 25 99 1 102 90 12 43 106", "StartB FNC1 9 CodeC 01 FNC1 90 12; BWIPP different encodation (BWIPP 1 longer)" },
/* 3*/ { GS1_MODE, "[90]1[90]123", 0, 134, 1, "(12) 105 102 90 100 17 102 25 99 1 23 57 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01 23" },
/* 2*/ { GS1_MODE, "[90]1[90]12", 0, 112, 1, "(10) 104 102 25 99 1 102 90 12 43 106", "StartB FNC1 9 CodeC 01 FNC1 90 12" },
/* 3*/ { GS1_MODE, "[90]1[90]123", 0, 134, 0, "(12) 105 102 90 100 17 102 25 99 1 23 57 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01 23; BWIPP different encodation" },
/* 4*/ { GS1_MODE, "[90]12[90]1", 0, 112, 1, "(10) 105 102 90 12 102 90 100 17 43 106", "StartC FNC1 90 12 FNC1 90 CodeB 1" },
/* 5*/ { GS1_MODE, "[90]12[90]12", 0, 101, 1, "(9) 105 102 90 12 102 90 12 14 106", "StartC FNC1 90 12 FNC1 90 12" },
/* 6*/ { GS1_MODE, "[90]12[90]123", 0, 123, 1, "(11) 105 102 90 12 102 90 12 100 19 42 106", "StartC FNC1 90 12 FNC1 CodeB 9 CodeC 01 23" },
/* 7*/ { GS1_MODE, "[90]123[90]1", 0, 134, 0, "(12) 105 102 90 12 100 19 102 25 99 1 34 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 CodeC 01; BWIPP different encodation (same width)" },
/* 8*/ { GS1_MODE, "[90]123[90]1234", 0, 134, 0, "(12) 104 102 25 99 1 23 102 90 12 34 50 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 34" },
/* 8*/ { GS1_MODE, "[90]123[90]1234", 0, 134, 1, "(12) 104 102 25 99 1 23 102 90 12 34 50 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 34" },
/* 9*/ { GS1_MODE, "[90]1[90]1[90]1", 0, 167, 0, "(15) 105 102 90 100 17 102 25 99 1 102 90 100 17 88 106", "StartC FNC1(GS1) 90 CodeB 1 FNC1(29) 9 CodeC 01 FNC1(29) 90 CodeB 1; BWIPP different encodation (same width)" },
/* 10*/ { GS1_MODE, "[90]1[90]12[90]1", 0, 156, 0, "(14) 104 102 25 99 1 102 90 12 102 90 100 17 75 106", "StartB FNC1 9 CodeC 01 FNC1 90 12 FNC1 90 CodeB 1; BWIPP different encodation (BWIPP 2 longer)" },
/* 11*/ { GS1_MODE, "[90]1[90]123[90]1", 0, 178, 1, "(16) 105 102 90 100 17 102 25 99 1 23 102 90 100 17 89 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01 23 FNC1 90 CodeB 1" },
/* 10*/ { GS1_MODE, "[90]1[90]12[90]1", 0, 156, 1, "(14) 104 102 25 99 1 102 90 12 102 90 100 17 75 106", "StartB FNC1 9 CodeC 01 FNC1 90 12 FNC1 90 CodeB 1" },
/* 11*/ { GS1_MODE, "[90]1[90]123[90]1", 0, 178, 0, "(16) 105 102 90 100 17 102 25 99 1 23 102 90 100 17 89 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01 23 FNC1 90 CodeB 1; BWIPP different encodation" },
/* 12*/ { GS1_MODE, "[90]12[90]123[90]1", 0, 167, 0, "(15) 105 102 90 12 102 90 12 100 19 102 25 99 1 45 106", "StartC FNC1 90 12 FNC1 90 12 CodeB 3 FNC1 9 CodeC 01; BWIPP different encodation (same width)" },
/* 13*/ { GS1_MODE, "[90]12[90]123[90]12", 0, 167, 0, "(15) 105 102 90 12 102 90 12 100 19 99 102 90 12 100 106", "StartC FNC1 90 12 FNC1 90 12 CodeB 3 CodeC FNC1 90 12; BWIPP different encodation (same width)" },
/* 14*/ { GS1_MODE, "[90]123[90]1[90]1", 0, 178, 0, "(16) 105 102 90 12 100 19 102 25 99 1 102 90 100 17 66 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 CodeC 01 FNC1 90 CodeB 1; BWIPP different encodation (same width)" },
/* 15*/ { GS1_MODE, "[90]123[90]12[90]1", 0, 167, 0, "(15) 104 102 25 99 1 23 102 90 12 102 90 100 17 85 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 FNC1 90 CodeB 1; BWIPP different encodation (BWIPP 2 longer)" },
/* 15*/ { GS1_MODE, "[90]123[90]12[90]1", 0, 167, 1, "(15) 104 102 25 99 1 23 102 90 12 102 90 100 17 85 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 FNC1 90 CodeB 1" },
/* 16*/ { GS1_MODE, "[90]123[90]123[90]12", 0, 178, 1, "(16) 105 102 90 12 100 19 102 25 99 1 23 102 90 12 47 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 CodeC 01 23 FNC1 90 12" },
/* 17*/ { GS1_MODE, "[90]123[90]1234[90]1", 0, 178, 0, "(16) 104 102 25 99 1 23 102 90 12 34 102 90 100 17 82 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 34 FNC1 90 CodeB 1; BWIPP different encodation (BWIPP 3 longer)" },
/* 18*/ { GS1_MODE, "[90]123[90]1234[90]123", 0, 189, 0, "(17) 104 102 25 99 1 23 102 90 12 34 102 90 12 100 19 62 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 34 FNC1 90 12 CodeB 3; BWIPP different encodation (BWIPP 3 longer)" },
/* 19*/ { GS1_MODE, "[90]12345[90]1234[90]1", 0, 189, 0, "(17) 104 102 25 99 1 23 45 102 90 12 34 102 90 100 17 75 106", "StartB FNC1 9 CodeC 01 23 45 FNC1 90 12 34 FNC1 90 CodeB 1; BWIPP different encodation (BWIPP 3 longer)" },
/* 17*/ { GS1_MODE, "[90]123[90]1234[90]1", 0, 178, 1, "(16) 104 102 25 99 1 23 102 90 12 34 102 90 100 17 82 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 34 FNC1 90 CodeB 1" },
/* 18*/ { GS1_MODE, "[90]123[90]1234[90]123", 0, 189, 1, "(17) 104 102 25 99 1 23 102 90 12 34 102 90 12 100 19 62 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 34 FNC1 90 12 CodeB 3" },
/* 19*/ { GS1_MODE, "[90]12345[90]1234[90]1", 0, 189, 1, "(17) 104 102 25 99 1 23 45 102 90 12 34 102 90 100 17 75 106", "StartB FNC1 9 CodeC 01 23 45 FNC1 90 12 34 FNC1 90 CodeB 1" },
/* 20*/ { GS1_MODE, "[90]1A[90]1", 0, 134, 0, "(12) 105 102 90 100 17 33 102 25 99 1 36 106", "StartC FNC1 90 CodeB 1 A FNC1 9 CodeC 01; BWIPP different encodation (same width)" },
/* 21*/ { GS1_MODE, "[90]12A[90]123", 0, 145, 1, "(13) 105 102 90 12 100 33 102 25 99 1 23 25 106", "StartC FNC1 90 12 CodeB A FNC1 9 CodeC 01 23" },
/* 22*/ { GS1_MODE, "[90]123[90]A234[90]123", 0, 222, 0, "(20) 105 102 90 12 100 19 102 25 16 33 18 99 34 102 90 12 100 19 50 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 0 A 2 CodeC 34 FNC1 90 12 CodeB 3; BWIPP different encodation (same width)" },
/* 22*/ { GS1_MODE, "[90]123[90]A234[90]123", 0, 222, 1, "(20) 105 102 90 12 100 19 102 25 16 33 18 99 34 102 90 12 100 19 50 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 0 A 2 CodeC 34 FNC1 90 12 CodeB 3" },
/* 23*/ { GS1_MODE, "[90]12345A12345A", 0, 178, 0, "(16) 105 102 90 12 34 100 21 33 99 12 34 100 21 33 8 106", "StartC FNC1 90 12 34 CodeB 5 A CodeC 12 34 CodeB 5 A; BWIPP different encodation (same width)" },
/* 24*/ { GS1_MODE, "[01]12345678901231[90]12345678901234567890123456789", 0, 321, 1, "(29) 105 102 1 12 34 56 78 90 12 31 90 12 34 56 78 90 12 34 56 78 90 12 34 56 78 100 25 59", "Max length" },
/* 25*/ { GS1_MODE, "[01]12345678901231[90]123456789012345678901234567890[91]1", ZINT_WARN_NONCOMPLIANT, 354, 1, "Warning 843: Input too long, requires 52 characters (maximum 48)", "Over length" },
@ -997,7 +997,7 @@ static void test_encode(const testCtx *const p_ctx) {
/* 4*/ { BARCODE_CODE128, DATA_MODE, -1, "\101\102\103\104\105\106\200\200\200\200\200", 0, 1, 178, 1, "",
"1101000010010100011000100010110001000100011010110001000100011010001000110001011101011110111010111101010000110010100001100101000011001010000110010100001100110110110001100011101011"
},
/* 5*/ { BARCODE_CODE128, DATA_MODE, -1, "\101\102\103\144\012\105\061\062\063\110\111\112\064\065\066\067\114\115\120\141\127\012\130\131\132\141\142\012\012\145\012\012\146\147\012\175\061\062\012\012\064\065\066\012\202\302\012\012\342\061\062\012\012\012\012\061\062\063\012\012\012\012\012\012\061\062\063\064\012\012\012\012\342\342\342\061\062\063\064\342\342\342", 0, 1, 1124, 0, "BWIPP different encodation, same codeword count",
/* 5*/ { BARCODE_CODE128, DATA_MODE, -1, "\101\102\103\144\012\105\061\062\063\110\111\112\064\065\066\067\114\115\120\141\127\012\130\131\132\141\142\012\012\145\012\012\146\147\012\175\061\062\012\012\064\065\066\012\202\302\012\012\342\061\062\012\012\012\012\061\062\063\012\012\012\012\012\012\061\062\063\064\012\012\012\012\342\342\342\061\062\063\064\342\342\342", 0, 1, 1124, 0, "BWIPP different encodation, BWIPP 3 shorter",
"11010010000101000110001000101100010001000110100001001101110101111010000110010100011010001001110011011001110010110010111001100010100011000100010101101110001011101111010111011000100001011001011110111010001101110101110110001110111011010010110000111010001101111010001010000110010111000101101110110100011101100010100101100001001000011011101011110100001100101000011001011110100010101100100001000011001010000110010101111011101011000010010011010000111010111101000011001011110100010101000111101001110011011001110010100001100101000011001011001001110110111001001100111010010000110010111010111101001000011011101011110100010110001000011001010000110010111010111101111010001010010000110100111001101100111001010000110010100001100101000011001010000110010100111001101100111001011001011100100001100101000011001010000110010100001100101000011001010000110010101110111101011001110010001011000111010111101000011001010000110010100001100101000011001010111101110101111011101001000011010111101110100100001101011110111010010000110101110111101011001110010001011000101111011101011110111010111101110100100001101001000011010010000110110001011101100011101011"
},
/* 6*/ { BARCODE_GS1_128, GS1_MODE, -1, "[8018]950110153123456781", 0, 1, 167, 1, "GGS Figure 2.5.2-1",
@ -1009,7 +1009,7 @@ static void test_encode(const testCtx *const p_ctx) {
/* 8*/ { BARCODE_GS1_128, GS1_MODE, -1, "[12]010425[8020]ABC123", 0, 1, 189, 0, "GGS Figure 2.6.6-1 bottom **NOT SAME**, different encodation, same width; BWIPP as standard",
"110100111001111010111010110011100110011011001001000110011100101100101001111001100100111010111101110101000110001000101100010001000110100111001101011101111011101101110111101000101100011101011"
},
/* 9*/ { BARCODE_GS1_128, GS1_MODE, -1, "[253]950110153005812345678901", 0, 1, 211, 0, "GGS Figure 2.6.9-1 **NOT SAME**, different encodation, same width; BWIPP as standard",
/* 9*/ { BARCODE_GS1_128, GS1_MODE, -1, "[253]950110153005812345678901", 0, 1, 211, 1, "GGS Figure 2.6.9-1 **NOT SAME**, different encodation, same width",
"1101001110011110101110111001011001101000100011000101110110001001001100110110011011101110110110011001110110001010110011100100010110001110001011011000010100110111101101011110111010011100110101110110001100011101011"
},
/* 10*/ { BARCODE_GS1_128, GS1_MODE, -1, "[253]950110153006567890543210987", 0, 1, 211, 1, "GGS Figure 2.6.9-2",
@ -1033,7 +1033,7 @@ static void test_encode(const testCtx *const p_ctx) {
/* 16*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]006141411234567890", 0, 1, 156, 1, "GGS Figure 6.6.5-1. (and Figures 6.6.5-3 bottom, 6.6.5-4 bottom)",
"110100111001111010111011011001100110110011001100100001011000100010110001000101011001110010001011000111000101101100001010011011110110110110110001100011101011"
},
/* 17*/ { BARCODE_GS1_128, GS1_MODE, -1, "[403]402621[401]950110153B01001", 0, 1, 255, 0, "GGS Figure 6.6.5-2 top, same; BWIPP different encodation, same width",
/* 17*/ { BARCODE_GS1_128, GS1_MODE, -1, "[403]402621[401]950110153B01001", 0, 1, 255, 1, "GGS Figure 6.6.5-2 top, same",
"110100100001111010111011001001110101110111101001001100011000101000111001001101101110010011110101110110001010001100101110011000101110110001001001100110110011011101110101111011101000101100010011101100101110111101100100010011001101100110001101101100011101011"
},
/* 18*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]395011015300000011", 0, 1, 156, 1, "GGS Figure 6.6.5-2 bottom",
@ -1090,7 +1090,7 @@ static void test_encode(const testCtx *const p_ctx) {
/* 35*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]340433935039756615", 0, 1, 156, 1, "DHL Identcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html",
"110100111001111010111011011001100100010110001001000110010100011000101000111101100010111011010001000110000100101001000011010111001100100111001101100011101011"
},
/* 36*/ { BARCODE_GS1_128, GS1_MODE, -1, "[90]ABCDEfGHI", 0, 1, 167, 1, "Shift A",
/* 36*/ { BARCODE_GS1_128, GS1_MODE, -1, "[90]ABCDEfGHI", 0, 1, 167, 0, "Shift A; BWIPP different encodation",
"11010011100111101011101101111011010111101110101000110001000101100010001000110101100010001000110100010110000100110100010001100010100011000100010100010111101100011101011"
},
/* 37*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[3100]121212[20]34[20]78", ZINT_WARN_HRT_TRUNCATED, 1, 1135, 1, "Max length",
@ -1138,7 +1138,7 @@ static void test_encode(const testCtx *const p_ctx) {
/* 51*/ { BARCODE_DPD, UNICODE_MODE, 1, "006376209980000020044118276", 0, 1, 200, 1, "DPDPLS Section 8.7.2 relabel, **NOT SAME**, figure begins StartB then immediate CodeC, zint begins StartC (shorter)",
"11010011100110110011001010011000011001010000110010011101011101111010100111100110110011001101100110011001001110100100011001100010001011001110010111011001001011110111011001110100110111011101100011101011"
},
/* 52*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, "EE876543216CA", 0, 1, 156, 0, "BWIPP different encodation, same width",
/* 52*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, "EE876543216CA", 0, 1, 156, 1, "",
"110100100001000110100010001101000101110111101111001010010010110000101100011101101110010010111101110110011101001000100011010100011000100010011001100011101011"
},
};

View File

@ -109,7 +109,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
/* 0*/ { UNICODE_MODE, READER_INIT, "A", 0, 2, 70, "(10) 1 96 33 103 103 103 103 103 68 35", "ModeB FNC3 A Pad (5)" },
/* 1*/ { UNICODE_MODE, READER_INIT, "12", 0, 2, 70, "(10) 5 96 12 103 103 103 103 103 99 41", "ModeC1SB FNC3 12 Pad (5)" },
/* 2*/ { UNICODE_MODE, READER_INIT, "A1234", 0, 2, 70, "(10) 6 96 33 12 34 103 103 103 65 53", "ModeC2SB FNC3 A 12 34 Pad (3)" },
/* 3*/ { GS1_MODE, READER_INIT, "[90]1", ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 422: Cannot use both GS1 mode and Reader Initialisation", "" },
/* 3*/ { GS1_MODE, READER_INIT, "[90]1", ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 422: Cannot use Reader Initialisation in GS1 mode", "" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;

View File

@ -645,7 +645,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
};
static const 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", "" },
/* 1*/ { BARCODE_DATAMATRIX, GS1_MODE, READER_INIT, "[91]A", ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 521: Cannot use Reader Initialisation in GS1 mode", "" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;

View File

@ -43,44 +43,46 @@ static void test_large(const testCtx *const p_ctx) {
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
/* 0*/ { -1, -1, "1", 138, "", 0, 33, 30 }, /* Mode 4 (138 agrees with ISO/IEC 16023:2000) */
/* 1*/ { -1, -1, "1", 139, "", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 2*/ { -1, -1, "1", 144, "", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 3*/ { -1, -1, "1", 145, "", ZINT_ERROR_TOO_LONG, -1, -1 }, /* Absolute max */
/* 4*/ { -1, -1, "A", 93, "", 0, 33, 30 },
/* 5*/ { -1, -1, "A", 94, "", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 6*/ { -1, -1, "\001", 91, "", 0, 33, 30 },
/* 7*/ { -1, -1, "\001", 92, "", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 8*/ { -1, -1, "\200", 91, "", 0, 33, 30 },
/* 9*/ { -1, -1, "\200", 92, "", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 10*/ { 2, -1, "1", 126, "123456789123123", 0, 33, 30 },
/* 11*/ { 2, -1, "1", 127, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 12*/ { 2, -1, "A", 84, "123456789123123", 0, 33, 30 },
/* 13*/ { 2, -1, "A", 85, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 14*/ { 2, 96 + 1, "1", 109, "123456789123123", 0, 33, 30 },
/* 15*/ { 2, 96 + 1, "1", 110, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 16*/ { 2, 96 + 1, "1", 136, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1 }, /* Absolute max with SCM vv */
/* 17*/ { 3, -1, "1", 126, "ABCDEF123123", 0, 33, 30 },
/* 18*/ { 3, -1, "1", 127, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 19*/ { 3, -1, "A", 84, "ABCDEF123123", 0, 33, 30 },
/* 20*/ { 3, -1, "A", 85, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 21*/ { 3, 96 + 1, "1", 109, "ABCDEF123123", 0, 33, 30 },
/* 22*/ { 3, 96 + 1, "1", 110, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 23*/ { 0, -1, "1", 126, "123456789123123", 0, 33, 30 }, /* Mode 2 */
/* 24*/ { 0, -1, "1", 127, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 25*/ { 0, -1, "1", 126, "ABCDEF123123", 0, 33, 30 }, /* Mode 3 */
/* 26*/ { 0, -1, "1", 127, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 27*/ { 5, -1, "1", 113, "", 0, 33, 30 }, /* Extra EEC */
/* 28*/ { 5, -1, "1", 114, "", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 29*/ { 5, -1, "A", 77, "", 0, 33, 30 },
/* 30*/ { 5, -1, "A", 78, "", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 31*/ { 6, -1, "1", 138, "", 0, 33, 30 },
/* 32*/ { 6, -1, "1", 139, "", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 33*/ { 6, -1, "A", 93, "", 0, 33, 30 },
/* 34*/ { 6, -1, "A", 94, "", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 0*/ { -1, -1, "1", 138, "", 0, 33, 30, 0, "Mode 4 (138 agrees with ISO/IEC 16023:2000); BWIPP different encodation (begins with ASCII digits then NSes)" },
/* 1*/ { -1, -1, "1", 139, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 2*/ { -1, -1, "1", 144, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 3*/ { -1, -1, "1", 145, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "Absolute max" },
/* 4*/ { -1, -1, "A", 93, "", 0, 33, 30, 1, "" },
/* 5*/ { -1, -1, "A", 94, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 6*/ { -1, -1, "\001", 91, "", 0, 33, 30, 1, "" },
/* 7*/ { -1, -1, "\001", 92, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 8*/ { -1, -1, "\200", 91, "", 0, 33, 30, 1, "" },
/* 9*/ { -1, -1, "\200", 92, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 10*/ { 2, -1, "1", 126, "123456789123123", 0, 33, 30, 1, "" },
/* 11*/ { 2, -1, "1", 127, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 12*/ { 2, -1, "A", 84, "123456789123123", 0, 33, 30, 1, "" },
/* 13*/ { 2, -1, "A", 85, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 14*/ { 2, 96 + 1, "1", 109, "123456789123123", 0, 33, 30, 0, "BWIPP different encodation (begins with ASCII digits then NSes)" },
/* 15*/ { 2, 96 + 1, "1", 110, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 16*/ { 2, 96 + 1, "1", 136, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "Absolute max with SCM vv" },
/* 17*/ { 3, -1, "1", 126, "ABCDEF123123", 0, 33, 30, 1, "" },
/* 18*/ { 3, -1, "1", 127, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 19*/ { 3, -1, "A", 84, "ABCDEF123123", 0, 33, 30, 1, "" },
/* 20*/ { 3, -1, "A", 85, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 21*/ { 3, 96 + 1, "1", 109, "ABCDEF123123", 0, 33, 30, 0, "BWIPP different encodation" },
/* 22*/ { 3, 96 + 1, "1", 110, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 23*/ { 0, -1, "1", 126, "123456789123123", 0, 33, 30, 0, "Mode 2; BWIPP requires mode" },
/* 24*/ { 0, -1, "1", 127, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 25*/ { 0, -1, "1", 126, "ABCDEF123123", 0, 33, 30, 1, "Mode 3" },
/* 26*/ { 0, -1, "1", 127, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 27*/ { 5, -1, "1", 113, "", 0, 33, 30, 0, "Extra EEC; BWIPP different encodation (begins with ASCII digits then NSes)" },
/* 28*/ { 5, -1, "1", 114, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 29*/ { 5, -1, "A", 77, "", 0, 33, 30, 1, "" },
/* 30*/ { 5, -1, "A", 78, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 31*/ { 6, -1, "1", 138, "", 0, 33, 30, 0, "BWIPP different encodation (begins with ASCII digits then NSes)" },
/* 32*/ { 6, -1, "1", 139, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
/* 33*/ { 6, -1, "A", 93, "", 0, 33, 30, 1, "" },
/* 34*/ { 6, -1, "A", 94, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -92,6 +94,7 @@ static void test_large(const testCtx *const p_ctx) {
char cmp_msg[1024];
const char expected_errtxt[] = "Error 553: Input too long, requires too many codewords (maximum 144)";
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
testStartSymbol("test_large", &symbol);
@ -121,6 +124,20 @@ static void test_large(const testCtx *const p_ctx) {
}
if (ret < ZINT_ERROR) {
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 {
char modules_dump[33 * 33 + 1];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data_buf, length, symbol->primary, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
}
}
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data_buf, length, debug)) {
int cmp_len, ret_len;
char modules_dump[33 * 33 + 1];
@ -212,10 +229,10 @@ static void test_input(const testCtx *const p_ctx) {
/* 49*/ { UNICODE_MODE, -1, -1, -1, { 1, 9, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 558: Structured Append count '9' out of range (2 to 8)", 1, 1, "" },
/* 50*/ { UNICODE_MODE, -1, -1, -1, { 3, 2, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 559: Structured Append index '3' out of range (1 to count 2)", 1, 1, "" },
/* 51*/ { UNICODE_MODE, -1, -1, -1, { 1, 2, "A" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 549: Structured Append ID not available for MaxiCode", 1, 1, "" },
/* 52*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "b..A", -1, "", 0, 30, "(144) 04 3F 02 31 38 2E 01 21 21 21 23 2F 04 2C 34 3B 28 25 2C 11 21 21 21 21 21 21 21 21", 0, 1, "BWIPP pending PR #279" },
/* 53*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A123456789b123456789bbbA", -1, "", 0, 30, "(144) 04 01 1F 07 16 3C 34 15 3B 02 08 28 3C 0E 06 03 34 25 3C 1E 1F 07 16 3C 34 15 3F 02", 1, 1, "BWIPP pending PR #279" },
/* 54*/ { ESCAPE_MODE, -1, -1, -1, { 0, 0, "" }, "\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192", -1, "", 0, 30, "(144) 04 3C 00 3D 00 3D 00 3D 00 3C 32 10 27 30 09 0B 06 16 3D 0D 00 3D 00 3D 00 3D 00 3C", 1, 1, "BWIPP pending PR #279" },
/* 54*/ { ESCAPE_MODE, -1, -1, -1, { 0, 0, "" }, "\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192", -1, "", 0, 30, "(144) 04 3C 00 3D 00 3D 00 3D 00 3C 32 10 27 30 09 0B 06 16 3D 0D 00 3D 00 3D 00 3D 00 3C", 1, 1, "BWIPP pending PR #279" },
/* 52*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "b..A", -1, "", 0, 30, "(144) 04 3F 02 31 38 2E 01 21 21 21 23 2F 04 2C 34 3B 28 25 2C 11 21 21 21 21 21 21 21 21", 0, 1, "BWIPP PR #279 (BWIPP 1 shorter)" },
/* 53*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A123456789b123456789bbbA", -1, "", 0, 30, "(144) 04 01 1F 07 16 3C 34 15 3B 02 08 28 3C 0E 06 03 34 25 3C 1E 1F 07 16 3C 34 15 3F 02", 0, 1, "BWIPP PR #279 (BWIPP 1 shorter)" },
/* 54*/ { ESCAPE_MODE, -1, -1, -1, { 0, 0, "" }, "\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192", -1, "", 0, 30, "(144) 04 3C 00 3D 00 3D 00 3D 00 3C 32 10 27 30 09 0B 06 16 3D 0D 00 3D 00 3D 00 3D 00 3C", 0, 1, "BWIPP PR #279 (BWIPP 1 shorter)" },
/* 55*/ { ESCAPE_MODE, -1, 2, -1, { 0, 0, "" }, "1Z34567890\\GUPSN\\G102562\\G034\\G\\G1/1\\G\\GY\\G2201 Second St\\GFt Myers\\GFL\\R\\E", -1, "339010000840001", 0, 30, "(144) 02 34 21 13 03 15 02 12 07 00 0C 03 00 38 24 04 0B 1F 2F 21 31 1A 33 34 35 36 37 38", 0, 1, "BWIPP different encodation" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -529,7 +546,7 @@ static void test_encode(const testCtx *const p_ctx) {
"001011110011100001001001101100"
"000010111011111010110011000011"
},
/* 6*/ { -1, -1, -1, { 0, 0, "" }, "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", -1, "", 0, 33, 30, 1, "Numeric compaction, verified manually against tec-it",
/* 6*/ { -1, -1, -1, { 0, 0, "" }, "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", -1, "", 0, 33, 30, 0, "Numeric compaction, verified manually against TEC-IT; BWIPP different encodation",
"010111101101010111101101010111"
"111011110110111011110110111010"
"001111111101001111111101001100"
@ -704,7 +721,7 @@ static void test_encode(const testCtx *const p_ctx) {
"100100110011010101001011100100"
"001000101111010000111000010101"
},
/* 11*/ { UNICODE_MODE | ESCAPE_MODE, 4, -1, { 0, 0, "" }, "\\rABCDEFGHIJKLMNOPQRSTUVWXYZ\034\\G\\R \"#$%&'()*+,-./0123456789:", -1, "", 0, 33, 30, 1, "Mode 4 Set A",
/* 11*/ { UNICODE_MODE | ESCAPE_MODE, 4, -1, { 0, 0, "" }, "\\rABCDEFGHIJKLMNOPQRSTUVWXYZ\034\\G\\R \"#$%&'()*+,-./0123456789:", -1, "", 0, 33, 30, 0, "Mode 4 Set A; BWIPP different encodation",
"000000000000001010101010101011"
"010101111111110000000010101010"
"100111001001110010011100100101"
@ -949,7 +966,7 @@ static void test_encode(const testCtx *const p_ctx) {
"011100101001010011011100111100"
"101101110111011101011010011101"
},
/* 18*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ABCDE12abcde1ÀÁÂ⣤¥1àáâãabcde123A123456789àáâ㢣¤¥abc", -1, "", 0, 33, 30, 1, "Mode 4 mixed sets",
/* 18*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ABCDE12abcde1ÀÁÂ⣤¥1àáâãabcde123A123456789àáâ㢣¤¥abc", -1, "", 0, 33, 30, 0, "Mode 4 mixed sets; BWIPP different encodation",
"000000001111111100000000111111"
"000010100100111100000000111100"
"011100101110000000100111010100"
@ -1398,7 +1415,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
"010111011011100000011000101000"
"001111010010000100010110011110"
},
/* 6*/ { DATA_MODE, -1, -1, { 0, 0, "" }, { { TU("\266"), 1, 0 }, { TU("\266"), 1, 7 }, { TU("\266"), 1, 0 } }, "", 0, 33, 30, 1, "Standard example + extra seg, data mode",
/* 6*/ { DATA_MODE, -1, -1, { 0, 0, "" }, { { TU("\266"), 1, 0 }, { TU("\266"), 1, 7 }, { TU("\266"), 1, 0 } }, "", 0, 33, 30, 0, "Standard example + extra seg, data mode; BWIPP different encodation",
"010101010101010101010101010111"
"110000000000000000000000000010"
"111010101010101010101010101011"
@ -1433,7 +1450,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
"000111101111000100101110001100"
"000100001000100111100110010100"
},
/* 7*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("αβ"), -1, 0 }, { TU("ÿ"), -1, 0 }, { TU("貫やぐ禁"), -1, 20 } }, "", ZINT_WARN_USES_ECI, 33, 30, 1, "Auto-ECI",
/* 7*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("αβ"), -1, 0 }, { TU("ÿ"), -1, 0 }, { TU("貫やぐ禁"), -1, 20 } }, "", ZINT_WARN_USES_ECI, 33, 30, 0, "Auto-ECI; BWIPP different encodation",
"011010110111101111110011111111"
"100110111111001100110011001110"
"001100101100100001100100010111"
@ -1503,7 +1520,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
"101010011010110110110010010100"
"100101010111100011100010101000"
},
/* 9*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("ab"), -1, 3 }, { TU("ABCD"), -1, 4 }, { TU(""), 0, 0 } }, "", 0, 33, 30, 1, "Code Set B then A",
/* 9*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("ab"), -1, 3 }, { TU("ABCD"), -1, 4 }, { TU(""), 0, 0 } }, "", 0, 33, 30, 0, "Code Set B then A; BWIPP different encodation",
"000000010101010101010101010111"
"000010000000000000000000000010"
"011100101010101010101010101001"
@ -1538,7 +1555,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
"011011011101010101001101001000"
"001010010110100000100111101000"
},
/* 10*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("\004\004\004\004"), -1, 3 }, { TU("ABCD"), -1, 4 }, { TU("abcd"), -1, 5 } }, "", 0, 33, 30, 1, "Code Set E then A then B",
/* 10*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("\004\004\004\004"), -1, 3 }, { TU("ABCD"), -1, 4 }, { TU("abcd"), -1, 5 } }, "", 0, 33, 30, 0, "Code Set E then A then B; BWIPP different encodation",
"001100000000100011000000000111"
"100100000010011011000000100000"
"000110011100111011100111001010"

View File

@ -2472,7 +2472,7 @@ static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const ch
/* 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 == '^' && !init_parsefnc) || *d == '"' || *d == '\''
|| *d == '(' || *d == ')' || (*d == '\\' && !zint_escape_mode)) {
|| *d == '(' || (*d == '\\' && !zint_escape_mode)) {
if (b + 4 >= be) {
fprintf(stderr, "testUtilBwippEscape: double quote bwipp_data buffer full (%d)\n", bwipp_data_size);
return NULL;
@ -3128,8 +3128,6 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
itoc(symbol->structapp.count));
bwipp_opts = bwipp_opts_buf;
}
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%snewencoder", strlen(bwipp_opts_buf) ? " " : "");
bwipp_opts = bwipp_opts_buf;
} else if (symbology == BARCODE_BC412) {
to_upper((unsigned char *) bwipp_data, (int) strlen(bwipp_data));
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%ssemi", strlen(bwipp_opts_buf) ? " " : "");
@ -3141,6 +3139,13 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
}
}
if (symbology == BARCODE_CODE128 || symbology == BARCODE_CODE128AB || symbology == BARCODE_HIBC_128
|| symbology == BARCODE_GS1_128 || symbology == BARCODE_GS1_128_CC || symbology == BARCODE_NVE18
|| symbology == BARCODE_EAN14 || symbology == BARCODE_UPU_S10 || symbology == BARCODE_MAXICODE) {
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%snewencoder", strlen(bwipp_opts_buf) ? " " : "");
bwipp_opts = bwipp_opts_buf;
}
if (symbology == BARCODE_DATAMATRIX || symbology == BARCODE_HIBC_DM) {
int added_dmre = 0;
#include "../dmatrix.h"

View File

@ -47,6 +47,7 @@ run_bwipp_test "test_gs1" "gs1_reduce"
run_bwipp_test "test_imail" "input"
run_bwipp_test "test_imail" "encode"
run_bwipp_test "test_mailmark" "2d_encode"
run_bwipp_test "test_maxicode" "large"
run_bwipp_test "test_maxicode" "input"
run_bwipp_test "test_maxicode" "encode"
run_bwipp_test "test_maxicode" "encode_segs"