diff --git a/backend/dotcode.c b/backend/dotcode.c index 5a2d5f5d..78f39141 100644 --- a/backend/dotcode.c +++ b/backend/dotcode.c @@ -32,7 +32,7 @@ /* vim: set ts=4 sw=4 et : */ /* - * Attempts to encode DotCode according to AIMD013 Rev 1.34a, dated Feb 19, 2009 + * Attempts to encode DotCode according to (AIMD013) ISS DotCode Rev. 4.0, DRAFT 0.15, TSC Pre-PR #5, dated May 28, 2019 * Incorporating suggestions from Terry Burton at BWIPP */ @@ -68,6 +68,7 @@ static const unsigned short int dot_patterns[113] = { 0x1b8, 0x1c6, 0x1cc }; +// Printed() routine from Annex A adapted to char array of ASCII 1's and 0's static int get_dot(char Dots[], const int Hgt, const int Wid, const int x, const int y) { int retval = 0; @@ -102,61 +103,67 @@ static int clr_row(char *Dots, const int Hgt, const int Wid, const int y) { return 1; } -/* Dot pattern scoring routine from Annex A */ -static int score_array(char Dots[], int Hgt, int Wid) { - int x, y, worstedge, first, last, sum; - int penalty_local = 0; - int penalty = 0; +// calc penalty for empty interior columns +static int col_penalty(char *Dots, int Hgt, int Wid) { + int x, penalty = 0, penalty_local = 0; - // first, guard against "pathelogical" gaps in the array - if (Hgt & 1) { - if (Hgt < 12) { - sum = 0; - for (x = 1; x < Wid - 1; x++) { - if (!(clr_col(Dots, Hgt, Wid, x))) { - sum = 0; - if (penalty_local) { - penalty += penalty_local; - penalty_local = 0; - } - } else { - sum++; - if (sum == 1) { - penalty_local = Hgt; - } else { - penalty_local *= Hgt; - } - } + for (x = 1; x < Wid - 1; x++) { + if (clr_col(Dots, Hgt, Wid, x)) { + if (penalty_local == 0) { + penalty_local = Hgt; + } else { + penalty_local *= Hgt; } - } - } else { - if (Wid < 12) { - sum = 0; - for (y = 1; y < Hgt - 1; y++) { - if (!(clr_row(Dots, Hgt, Wid, y))) { - sum = 0; - if (penalty_local) { - penalty += penalty_local; - penalty_local = 0; - } - } else { - sum++; - if (sum == 1) { - penalty_local = Wid; - } else { - penalty_local *= Wid; - } - } + } else { + if (penalty_local) { + penalty += penalty_local; + penalty_local = 0; } } } + return penalty + penalty_local; +} + +// calc penalty for empty interior rows +static int row_penalty(char *Dots, int Hgt, int Wid) { + int y, penalty = 0, penalty_local = 0; + + for (y = 1; y < Hgt - 1; y++) { + if (clr_row(Dots, Hgt, Wid, y)) { + if (penalty_local == 0) { + penalty_local = Wid; + } else { + penalty_local *= Wid; + } + } else { + if (penalty_local) { + penalty += penalty_local; + penalty_local = 0; + } + } + } + + return penalty + penalty_local; +} + +/* Dot pattern scoring routine from Annex A */ +static int score_array(char Dots[], int Hgt, int Wid) { + int x, y, worstedge, first, last, sum; + int penalty = 0; + + // first, guard against "pathelogical" gaps in the array + // subtract a penalty score for empty rows/columns from total code score for each mask, + // where the penalty is Sum(N ^ n), where N is the number of positions in a column/row, + // and n is the number of consecutive empty rows/columns + penalty = row_penalty(Dots, Hgt, Wid) + col_penalty(Dots, Hgt, Wid); + sum = 0; first = -1; last = -1; // across the top edge, count printed dots and measure their extent - for (x = 0; x < Wid; x += 2) + for (x = 0; x < Wid; x += 2) { if (get_dot(Dots, Hgt, Wid, x, 0)) { if (first < 0) { first = x; @@ -164,19 +171,20 @@ static int score_array(char Dots[], int Hgt, int Wid) { last = x; sum++; } - worstedge = sum + last - first; - worstedge *= Hgt; - + } if (sum == 0) { return SCORE_UNLIT_EDGE; // guard against empty top edge } + worstedge = sum + last - first; + worstedge *= Hgt; + sum = 0; first = -1; last = -1; - //across the bottom edge, ditto - for (x = Wid & 1; x < Wid; x += 2) + // across the bottom edge, ditto + for (x = Wid & 1; x < Wid; x += 2) { if (get_dot(Dots, Hgt, Wid, x, Hgt - 1)) { if (first < 0) { first = x; @@ -184,22 +192,23 @@ static int score_array(char Dots[], int Hgt, int Wid) { last = x; sum++; } + } + if (sum == 0) { + return SCORE_UNLIT_EDGE; // guard against empty bottom edge + } + sum += last - first; sum *= Hgt; if (sum < worstedge) { worstedge = sum; } - if (sum == 0) { - return SCORE_UNLIT_EDGE; // guard against empty bottom edge - } - sum = 0; first = -1; last = -1; - //down the left edge, ditto - for (y = 0; y < Hgt; y += 2) + // down the left edge, ditto + for (y = 0; y < Hgt; y += 2) { if (get_dot(Dots, Hgt, Wid, 0, y)) { if (first < 0) { first = y; @@ -207,22 +216,23 @@ static int score_array(char Dots[], int Hgt, int Wid) { last = y; sum++; } + } + if (sum == 0) { + return SCORE_UNLIT_EDGE; // guard against empty left edge + } + sum += last - first; sum *= Wid; if (sum < worstedge) { worstedge = sum; } - if (sum == 0) { - return SCORE_UNLIT_EDGE; // guard against empty left edge - } - sum = 0; first = -1; last = -1; - //down the right edge, ditto - for (y = Hgt & 1; y < Hgt; y += 2) + // down the right edge, ditto + for (y = Hgt & 1; y < Hgt; y += 2) { if (get_dot(Dots, Hgt, Wid, Wid - 1, y)) { if (first < 0) { first = y; @@ -230,16 +240,17 @@ static int score_array(char Dots[], int Hgt, int Wid) { last = y; sum++; } + } + if (sum == 0) { + return SCORE_UNLIT_EDGE; // guard against empty right edge + } + sum += last - first; sum *= Wid; if (sum < worstedge) { worstedge = sum; } - if (sum == 0) { - return SCORE_UNLIT_EDGE; // guard against empty right edge - } - // throughout the array, count the # of unprinted 5-somes (cross patterns) // plus the # of printed dots surrounded by 8 unprinted neighbors sum = 0; @@ -268,12 +279,22 @@ static int score_array(char Dots[], int Hgt, int Wid) { //------------------------------------------------------------------------- static void rsencode(int nd, int nc, unsigned char *wd) { - int i, j, k, nw, start, step, root[GF], c[GF]; - - // Start by generating "nc" roots (antilogs): - root[0] = 1; - for (i = 1; (i <= nc) && (i < GF); i++) - root[i] = (PM * root[i - 1]) % GF; + // roots (antilogs): root[0] = 1; for (i = 1; i < GF - 1; i++) root[i] = (PM * root[i - 1]) % GF; + static int root[GF - 1] = { + 1, 3, 9, 27, 81, 17, 51, 40, 7, 21, + 63, 76, 2, 6, 18, 54, 49, 34, 102, 80, + 14, 42, 13, 39, 4, 12, 36, 108, 98, 68, + 91, 47, 28, 84, 26, 78, 8, 24, 72, 103, + 83, 23, 69, 94, 56, 55, 52, 43, 16, 48, + 31, 93, 53, 46, 25, 75, 112, 110, 104, 86, + 32, 96, 62, 73, 106, 92, 50, 37, 111, 107, + 95, 59, 64, 79, 11, 33, 99, 71, 100, 74, + 109, 101, 77, 5, 15, 45, 22, 66, 85, 29, + 87, 35, 105, 89, 41, 10, 30, 90, 44, 19, + 57, 58, 61, 70, 97, 65, 82, 20, 60, 67, + 88, 38 + }; + int i, j, k, nw, start, step, c[GF]; // Here we compute how many interleaved R-S blocks will be needed nw = nd + nc; @@ -281,13 +302,14 @@ static void rsencode(int nd, int nc, unsigned char *wd) { // ...& then for each such block: for (start = 0; start < step; start++) { - int ND = (nd - start + step - 1) / step, NW = (nw - start + step - 1) / step, NC = NW - ND; + int ND = (nd - start + step - 1) / step; + int NW = (nw - start + step - 1) / step; + int NC = NW - ND; // first compute the generator polynomial "c" of order "NC": - for (i = 1; i <= NC; i++) - c[i] = 0; - c[0] = 1; + memset(c, 0, GF * sizeof(int)); // Keep clang-tidy happy (as far as UndefinedBinaryOperatorResult warning below at least) + c[0] = 1; for (i = 1; i <= NC; i++) { for (j = NC; j >= 1; j--) { c[j] = (GF + c[j] - (root[i] * c[j - 1]) % GF) % GF; @@ -296,17 +318,19 @@ static void rsencode(int nd, int nc, unsigned char *wd) { // & then compute the corresponding checkword values into wd[] // ... (a) starting at wd[start] & (b) stepping by step - for (i = ND; i < NW; i++) + for (i = ND; i < NW; i++) { wd[start + i * step] = 0; + } for (i = 0; i < ND; i++) { - k = (wd[start + i * step] + wd[start + ND * step]) % GF; + k = (wd[start + i * step] + wd[start + ND * step]) % GF; // NOLINT wd set 0..(nd - 1) and start + i * step <= nd - 1 for (j = 0; j < NC - 1; j++) { wd[start + (ND + j) * step] = (GF - ((c[j + 1] * k) % GF) + wd[start + (ND + j + 1) * step]) % GF; } wd[start + (ND + NC - 1) * step] = (GF - ((c[NC] * k) % GF)) % GF; } - for (i = ND; i < NW; i++) + for (i = ND; i < NW; i++) { wd[start + i * step] = (GF - wd[start + i * step]) % GF; + } } } @@ -323,7 +347,7 @@ static int datum_a(const unsigned char source[], int position, int length) { return retval; } -/* Check if the next character is directly encodable in code set B (Annex F.II.D) */ +/* Check if the next character is directly encodable in code set B (Annex F.II.D). Note changed to return 2 if CR/LF */ static int datum_b(const unsigned char source[], int position, int length) { int retval = 0; @@ -340,9 +364,9 @@ static int datum_b(const unsigned char source[], int position, int length) { retval = 1; } - if (position != length - 2) { + if (position + 1 < length) { if ((source[position] == 13) && (source[position + 1] == 10)) { // CRLF - retval = 1; + retval = 2; } } } @@ -426,17 +450,21 @@ static int ahead_a(const unsigned char source[], int position, int length) { return count; } -/* Annex F.II.H */ -static int ahead_b(const unsigned char source[], int position, int length) { +/* Annex F.II.H Note: changed to return number of chars encodable. Number of codewords returned in *p_nx. */ +static int ahead_b(const unsigned char source[], int position, int length, int *p_nx) { int count = 0; - int i; + int i, incr; - for (i = position; ((i < length) && datum_b(source, i, length)) - && (try_c(source, i, length) < 2); i++) { + for (i = position; (i < length) && (incr = datum_b(source, i, length)) + && (try_c(source, i, length) < 2); i += incr) { count++; } - return count; + if (p_nx != NULL) { + *p_nx = count; + } + + return i - position; } /* checks if the next character is in the range 128 to 255 (Annex F.II.I) */ @@ -452,12 +480,15 @@ static int binary(const unsigned char source[], int length, int position) { /* Analyse input data stream and encode using algorithm from Annex F */ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char *codeword_array, int *binary_finish) { + static char lead_specials[] = "\x09\x1C\x1D\x1E"; // HT, FS, GS, RS + int input_position, array_length, i; char encoding_mode; int inside_macro; int debug = (symbol->debug & ZINT_DEBUG_PRINT); int binary_buffer_size = 0; int lawrencium[6]; // Reversed radix 103 values + int nx; #if defined(_MSC_VER) && _MSC_VER == 1200 uint64_t binary_buffer = 0; @@ -509,39 +540,16 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha } // Prevent encodation as a macro if a special character is in first position - if (source[input_position] == 9) { + if (strchr(lead_specials, source[input_position]) != NULL) { codeword_array[array_length] = 101; // Latch A array_length++; - codeword_array[array_length] = 73; // HT + codeword_array[array_length] = source[input_position] + 64; array_length++; encoding_mode = 'A'; + input_position++; } - if (source[input_position] == 28) { - codeword_array[array_length] = 101; // Latch A - array_length++; - codeword_array[array_length] = 92; // FS - array_length++; - encoding_mode = 'A'; - } - - if (source[input_position] == 29) { - codeword_array[array_length] = 101; // Latch A - array_length++; - codeword_array[array_length] = 93; // GS - array_length++; - encoding_mode = 'A'; - } - - if (source[input_position] == 30) { - codeword_array[array_length] = 101; // Latch A - array_length++; - codeword_array[array_length] = 94; // RS - array_length++; - encoding_mode = 'A'; - } - - do { + while (input_position < length) { int done = 0; /* Step A */ if ((input_position == length - 2) && (inside_macro != 0) && (inside_macro != 100)) { @@ -565,18 +573,19 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha /* Step C1 */ if ((!done) && (encoding_mode == 'C')) { - if ((array_length == 0) && (length > 9)) { + if ((array_length == 0) && (length > 6)) { if ((source[input_position] == '[') && (source[input_position + 1] == ')') && (source[input_position + 2] == '>') && (source[input_position + 3] == 30) // RS - && (source[length - 1] == 04)) { // EOT + && (source[length - 1] == 4)) { // EOT if ((source[input_position + 6] == 29) && (source[length - 2] == 30)) { // GS/RS if ((source[input_position + 4] == '0') && (source[input_position + 5] == '5')) { - codeword_array[array_length] = 102; // Shift B + codeword_array[array_length] = 106; // Latch B array_length++; + encoding_mode = 'B'; codeword_array[array_length] = 97; // Macro array_length++; input_position += 7; @@ -587,9 +596,10 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha } } - if ((source[input_position + 4] == '0') && (source[input_position + 5] == '6')) { - codeword_array[array_length] = 102; // Shift B + if ((!done) && (source[input_position + 4] == '0') && (source[input_position + 5] == '6')) { + codeword_array[array_length] = 106; // Latch B array_length++; + encoding_mode = 'B'; codeword_array[array_length] = 98; // Macro array_length++; input_position += 7; @@ -600,9 +610,10 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha } } - if ((source[input_position + 4] == '1') && (source[input_position + 5] == '2')) { - codeword_array[array_length] = 102; // Shift B + if ((!done) && (source[input_position + 4] == '1') && (source[input_position + 5] == '2')) { + codeword_array[array_length] = 106; // Latch B array_length++; + encoding_mode = 'B'; codeword_array[array_length] = 99; // Macro array_length++; input_position += 7; @@ -614,10 +625,11 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha } } - if ((!done) && (source[input_position] >= '0') && (source[input_position] <= '9') && - (source[input_position + 1] >= '0') && (source[input_position + 1] <= '9')) { - codeword_array[array_length] = 102; // Shift B + if ((!done) && (source[input_position + 4] >= '0') && (source[input_position + 4] <= '9') && + (source[input_position + 5] >= '0') && (source[input_position + 5] <= '9')) { + codeword_array[array_length] = 106; // Latch B array_length++; + encoding_mode = 'B'; codeword_array[array_length] = 100; // Macro array_length++; input_position += 4; @@ -672,12 +684,12 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha if (binary(source, length, input_position)) { if (n_digits(source, input_position + 1, length) > 0) { if ((source[input_position] - 128) < 32) { - codeword_array[array_length] = 110; // Bin Shift A + codeword_array[array_length] = 110; // Upper Shift A array_length++; codeword_array[array_length] = source[input_position] - 128 + 64; array_length++; } else { - codeword_array[array_length] = 111; // Bin Shift B + codeword_array[array_length] = 111; // Upper Shift B array_length++; codeword_array[array_length] = source[input_position] - 128 - 32; array_length++; @@ -698,19 +710,22 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha /* Step C4 */ if ((!done) && (encoding_mode == 'C')) { int m = ahead_a(source, input_position, length); - int n = ahead_b(source, input_position, length); + int n = ahead_b(source, input_position, length, &nx); if (m > n) { codeword_array[array_length] = 101; // Latch A array_length++; encoding_mode = 'A'; } else { - if (n <= 4) { - codeword_array[array_length] = 101 + n; // nx Shift B + if (nx >= 1 && nx <= 4) { + codeword_array[array_length] = 101 + nx; // nx Shift B array_length++; - for (i = 0; i < n; i++) { + for (i = 0; i < nx; i++) { if (source[input_position] >= 32) { codeword_array[array_length] = source[input_position] - 32; + } else if (source[input_position] == 13) { // CR/LF + codeword_array[array_length] = 96; + input_position++; } else { switch(source[input_position]) { case 9: codeword_array[array_length] = 97; break; // HT @@ -890,6 +905,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha /* Step E2 */ if ((!done) && (encoding_mode == 'A')) { if ((source[input_position] == '[') && ((symbol->input_mode & 0x07) == GS1_MODE)) { + // Note: this branch probably never reached as no reason to be in Code Set A for GS1 data codeword_array[array_length] = 107; // FNC1 array_length++; input_position++; @@ -944,14 +960,17 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha /* Step E4 */ if ((!done) && (encoding_mode == 'A')) { - int n = ahead_b(source, input_position, length); + ahead_b(source, input_position, length, &nx); - if (n <= 6) { - codeword_array[array_length] = 95 + n; // nx Shift B + if (nx >= 1 && nx <= 6) { + codeword_array[array_length] = 95 + nx; // nx Shift B array_length++; - for (i = 0; i < n; i++) { + for (i = 0; i < nx; i++) { if (source[input_position] >= 32) { codeword_array[array_length] = source[input_position] - 32; + } else if (source[input_position] == 13) { // CR/LF + codeword_array[array_length] = 96; + input_position++; } else { switch(source[input_position]) { case 9: codeword_array[array_length] = 97; break; // HT @@ -1062,7 +1081,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha binary_buffer = 0; binary_buffer_size = 0; - if (ahead_a(source, input_position, length) > ahead_b(source, input_position, length)) { + if (ahead_a(source, input_position, length) > ahead_b(source, input_position, length, NULL)) { codeword_array[array_length] = 109; // Terminate with Latch to A encoding_mode = 'A'; } else { @@ -1070,12 +1089,12 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha encoding_mode = 'B'; } array_length++; - done = 1; + // done = 1 // As long as last branch not needed if (debug) { printf("F3 "); } } - } while (input_position < length); + } if (encoding_mode == 'X') { if (binary_buffer_size != 0) { @@ -1111,7 +1130,7 @@ static size_t make_dotstream(unsigned char masked_array[], int array_length, cha /* The rest of the data uses 9-bit dot patterns from Annex C */ for (i = 1; i < array_length; i++) { - bin_append(dot_patterns[masked_array[i]], 9, dot_stream); + bin_append(dot_patterns[masked_array[i]], 9, dot_stream); // NOLINT masked_array values modulo 113 and fully set } return strlen(dot_stream); @@ -1318,7 +1337,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, const unsigned char source[], i ecc_length = 3 + (data_length / 2); - if (debug) { + if (debug & ZINT_DEBUG_PRINT) { printf("Codeword length = %d, ECC length = %d\n", data_length, ecc_length); printf("Codewords: "); for (i = 0; i < data_length; i++) { @@ -1326,6 +1345,11 @@ INTERNAL int dotcode(struct zint_symbol *symbol, const unsigned char source[], i } printf("\n"); } +#ifdef ZINT_TEST + if (debug & ZINT_DEBUG_TEST) { + debug_test_codeword_dump(symbol, codeword_array, data_length); + } +#endif min_dots = 9 * (data_length + 3 + (data_length / 2)) + 2; min_area = min_dots * 2; @@ -1380,6 +1404,10 @@ INTERNAL int dotcode(struct zint_symbol *symbol, const unsigned char source[], i } } + if (debug & ZINT_DEBUG_PRINT) { + printf("Width = %d, Height = %d\n", width, height); + } + if ((height > 200) || (width > 200)) { strcpy(symbol->errtxt, "526: Specified symbol size is too large"); return ZINT_ERROR_INVALID_OPTION; @@ -1453,7 +1481,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, const unsigned char source[], i mask_score[i] = score_array(dot_array, height, width); - if (debug) { + if (debug & ZINT_DEBUG_PRINT) { printf("Mask %d score is %d\n", i, mask_score[i]); } } @@ -1487,7 +1515,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, const unsigned char source[], i mask_score[i + 4] = score_array(dot_array, height, width); - if (debug) { + if (debug & ZINT_DEBUG_PRINT) { printf("Mask %d score is %d\n", i + 4, mask_score[i + 4]); } } @@ -1500,8 +1528,8 @@ INTERNAL int dotcode(struct zint_symbol *symbol, const unsigned char source[], i } } - if (debug) { - printf("Applying mask %d\n", best_mask); + if (debug & ZINT_DEBUG_PRINT) { + printf("Applying mask %d, high_score %d\n", best_mask, high_score); } /* Apply best mask */ diff --git a/backend/gs1.c b/backend/gs1.c index 9e7b4ba6..b477751b 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -105,6 +105,10 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] strcpy(symbol->errtxt, "251: Control characters are not supported by GS1"); return ZINT_ERROR_INVALID_DATA; } + if (source[i] == 127) { + strcpy(symbol->errtxt, "263: DEL characters are not supported by GS1"); + return ZINT_ERROR_INVALID_DATA; + } } if (source[0] != '[') { diff --git a/backend/tests/test_dotcode.c b/backend/tests/test_dotcode.c index d8ad0931..c00e7dba 100644 --- a/backend/tests/test_dotcode.c +++ b/backend/tests/test_dotcode.c @@ -31,27 +31,116 @@ #include "testcommon.h" -#define TEST_ENCODE_GENERATE_EXPECTED 1 +//#define TEST_INPUT_GENERATE_EXPECTED 1 +//#define TEST_ENCODE_GENERATE_EXPECTED 1 -// TODO: Verify against AIM standard -static void test_encode(void) -{ +static void test_input(void) { + testStart(""); + + int ret; + struct item { + int input_mode; + int eci; + unsigned char *data; + int length; + int ret; + char *expected; + char *comment; + }; + struct item data[] = { + /* 0*/ { UNICODE_MODE, -1, "A", -1, 0, "66 21", "" }, + /* 1*/ { UNICODE_MODE, 3, "A", -1, 0, "6C 03 66 21", "" }, + /* 2*/ { UNICODE_MODE, 40, "A", -1, 0, "6C 28 00 00 66 21", "" }, + /* 3*/ { UNICODE_MODE, 113, "A", -1, 0, "6C 28 00 49 66 21", "" }, + /* 4*/ { UNICODE_MODE, 899, "A", -1, 0, "6C 28 07 44 66 21", "" }, + /* 5*/ { UNICODE_MODE, 12769, "A", -1, 0, "6C 28 70 49 66 21", "" }, + /* 6*/ { UNICODE_MODE, 811799, "A", -1, 0, "6C 67 40 50 66 21", "" }, + /* 7*/ { UNICODE_MODE, -1, "\000", 1, 0, "65 40", "LatchA (0x65) NUL" }, + /* 8*/ { UNICODE_MODE, -1, "\010", -1, 0, "65 48", "LatchA (0x65) BS" }, + /* 9*/ { UNICODE_MODE, -1, "\011", -1, 0, "65 49", "Lead special; LatchA (0x65) HT" }, + /* 10*/ { UNICODE_MODE, -1, "\034", -1, 0, "65 5C", "Lead special; LatchA (0x65) FS" }, + /* 11*/ { UNICODE_MODE, -1, "\035", -1, 0, "65 5D", "Lead special; LatchA (0x65) GS" }, + /* 12*/ { UNICODE_MODE, -1, "\036", -1, 0, "65 5E", "Lead special; LatchA (0x65) RS" }, + /* 13*/ { UNICODE_MODE, -1, "\037", -1, 0, "65 5F", "LatchA (0x65) US" }, + /* 14*/ { UNICODE_MODE, -1, "\177", -1, 0, "66 5F", "ShiftB (0x66) DEL" }, + /* 15*/ { UNICODE_MODE, -1, "[)>\03605\035A\036\004", -1, 0, "6A 61 21", "[)>RS 05 GS A RS EOT; LatchB (0x6A) Macro97 (0x61) A" }, + /* 16*/ { UNICODE_MODE, -1, "[)>\03606\035\011\034\035\036\036\004", -1, 0, "6A 62 61 62 63 64", "[)>RS 06 GS HT FS GS RS RS EOT; LatchB (0x6A) Macro98 (0x62) HT FS GS RS" }, + /* 17*/ { UNICODE_MODE, -1, "[)>\03612\03512345\036\004", -1, 0, "6A 63 11 67 17 2D", "[)>RS 12 GS A RS EOT; LatchB (0x6A) Macro99 (0x63) 1 2xShiftC (0x67) 23 45" }, + /* 18*/ { UNICODE_MODE, -1, "[)>\03601Blah\004", -1, 0, "6A 64 10 11 22 4C 41 48", "[)>RS 01 Blah EOT; LatchB (0x6A) Macro100 (0x64) 0 1 B l a h" }, + /* 19*/ { UNICODE_MODE, -1, "[)>\03605\035A\004", -1, 0, "6A 64 10 15 63 21", "[)>RS 05 GS A EOT; LatchB (0x6A) Macro100 (0x64) 0 5 HT A" }, + /* 20*/ { UNICODE_MODE, -1, "[)>\03606A\004", -1, 0, "6A 64 10 16 21", "[)>RS 06 A EOT; LatchB (0x6A) Macro100 (0x64) 0 6 A" }, + /* 21*/ { UNICODE_MODE, -1, "[)>\036991\036\004", -1, 0, "6A 64 19 19 11 64", "[)>RS 99 1 RS EOT; LatchB (0x6A) Macro100 (0x64) 9 9 1 RS" }, + /* 22*/ { UNICODE_MODE, -1, "1712345610", -1, 0, "6B 64 0C 22 38", "FNC1 (0x6B) 17..10 12 34 56" }, + /* 23*/ { GS1_MODE, -1, "[17]123456[10]123", -1, 0, "64 0C 22 38 0C 66 13", "17..10 12 34 56 12 ShiftB (0x66) 3" }, + /* 24*/ { GS1_MODE, -1, "[90]ABC[90]abc[90]123", -1, 0, "5A 6A 21 22 23 6B 19 10 41 42 43 6B 19 67 01 17", "90 LatchB (0x6A) A B C FNC1 (0x6B) 9 0 a b c FNC1 (0x6B) 9 2xShitfC (0x67) 01 23" }, + /* 25*/ { UNICODE_MODE, -1, "99aA[{00\000", 9, 0, "6B 63 6A 41 21 3B 5B 10 10 65 40", "FNC1 (0x6B) 99 LatchB (0x6A) a A [ { 0 0 ShiftA (0x65) NUL" }, + /* 26*/ { UNICODE_MODE, -1, "\015\012", -1, 0, "66 60", "ShiftB (0x66) CR/LF" }, + /* 27*/ { UNICODE_MODE, -1, "A\015\012", -1, 0, "67 21 60", "2xShiftB (0x67) A CR/LF" }, + /* 28*/ { UNICODE_MODE, -1, "\015\015\012", -1, 0, "65 4D 4D 4A", "LatchA (0x65) CR CR LF" }, + /* 29*/ { UNICODE_MODE, -1, "ABCDE12345678", -1, 0, "6A 21 22 23 24 25 69 0C 22 38 4E", "LatchB (0x6A) A B C D 4xShiftC 12 34 56 78" }, + /* 30*/ { UNICODE_MODE, -1, "\000ABCD1234567890", 15, 0, "65 40 21 22 23 24 6A 0C 22 38 4E 5A", "LatchA (0x65) NULL A B C D LatchC (0x6A) 12 34 56 78 90" }, + /* 31*/ { DATA_MODE, -1, "\141\142\143\144\145\200\201\202\203\204\377", -1, 0, "6A 41 42 43 44 45 70 31 5A 35 21 5A 5F 02 31", "LatchB (0x6A) a b c d e BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x84 0xFF" }, + /* 32*/ { DATA_MODE, -1, "\200\061\062\240\063\064\201\202\065\066", -1, 0, "6E 40 0C 6F 00 22 70 03 10 42 6E 15 16", "UpperShiftA (0x6E) NUL 12 UpperShiftB (0x6F) SP 34 BinaryLatch (0x70) 0x81 0x82 TermB (0x6E) 5 6" }, + /* 33*/ { DATA_MODE, -1, "\200\201\202\203\061\062\063\064", -1, 0, "70 13 56 0A 59 2C 67 0C 22", "BinaryLatch (0x70) 0x80 0x81 0x82 0x83 Intr2xShiftC (0x67) 12 3" }, + /* 34*/ { DATA_MODE, -1, "\001\200\201\202\203\204\200\201\202\203\204", -1, 0, "65 41 70 31 5A 35 21 5A 5F 31 5A 35 21 5A 5F", "LatchA (0x65) SOH BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x80 0x81 0x82 0x83" }, + /* 35*/ { UNICODE_MODE, -1, "\001abc\011\015\012\036", -1, 0, "65 41 65 41 42 43 61 60 64", "LatchA (0x65) SOH 6xShiftB (0x65) a b c HT CR/LF RS" }, + }; + int data_size = sizeof(data) / sizeof(struct item); + + char escaped[1024]; + + for (int i = 0; i < data_size; i++) { + + struct zint_symbol *symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + symbol->symbology = BARCODE_DOTCODE; + symbol->input_mode = data[i].input_mode; + if (data[i].eci != -1) { + symbol->eci = data[i].eci; + } + symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt + //symbol->debug |= ZINT_DEBUG_PRINT; + + int length = data[i].length != -1 ? data[i].length : strlen(data[i].data); + + ret = ZBarcode_Encode(symbol, 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); + + #ifdef TEST_INPUT_GENERATE_EXPECTED + printf(" /*%3d*/ { %s, %d, \"%s\", %d, %s, \"%s\", \"%s\" },\n", + i, testUtilInputModeName(data[i].input_mode), data[i].eci, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), + data[i].length, testUtilErrorName(data[i].ret), symbol->errtxt, data[i].comment); + #else + if (ret < 5) { + assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); + } + #endif + + ZBarcode_Delete(symbol); + } + + testFinish(); +} + +static void test_encode(void) { testStart(""); int ret; struct item { int input_mode; int option_2; - unsigned char* data; + unsigned char *data; + int length; int ret; int expected_rows; int expected_width; - char* comment; - char* expected; + char *comment; + char *expected; }; struct item data[] = { - /* 0*/ { UNICODE_MODE, -1, "2741", 0, 10, 13, "Verified manually againt bwipp (tec-it differs)", + /* 0*/ { UNICODE_MODE, -1, "2741", -1, 0, 10, 13, "ISS DotCode Rev 4.0 Figure 7B Mask = 2 prime (5)", "1010001010101" "0001000000000" "1000100010101" @@ -63,6 +152,207 @@ static void test_encode(void) "1000100010101" "0101000100010" }, + /* 1*/ { GS1_MODE, 64, "[01]00012345678905[17]201231[10]ABC123456", -1, 0, 9, 64, "ISS DotCode Rev 4.0 Figure 1 (left)", + "1010000000101000101010000010000010001010100010101000101000001010" + "0100010001010001010001000001010100010100010001000100010101000001" + "1010001010000000101010100010001010000010101000000010100010100000" + "0000000101000101010001010100000001000100010001000100010100000001" + "1000001000000010100010101000001010100000101010100000100010001010" + "0101000101000001000001010001010100000001000100010101000101010001" + "1000000010100010001000001000100010101000100010000010101000100000" + "0001010100010001010100010001010000010001010000000101010001010101" + "1000100010001000100010100010001010001000101000101000100010000010" + }, + /* 2*/ { GS1_MODE, -1, "[01]00012345678905[17]201231[10]ABC123456", -1, 0, 20, 29, "ISS DotCode Rev 4.0 Figure 1 (right)", + "10101000101010100010101000101" + "00010100010100010100000001010" + "00001010100010000000101010000" + "01000001010101010101010101000" + "10101010100000000010100010101" + "01000100000000000101010101010" + "00100010001010101000100000101" + "00000101010000000001010000010" + "10001010100010101010001010100" + "01010000000000010000000100010" + "00100000000010100000100000000" + "00010000000101000001000001000" + "10101000101000001010001010001" + "01010001010001010101000000010" + "00001000001010001010100000101" + "01000100010100000000010100010" + "10100010000010101000101010001" + "00010101000001010100010100010" + "10000010101000100000001000001" + "01000100010101010000000101010" + }, + /* 3*/ { GS1_MODE, -1, "[17]070620[10]ABC123456", -1, 0, 16, 23, "ISS DotCode Rev 4.0 Figure 6, Mask = 1", + "10000000001010001000101" + "01010101000100000101000" + "00100010000000100000001" + "01010001000001000001000" + "10101010100000001010101" + "00000100010100000100010" + "00000000001010101010001" + "00010001010001000001000" + "00101010101000001010001" + "01000100000001010000000" + "10101000101000101000001" + "00010101000100010101010" + "10001000001010100000101" + "01010001010001000001010" + "10000010101010100010101" + "01000101000101010101010" + }, + /* 4*/ { GS1_MODE, 40, "[01]00012345678905", -1, 0, 7, 40, "ISS DotCode Rev 4.0 Figure 8, 7x40 **NOT SAME** but same if force mask 1 instead of mask 6", + "1010000010001010000010100000001010100010" + "0101010001000100010100000101010000010101" + "0000001010100010001010001000100000100010" + "0001000001000101010100000100010100010001" + "1000101010100000100000101000000010101010" + "0100010000010001000101000101010001000001" + "1010000010001000100010101000101000100010" + }, + /* 5*/ { GS1_MODE, 18, "[01]00012345678905", -1, 0, 17, 18, "ISS DotCode Rev 4.0 Figure 8, 17x18 **NOT SAME** no matter what mask; but verified manually against bwipp and tec-it", + "101000001000101010" + "010100000101010001" + "000000101000001010" + "000100010101000101" + "001010000000100010" + "010100000100010101" + "100010001000001010" + "010001000100010100" + "001000001010000010" + "010100000001010001" + "000000101010001010" + "000101000001000101" + "100010001010100010" + "000100010000000101" + "100010001010001010" + "010001010001000101" + "100010001000100010" + }, + /* 6*/ { GS1_MODE, 35, "[01]00012345678905", -1, 0, 8, 35, "ISS DotCode Rev 4.0 Figure 8, 8x35; **NOT SAME** using mask 3 prime (7) not 3 so extra dot in bottom right corner compared to figure", + "10100010000000000010100000100010101" + "00010101010001000000010100010100000" + "10001000101010101010001010000010101" + "01010001000100000101000100010101010" + "10101000100000101000100010001000001" + "00010100010000010001010001010000000" + "10000010101010101010000010000010001" + "01000001000101000100010100010001010" + }, + /* 7*/ { GS1_MODE, 17, "[01]00012345678905", -1, 0, 18, 17, "ISS DotCode Rev 4.0 Figure 8, 18x17 **NOT SAME** no matter what mask; verified manually against bwipp and tec-it", + "10101000001000001" + "01000001010100010" + "00000000100010001" + "00010101000101010" + "10101000001010000" + "01000100010000000" + "00000010000000100" + "01010000000001000" + "10101010101000101" + "00000000010101010" + "00101010100000000" + "01000101000001010" + "10001000000010001" + "00000001010100010" + "00100010001000101" + "01010100010101000" + "10101010101010101" + "01010101000101010" + }, + /* 8*/ { UNICODE_MODE, 35, "Dots can be Square!", -1, 0, 18, 35, "ISS DotCode Rev 4.0 Figure 11 **NOT SAME**; verified manually against bwipp and tec-it", + "10000010101000000000000000101010101" + "01010101000101000100010100000001000" + "00001000000010101000101010101010000" + "01000001000100000001010001000000000" + "00100010101010101000000010100000101" + "00000001010001010101010100010101000" + "10101000100010000010101010001010001" + "00010001010100010101000101000101010" + "00101010001000001010101000100000101" + "00010100010001010000000001010001010" + "00101000100010100000100000000000101" + "01010100010001010100010100000100000" + "10000010000000000010001000101010100" + "00010000000100010001000000010001010" + "10001000001010101010001010101000001" + "01000101010101000100000100010101000" + "10101000101000001000100010101000101" + "01000001000001000101010001000000010" + }, + /* 9*/ { GS1_MODE, -1, "[99]8766", -1, 0, 10, 13, "ISS DotCode Rev 4.0 Table G.1 Mask 0 prime (4); all mask scores match Table G.1", + "1000001010001" + "0001010000010" + "0000000010001" + "0100010101000" + "0010101000101" + "0100010101010" + "0010000010000" + "0101010000010" + "1010000000101" + "0101000101010" + }, + /* 10*/ { UNICODE_MODE, 6, "A", -1, 0, 19, 6, "ISS DotCode Rev 4.0 5.2.1.4 2) Table 4, 1 padding dot available; same as bwipp and tec-it except corners lit", + "101010" + "000101" + "101010" + "000001" + "100010" + "000100" + "001010" + "000101" + "101000" + "010000" + "100010" + "010000" + "000010" + "000101" + "101010" + "000001" + "101000" + "010001" + "101010" + }, + /* 11*/ { UNICODE_MODE, 94, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS", -1, 0, 37, 94, "Interleaved R-S; same as bwipp and tec-it except corners lit", + "1000001010000000100010000010101010101000001000100000001010101000001000001000101010001000101010" + "0101010000000101000001010001010001010100010001000001000000010101010000000101010100010001010101" + "0010101000100010000010101010000000101010000010101000001000100010100000100010100010001000101000" + "0000000100010101000001010000010000010101010100010100000100000101000100010001000001010001010001" + "0010100000100010101000001000101010000010001000001010100000101000101010000010001000101010100010" + "0100000101010001010001000101000001000100000101010001000101000100010100000100010100010001010100" + "1010000000100010100000101010000010101000001000001010001010000010001010100000101010100000100000" + "0001010100000101000001000000010001010100000101000100010101000001000101000100010000010101010001" + "1010001010001010000000100000101010100000100010101000000010100010001010100010000010100010001010" + "0001000100010100010001010000000101010100010000010100000100000101010100010000010100010001000001" + "1000001010001010100010000010001000100010100010100010000010001000101010100000101000001000101010" + "0101000001000101000100000001010001010101010001000001000000010001010100010101010000010100000001" + "0000100000001010100010101000000010001010001010000000101010001000101010001000101000100000100010" + "0000000100000100000101010101000000010101010001000100010001000101010001000100010000010100010101" + "0010101000001010001000101000000000101010001010000010101010000010001000100000001010101010001010" + "0100010001010100010000010100010001010100010000010001000100000100010101000101000100000101010001" + "1000001000100010101010101000000010001000001010000010101010000010101010000000100010001000101000" + "0000010000010101010000010101000000010101000001000101000100010001000101010001000100010000010100" + "1000001000101010000010001000001000101010100000100000001010001010101000000010001010101010001000" + "0100010001010001000100010000010100000100010100010100010001000001010100010101000100000101000101" + "1010000000101000100000001000101010100010000000101010101010000010101000000010100010001000100010" + "0100000101010000010100010001010100010000010101000100000100000101000001010100010000000101010001" + "1000001000001010001010001000101000001000101010000010101000100010100000101000100000001000101010" + "0101010100010001010101000000010101010000010100000100010100010001000100000100010001010100010100" + "1000100000101000000010100010101000001010100010100000100000101010000010101000100000001010000000" + "0001000001000101000101010000010001000100000101010001000100010100000101000101000100000101010001" + "0000000010001000101000100000100000101010101000000010101010001000100010001000101010001000100010" + "0101010100010000000100010101010001010100000001010101000001000001000001010100000101010001010101" + "1000100010101000100000101010001000101010000010001010001010001010000010100010100010000000100000" + "0000010101010000010101000000010101000001000101000100010001000101010001000100010000010100010000" + "1000101010000010001000001000101010100000100000001010001010101000000010001010101010001000000010" + "0100000101000001010001010000000100010100010100010001000001010100010101000100000101000101010000" + "0000001010001000100010100010000010101000100010001000101000001000100000101000100010100010001010" + "0101010000010100010000010100000101010100000101000001000000010101000101000101010000000101010101" + "1000001010001010001000101000001000101010000010101000100010100000101000100000001000101010100000" + "0001000101010100000001010101000001010000010001010001000100010000010001000101010001010001000001" + "1010001000001010101000000010101000101000001000001010100000101010001000000010100000001010101010" + }, }; int data_size = sizeof(data) / sizeof(struct item); @@ -70,7 +360,7 @@ static void test_encode(void) for (int i = 0; i < data_size; i++) { - struct zint_symbol* symbol = ZBarcode_Create(); + struct zint_symbol *symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); symbol->symbology = BARCODE_DOTCODE; @@ -78,16 +368,16 @@ static void test_encode(void) if (data[i].option_2 != -1) { symbol->option_2 = data[i].option_2; } - symbol->debug = ZINT_DEBUG_PRINT; + //symbol->debug = ZINT_DEBUG_PRINT; - int length = strlen(data[i].data); + int length = data[i].length != -1 ? data[i].length : strlen(data[i].data); ret = ZBarcode_Encode(symbol, 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); #ifdef TEST_ENCODE_GENERATE_EXPECTED - printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n", - i, testUtilInputModeName(data[i].input_mode), data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), + printf(" /*%3d*/ { %s, %d, \"%s\", %d, %s, %d, %d, \"%s\",\n", + i, testUtilInputModeName(data[i].input_mode), data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment); testUtilModulesDump(symbol, " ", "\n"); printf(" },\n"); @@ -111,13 +401,12 @@ static void test_encode(void) } // #181 Christian Hartlage / Nico Gunkel OSS-Fuzz -static void test_fuzz(void) -{ +static void test_fuzz(void) { testStart(""); int ret; struct item { - unsigned char* data; + unsigned char *data; int length; int input_mode; int ret; @@ -151,7 +440,7 @@ static void test_fuzz(void) for (int i = 0; i < data_size; i++) { - struct zint_symbol* symbol = ZBarcode_Create(); + struct zint_symbol *symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); symbol->symbology = BARCODE_DOTCODE; @@ -172,10 +461,55 @@ static void test_fuzz(void) testFinish(); } -int main() -{ +static void test_large(void) { + testStart(""); + + int ret; + struct item { + int option_2; + char datum; + int length; + int ret; + }; + // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) + struct item data[] = { + /* 0*/ { 200, '0', 2940, 0 }, // 2940 largest Code Set C data that fits in 200x199 HxW + /* 1*/ { 200, '0', 2941, ZINT_ERROR_INVALID_OPTION }, + /* 2*/ { 200, '9', 200, 0 }, // Changes a number of mask scores re pre-Rev. 4 version, but best score still the same (7) + /* 3*/ { 30, '\001', 71, 0 }, // Codeword length 72, ECC length 39, for ND + 1 == 112 + }; + int data_size = sizeof(data) / sizeof(struct item); + + char data_buf[4096]; + + for (int i = 0; i < data_size; i++) { + + struct zint_symbol *symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + symbol->symbology = BARCODE_DOTCODE; + symbol->input_mode = DATA_MODE; + symbol->option_2 = data[i].option_2; + //symbol->debug = ZINT_DEBUG_PRINT; + + int length = data[i].length; + + memset(data_buf, data[i].datum, length); + + ret = ZBarcode_Encode(symbol, data_buf, length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + + ZBarcode_Delete(symbol); + } + + testFinish(); +} + +int main() { + test_input(); test_encode(); test_fuzz(); + test_large(); testReport(); diff --git a/backend/tests/test_gs1.c b/backend/tests/test_gs1.c index d2f2f439..59537459 100644 --- a/backend/tests/test_gs1.c +++ b/backend/tests/test_gs1.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2008-2019 Robin Stuart + Copyright (C) 2019 - 2020 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -36,20 +36,19 @@ /* * Check that EAN128 and RSS_EXP based symbologies reduce GS1 data */ -static void test_gs1_reduce(void) -{ +static void test_gs1_reduce(void) { testStart(""); int ret; struct item { int symbology; int input_mode; - unsigned char* data; - unsigned char* composite; + unsigned char *data; + unsigned char *composite; int ret; - char* comment; - unsigned char* expected; + char *comment; + unsigned char *expected; }; struct item data[] = { /* 0*/ { BARCODE_EAN128, -1, "12345678901234", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, @@ -167,11 +166,11 @@ static void test_gs1_reduce(void) }; int data_size = sizeof(data) / sizeof(struct item); - char* text; + char *text; for (int i = 0; i < data_size; i++) { - struct zint_symbol* symbol = ZBarcode_Create(); + struct zint_symbol *symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); symbol->symbology = data[i].symbology; @@ -215,17 +214,16 @@ static void test_gs1_reduce(void) testFinish(); } -static void test_hrt(void) -{ +static void test_hrt(void) { testStart(""); int ret; struct item { int symbology; - unsigned char* data; - unsigned char* composite; + unsigned char *data; + unsigned char *composite; - unsigned char* expected; + unsigned char *expected; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%2d*\/", line(".") - line("'<")) struct item data[] = { @@ -236,11 +234,11 @@ static void test_hrt(void) }; int data_size = sizeof(data) / sizeof(struct item); - char* text; + char *text; for (int i = 0; i < data_size; i++) { - struct zint_symbol* symbol = ZBarcode_Create(); + struct zint_symbol *symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); symbol->symbology = data[i].symbology; @@ -266,15 +264,14 @@ static void test_hrt(void) extern int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const size_t src_len, char reduced[]); -static void test_gs1_verify(void) -{ +static void test_gs1_verify(void) { testStart(""); int ret; struct item { - unsigned char* data; + unsigned char *data; int ret; - char* expected; + char *expected; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -284,482 +281,483 @@ static void test_gs1_verify(void) /* 3*/ { "[12345]12", ZINT_ERROR_INVALID_DATA, "" }, /* 4*/ { "[9999]1234", ZINT_ERROR_INVALID_DATA, "" }, /* 5*/ { "[[01]]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 6*/ { "[20]1\n", ZINT_ERROR_INVALID_DATA, "" }, - /* 7*/ { "[20]1\x80", ZINT_ERROR_INVALID_DATA, "" }, - /* 8*/ { "[00]123456789012345678", 0, "00123456789012345678" }, - /* 9*/ { "[00]12345678901234567", ZINT_ERROR_INVALID_DATA, "" }, - /* 10*/ { "[01]12345678901234", 0, "0112345678901234" }, - /* 11*/ { "[01]123456789012345", ZINT_ERROR_INVALID_DATA, "" }, - /* 12*/ { "[02]12345678901234", 0, "0212345678901234" }, - /* 13*/ { "[02]1234567890123", ZINT_ERROR_INVALID_DATA, "" }, - /* 14*/ { "[03]12345678901234", ZINT_ERROR_INVALID_DATA, "" }, - /* 15*/ { "[04]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 16*/ { "[05]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 17*/ { "[06]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 18*/ { "[07]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 19*/ { "[08]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 20*/ { "[09]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 21*/ { "[10]ABCD123456", 0, "10ABCD123456" }, - /* 22*/ { "[10]123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /* 23*/ { "[100]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 24*/ { "[11]990102", 0, "11990102" }, - /* 25*/ { "[11]9901023", ZINT_ERROR_INVALID_DATA, "" }, - /* 26*/ { "[12]000100", 0, "12000100" }, - /* 27*/ { "[12]00010", ZINT_ERROR_INVALID_DATA, "" }, - /* 28*/ { "[13]991301", 0, "13991301" }, - /* 29*/ { "[13]9913011", ZINT_ERROR_INVALID_DATA, "" }, - /* 30*/ { "[14]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 31*/ { "[15]021231", 0, "15021231" }, - /* 32*/ { "[15]02123", ZINT_ERROR_INVALID_DATA, "" }, - /* 33*/ { "[16]000000", 0, "16000000" }, - /* 34*/ { "[16]00000", ZINT_ERROR_INVALID_DATA, "" }, - /* 35*/ { "[17]010200", 0, "17010200" }, - /* 36*/ { "[17]0102000", ZINT_ERROR_INVALID_DATA, "" }, - /* 37*/ { "[18]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 38*/ { "[19]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 39*/ { "[20]12", 0, "2012" }, - /* 40*/ { "[20]1", ZINT_ERROR_INVALID_DATA, "" }, - /* 41*/ { "[200]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 42*/ { "[21]A12345678", 0, "21A12345678" }, - /* 43*/ { "[21]123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /* 44*/ { "[22]abcdefghijklmnopqrst", 0, "22abcdefghijklmnopqrst" }, - /* 45*/ { "[22]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /* 46*/ { "[23]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 47*/ { "[235]1abcdefghijklmnopqrstuvwxyz0", 0, "2351abcdefghijklmnopqrstuvwxyz0" }, - /* 48*/ { "[235]1abcdefghijklmnopqrstuvwxyz01", ZINT_ERROR_INVALID_DATA, "" }, - /* 49*/ { "[24]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 50*/ { "[240]abcdefghijklmnopqrstuvwxyz1234", 0, "240abcdefghijklmnopqrstuvwxyz1234" }, - /* 51*/ { "[240]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, - /* 52*/ { "[241]abcdefghijklmnopqrstuvwxyz1234", 0, "241abcdefghijklmnopqrstuvwxyz1234" }, - /* 53*/ { "[241]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, - /* 54*/ { "[242]12345", 0, "24212345" }, - /* 55*/ { "[242]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /* 56*/ { "[243]abcdefghijklmnopqrst", 0, "243abcdefghijklmnopqrst" }, - /* 57*/ { "[243]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /* 58*/ { "[244]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 59*/ { "[249]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 60*/ { "[25]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 61*/ { "[250]abcdefghijklmnopqrstuvwxyz1234", 0, "250abcdefghijklmnopqrstuvwxyz1234" }, - /* 62*/ { "[250]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, - /* 63*/ { "[251]abcdefghijklmnopqrstuvwxyz1234", 0, "251abcdefghijklmnopqrstuvwxyz1234" }, - /* 64*/ { "[251]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, - /* 65*/ { "[252]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 66*/ { "[253]131313131313412345678901234567", 0, "253131313131313412345678901234567" }, - /* 67*/ { "[253]13131313131341234567890123345678", ZINT_ERROR_INVALID_DATA, "" }, - /* 68*/ { "[254]abcdefghijklmnopqrst", 0, "254abcdefghijklmnopqrst" }, - /* 69*/ { "[254]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /* 70*/ { "[255]1313131313134123456789012", 0, "2551313131313134123456789012" }, - /* 71*/ { "[255]13131313131341234567890123", ZINT_ERROR_INVALID_DATA, "" }, - /* 72*/ { "[256]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 73*/ { "[259]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 74*/ { "[26]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 75*/ { "[27]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 76*/ { "[28]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 77*/ { "[29]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 78*/ { "[30]12345678", 0, "3012345678" }, - /* 79*/ { "[30]123456789", ZINT_ERROR_INVALID_DATA, "" }, - /* 80*/ { "[3000]1234", ZINT_ERROR_INVALID_DATA, "" }, - /* 81*/ { "[31]123456", ZINT_ERROR_INVALID_DATA, "" }, - /* 82*/ { "[3100]123456", 0, "3100123456" }, - /* 83*/ { "[3100]12345", ZINT_ERROR_INVALID_DATA, "" }, - /* 84*/ { "[3101]123456", 0, "3101123456" }, - /* 85*/ { "[3101]12345", ZINT_ERROR_INVALID_DATA, "" }, - /* 86*/ { "[3109]123456", 0, "3109123456" }, - /* 87*/ { "[3110]123456", 0, "3110123456" }, - /* 88*/ { "[3110]12345", ZINT_ERROR_INVALID_DATA, "" }, - /* 89*/ { "[3119]123456", 0, "3119123456" }, - /* 90*/ { "[3120]123456", 0, "3120123456" }, - /* 91*/ { "[3120]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /* 92*/ { "[3129]123456", 0, "3129123456" }, - /* 93*/ { "[3130]123456", 0, "3130123456" }, - /* 94*/ { "[3130]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /* 95*/ { "[3139]123456", 0, "3139123456" }, - /* 96*/ { "[3140]123456", 0, "3140123456" }, - /* 97*/ { "[3140]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /* 98*/ { "[3149]123456", 0, "3149123456" }, - /* 99*/ { "[3150]123456", 0, "3150123456" }, - /*100*/ { "[3150]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*101*/ { "[3159]123456", 0, "3159123456" }, - /*102*/ { "[3160]123456", 0, "3160123456" }, - /*103*/ { "[3160]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*104*/ { "[3169]123456", 0, "3169123456" }, - /*105*/ { "[3170]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*106*/ { "[3180]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*107*/ { "[3190]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*108*/ { "[32]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*109*/ { "[3200]123456", 0, "3200123456" }, - /*110*/ { "[3200]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*111*/ { "[3210]123456", 0, "3210123456" }, - /*112*/ { "[3210]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*113*/ { "[3220]123456", 0, "3220123456" }, - /*114*/ { "[3220]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*115*/ { "[3230]123456", 0, "3230123456" }, - /*116*/ { "[3240]123456", 0, "3240123456" }, - /*117*/ { "[3250]123456", 0, "3250123456" }, - /*118*/ { "[3260]123456", 0, "3260123456" }, - /*119*/ { "[3270]123456", 0, "3270123456" }, - /*120*/ { "[3280]123456", 0, "3280123456" }, - /*121*/ { "[3290]123456", 0, "3290123456" }, - /*122*/ { "[3290]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*123*/ { "[3299]123456", 0, "3299123456" }, - /*124*/ { "[33]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*125*/ { "[3300]123456", 0, "3300123456" }, - /*126*/ { "[3300]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*127*/ { "[3310]123456", 0, "3310123456" }, - /*128*/ { "[3310]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*129*/ { "[3320]123456", 0, "3320123456" }, - /*130*/ { "[3330]123456", 0, "3330123456" }, - /*131*/ { "[3340]123456", 0, "3340123456" }, - /*132*/ { "[3350]123456", 0, "3350123456" }, - /*133*/ { "[3360]123456", 0, "3360123456" }, - /*134*/ { "[3370]123456", 0, "3370123456" }, - /*135*/ { "[3370]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*136*/ { "[3379]123456", 0, "3379123456" }, - /*137*/ { "[3380]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*138*/ { "[3390]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*139*/ { "[34]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*140*/ { "[3400]123456", 0, "3400123456" }, - /*141*/ { "[3400]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*142*/ { "[3410]123456", 0, "3410123456" }, - /*143*/ { "[3410]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*144*/ { "[3420]123456", 0, "3420123456" }, - /*145*/ { "[3430]123456", 0, "3430123456" }, - /*146*/ { "[3440]123456", 0, "3440123456" }, - /*147*/ { "[3450]123456", 0, "3450123456" }, - /*148*/ { "[3460]123456", 0, "3460123456" }, - /*149*/ { "[3470]123456", 0, "3470123456" }, - /*150*/ { "[3480]123456", 0, "3480123456" }, - /*151*/ { "[3490]123456", 0, "3490123456" }, - /*152*/ { "[3490]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*153*/ { "[3499]123456", 0, "3499123456" }, - /*154*/ { "[35]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*155*/ { "[3500]123456", 0, "3500123456" }, - /*156*/ { "[3500]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*157*/ { "[3510]123456", 0, "3510123456", }, - /*158*/ { "[3510]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*159*/ { "[3520]123456", 0, "3520123456", }, - /*160*/ { "[3530]123456", 0, "3530123456", }, - /*161*/ { "[3540]123456", 0, "3540123456", }, - /*162*/ { "[3550]123456", 0, "3550123456", }, - /*163*/ { "[3560]123456", 0, "3560123456", }, - /*164*/ { "[3570]123456", 0, "3570123456", }, - /*165*/ { "[3579]123456", 0, "3579123456" }, - /*166*/ { "[3580]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*167*/ { "[3590]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*168*/ { "[36]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*169*/ { "[3600]123456", 0, "3600123456" }, - /*170*/ { "[3600]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*171*/ { "[3610]123456", 0, "3610123456" }, - /*172*/ { "[3610]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*173*/ { "[3620]123456", 0, "3620123456", }, - /*174*/ { "[3630]123456", 0, "3630123456", }, - /*175*/ { "[3640]123456", 0, "3640123456", }, - /*176*/ { "[3650]123456", 0, "3650123456", }, - /*177*/ { "[3660]123456", 0, "3660123456", }, - /*178*/ { "[3670]123456", 0, "3670123456", }, - /*179*/ { "[3680]123456", 0, "3680123456", }, + /* 6*/ { "[90]\n", ZINT_ERROR_INVALID_DATA, "" }, + /* 7*/ { "[90]\x7F", ZINT_ERROR_INVALID_DATA, "" }, + /* 8*/ { "[90]\x80", ZINT_ERROR_INVALID_DATA, "" }, + /* 9*/ { "[00]123456789012345678", 0, "00123456789012345678" }, + /* 10*/ { "[00]12345678901234567", ZINT_ERROR_INVALID_DATA, "" }, + /* 11*/ { "[01]12345678901234", 0, "0112345678901234" }, + /* 12*/ { "[01]123456789012345", ZINT_ERROR_INVALID_DATA, "" }, + /* 13*/ { "[02]12345678901234", 0, "0212345678901234" }, + /* 14*/ { "[02]1234567890123", ZINT_ERROR_INVALID_DATA, "" }, + /* 15*/ { "[03]12345678901234", ZINT_ERROR_INVALID_DATA, "" }, + /* 16*/ { "[04]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 17*/ { "[05]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 18*/ { "[06]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 19*/ { "[07]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 20*/ { "[08]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 21*/ { "[09]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 22*/ { "[10]ABCD123456", 0, "10ABCD123456" }, + /* 23*/ { "[10]123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /* 24*/ { "[100]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 25*/ { "[11]990102", 0, "11990102" }, + /* 26*/ { "[11]9901023", ZINT_ERROR_INVALID_DATA, "" }, + /* 27*/ { "[12]000100", 0, "12000100" }, + /* 28*/ { "[12]00010", ZINT_ERROR_INVALID_DATA, "" }, + /* 29*/ { "[13]991301", 0, "13991301" }, + /* 30*/ { "[13]9913011", ZINT_ERROR_INVALID_DATA, "" }, + /* 31*/ { "[14]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 32*/ { "[15]021231", 0, "15021231" }, + /* 33*/ { "[15]02123", ZINT_ERROR_INVALID_DATA, "" }, + /* 34*/ { "[16]000000", 0, "16000000" }, + /* 35*/ { "[16]00000", ZINT_ERROR_INVALID_DATA, "" }, + /* 36*/ { "[17]010200", 0, "17010200" }, + /* 37*/ { "[17]0102000", ZINT_ERROR_INVALID_DATA, "" }, + /* 38*/ { "[18]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 39*/ { "[19]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 40*/ { "[20]12", 0, "2012" }, + /* 41*/ { "[20]1", ZINT_ERROR_INVALID_DATA, "" }, + /* 42*/ { "[200]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 43*/ { "[21]A12345678", 0, "21A12345678" }, + /* 44*/ { "[21]123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /* 45*/ { "[22]abcdefghijklmnopqrst", 0, "22abcdefghijklmnopqrst" }, + /* 46*/ { "[22]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /* 47*/ { "[23]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 48*/ { "[235]1abcdefghijklmnopqrstuvwxyz0", 0, "2351abcdefghijklmnopqrstuvwxyz0" }, + /* 49*/ { "[235]1abcdefghijklmnopqrstuvwxyz01", ZINT_ERROR_INVALID_DATA, "" }, + /* 50*/ { "[24]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 51*/ { "[240]abcdefghijklmnopqrstuvwxyz1234", 0, "240abcdefghijklmnopqrstuvwxyz1234" }, + /* 52*/ { "[240]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, + /* 53*/ { "[241]abcdefghijklmnopqrstuvwxyz1234", 0, "241abcdefghijklmnopqrstuvwxyz1234" }, + /* 54*/ { "[241]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, + /* 55*/ { "[242]12345", 0, "24212345" }, + /* 56*/ { "[242]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /* 57*/ { "[243]abcdefghijklmnopqrst", 0, "243abcdefghijklmnopqrst" }, + /* 58*/ { "[243]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /* 59*/ { "[244]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 60*/ { "[249]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 61*/ { "[25]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 62*/ { "[250]abcdefghijklmnopqrstuvwxyz1234", 0, "250abcdefghijklmnopqrstuvwxyz1234" }, + /* 63*/ { "[250]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, + /* 64*/ { "[251]abcdefghijklmnopqrstuvwxyz1234", 0, "251abcdefghijklmnopqrstuvwxyz1234" }, + /* 65*/ { "[251]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, + /* 66*/ { "[252]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 67*/ { "[253]131313131313412345678901234567", 0, "253131313131313412345678901234567" }, + /* 68*/ { "[253]13131313131341234567890123345678", ZINT_ERROR_INVALID_DATA, "" }, + /* 69*/ { "[254]abcdefghijklmnopqrst", 0, "254abcdefghijklmnopqrst" }, + /* 70*/ { "[254]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /* 71*/ { "[255]1313131313134123456789012", 0, "2551313131313134123456789012" }, + /* 72*/ { "[255]13131313131341234567890123", ZINT_ERROR_INVALID_DATA, "" }, + /* 73*/ { "[256]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 74*/ { "[259]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 75*/ { "[26]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 76*/ { "[27]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 77*/ { "[28]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 78*/ { "[29]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 79*/ { "[30]12345678", 0, "3012345678" }, + /* 80*/ { "[30]123456789", ZINT_ERROR_INVALID_DATA, "" }, + /* 81*/ { "[3000]1234", ZINT_ERROR_INVALID_DATA, "" }, + /* 82*/ { "[31]123456", ZINT_ERROR_INVALID_DATA, "" }, + /* 83*/ { "[3100]123456", 0, "3100123456" }, + /* 84*/ { "[3100]12345", ZINT_ERROR_INVALID_DATA, "" }, + /* 85*/ { "[3101]123456", 0, "3101123456" }, + /* 86*/ { "[3101]12345", ZINT_ERROR_INVALID_DATA, "" }, + /* 87*/ { "[3109]123456", 0, "3109123456" }, + /* 88*/ { "[3110]123456", 0, "3110123456" }, + /* 89*/ { "[3110]12345", ZINT_ERROR_INVALID_DATA, "" }, + /* 90*/ { "[3119]123456", 0, "3119123456" }, + /* 91*/ { "[3120]123456", 0, "3120123456" }, + /* 92*/ { "[3120]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /* 93*/ { "[3129]123456", 0, "3129123456" }, + /* 94*/ { "[3130]123456", 0, "3130123456" }, + /* 95*/ { "[3130]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /* 96*/ { "[3139]123456", 0, "3139123456" }, + /* 97*/ { "[3140]123456", 0, "3140123456" }, + /* 98*/ { "[3140]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /* 99*/ { "[3149]123456", 0, "3149123456" }, + /*100*/ { "[3150]123456", 0, "3150123456" }, + /*101*/ { "[3150]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*102*/ { "[3159]123456", 0, "3159123456" }, + /*103*/ { "[3160]123456", 0, "3160123456" }, + /*104*/ { "[3160]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*105*/ { "[3169]123456", 0, "3169123456" }, + /*106*/ { "[3170]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*107*/ { "[3180]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*108*/ { "[3190]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*109*/ { "[32]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*110*/ { "[3200]123456", 0, "3200123456" }, + /*111*/ { "[3200]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*112*/ { "[3210]123456", 0, "3210123456" }, + /*113*/ { "[3210]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*114*/ { "[3220]123456", 0, "3220123456" }, + /*115*/ { "[3220]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*116*/ { "[3230]123456", 0, "3230123456" }, + /*117*/ { "[3240]123456", 0, "3240123456" }, + /*118*/ { "[3250]123456", 0, "3250123456" }, + /*119*/ { "[3260]123456", 0, "3260123456" }, + /*120*/ { "[3270]123456", 0, "3270123456" }, + /*121*/ { "[3280]123456", 0, "3280123456" }, + /*122*/ { "[3290]123456", 0, "3290123456" }, + /*123*/ { "[3290]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*124*/ { "[3299]123456", 0, "3299123456" }, + /*125*/ { "[33]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*126*/ { "[3300]123456", 0, "3300123456" }, + /*127*/ { "[3300]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*128*/ { "[3310]123456", 0, "3310123456" }, + /*129*/ { "[3310]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*130*/ { "[3320]123456", 0, "3320123456" }, + /*131*/ { "[3330]123456", 0, "3330123456" }, + /*132*/ { "[3340]123456", 0, "3340123456" }, + /*133*/ { "[3350]123456", 0, "3350123456" }, + /*134*/ { "[3360]123456", 0, "3360123456" }, + /*135*/ { "[3370]123456", 0, "3370123456" }, + /*136*/ { "[3370]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*137*/ { "[3379]123456", 0, "3379123456" }, + /*138*/ { "[3380]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*139*/ { "[3390]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*140*/ { "[34]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*141*/ { "[3400]123456", 0, "3400123456" }, + /*142*/ { "[3400]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*143*/ { "[3410]123456", 0, "3410123456" }, + /*144*/ { "[3410]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*145*/ { "[3420]123456", 0, "3420123456" }, + /*146*/ { "[3430]123456", 0, "3430123456" }, + /*147*/ { "[3440]123456", 0, "3440123456" }, + /*148*/ { "[3450]123456", 0, "3450123456" }, + /*149*/ { "[3460]123456", 0, "3460123456" }, + /*150*/ { "[3470]123456", 0, "3470123456" }, + /*151*/ { "[3480]123456", 0, "3480123456" }, + /*152*/ { "[3490]123456", 0, "3490123456" }, + /*153*/ { "[3490]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*154*/ { "[3499]123456", 0, "3499123456" }, + /*155*/ { "[35]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*156*/ { "[3500]123456", 0, "3500123456" }, + /*157*/ { "[3500]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*158*/ { "[3510]123456", 0, "3510123456", }, + /*159*/ { "[3510]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*160*/ { "[3520]123456", 0, "3520123456", }, + /*161*/ { "[3530]123456", 0, "3530123456", }, + /*162*/ { "[3540]123456", 0, "3540123456", }, + /*163*/ { "[3550]123456", 0, "3550123456", }, + /*164*/ { "[3560]123456", 0, "3560123456", }, + /*165*/ { "[3570]123456", 0, "3570123456", }, + /*166*/ { "[3579]123456", 0, "3579123456" }, + /*167*/ { "[3580]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*168*/ { "[3590]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*169*/ { "[36]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*170*/ { "[3600]123456", 0, "3600123456" }, + /*171*/ { "[3600]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*172*/ { "[3610]123456", 0, "3610123456" }, + /*173*/ { "[3610]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*174*/ { "[3620]123456", 0, "3620123456", }, + /*175*/ { "[3630]123456", 0, "3630123456", }, + /*176*/ { "[3640]123456", 0, "3640123456", }, + /*177*/ { "[3650]123456", 0, "3650123456", }, + /*178*/ { "[3660]123456", 0, "3660123456", }, + /*179*/ { "[3670]123456", 0, "3670123456", }, /*180*/ { "[3680]123456", 0, "3680123456", }, - /*181*/ { "[3680]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*182*/ { "[3690]123456", 0, "3690123456" }, - /*183*/ { "[3699]123456", 0, "3699123456" }, - /*184*/ { "[37]12345678", 0, "3712345678" }, - /*185*/ { "[37]123456789", ZINT_ERROR_INVALID_DATA, "" }, - /*186*/ { "[3700]12345678", ZINT_ERROR_INVALID_DATA, "" }, - /*187*/ { "[38]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*188*/ { "[3800]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*189*/ { "[39]123456", ZINT_ERROR_INVALID_DATA, "" }, - /*190*/ { "[3900]123456789012345", 0, "3900123456789012345" }, - /*191*/ { "[3900]1234567890123456", ZINT_ERROR_INVALID_DATA, "" }, - /*192*/ { "[3909]123456789012345", 0, "3909123456789012345" }, - /*193*/ { "[3910]123123456789012345", 0, "3910123123456789012345" }, - /*194*/ { "[3910]1231234567890123456", ZINT_ERROR_INVALID_DATA, "" }, - /*195*/ { "[3910]123", ZINT_ERROR_INVALID_DATA, "" }, - /*196*/ { "[3920]123456789012345", 0, "3920123456789012345" }, - /*197*/ { "[3920]1234567890123456", ZINT_ERROR_INVALID_DATA, "" }, - /*198*/ { "[3930]123123456789012345", 0, "3930123123456789012345" }, - /*199*/ { "[3930]1231234567890123456", ZINT_ERROR_INVALID_DATA, "" }, - /*200*/ { "[3930]123", ZINT_ERROR_INVALID_DATA, "" }, - /*201*/ { "[3940]1234", 0, "39401234" }, - /*202*/ { "[3940]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*203*/ { "[3940]123", ZINT_ERROR_INVALID_DATA, "" }, - /*204*/ { "[3949]1234", 0, "39491234" }, - /*205*/ { "[3950]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*206*/ { "[3960]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*207*/ { "[3970]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*208*/ { "[3980]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*209*/ { "[3999]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*210*/ { "[40]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*211*/ { "[400]123456789012345678901234567890", 0, "400123456789012345678901234567890" }, - /*212*/ { "[400]1234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*213*/ { "[401]1234abcdefghijklmnopqrstuvwxyz", 0, "4011234abcdefghijklmnopqrstuvwxyz" }, - /*214*/ { "[401]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "" }, - /*215*/ { "[402]13131313131313132", 0, "40213131313131313132" }, - /*216*/ { "[402]1313131313131313", ZINT_ERROR_INVALID_DATA, "" }, - /*217*/ { "[403]abcdefghijklmnopqrstuvwxyz1234", 0, "403abcdefghijklmnopqrstuvwxyz1234" }, - /*218*/ { "[403]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, - /*219*/ { "[404]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*220*/ { "[409]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*221*/ { "[410]3898765432108", 0, "4103898765432108" }, - /*222*/ { "[410]12345678901234", ZINT_ERROR_INVALID_DATA, "" }, - /*223*/ { "[411]1313131313134", 0, "4111313131313134" }, - /*224*/ { "[411]13131313131", ZINT_ERROR_INVALID_DATA, "" }, - /*225*/ { "[412]1313131313134", 0, "4121313131313134" }, - /*226*/ { "[412]13131313131", ZINT_ERROR_INVALID_DATA, "" }, - /*227*/ { "[413]1313131313134", 0, "4131313131313134" }, - /*228*/ { "[413]13131313131", ZINT_ERROR_INVALID_DATA, "" }, - /*229*/ { "[414]1313131313134", 0, "4141313131313134" }, - /*230*/ { "[414]13131313131", ZINT_ERROR_INVALID_DATA, "" }, - /*231*/ { "[415]1313131313134", 0, "4151313131313134" }, - /*232*/ { "[415]13131313131", ZINT_ERROR_INVALID_DATA, "" }, - /*233*/ { "[416]1313131313134", 0, "4161313131313134" }, - /*234*/ { "[416]13131313131", ZINT_ERROR_INVALID_DATA, "" }, - /*235*/ { "[417]1313131313134", 0, "4171313131313134" }, - /*236*/ { "[417]13131313131", ZINT_ERROR_INVALID_DATA, "" }, - /*237*/ { "[418]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*238*/ { "[419]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*239*/ { "[420]abcdefghijklmnopqrst", 0, "420abcdefghijklmnopqrst" }, - /*240*/ { "[420]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*241*/ { "[421]123abcdefghi", 0, "421123abcdefghi" }, - /*242*/ { "[421]123abcdefghij", ZINT_ERROR_INVALID_DATA, "" }, - /*243*/ { "[422]123", 0, "422123" }, - /*244*/ { "[422]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*245*/ { "[422]12", ZINT_ERROR_INVALID_DATA, "" }, - /*246*/ { "[423]123123123123123", 0, "423123123123123123" }, - /*247*/ { "[423]1231231231231231", ZINT_ERROR_INVALID_DATA, "" }, - /*248*/ { "[423]12", ZINT_ERROR_INVALID_DATA, "" }, - /*249*/ { "[424]123", 0, "424123" }, - /*250*/ { "[424]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*251*/ { "[424]12", ZINT_ERROR_INVALID_DATA, "" }, - /*252*/ { "[425]123123123123123", 0, "425123123123123123" }, - /*253*/ { "[425]1231231231231231", ZINT_ERROR_INVALID_DATA, "" }, - /*254*/ { "[425]12", ZINT_ERROR_INVALID_DATA, "" }, - /*255*/ { "[426]123", 0, "426123" }, - /*256*/ { "[426]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*257*/ { "[426]12", ZINT_ERROR_INVALID_DATA, "" }, - /*258*/ { "[427]abc", 0, "427abc" }, - /*259*/ { "[427]abcd", ZINT_ERROR_INVALID_DATA, "" }, - /*260*/ { "[428]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*261*/ { "[429]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*262*/ { "[430]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*263*/ { "[499]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*264*/ { "[50]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*265*/ { "[500]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*266*/ { "[5000]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*267*/ { "[51]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*268*/ { "[59]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*269*/ { "[60]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*270*/ { "[600]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*271*/ { "[6000]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*272*/ { "[61]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*273*/ { "[69]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*274*/ { "[70]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*275*/ { "[700]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*276*/ { "[7000]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*277*/ { "[7001]1234567890123", 0, "70011234567890123" }, - /*278*/ { "[7001]123456789012", ZINT_ERROR_INVALID_DATA, "" }, - /*279*/ { "[7002]abcdefghijklmnopqrstuvwxyz1234", 0, "7002abcdefghijklmnopqrstuvwxyz1234" }, - /*280*/ { "[7002]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, - /*281*/ { "[7003]1212121212", 0, "70031212121212" }, - /*282*/ { "[7003]121212121", ZINT_ERROR_INVALID_DATA, "" }, - /*283*/ { "[7004]1234", 0, "70041234" }, - /*284*/ { "[7004]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*285*/ { "[7005]abcdefghijkl", 0, "7005abcdefghijkl" }, - /*286*/ { "[7005]abcdefghijklm", ZINT_ERROR_INVALID_DATA, "" }, - /*287*/ { "[7006]200132", 0, "7006200132" }, - /*288*/ { "[7006]2001320", ZINT_ERROR_INVALID_DATA, "" }, - /*289*/ { "[7007]010101121212", 0, "7007010101121212" }, - /*290*/ { "[7007]01010112121", ZINT_ERROR_INVALID_DATA, "" }, - /*291*/ { "[7007]121212", 0, "7007121212" }, - /*292*/ { "[7007]12121", ZINT_ERROR_INVALID_DATA, "" }, - /*293*/ { "[7007]1212121", ZINT_ERROR_INVALID_DATA, "" }, - /*294*/ { "[7008]abc", 0, "7008abc" }, - /*295*/ { "[7008]abcd", ZINT_ERROR_INVALID_DATA, "" }, - /*296*/ { "[7009]abcdefghij", 0, "7009abcdefghij" }, - /*297*/ { "[7009]abcdefghijk", ZINT_ERROR_INVALID_DATA, "" }, - /*298*/ { "[7010]01", 0, "701001" }, - /*299*/ { "[7010]1", 0, "70101" }, - /*300*/ { "[7010]012", ZINT_ERROR_INVALID_DATA, "" }, - /*301*/ { "[7011]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*302*/ { "[7012]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*303*/ { "[7019]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*304*/ { "[7020]abcdefghijklmnopqrst", 0, "7020abcdefghijklmnopqrst" }, - /*305*/ { "[7020]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*306*/ { "[7021]abcdefghijklmnopqrst", 0, "7021abcdefghijklmnopqrst" }, - /*307*/ { "[7021]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*308*/ { "[7022]abcdefghijklmnopqrst", 0, "7022abcdefghijklmnopqrst" }, - /*309*/ { "[7022]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*310*/ { "[7023]1234abcdefghijklmnopqrstuvwxyz", 0, "70231234abcdefghijklmnopqrstuvwxyz" }, - /*311*/ { "[7023]1234abcdefghijklmnopqrstuvwxyza", ZINT_ERROR_INVALID_DATA, "" }, - /*312*/ { "[7024]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*313*/ { "[7025]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*314*/ { "[7029]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*315*/ { "[7030]123abcdefghijklmnopqrstuvwxyza", 0, "7030123abcdefghijklmnopqrstuvwxyza" }, - /*316*/ { "[7030]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "" }, - /*317*/ { "[7031]123abcdefghijklmnopqrstuvwxyza", 0, "7031123abcdefghijklmnopqrstuvwxyza" }, - /*318*/ { "[7031]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "" }, - /*319*/ { "[7032]123abcdefghijklmnopqrstuvwxyza", 0, "7032123abcdefghijklmnopqrstuvwxyza" }, - /*320*/ { "[7033]123abcdefghijklmnopqrstuvwxyza", 0, "7033123abcdefghijklmnopqrstuvwxyza" }, - /*321*/ { "[7034]123abcdefghijklmnopqrstuvwxyza", 0, "7034123abcdefghijklmnopqrstuvwxyza" }, - /*322*/ { "[7035]123abcdefghijklmnopqrstuvwxyza", 0, "7035123abcdefghijklmnopqrstuvwxyza" }, - /*323*/ { "[7036]123abcdefghijklmnopqrstuvwxyza", 0, "7036123abcdefghijklmnopqrstuvwxyza" }, - /*324*/ { "[7037]123abcdefghijklmnopqrstuvwxyza", 0, "7037123abcdefghijklmnopqrstuvwxyza" }, - /*325*/ { "[7038]123abcdefghijklmnopqrstuvwxyza", 0, "7038123abcdefghijklmnopqrstuvwxyza" }, - /*326*/ { "[7039]123abcdefghijklmnopqrstuvwxyza", 0, "7039123abcdefghijklmnopqrstuvwxyza" }, - /*327*/ { "[7039]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "" }, - /*328*/ { "[7040]1abc", 0, "70401abc" }, - /*329*/ { "[7040]1ab", ZINT_ERROR_INVALID_DATA, "" }, - /*330*/ { "[7040]1abcd", ZINT_ERROR_INVALID_DATA, "" }, - /*331*/ { "[7041]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*332*/ { "[7042]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*333*/ { "[7050]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*334*/ { "[7090]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*335*/ { "[7099]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*336*/ { "[71]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*337*/ { "[710]abcdefghijklmnopqrst", 0, "710abcdefghijklmnopqrst" }, - /*338*/ { "[710]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*339*/ { "[711]abcdefghijklmnopqrst", 0, "711abcdefghijklmnopqrst" }, - /*340*/ { "[711]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*341*/ { "[712]abcdefghijklmnopqrst", 0, "712abcdefghijklmnopqrst" }, - /*342*/ { "[712]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*343*/ { "[713]abcdefghijklmnopqrst", 0, "713abcdefghijklmnopqrst" }, - /*344*/ { "[713]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*345*/ { "[714]abcdefghijklmnopqrst", 0, "714abcdefghijklmnopqrst" }, - /*346*/ { "[714]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*347*/ { "[715]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*348*/ { "[716]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*349*/ { "[719]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*350*/ { "[7100]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*351*/ { "[72]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*352*/ { "[7200]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*353*/ { "[7210]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*354*/ { "[7220]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*355*/ { "[7230]EMabcdefghijklmnopqrstuvwxyzab", 0, "7230EMabcdefghijklmnopqrstuvwxyzab" }, - /*356*/ { "[7230]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "" }, - /*357*/ { "[7230]EM", ZINT_ERROR_INVALID_DATA, "" }, - /*358*/ { "[7231]EMabcdefghijklmnopqrstuvwxyzab", 0, "7231EMabcdefghijklmnopqrstuvwxyzab" }, - /*359*/ { "[7232]EMabcdefghijklmnopqrstuvwxyzab", 0, "7232EMabcdefghijklmnopqrstuvwxyzab" }, - /*360*/ { "[7233]EMabcdefghijklmnopqrstuvwxyzab", 0, "7233EMabcdefghijklmnopqrstuvwxyzab" }, - /*361*/ { "[7234]EMabcdefghijklmnopqrstuvwxyzab", 0, "7234EMabcdefghijklmnopqrstuvwxyzab" }, - /*362*/ { "[7235]EMabcdefghijklmnopqrstuvwxyzab", 0, "7235EMabcdefghijklmnopqrstuvwxyzab" }, - /*363*/ { "[7236]EMabcdefghijklmnopqrstuvwxyzab", 0, "7236EMabcdefghijklmnopqrstuvwxyzab" }, - /*364*/ { "[7237]EMabcdefghijklmnopqrstuvwxyzab", 0, "7237EMabcdefghijklmnopqrstuvwxyzab" }, - /*365*/ { "[7238]EMabcdefghijklmnopqrstuvwxyzab", 0, "7238EMabcdefghijklmnopqrstuvwxyzab" }, - /*366*/ { "[7239]EMabcdefghijklmnopqrstuvwxyzab", 0, "7239EMabcdefghijklmnopqrstuvwxyzab" }, - /*367*/ { "[7239]E", ZINT_ERROR_INVALID_DATA, "" }, - /*368*/ { "[7240]abcdefghijklmnopqrst", 0, "7240abcdefghijklmnopqrst" }, - /*369*/ { "[7240]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*370*/ { "[7241]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*371*/ { "[7249]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*372*/ { "[7250]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*373*/ { "[7299]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*374*/ { "[73]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*375*/ { "[7300]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*376*/ { "[74]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*377*/ { "[7400]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*378*/ { "[79]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*379*/ { "[7900]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*380*/ { "[7999]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*381*/ { "[80]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*382*/ { "[800]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*383*/ { "[8000]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*384*/ { "[8001]12345678901234", 0, "800112345678901234" }, - /*385*/ { "[8001]1234123456789012345", ZINT_ERROR_INVALID_DATA, "" }, - /*386*/ { "[8002]abcdefghijklmnopqrst", 0, "8002abcdefghijklmnopqrst" }, - /*387*/ { "[8002]abcdefghijklmnopqrstuv", ZINT_ERROR_INVALID_DATA, "" }, - /*388*/ { "[8003]01234567890123abcdefghijklmnop", 0, "800301234567890123abcdefghijklmnop" }, - /*389*/ { "[8004]abcdefghijklmnopqrstuvwxyz1234", 0, "8004abcdefghijklmnopqrstuvwxyz1234" }, - /*390*/ { "[8004]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, - /*391*/ { "[8005]123456", 0, "8005123456" }, - /*392*/ { "[8005]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*393*/ { "[8005]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*394*/ { "[8006]123456789012341212", 0, "8006123456789012341212" }, - /*395*/ { "[8006]12345678901234121", ZINT_ERROR_INVALID_DATA, "" }, - /*396*/ { "[8006]1234567890123412123", ZINT_ERROR_INVALID_DATA, "" }, - /*397*/ { "[8007]abcdefghijklmnopqrstuvwxyz12345678", 0, "8007abcdefghijklmnopqrstuvwxyz12345678" }, - /*398*/ { "[8007]abcdefghijklmnopqrstuvwxyz123456789", ZINT_ERROR_INVALID_DATA, "" }, - /*399*/ { "[8008]123456121212", 0, "8008123456121212" }, - /*400*/ { "[8008]1234561212", 0, "80081234561212" }, - /*401*/ { "[8008]12345612", 0, "800812345612" }, - /*402*/ { "[8008]1234561", ZINT_ERROR_INVALID_DATA, "" }, - /*403*/ { "[8008]123456121", ZINT_ERROR_INVALID_DATA, "" }, - /*404*/ { "[8008]12345612121", ZINT_ERROR_INVALID_DATA, "" }, - /*405*/ { "[8008]1234561212123", ZINT_ERROR_INVALID_DATA, "" }, - /*406*/ { "[8009]12345678901234567890123456789012345678901234567890", 0, "800912345678901234567890123456789012345678901234567890" }, - /*407*/ { "[8009]123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*408*/ { "[8010]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "" }, - /*409*/ { "[8011]123456789012", 0, "8011123456789012" }, - /*410*/ { "[8011]1234567890123", ZINT_ERROR_INVALID_DATA, "" }, - /*411*/ { "[8012]abcdefghijklmnopqrst", 0, "8012abcdefghijklmnopqrst" }, - /*412*/ { "[8012]abcdefghijklmnopqrstuv", ZINT_ERROR_INVALID_DATA, "" }, - /*413*/ { "[8013]1234abcdefghijklmnopqrstuvwxyz", 0, "80131234abcdefghijklmnopqrstuvwxyz" }, - /*414*/ { "[8013]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "" }, - /*415*/ { "[8014]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*416*/ { "[8016]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*417*/ { "[8017]313131313131313139", 0, "8017313131313131313139" }, - /*418*/ { "[8017]31313131313131313", ZINT_ERROR_INVALID_DATA, "" }, - /*419*/ { "[8017]3131313131313131390", ZINT_ERROR_INVALID_DATA, "" }, - /*420*/ { "[8018]313131313131313139", 0, "8018313131313131313139" }, - /*421*/ { "[8018]31313131313131313", ZINT_ERROR_INVALID_DATA, "" }, - /*422*/ { "[8018]3131313131313131390", ZINT_ERROR_INVALID_DATA, "" }, - /*423*/ { "[8019]1234567890", 0, "80191234567890" }, - /*424*/ { "[8019]12345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*425*/ { "[8020]abcdefghijklmnopqrstuvwxy", 0, "8020abcdefghijklmnopqrstuvwxy" }, - /*426*/ { "[8020]abcdefghijklmnopqrstuvwxyz", ZINT_ERROR_INVALID_DATA, "" }, - /*427*/ { "[8021]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*428*/ { "[8025]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*429*/ { "[8026]123456789012341212", 0, "8026123456789012341212" }, - /*430*/ { "[8026]1234567890123451212", ZINT_ERROR_INVALID_DATA, "" }, - /*431*/ { "[8026]12345678901234512", ZINT_ERROR_INVALID_DATA, "" }, - /*432*/ { "[8027]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*433*/ { "[8030]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*434*/ { "[8040]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*435*/ { "[8090]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*436*/ { "[8099]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*437*/ { "[81]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*438*/ { "[8100]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*439*/ { "[8109]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*440*/ { "[8110]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "81101234567890123456789012345678901234567890123456789012345678901234567890" }, - /*441*/ { "[8110]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*442*/ { "[8111]1234", 0, "81111234" }, - /*443*/ { "[8111]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*444*/ { "[8111]123", ZINT_ERROR_INVALID_DATA, "" }, - /*445*/ { "[8112]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "81121234567890123456789012345678901234567890123456789012345678901234567890" }, - /*446*/ { "[8112]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*447*/ { "[8113]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*448*/ { "[8120]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*449*/ { "[8190]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*450*/ { "[8199]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*451*/ { "[82]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*452*/ { "[8200]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "82001234567890123456789012345678901234567890123456789012345678901234567890" }, - /*453*/ { "[8201]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*454*/ { "[8210]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*455*/ { "[8290]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*456*/ { "[8299]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*457*/ { "[83]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*458*/ { "[8300]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*459*/ { "[89]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*460*/ { "[8900]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*461*/ { "[90]abcdefghijklmnopqrstuvwxyz1234", 0, "90abcdefghijklmnopqrstuvwxyz1234" }, - /*462*/ { "[9000]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*463*/ { "[90]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, - /*464*/ { "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*465*/ { "[91]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*466*/ { "[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*467*/ { "[92]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*468*/ { "[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "93123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*469*/ { "[93]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*470*/ { "[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "94123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*471*/ { "[94]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*472*/ { "[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "98123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*473*/ { "[98]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*474*/ { "[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "99123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*475*/ { "[99]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*476*/ { "[9900]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*477*/ { "[9999]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*478*/ { "[01]12345678901234[7006]200101", 0, "01123456789012347006200101" }, - /*479*/ { "[3900]1234567890[01]12345678901234", 0, "39001234567890[0112345678901234" }, - /*480*/ { "[253]12345678901234[3901]12345678901234[20]12", 0, "25312345678901234[390112345678901234[2012" }, - /*481*/ { "[253]12345678901234[01]12345678901234[3901]12345678901234[20]12", 0, "25312345678901234[0112345678901234390112345678901234[2012" }, + /*181*/ { "[3680]123456", 0, "3680123456", }, + /*182*/ { "[3680]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*183*/ { "[3690]123456", 0, "3690123456" }, + /*184*/ { "[3699]123456", 0, "3699123456" }, + /*185*/ { "[37]12345678", 0, "3712345678" }, + /*186*/ { "[37]123456789", ZINT_ERROR_INVALID_DATA, "" }, + /*187*/ { "[3700]12345678", ZINT_ERROR_INVALID_DATA, "" }, + /*188*/ { "[38]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*189*/ { "[3800]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*190*/ { "[39]123456", ZINT_ERROR_INVALID_DATA, "" }, + /*191*/ { "[3900]123456789012345", 0, "3900123456789012345" }, + /*192*/ { "[3900]1234567890123456", ZINT_ERROR_INVALID_DATA, "" }, + /*193*/ { "[3909]123456789012345", 0, "3909123456789012345" }, + /*194*/ { "[3910]123123456789012345", 0, "3910123123456789012345" }, + /*195*/ { "[3910]1231234567890123456", ZINT_ERROR_INVALID_DATA, "" }, + /*196*/ { "[3910]123", ZINT_ERROR_INVALID_DATA, "" }, + /*197*/ { "[3920]123456789012345", 0, "3920123456789012345" }, + /*198*/ { "[3920]1234567890123456", ZINT_ERROR_INVALID_DATA, "" }, + /*199*/ { "[3930]123123456789012345", 0, "3930123123456789012345" }, + /*200*/ { "[3930]1231234567890123456", ZINT_ERROR_INVALID_DATA, "" }, + /*201*/ { "[3930]123", ZINT_ERROR_INVALID_DATA, "" }, + /*202*/ { "[3940]1234", 0, "39401234" }, + /*203*/ { "[3940]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*204*/ { "[3940]123", ZINT_ERROR_INVALID_DATA, "" }, + /*205*/ { "[3949]1234", 0, "39491234" }, + /*206*/ { "[3950]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*207*/ { "[3960]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*208*/ { "[3970]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*209*/ { "[3980]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*210*/ { "[3999]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*211*/ { "[40]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*212*/ { "[400]123456789012345678901234567890", 0, "400123456789012345678901234567890" }, + /*213*/ { "[400]1234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*214*/ { "[401]1234abcdefghijklmnopqrstuvwxyz", 0, "4011234abcdefghijklmnopqrstuvwxyz" }, + /*215*/ { "[401]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "" }, + /*216*/ { "[402]13131313131313132", 0, "40213131313131313132" }, + /*217*/ { "[402]1313131313131313", ZINT_ERROR_INVALID_DATA, "" }, + /*218*/ { "[403]abcdefghijklmnopqrstuvwxyz1234", 0, "403abcdefghijklmnopqrstuvwxyz1234" }, + /*219*/ { "[403]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, + /*220*/ { "[404]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*221*/ { "[409]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*222*/ { "[410]3898765432108", 0, "4103898765432108" }, + /*223*/ { "[410]12345678901234", ZINT_ERROR_INVALID_DATA, "" }, + /*224*/ { "[411]1313131313134", 0, "4111313131313134" }, + /*225*/ { "[411]13131313131", ZINT_ERROR_INVALID_DATA, "" }, + /*226*/ { "[412]1313131313134", 0, "4121313131313134" }, + /*227*/ { "[412]13131313131", ZINT_ERROR_INVALID_DATA, "" }, + /*228*/ { "[413]1313131313134", 0, "4131313131313134" }, + /*229*/ { "[413]13131313131", ZINT_ERROR_INVALID_DATA, "" }, + /*230*/ { "[414]1313131313134", 0, "4141313131313134" }, + /*231*/ { "[414]13131313131", ZINT_ERROR_INVALID_DATA, "" }, + /*232*/ { "[415]1313131313134", 0, "4151313131313134" }, + /*233*/ { "[415]13131313131", ZINT_ERROR_INVALID_DATA, "" }, + /*234*/ { "[416]1313131313134", 0, "4161313131313134" }, + /*235*/ { "[416]13131313131", ZINT_ERROR_INVALID_DATA, "" }, + /*236*/ { "[417]1313131313134", 0, "4171313131313134" }, + /*237*/ { "[417]13131313131", ZINT_ERROR_INVALID_DATA, "" }, + /*238*/ { "[418]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*239*/ { "[419]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*240*/ { "[420]abcdefghijklmnopqrst", 0, "420abcdefghijklmnopqrst" }, + /*241*/ { "[420]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /*242*/ { "[421]123abcdefghi", 0, "421123abcdefghi" }, + /*243*/ { "[421]123abcdefghij", ZINT_ERROR_INVALID_DATA, "" }, + /*244*/ { "[422]123", 0, "422123" }, + /*245*/ { "[422]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*246*/ { "[422]12", ZINT_ERROR_INVALID_DATA, "" }, + /*247*/ { "[423]123123123123123", 0, "423123123123123123" }, + /*248*/ { "[423]1231231231231231", ZINT_ERROR_INVALID_DATA, "" }, + /*249*/ { "[423]12", ZINT_ERROR_INVALID_DATA, "" }, + /*250*/ { "[424]123", 0, "424123" }, + /*251*/ { "[424]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*252*/ { "[424]12", ZINT_ERROR_INVALID_DATA, "" }, + /*253*/ { "[425]123123123123123", 0, "425123123123123123" }, + /*254*/ { "[425]1231231231231231", ZINT_ERROR_INVALID_DATA, "" }, + /*255*/ { "[425]12", ZINT_ERROR_INVALID_DATA, "" }, + /*256*/ { "[426]123", 0, "426123" }, + /*257*/ { "[426]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*258*/ { "[426]12", ZINT_ERROR_INVALID_DATA, "" }, + /*259*/ { "[427]abc", 0, "427abc" }, + /*260*/ { "[427]abcd", ZINT_ERROR_INVALID_DATA, "" }, + /*261*/ { "[428]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*262*/ { "[429]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*263*/ { "[430]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*264*/ { "[499]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*265*/ { "[50]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*266*/ { "[500]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*267*/ { "[5000]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*268*/ { "[51]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*269*/ { "[59]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*270*/ { "[60]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*271*/ { "[600]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*272*/ { "[6000]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*273*/ { "[61]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*274*/ { "[69]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*275*/ { "[70]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*276*/ { "[700]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*277*/ { "[7000]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*278*/ { "[7001]1234567890123", 0, "70011234567890123" }, + /*279*/ { "[7001]123456789012", ZINT_ERROR_INVALID_DATA, "" }, + /*280*/ { "[7002]abcdefghijklmnopqrstuvwxyz1234", 0, "7002abcdefghijklmnopqrstuvwxyz1234" }, + /*281*/ { "[7002]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, + /*282*/ { "[7003]1212121212", 0, "70031212121212" }, + /*283*/ { "[7003]121212121", ZINT_ERROR_INVALID_DATA, "" }, + /*284*/ { "[7004]1234", 0, "70041234" }, + /*285*/ { "[7004]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*286*/ { "[7005]abcdefghijkl", 0, "7005abcdefghijkl" }, + /*287*/ { "[7005]abcdefghijklm", ZINT_ERROR_INVALID_DATA, "" }, + /*288*/ { "[7006]200132", 0, "7006200132" }, + /*289*/ { "[7006]2001320", ZINT_ERROR_INVALID_DATA, "" }, + /*290*/ { "[7007]010101121212", 0, "7007010101121212" }, + /*291*/ { "[7007]01010112121", ZINT_ERROR_INVALID_DATA, "" }, + /*292*/ { "[7007]121212", 0, "7007121212" }, + /*293*/ { "[7007]12121", ZINT_ERROR_INVALID_DATA, "" }, + /*294*/ { "[7007]1212121", ZINT_ERROR_INVALID_DATA, "" }, + /*295*/ { "[7008]abc", 0, "7008abc" }, + /*296*/ { "[7008]abcd", ZINT_ERROR_INVALID_DATA, "" }, + /*297*/ { "[7009]abcdefghij", 0, "7009abcdefghij" }, + /*298*/ { "[7009]abcdefghijk", ZINT_ERROR_INVALID_DATA, "" }, + /*299*/ { "[7010]01", 0, "701001" }, + /*300*/ { "[7010]1", 0, "70101" }, + /*301*/ { "[7010]012", ZINT_ERROR_INVALID_DATA, "" }, + /*302*/ { "[7011]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*303*/ { "[7012]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*304*/ { "[7019]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*305*/ { "[7020]abcdefghijklmnopqrst", 0, "7020abcdefghijklmnopqrst" }, + /*306*/ { "[7020]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /*307*/ { "[7021]abcdefghijklmnopqrst", 0, "7021abcdefghijklmnopqrst" }, + /*308*/ { "[7021]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /*309*/ { "[7022]abcdefghijklmnopqrst", 0, "7022abcdefghijklmnopqrst" }, + /*310*/ { "[7022]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /*311*/ { "[7023]1234abcdefghijklmnopqrstuvwxyz", 0, "70231234abcdefghijklmnopqrstuvwxyz" }, + /*312*/ { "[7023]1234abcdefghijklmnopqrstuvwxyza", ZINT_ERROR_INVALID_DATA, "" }, + /*313*/ { "[7024]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*314*/ { "[7025]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*315*/ { "[7029]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*316*/ { "[7030]123abcdefghijklmnopqrstuvwxyza", 0, "7030123abcdefghijklmnopqrstuvwxyza" }, + /*317*/ { "[7030]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "" }, + /*318*/ { "[7031]123abcdefghijklmnopqrstuvwxyza", 0, "7031123abcdefghijklmnopqrstuvwxyza" }, + /*319*/ { "[7031]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "" }, + /*320*/ { "[7032]123abcdefghijklmnopqrstuvwxyza", 0, "7032123abcdefghijklmnopqrstuvwxyza" }, + /*321*/ { "[7033]123abcdefghijklmnopqrstuvwxyza", 0, "7033123abcdefghijklmnopqrstuvwxyza" }, + /*322*/ { "[7034]123abcdefghijklmnopqrstuvwxyza", 0, "7034123abcdefghijklmnopqrstuvwxyza" }, + /*323*/ { "[7035]123abcdefghijklmnopqrstuvwxyza", 0, "7035123abcdefghijklmnopqrstuvwxyza" }, + /*324*/ { "[7036]123abcdefghijklmnopqrstuvwxyza", 0, "7036123abcdefghijklmnopqrstuvwxyza" }, + /*325*/ { "[7037]123abcdefghijklmnopqrstuvwxyza", 0, "7037123abcdefghijklmnopqrstuvwxyza" }, + /*326*/ { "[7038]123abcdefghijklmnopqrstuvwxyza", 0, "7038123abcdefghijklmnopqrstuvwxyza" }, + /*327*/ { "[7039]123abcdefghijklmnopqrstuvwxyza", 0, "7039123abcdefghijklmnopqrstuvwxyza" }, + /*328*/ { "[7039]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "" }, + /*329*/ { "[7040]1abc", 0, "70401abc" }, + /*330*/ { "[7040]1ab", ZINT_ERROR_INVALID_DATA, "" }, + /*331*/ { "[7040]1abcd", ZINT_ERROR_INVALID_DATA, "" }, + /*332*/ { "[7041]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*333*/ { "[7042]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*334*/ { "[7050]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*335*/ { "[7090]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*336*/ { "[7099]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*337*/ { "[71]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*338*/ { "[710]abcdefghijklmnopqrst", 0, "710abcdefghijklmnopqrst" }, + /*339*/ { "[710]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /*340*/ { "[711]abcdefghijklmnopqrst", 0, "711abcdefghijklmnopqrst" }, + /*341*/ { "[711]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /*342*/ { "[712]abcdefghijklmnopqrst", 0, "712abcdefghijklmnopqrst" }, + /*343*/ { "[712]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /*344*/ { "[713]abcdefghijklmnopqrst", 0, "713abcdefghijklmnopqrst" }, + /*345*/ { "[713]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /*346*/ { "[714]abcdefghijklmnopqrst", 0, "714abcdefghijklmnopqrst" }, + /*347*/ { "[714]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /*348*/ { "[715]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*349*/ { "[716]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*350*/ { "[719]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*351*/ { "[7100]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*352*/ { "[72]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*353*/ { "[7200]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*354*/ { "[7210]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*355*/ { "[7220]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*356*/ { "[7230]EMabcdefghijklmnopqrstuvwxyzab", 0, "7230EMabcdefghijklmnopqrstuvwxyzab" }, + /*357*/ { "[7230]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "" }, + /*358*/ { "[7230]EM", ZINT_ERROR_INVALID_DATA, "" }, + /*359*/ { "[7231]EMabcdefghijklmnopqrstuvwxyzab", 0, "7231EMabcdefghijklmnopqrstuvwxyzab" }, + /*360*/ { "[7232]EMabcdefghijklmnopqrstuvwxyzab", 0, "7232EMabcdefghijklmnopqrstuvwxyzab" }, + /*361*/ { "[7233]EMabcdefghijklmnopqrstuvwxyzab", 0, "7233EMabcdefghijklmnopqrstuvwxyzab" }, + /*362*/ { "[7234]EMabcdefghijklmnopqrstuvwxyzab", 0, "7234EMabcdefghijklmnopqrstuvwxyzab" }, + /*363*/ { "[7235]EMabcdefghijklmnopqrstuvwxyzab", 0, "7235EMabcdefghijklmnopqrstuvwxyzab" }, + /*364*/ { "[7236]EMabcdefghijklmnopqrstuvwxyzab", 0, "7236EMabcdefghijklmnopqrstuvwxyzab" }, + /*365*/ { "[7237]EMabcdefghijklmnopqrstuvwxyzab", 0, "7237EMabcdefghijklmnopqrstuvwxyzab" }, + /*366*/ { "[7238]EMabcdefghijklmnopqrstuvwxyzab", 0, "7238EMabcdefghijklmnopqrstuvwxyzab" }, + /*367*/ { "[7239]EMabcdefghijklmnopqrstuvwxyzab", 0, "7239EMabcdefghijklmnopqrstuvwxyzab" }, + /*368*/ { "[7239]E", ZINT_ERROR_INVALID_DATA, "" }, + /*369*/ { "[7240]abcdefghijklmnopqrst", 0, "7240abcdefghijklmnopqrst" }, + /*370*/ { "[7240]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /*371*/ { "[7241]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*372*/ { "[7249]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*373*/ { "[7250]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*374*/ { "[7299]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*375*/ { "[73]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*376*/ { "[7300]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*377*/ { "[74]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*378*/ { "[7400]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*379*/ { "[79]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*380*/ { "[7900]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*381*/ { "[7999]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*382*/ { "[80]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*383*/ { "[800]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*384*/ { "[8000]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*385*/ { "[8001]12345678901234", 0, "800112345678901234" }, + /*386*/ { "[8001]1234123456789012345", ZINT_ERROR_INVALID_DATA, "" }, + /*387*/ { "[8002]abcdefghijklmnopqrst", 0, "8002abcdefghijklmnopqrst" }, + /*388*/ { "[8002]abcdefghijklmnopqrstuv", ZINT_ERROR_INVALID_DATA, "" }, + /*389*/ { "[8003]01234567890123abcdefghijklmnop", 0, "800301234567890123abcdefghijklmnop" }, + /*390*/ { "[8004]abcdefghijklmnopqrstuvwxyz1234", 0, "8004abcdefghijklmnopqrstuvwxyz1234" }, + /*391*/ { "[8004]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, + /*392*/ { "[8005]123456", 0, "8005123456" }, + /*393*/ { "[8005]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*394*/ { "[8005]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*395*/ { "[8006]123456789012341212", 0, "8006123456789012341212" }, + /*396*/ { "[8006]12345678901234121", ZINT_ERROR_INVALID_DATA, "" }, + /*397*/ { "[8006]1234567890123412123", ZINT_ERROR_INVALID_DATA, "" }, + /*398*/ { "[8007]abcdefghijklmnopqrstuvwxyz12345678", 0, "8007abcdefghijklmnopqrstuvwxyz12345678" }, + /*399*/ { "[8007]abcdefghijklmnopqrstuvwxyz123456789", ZINT_ERROR_INVALID_DATA, "" }, + /*400*/ { "[8008]123456121212", 0, "8008123456121212" }, + /*401*/ { "[8008]1234561212", 0, "80081234561212" }, + /*402*/ { "[8008]12345612", 0, "800812345612" }, + /*403*/ { "[8008]1234561", ZINT_ERROR_INVALID_DATA, "" }, + /*404*/ { "[8008]123456121", ZINT_ERROR_INVALID_DATA, "" }, + /*405*/ { "[8008]12345612121", ZINT_ERROR_INVALID_DATA, "" }, + /*406*/ { "[8008]1234561212123", ZINT_ERROR_INVALID_DATA, "" }, + /*407*/ { "[8009]12345678901234567890123456789012345678901234567890", 0, "800912345678901234567890123456789012345678901234567890" }, + /*408*/ { "[8009]123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*409*/ { "[8010]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "" }, + /*410*/ { "[8011]123456789012", 0, "8011123456789012" }, + /*411*/ { "[8011]1234567890123", ZINT_ERROR_INVALID_DATA, "" }, + /*412*/ { "[8012]abcdefghijklmnopqrst", 0, "8012abcdefghijklmnopqrst" }, + /*413*/ { "[8012]abcdefghijklmnopqrstuv", ZINT_ERROR_INVALID_DATA, "" }, + /*414*/ { "[8013]1234abcdefghijklmnopqrstuvwxyz", 0, "80131234abcdefghijklmnopqrstuvwxyz" }, + /*415*/ { "[8013]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "" }, + /*416*/ { "[8014]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*417*/ { "[8016]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*418*/ { "[8017]313131313131313139", 0, "8017313131313131313139" }, + /*419*/ { "[8017]31313131313131313", ZINT_ERROR_INVALID_DATA, "" }, + /*420*/ { "[8017]3131313131313131390", ZINT_ERROR_INVALID_DATA, "" }, + /*421*/ { "[8018]313131313131313139", 0, "8018313131313131313139" }, + /*422*/ { "[8018]31313131313131313", ZINT_ERROR_INVALID_DATA, "" }, + /*423*/ { "[8018]3131313131313131390", ZINT_ERROR_INVALID_DATA, "" }, + /*424*/ { "[8019]1234567890", 0, "80191234567890" }, + /*425*/ { "[8019]12345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*426*/ { "[8020]abcdefghijklmnopqrstuvwxy", 0, "8020abcdefghijklmnopqrstuvwxy" }, + /*427*/ { "[8020]abcdefghijklmnopqrstuvwxyz", ZINT_ERROR_INVALID_DATA, "" }, + /*428*/ { "[8021]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*429*/ { "[8025]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*430*/ { "[8026]123456789012341212", 0, "8026123456789012341212" }, + /*431*/ { "[8026]1234567890123451212", ZINT_ERROR_INVALID_DATA, "" }, + /*432*/ { "[8026]12345678901234512", ZINT_ERROR_INVALID_DATA, "" }, + /*433*/ { "[8027]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*434*/ { "[8030]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*435*/ { "[8040]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*436*/ { "[8090]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*437*/ { "[8099]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*438*/ { "[81]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*439*/ { "[8100]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*440*/ { "[8109]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*441*/ { "[8110]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "81101234567890123456789012345678901234567890123456789012345678901234567890" }, + /*442*/ { "[8110]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*443*/ { "[8111]1234", 0, "81111234" }, + /*444*/ { "[8111]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*445*/ { "[8111]123", ZINT_ERROR_INVALID_DATA, "" }, + /*446*/ { "[8112]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "81121234567890123456789012345678901234567890123456789012345678901234567890" }, + /*447*/ { "[8112]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*448*/ { "[8113]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*449*/ { "[8120]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*450*/ { "[8190]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*451*/ { "[8199]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*452*/ { "[82]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*453*/ { "[8200]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "82001234567890123456789012345678901234567890123456789012345678901234567890" }, + /*454*/ { "[8201]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*455*/ { "[8210]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*456*/ { "[8290]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*457*/ { "[8299]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*458*/ { "[83]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*459*/ { "[8300]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*460*/ { "[89]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*461*/ { "[8900]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*462*/ { "[90]abcdefghijklmnopqrstuvwxyz1234", 0, "90abcdefghijklmnopqrstuvwxyz1234" }, + /*463*/ { "[9000]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*464*/ { "[90]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, + /*465*/ { "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*466*/ { "[91]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*467*/ { "[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*468*/ { "[92]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*469*/ { "[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "93123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*470*/ { "[93]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*471*/ { "[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "94123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*472*/ { "[94]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*473*/ { "[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "98123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*474*/ { "[98]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*475*/ { "[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "99123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*476*/ { "[99]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*477*/ { "[9900]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*478*/ { "[9999]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*479*/ { "[01]12345678901234[7006]200101", 0, "01123456789012347006200101" }, + /*480*/ { "[3900]1234567890[01]12345678901234", 0, "39001234567890[0112345678901234" }, + /*481*/ { "[253]12345678901234[3901]12345678901234[20]12", 0, "25312345678901234[390112345678901234[2012" }, + /*482*/ { "[253]12345678901234[01]12345678901234[3901]12345678901234[20]12", 0, "25312345678901234[0112345678901234390112345678901234[2012" }, }; int data_size = sizeof(data) / sizeof(struct item); @@ -767,7 +765,7 @@ static void test_gs1_verify(void) for (int i = 0; i < data_size; i++) { - struct zint_symbol* symbol = ZBarcode_Create(); + struct zint_symbol *symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); int length = strlen(data[i].data); @@ -785,15 +783,14 @@ static void test_gs1_verify(void) testFinish(); } -static void test_input_mode(void) -{ +static void test_input_mode(void) { testStart(""); int ret; struct item { int symbology; - unsigned char* data; - unsigned char* composite; + unsigned char *data; + unsigned char *composite; int input_mode; int output_options; int ret; @@ -840,12 +837,12 @@ static void test_input_mode(void) }; int data_size = sizeof(data) / sizeof(struct item); - char* text; + char *text; struct zint_symbol previous_symbol; for (int i = 0; i < data_size; i++) { - struct zint_symbol* symbol = ZBarcode_Create(); + struct zint_symbol *symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); symbol->symbology = data[i].symbology; @@ -876,8 +873,7 @@ static void test_input_mode(void) testFinish(); } -int main() -{ +int main() { test_gs1_reduce(); test_hrt(); test_gs1_verify();