mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
library: compat symbology 39 fix; ISBN: "X" check
WARN_FAIL_ALL: always return error: ZINT_ERROR_USES_ECI/NON_COMPLIANT Fuller error messages; more comments zint.h mainwindow.cpp: replace metaobject ENUM with array (suppresses virtual in constructor warning)
This commit is contained in:
@ -140,27 +140,31 @@ static void test_input(int index, int debug) {
|
||||
int ret;
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
char *expected_errtxt;
|
||||
};
|
||||
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
|
||||
struct item data[] = {
|
||||
/* 0*/ { BARCODE_AUSPOST, "12345678", 0, 3, 73 },
|
||||
/* 1*/ { BARCODE_AUSPOST, "1234567A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||
/* 2*/ { BARCODE_AUSPOST, "12345678ABcd#", 0, 3, 103 },
|
||||
/* 3*/ { BARCODE_AUSPOST, "12345678ABcd!", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||
/* 4*/ { BARCODE_AUSPOST, "12345678ABcd#", 0, 3, 103 },
|
||||
/* 5*/ { BARCODE_AUSPOST, "1234567890123456", 0, 3, 103 },
|
||||
/* 6*/ { BARCODE_AUSPOST, "123456789012345A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||
/* 7*/ { BARCODE_AUSPOST, "12345678ABCDefgh #", 0, 3, 133 }, // Length 18
|
||||
/* 8*/ { BARCODE_AUSPOST, "12345678901234567890123", 0, 3, 133 },
|
||||
/* 9*/ { BARCODE_AUSPOST, "1234567890123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||
/* 10*/ { BARCODE_AUSREPLY, "12345678", 0, 3, 73 },
|
||||
/* 11*/ { BARCODE_AUSREPLY, "1234567", 0, 3, 73 }, // Leading zeroes added
|
||||
/* 12*/ { BARCODE_AUSROUTE, "123456", 0, 3, 73 },
|
||||
/* 13*/ { BARCODE_AUSROUTE, "12345", 0, 3, 73 },
|
||||
/* 14*/ { BARCODE_AUSREDIRECT, "1234", 0, 3, 73 },
|
||||
/* 15*/ { BARCODE_AUSREDIRECT, "123", 0, 3, 73 },
|
||||
/* 16*/ { BARCODE_AUSREDIRECT, "0", 0, 3, 73 },
|
||||
/* 17*/ { BARCODE_AUSPOST, "1234567", ZINT_ERROR_TOO_LONG, -1, -1 }, // No leading zeroes added
|
||||
/* 0*/ { BARCODE_AUSPOST, "12345678", 0, 3, 73, "" },
|
||||
/* 1*/ { BARCODE_AUSPOST, "1234567A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 405: Invalid character in DPID (first 8 characters) (digits only)" },
|
||||
/* 2*/ { BARCODE_AUSPOST, "12345678ABcd#", 0, 3, 103, "" },
|
||||
/* 3*/ { BARCODE_AUSPOST, "12345678ABcd!", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 404: Invalid character in data (alphanumerics, space and \"#\" only)" },
|
||||
/* 4*/ { BARCODE_AUSPOST, "12345678ABcd#", 0, 3, 103, "" },
|
||||
/* 5*/ { BARCODE_AUSPOST, "1234567890123456", 0, 3, 103, "" },
|
||||
/* 6*/ { BARCODE_AUSPOST, "123456789012345A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 402: Invalid character in data (digits only for lengths 16 and 23)" },
|
||||
/* 7*/ { BARCODE_AUSPOST, "12345678ABCDefgh #", 0, 3, 133, "" }, // Length 18
|
||||
/* 8*/ { BARCODE_AUSPOST, "12345678901234567890123", 0, 3, 133, "" },
|
||||
/* 9*/ { BARCODE_AUSPOST, "1234567890123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 402: Invalid character in data (digits only for lengths 16 and 23)" },
|
||||
/* 10*/ { BARCODE_AUSPOST, "1234567", ZINT_ERROR_TOO_LONG, -1, -1, "Error 401: Auspost input is wrong length (8, 13, 16, 18 or 23 characters only)" }, // No leading zeroes added
|
||||
/* 11*/ { BARCODE_AUSREPLY, "12345678", 0, 3, 73, "" },
|
||||
/* 12*/ { BARCODE_AUSREPLY, "1234567", 0, 3, 73, "" }, // Leading zeroes added
|
||||
/* 13*/ { BARCODE_AUSREPLY, "123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 403: Auspost input is too long (8 character maximum)" },
|
||||
/* 14*/ { BARCODE_AUSROUTE, "123456", 0, 3, 73, "" },
|
||||
/* 15*/ { BARCODE_AUSROUTE, "12345", 0, 3, 73, "" },
|
||||
/* 16*/ { BARCODE_AUSROUTE, "123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 403: Auspost input is too long (8 character maximum)" },
|
||||
/* 17*/ { BARCODE_AUSREDIRECT, "1234", 0, 3, 73, "" },
|
||||
/* 18*/ { BARCODE_AUSREDIRECT, "123", 0, 3, 73, "" },
|
||||
/* 19*/ { BARCODE_AUSREDIRECT, "0", 0, 3, 73, "" },
|
||||
/* 20*/ { BARCODE_AUSREDIRECT, "123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 403: Auspost input is too long (8 character maximum)" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@ -184,6 +188,7 @@ static void test_input(int index, int debug) {
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ static void test_large(int index, int debug) {
|
||||
/* 19*/ { BARCODE_VIN, -1, "1", 18, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 20*/ { BARCODE_VIN, -1, "1", 16, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 21*/ { BARCODE_VIN, 1, "1", 17, 0, 1, 259 },
|
||||
/* 22*/ { BARCODE_HIBC_39, -1, "1", 66, 0, 1, 1119 }, // 68 - 2 ('+' and check digit)
|
||||
/* 23*/ { BARCODE_HIBC_39, -1, "1", 67, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 22*/ { BARCODE_HIBC_39, -1, "1", 67, 0, 1, 1135 }, // 69 - 2 ('+' and check digit)
|
||||
/* 23*/ { BARCODE_HIBC_39, -1, "1", 68, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
@ -138,7 +138,7 @@ static void test_hrt_cpy_iso8859_1(int index, int debug) {
|
||||
|
||||
testStart("test_hrt_cpy_iso8859_1");
|
||||
|
||||
symbol.debug |= debug;
|
||||
symbol.debug = debug;
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int j;
|
||||
@ -264,8 +264,8 @@ static void test_reader_init(int index, int generate, int debug) {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -294,7 +294,7 @@ static void test_input(int index, int generate, int debug) {
|
||||
// ß U+00DF (\337, 223), UTF-8 C39F, CodeA and CodeB extended ASCII
|
||||
// é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII
|
||||
struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, "\302\200", -1, ZINT_ERROR_INVALID_DATA, 0, "Error 204: Invalid characters in input data", "PAD not in ISO 8859-1" },
|
||||
/* 0*/ { UNICODE_MODE, "\302\200", -1, ZINT_ERROR_INVALID_DATA, 0, "Error 204: Invalid character in input data (ISO/IEC 8859-1 only)", "PAD not in ISO 8859-1" },
|
||||
/* 1*/ { DATA_MODE, "\200", -1, 0, 57, "(5) 103 101 64 23 106", "PAD ok using binary" },
|
||||
/* 2*/ { UNICODE_MODE, "AIM1234", -1, 0, 101, "(9) 104 33 41 45 99 12 34 87 106", "Example from Annex A.1, check char value 87" },
|
||||
/* 3*/ { GS1_MODE, "[90]12", -1, ZINT_ERROR_INVALID_OPTION, 0, "Error 220: Selected symbology does not support GS1 mode", "" },
|
||||
@ -358,8 +358,8 @@ static void test_input(int index, int generate, int debug) {
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -432,8 +432,8 @@ static void test_ean128_input(int index, int generate, int debug) {
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -452,7 +452,7 @@ static void test_hibc_input(int index, int generate, int debug) {
|
||||
char *comment;
|
||||
};
|
||||
struct item data[] = {
|
||||
/* 0*/ { ",", ZINT_ERROR_INVALID_DATA, -1, "", "" },
|
||||
/* 0*/ { ",", ZINT_ERROR_INVALID_DATA, -1, "Error 203: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)", "" },
|
||||
/* 1*/ { "A99912345/$$52001510X3", 0, 255, "(23) 104 11 33 99 99 91 23 45 100 15 4 4 99 52 0 15 10 100 56 19 19 53 106", "Check digit 3" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
@ -484,8 +484,64 @@ static void test_hibc_input(int index, int generate, int debug) {
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_dpd_input(int index, int generate, int debug) {
|
||||
|
||||
struct item {
|
||||
char *data;
|
||||
int ret;
|
||||
int expected_width;
|
||||
char *expected;
|
||||
char *comment;
|
||||
};
|
||||
struct item data[] = {
|
||||
/* 0*/ { "123456789012345678901234567", ZINT_ERROR_TOO_LONG, -1, "Error 349: DPD input wrong length (28 characters required)", "" },
|
||||
/* 1*/ { "12345678901234567890123456789", ZINT_ERROR_TOO_LONG, -1, "Error 349: DPD input wrong length (28 characters required)", "" },
|
||||
/* 2*/ { "123456789012345678901234567,", ZINT_ERROR_INVALID_DATA, -1, "Error 300: Invalid character in DPD data (alphanumerics only)", "Alphanumerics only in body" },
|
||||
/* 3*/ { ",234567890123456789012345678", 0, 211, "(19) 104 12 18 99 34 56 78 90 12 34 56 78 90 12 34 56 78 64 106", "Non-alphanumeric DPD Identifier (Barcode ID) allowed" },
|
||||
/* 4*/ { "\037234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, "Error 301: Invalid DPD identifier (first character), ASCII values 32 to 127 only", "Control char <US> as DPD Identifier" },
|
||||
/* 5*/ { "é234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, "Error 301: Invalid DPD identifier (first character), ASCII values 32 to 127 only", "Extended ASCII as DPD Identifier" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol;
|
||||
|
||||
char escaped[1024];
|
||||
|
||||
testStart("test_dpd_input");
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (index != -1 && i != index) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_DPD, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (generate) {
|
||||
printf(" /*%3d*/ { \"%s\", %s, %d, \"%s\", \"%s\" },\n",
|
||||
i, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||
testUtilErrorName(data[i].ret), symbol->width, symbol->errtxt, data[i].comment);
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -631,8 +687,8 @@ static void test_encode(int index, int generate, int debug) {
|
||||
/* 39*/ { BARCODE_DPD, UNICODE_MODE, "%000393206219912345678101040", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustrations 2, 7, 8, same; NOTE: correct HRT given by Illustration 7 only",
|
||||
"1101001000010001001100100111011001011101111011011001100110100010001100011011010011001000110111001001011101111010110011100100010110001110001011011000010100110010001001100100010011000101000101011110001100011101011"
|
||||
},
|
||||
/* 40*/ { BARCODE_DPD, UNICODE_MODE, "%000393206219912345678101040", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustration 6 **NOT SAME** HRT incorrect, also uses CodeA and inefficient encoding; verified against tec-it",
|
||||
"1101001000010001001100100111011001011101111011011001100110100010001100011011010011001000110111001001011101111010110011100100010110001110001011011000010100110010001001100100010011000101000101011110001100011101011"
|
||||
/* 40*/ { BARCODE_DPD, UNICODE_MODE, "%007110601782532948375101276", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustration 6 **NOT SAME** HRT incorrect, also uses CodeA and inefficient encoding; verified against tec-it",
|
||||
"1101001000010001001100100111011001011101111010011000100110001001001001100100011001101100110000101001110010110011000110110100010111101011110010011000010010110010001001011001110011001010000100010111101100011101011"
|
||||
},
|
||||
/* 41*/ { BARCODE_DPD, UNICODE_MODE, "0123456789012345678901234567", 0, 1, 189, 1, "DPDAPPD 4.0.2 - Illustration 9, same (allowing for literal HRT)",
|
||||
"110100111001100110110011101101110101110110001000010110011011011110110011011001110110111010111011000100001011001101101111011001101100111011011101011101100010000101100101011110001100011101011"
|
||||
@ -709,6 +765,7 @@ int main(int argc, char *argv[]) {
|
||||
{ "test_input", test_input, 1, 1, 1 },
|
||||
{ "test_ean128_input", test_ean128_input, 1, 1, 1 },
|
||||
{ "test_hibc_input", test_hibc_input, 1, 1, 1 },
|
||||
{ "test_dpd_input", test_dpd_input, 1, 1, 1 },
|
||||
{ "test_encode", test_encode, 1, 1, 1 },
|
||||
};
|
||||
|
||||
|
@ -96,7 +96,7 @@ static void test_input(int index, int generate, int debug) {
|
||||
// NUL U+0000, S1 SP (39)
|
||||
// US U+001F (\037, 31), S1 5
|
||||
struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, "é", -1, ZINT_ERROR_INVALID_DATA, 0, 0, "Error 431: Invalid characters in input data", "ASCII only" },
|
||||
/* 0*/ { UNICODE_MODE, "é", -1, ZINT_ERROR_INVALID_DATA, 0, 0, "Error 431: Invalid character in input data", "ASCII only" },
|
||||
/* 1*/ { UNICODE_MODE, "EXAMPLE 2", -1, 0, 2, 70, "(16) 14 33 10 22 25 21 14 41 38 2 35 14 18 13 0 22", "2.3.7 Symbol Example" },
|
||||
/* 2*/ { UNICODE_MODE, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", "2.3 Example 1: Numeric Encodation (Start 2, Numeric)" },
|
||||
/* 3*/ { UNICODE_MODE, "123456", -1, 0, 2, 70, "(16) 5 17 9 6 48 48 48 34 48 48 36 9 23 41 2 11", "2.3 Example 1: Numeric Encodation" },
|
||||
|
@ -58,7 +58,7 @@ static void test_utf8_to_unicode(int index, int debug) {
|
||||
|
||||
testStart("test_utf8_to_unicode");
|
||||
|
||||
symbol.debug |= debug;
|
||||
symbol.debug = debug;
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_length;
|
||||
@ -136,11 +136,11 @@ static void test_debug_test_codeword_dump_int(int index, int debug) {
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i;
|
||||
|
||||
struct zint_symbol symbol;
|
||||
struct zint_symbol symbol = {0};
|
||||
|
||||
testStart("test_debug_test_codeword_dump_int");
|
||||
|
||||
symbol.debug |= debug;
|
||||
symbol.debug = debug;
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -523,8 +523,8 @@ static void test_reader_init(int index, int generate, int debug) {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -680,8 +680,10 @@ static void test_input(int index, int generate, int debug) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n", i, symbol->eci, data[i].expected_eci);
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d width %d != %d\n", i, symbol->width, data[i].expected_width);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, data[i].option_3, debug)) {
|
||||
if (!data[i].bwipp_cmp) {
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
|
@ -164,7 +164,7 @@ static void test_input(int index, int generate, int debug) {
|
||||
/* 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, ZINT_WARN_NONCOMPLIANT, "Warning 64 0C 22 38 0C 66 13", "17..10 12 34 56 12 ShiftB (0x66) 3" },
|
||||
/* 23*/ { GS1_MODE, -1, "[17]123456[10]123", -1, ZINT_WARN_NONCOMPLIANT, "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*/ { GS1_MODE | GS1PARENS_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" },
|
||||
/* 26*/ { 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" },
|
||||
|
@ -125,7 +125,7 @@ static void test_gb2312_utf8(int index) {
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
||||
struct zint_symbol symbol;
|
||||
struct zint_symbol symbol = {0};
|
||||
unsigned int gbdata[20];
|
||||
|
||||
testStart("test_gb2312_utf8");
|
||||
|
@ -34,6 +34,7 @@
|
||||
static void test_large(int index, int debug) {
|
||||
|
||||
struct item {
|
||||
int option_2;
|
||||
char *pattern;
|
||||
int length;
|
||||
int ret;
|
||||
@ -42,12 +43,18 @@ static void test_large(int index, int debug) {
|
||||
};
|
||||
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
|
||||
struct item data[] = {
|
||||
/* 0*/ { "1", 2751, 0, 162, 162 },
|
||||
/* 1*/ { "1", 2752, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 1*/ { "A", 1836, 0, 162, 162 },
|
||||
/* 2*/ { "A", 1837, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 3*/ { "\200", 1143, 0, 162, 162 },
|
||||
/* 4*/ { "\200", 1144, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 0*/ { -1, "1", 2751, 0, 162, 162 },
|
||||
/* 1*/ { -1, "1", 2752, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 2*/ { -1, "A", 1836, 0, 162, 162 },
|
||||
/* 3*/ { -1, "A", 1837, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 4*/ { -1, "\200", 1143, 0, 162, 162 },
|
||||
/* 5*/ { -1, "\200", 1144, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 6*/ { 1, "1", 18, 0, 18, 18 },
|
||||
/* 7*/ { 1, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 8*/ { 1, "A", 13, 0, 18, 18 },
|
||||
/* 9*/ { 1, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 10*/ { 1, "\200", 7, 0, 18, 18 },
|
||||
/* 11*/ { 1, "\200", 8, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@ -67,7 +74,7 @@ static void test_large(int index, int debug) {
|
||||
testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length);
|
||||
assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf));
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
|
||||
length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
@ -245,6 +252,7 @@ static void test_input(int index, int generate, int debug) {
|
||||
/* 85*/ { UNICODE_MODE, 170, -1, "?", 0, 170, "60 55 0F 77 26 60", "ECI-170 L1 (ASCII invariant)" },
|
||||
/* 86*/ { DATA_MODE, 899, -1, "\200", 0, 899, "63 41 58 00 40 00", "ECI-899 B1 (8-bit binary)" },
|
||||
/* 87*/ { UNICODE_MODE, 900, -1, "é", 0, 900, "63 42 18 01 61 6A 20", "ECI-900 B2 (no conversion)" },
|
||||
/* 88*/ { UNICODE_MODE, 3, -1, "β", ZINT_ERROR_INVALID_DATA, 3, "Error 535: Invalid character in input data for ECI 3", "" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@ -275,10 +283,9 @@ static void test_input(int index, int generate, int debug) {
|
||||
testUtilErrorName(data[i].ret), ret < ZINT_ERROR ? symbol->eci : -1, symbol->errtxt, data[i].comment);
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n", i, symbol->eci, data[i].expected_eci);
|
||||
assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
|
@ -1527,7 +1527,7 @@ static void test_gs1_lint(int index, int debug) {
|
||||
/*174*/ { "[4300]%1", ZINT_WARN_NONCOMPLIANT, "4300%1", "261: AI (4300) position 1: Invalid % escape" }, // pcenc
|
||||
/*175*/ { "[4300]%", ZINT_WARN_NONCOMPLIANT, "4300%", "261: AI (4300) position 1: Invalid % escape" }, // pcenc
|
||||
/*176*/ { "[4300]12%1212", 0, "430012%1212", "" }, // pcenc
|
||||
/*177*/ { "[4300]12%1G12", ZINT_WARN_NONCOMPLIANT, "430012%1G12", "261: AI (4300) position 5: Invalid characters for percent encoding" }, // pcenc
|
||||
/*177*/ { "[4300]12%1G12", ZINT_WARN_NONCOMPLIANT, "430012%1G12", "261: AI (4300) position 5: Invalid character for percent encoding" }, // pcenc
|
||||
/*178*/ { "[4308]ABCDEFGHIJKLMNOPQRSTUVWXYZ%+12", 0, "4308ABCDEFGHIJKLMNOPQRSTUVWXYZ%+12", "" }, // no pcenc
|
||||
/*179*/ { "[4308]ABCDEFGHIJKLMNOPQRSTUVWXYZ%+123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4308)" }, // no pcenc
|
||||
/*180*/ { "[4321]1", 0, "43211", "" }, // yesno
|
||||
|
@ -34,6 +34,8 @@
|
||||
static void test_large(int index, int debug) {
|
||||
|
||||
struct item {
|
||||
int option_1;
|
||||
int option_2;
|
||||
char *pattern;
|
||||
int length;
|
||||
int ret;
|
||||
@ -42,12 +44,24 @@ static void test_large(int index, int debug) {
|
||||
};
|
||||
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
|
||||
struct item data[] = {
|
||||
/* 0*/ { "1", 7827, 0, 189, 189 },
|
||||
/* 1*/ { "1", 7828, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 1*/ { "A", 4349, 0, 189, 189 }, // TODO: should be 4350 according to spec, investigate
|
||||
/* 2*/ { "A", 4351, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 3*/ { "\200", 3260, 0, 189, 189 }, // TODO: should be 3261 according to spec, investigate
|
||||
/* 4*/ { "\200", 3262, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 0*/ { -1, -1, "1", 7827, 0, 189, 189 },
|
||||
/* 1*/ { -1, -1, "1", 7828, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 2*/ { -1, -1, "A", 4349, 0, 189, 189 }, // TODO: should be 4350 according to spec, investigate
|
||||
/* 3*/ { -1, -1, "A", 4350, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 4*/ { -1, -1, "\200", 3260, 0, 189, 189 }, // TODO: should be 3261 according to spec, investigate
|
||||
/* 5*/ { -1, -1, "\200", 3261, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 6*/ { -1, 1, "1", 42, 0, 23, 23 },
|
||||
/* 7*/ { -1, 1, "1", 43, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 8*/ { -1, 1, "A", 25, 0, 23, 23 },
|
||||
/* 9*/ { -1, 1, "A", 26, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 10*/ { -1, 1, "\200", 17, 0, 23, 23 },
|
||||
/* 11*/ { -1, 1, "\200", 18, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 12*/ { 2, 1, "A", 19, 0, 23, 23 },
|
||||
/* 13*/ { 2, 1, "A", 20, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 14*/ { 3, 1, "A", 14, 0, 23, 23 },
|
||||
/* 15*/ { 3, 1, "A", 15, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 16*/ { 4, 1, "A", 9, 0, 23, 23 },
|
||||
/* 17*/ { 4, 1, "A", 10, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@ -67,7 +81,7 @@ static void test_large(int index, int debug) {
|
||||
testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length);
|
||||
assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf));
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_HANXIN, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
|
||||
length = testUtilSetSymbol(symbol, BARCODE_HANXIN, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
@ -241,6 +255,7 @@ static void test_input(int index, int generate, int debug) {
|
||||
/* 76*/ { UNICODE_MODE, 170, -1, "?", -1, 0, 170, "88 0A A2 FB 1F C0 00 00 00", "ECI-170 L1 (ASCII invariant)" },
|
||||
/* 77*/ { DATA_MODE, 899, -1, "\200", -1, 0, 899, "88 38 33 00 0C 00 00 00 00", "ECI-899 B1 (8-bit binary)" },
|
||||
/* 78*/ { UNICODE_MODE, 900, -1, "é", -1, 0, 900, "88 38 43 00 16 1D 48 00 00", "ECI-900 B2 (no conversion)" },
|
||||
/* 79*/ { UNICODE_MODE, 3, -1, "β", -1, ZINT_ERROR_INVALID_DATA, 3, "Error 545: Invalid character in input data for ECI 3", "" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@ -272,8 +287,8 @@ static void test_input(int index, int generate, int debug) {
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n", i, symbol->eci, data[i].expected_eci);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
|
@ -38,6 +38,7 @@ static void test_checks(int index, int debug) {
|
||||
|
||||
struct item {
|
||||
int symbology;
|
||||
int option_1;
|
||||
char *data;
|
||||
int length;
|
||||
int input_mode;
|
||||
@ -51,49 +52,146 @@ static void test_checks(int index, int debug) {
|
||||
};
|
||||
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
|
||||
struct item data[] = {
|
||||
/* 0*/ { BARCODE_CODE128, "1234", -1, -1, 3, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", -1 },
|
||||
/* 1*/ { BARCODE_CODE128, "1234", -1, -1, 0, -1, -1, 0, "", -1 },
|
||||
/* 2*/ { BARCODE_QRCODE, "1234", -1, -1, 3, -1, -1, 0, "", -1 },
|
||||
/* 3*/ { BARCODE_QRCODE, "1234", -1, -1, 999999 + 1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: Invalid ECI mode", -1 },
|
||||
/* 4*/ { BARCODE_CODE128, "1234", -1, -1, -1, 20.1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Invalid dot size", -1 },
|
||||
/* 5*/ { BARCODE_CODE128, "1234", -1, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode", -1 },
|
||||
/* 6*/ { BARCODE_GS1_128, "[21]12\0004", 8, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 262: NUL characters not permitted in GS1 mode", -1 },
|
||||
/* 7*/ { BARCODE_GS1_128, "[21]12é4", -1, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1", -1 },
|
||||
/* 8*/ { BARCODE_GS1_128, "[21]12\0074", -1, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 251: Control characters are not supported by GS1", -1 },
|
||||
/* 9*/ { BARCODE_GS1_128, "[21]1234", -1, GS1_MODE, -1, -1, -1, 0, "", -1 },
|
||||
/* 10*/ { 0, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/* 11*/ { 0, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/* 12*/ { 0, "1", -1, -1, 1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, // Not supporting beats invalid ECI
|
||||
/* 13*/ { 0, "1", -1, -1, 1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/* 14*/ { 0, "1", -1, -1, -1, 0.009, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Invalid dot size", BARCODE_CODE128 },
|
||||
/* 15*/ { 0, "1", -1, -1, -1, 0.009, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/* 16*/ { 0, "1", -1, -1, 1, 0.009, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, // Invalid dot size no longer beats invalid ECI
|
||||
/* 17*/ { 0, "1", -1, -1, -1, 0.009, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/* 18*/ { 5, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_C25STANDARD },
|
||||
/* 19*/ { 5, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_C25STANDARD },
|
||||
/* 20*/ { 12, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_EANX },
|
||||
/* 21*/ { 12, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
|
||||
/* 22*/ { 19, "1", -1, -1, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 362: Input too short (3 character minimum)", BARCODE_CODABAR },
|
||||
/* 23*/ { 19, "A1B", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 207: Codabar 18 not supported", BARCODE_CODABAR },
|
||||
/* 24*/ { 19, "A1B", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 207: Codabar 18 not supported", -1 },
|
||||
/* 25*/ { 26, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_UPCA },
|
||||
/* 26*/ { 26, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA },
|
||||
/* 27*/ { 27, "1", -1, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 208: UPCD1 not supported", 27 },
|
||||
/* 28*/ { 54, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 210: General Parcel Code not supported", BARCODE_CODE128 },
|
||||
/* 29*/ { 54, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 210: General Parcel Code not supported", -1 },
|
||||
/* 30*/ { 91, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 212: Symbology out of range", BARCODE_CODE128 },
|
||||
/* 31*/ { 91, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 212: Symbology out of range", -1 },
|
||||
/* 32*/ { 95, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 213: Symbology out of range", BARCODE_CODE128 },
|
||||
/* 33*/ { 95, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 213: Symbology out of range", -1 },
|
||||
/* 34*/ { 111, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_HIBC_BLOCKF },
|
||||
/* 35*/ { 111, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_BLOCKF },
|
||||
/* 36*/ { 114, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 214: Symbology out of range", BARCODE_CODE128 },
|
||||
/* 37*/ { 114, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 214: Symbology out of range", -1 },
|
||||
/* 38*/ { 120, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
|
||||
/* 39*/ { 120, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
|
||||
/* 40*/ { 146, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 },
|
||||
/* 41*/ { 146, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 },
|
||||
/* 42*/ { BARCODE_CODE128, "\200", -1, UNICODE_MODE, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8", -1 },
|
||||
/* 0*/ { BARCODE_CODE128, -1, "1234", -1, -1, 3, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", -1 },
|
||||
/* 1*/ { BARCODE_CODE128, -1, "1234", -1, -1, 0, -1, -1, 0, "", -1 },
|
||||
/* 2*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 3, -1, -1, 0, "", -1 },
|
||||
/* 3*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 999999 + 1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: Invalid ECI mode", -1 },
|
||||
/* 4*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 20.1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Invalid dot size", -1 },
|
||||
/* 5*/ { BARCODE_CODE128, -1, "1234", -1, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode", -1 },
|
||||
/* 6*/ { BARCODE_GS1_128, -1, "[21]12\0004", 8, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 262: NUL characters not permitted in GS1 mode", -1 },
|
||||
/* 7*/ { BARCODE_GS1_128, -1, "[21]12é4", -1, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1", -1 },
|
||||
/* 8*/ { BARCODE_GS1_128, -1, "[21]12\0074", -1, GS1_MODE, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 251: Control characters are not supported by GS1", -1 },
|
||||
/* 9*/ { BARCODE_GS1_128, -1, "[21]1234", -1, GS1_MODE, -1, -1, -1, 0, "", -1 },
|
||||
/* 10*/ { 0, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
|
||||
/* 11*/ { 0, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/* 12*/ { 0, -1, "1", -1, -1, 1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, // Not supporting beats invalid ECI
|
||||
/* 13*/ { 0, -1, "1", -1, -1, 1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/* 14*/ { 0, -1, "1", -1, -1, -1, 0.009, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Invalid dot size", BARCODE_CODE128 },
|
||||
/* 15*/ { 0, -1, "1", -1, -1, -1, 0.009, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/* 16*/ { 0, -1, "1", -1, -1, 1, 0.009, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, // Invalid dot size no longer beats invalid ECI
|
||||
/* 17*/ { 0, -1, "1", -1, -1, -1, 0.009, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
|
||||
/* 18*/ { 5, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_C25STANDARD },
|
||||
/* 19*/ { 5, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_C25STANDARD },
|
||||
/* 20*/ { 10, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_EANX },
|
||||
/* 21*/ { 10, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
|
||||
/* 22*/ { 11, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_EANX },
|
||||
/* 23*/ { 11, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
|
||||
/* 24*/ { 12, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_EANX },
|
||||
/* 25*/ { 12, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
|
||||
/* 26*/ { 15, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_EANX },
|
||||
/* 27*/ { 15, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
|
||||
/* 28*/ { 17, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_UPCA },
|
||||
/* 29*/ { 17, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA },
|
||||
/* 30*/ { 19, -1, "1", -1, -1, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 362: Input too short (3 character minimum)", BARCODE_CODABAR },
|
||||
/* 31*/ { 19, -1, "A1B", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 207: Codabar 18 not supported", BARCODE_CODABAR },
|
||||
/* 32*/ { 19, -1, "A1B", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 207: Codabar 18 not supported", -1 },
|
||||
/* 33*/ { 26, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_UPCA },
|
||||
/* 34*/ { 26, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA },
|
||||
/* 35*/ { 27, -1, "1", -1, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 208: UPCD1 not supported", 27 },
|
||||
/* 36*/ { 33, -1, "1", -1, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI", BARCODE_GS1_128 },
|
||||
/* 37*/ { 33, -1, "[10]23", -1, -1, -1, -1, -1, 0, "", BARCODE_GS1_128 },
|
||||
/* 38*/ { 33, -1, "[10]23", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_GS1_128 },
|
||||
/* 39*/ { 36, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_UPCA },
|
||||
/* 40*/ { 36, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA },
|
||||
/* 41*/ { 39, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_UPCE },
|
||||
/* 42*/ { 39, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCE },
|
||||
/* 43*/ { 41, -1, "1", -1, -1, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 480: Input wrong length (5, 9 or 11 characters only)", BARCODE_POSTNET },
|
||||
/* 44*/ { 41, -1, "12345", -1, -1, -1, -1, -1, 0, "", BARCODE_POSTNET },
|
||||
/* 45*/ { 41, -1, "12345", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
|
||||
/* 46*/ { 42, -1, "12345", -1, -1, -1, -1, -1, 0, "", BARCODE_POSTNET },
|
||||
/* 47*/ { 42, -1, "12345", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
|
||||
/* 48*/ { 43, -1, "12345", -1, -1, -1, -1, -1, 0, "", BARCODE_POSTNET },
|
||||
/* 49*/ { 43, -1, "12345", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
|
||||
/* 50*/ { 44, -1, "12345", -1, -1, -1, -1, -1, 0, "", BARCODE_POSTNET },
|
||||
/* 51*/ { 44, -1, "12345", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
|
||||
/* 52*/ { 45, -1, "12345", -1, -1, -1, -1, -1, 0, "", BARCODE_POSTNET },
|
||||
/* 53*/ { 45, -1, "12345", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
|
||||
/* 54*/ { 46, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_PLESSEY },
|
||||
/* 55*/ { 46, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_PLESSEY },
|
||||
/* 56*/ { 48, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_NVE18 },
|
||||
/* 57*/ { 48, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_NVE18 },
|
||||
/* 58*/ { 54, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 210: General Parcel Code not supported", BARCODE_CODE128 },
|
||||
/* 59*/ { 54, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 210: General Parcel Code not supported", -1 },
|
||||
/* 60*/ { 59, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_CODE128 },
|
||||
/* 61*/ { 59, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE128 },
|
||||
/* 62*/ { 61, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_CODE128 },
|
||||
/* 63*/ { 61, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE128 },
|
||||
/* 64*/ { 62, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_CODE93 },
|
||||
/* 65*/ { 62, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE93 },
|
||||
/* 66*/ { 64, -1, "12345678", -1, -1, -1, -1, -1, 0, "", BARCODE_AUSPOST },
|
||||
/* 67*/ { 64, -1, "12345678", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_AUSPOST },
|
||||
/* 68*/ { 65, -1, "12345678", -1, -1, -1, -1, -1, 0, "", BARCODE_AUSPOST },
|
||||
/* 69*/ { 65, -1, "12345678", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_AUSPOST },
|
||||
/* 70*/ { 78, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_DBAR_OMN },
|
||||
/* 71*/ { 78, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_DBAR_OMN },
|
||||
/* 72*/ { 83, -1, "12345678901", -1, -1, -1, -1, -1, 0, "", BARCODE_PLANET },
|
||||
/* 73*/ { 83, -1, "12345678901", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_PLANET },
|
||||
/* 74*/ { 88, -1, "1", -1, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI", BARCODE_GS1_128 },
|
||||
/* 75*/ { 88, -1, "[10]12", -1, -1, -1, -1, -1, 0, "", BARCODE_GS1_128 },
|
||||
/* 76*/ { 88, -1, "[10]12", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_GS1_128 },
|
||||
/* 77*/ { 91, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 212: Symbology out of range", BARCODE_CODE128 },
|
||||
/* 78*/ { 91, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 212: Symbology out of range", -1 },
|
||||
/* 79*/ { 94, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 213: Symbology out of range", BARCODE_CODE128 },
|
||||
/* 80*/ { 94, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 213: Symbology out of range", -1 },
|
||||
/* 81*/ { 95, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 213: Symbology out of range", BARCODE_CODE128 },
|
||||
/* 82*/ { 95, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 213: Symbology out of range", -1 },
|
||||
/* 83*/ { 100, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_HIBC_128 },
|
||||
/* 84*/ { 100, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_128 },
|
||||
/* 85*/ { 101, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_HIBC_39 },
|
||||
/* 86*/ { 101, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_39 },
|
||||
/* 87*/ { 103, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_HIBC_DM },
|
||||
/* 88*/ { 103, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_DM },
|
||||
/* 89*/ { 105, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_HIBC_QR },
|
||||
/* 90*/ { 105, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_QR },
|
||||
/* 91*/ { 107, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_HIBC_PDF },
|
||||
/* 92*/ { 107, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_PDF },
|
||||
/* 93*/ { 109, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_HIBC_MICPDF },
|
||||
/* 94*/ { 109, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_MICPDF },
|
||||
/* 95*/ { 111, -1, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_HIBC_BLOCKF },
|
||||
/* 96*/ { 111, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_BLOCKF },
|
||||
/* 97*/ { 113, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 214: Symbology out of range", BARCODE_CODE128 },
|
||||
/* 98*/ { 113, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 214: Symbology out of range", -1 },
|
||||
/* 99*/ { 114, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 214: Symbology out of range", BARCODE_CODE128 },
|
||||
/*100*/ { 114, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 214: Symbology out of range", -1 },
|
||||
/*101*/ { 117, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
|
||||
/*102*/ { 117, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
|
||||
/*103*/ { 118, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
|
||||
/*104*/ { 118, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
|
||||
/*105*/ { 119, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
|
||||
/*106*/ { 119, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
|
||||
/*107*/ { 120, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
|
||||
/*108*/ { 120, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
|
||||
/*109*/ { 122, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
|
||||
/*110*/ { 122, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
|
||||
/*111*/ { 123, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
|
||||
/*112*/ { 123, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
|
||||
/*113*/ { 124, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
|
||||
/*114*/ { 124, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
|
||||
/*115*/ { 125, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
|
||||
/*116*/ { 125, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
|
||||
/*117*/ { 126, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
|
||||
/*118*/ { 126, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
|
||||
/*119*/ { 127, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
|
||||
/*120*/ { 127, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
|
||||
/*121*/ { 146, -1, "1", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 },
|
||||
/*122*/ { 146, -1, "1", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 },
|
||||
/*123*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input data", -1 },
|
||||
/*124*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
|
||||
/*125*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
|
||||
/*126*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, 13, -1, -1, 0, "", -1 },
|
||||
/*127*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
|
||||
/*128*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
|
||||
/*129*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 },
|
||||
/*130*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 },
|
||||
/*131*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, // Warning in encoder overrides library warnings
|
||||
/*132*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, // But not errors
|
||||
/*133*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, 13, -1, -1, 0, "", -1 },
|
||||
/*134*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
|
||||
/*135*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
|
||||
/*136*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Invalid error correction level - using default instead", -1 },
|
||||
/*137*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 },
|
||||
/*138*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, // ECI warning trumps all other warnings
|
||||
/*139*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, // But not errors
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@ -108,7 +206,7 @@ static void test_checks(int index, int debug) {
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, data[i].option_1, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
|
||||
if (data[i].dot_size != -1) {
|
||||
symbol->dot_size = data[i].dot_size;
|
||||
}
|
||||
@ -134,6 +232,21 @@ static void test_checks(int index, int debug) {
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_symbologies(void) {
|
||||
int i, ret;
|
||||
struct zint_symbol symbol = {0};
|
||||
|
||||
testStart("test_symbologies");
|
||||
|
||||
for (i = -1; i < 148; i++) {
|
||||
symbol.symbology = i;
|
||||
ret = ZBarcode_Encode(&symbol, (unsigned char *) "1", 0);
|
||||
assert_notequal(ret, ZINT_ERROR_ENCODING_PROBLEM, "i:%d Encoding problem (%s)\n", i, symbol.errtxt);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_input_mode(int index, int debug) {
|
||||
|
||||
struct item {
|
||||
@ -583,40 +696,55 @@ static void test_valid_id(void) {
|
||||
testFinish();
|
||||
}
|
||||
|
||||
STATIC_UNLESS_ZINT_TEST int error_tag(char error_string[100], int error_number);
|
||||
STATIC_UNLESS_ZINT_TEST int error_tag(struct zint_symbol *symbol, int error_number, const char *error_string);
|
||||
|
||||
static void test_error_tag(int index) {
|
||||
|
||||
struct item {
|
||||
int error_number;
|
||||
int warn_level;
|
||||
char* data;
|
||||
int ret;
|
||||
char* expected;
|
||||
};
|
||||
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
|
||||
struct item data[] = {
|
||||
/* 0*/ { ZINT_WARN_INVALID_OPTION, "", ZINT_WARN_INVALID_OPTION, "Warning " },
|
||||
/* 1*/ { ZINT_ERROR_TOO_LONG, "", ZINT_ERROR_TOO_LONG, "Error " },
|
||||
/* 2*/ { ZINT_WARN_USES_ECI, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 3*/ { ZINT_ERROR_INVALID_DATA, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 0*/ { ZINT_WARN_INVALID_OPTION, -1, "", ZINT_WARN_INVALID_OPTION, "Warning " },
|
||||
/* 1*/ { ZINT_WARN_INVALID_OPTION, WARN_FAIL_ALL, "", ZINT_ERROR_INVALID_OPTION, "Error " },
|
||||
/* 2*/ { ZINT_WARN_USES_ECI, -1, "", ZINT_WARN_USES_ECI, "Warning " },
|
||||
/* 3*/ { ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "", ZINT_ERROR_USES_ECI, "Error " },
|
||||
/* 4*/ { ZINT_WARN_NONCOMPLIANT, -1, "", ZINT_WARN_NONCOMPLIANT, "Warning " },
|
||||
/* 5*/ { ZINT_WARN_NONCOMPLIANT, WARN_FAIL_ALL, "", ZINT_ERROR_NONCOMPLIANT, "Error " },
|
||||
/* 6*/ { ZINT_ERROR_TOO_LONG, WARN_DEFAULT, "", ZINT_ERROR_TOO_LONG, "Error " },
|
||||
/* 7*/ { ZINT_WARN_USES_ECI, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 8*/ { ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 9*/ { ZINT_ERROR_INVALID_DATA, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 10*/ { ZINT_WARN_USES_ECI, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 11*/ { ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 12*/ { ZINT_ERROR_INVALID_DATA, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, ret;
|
||||
|
||||
char errtxt[100];
|
||||
|
||||
testStart("test_error_tag");
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
struct zint_symbol symbol = {0};
|
||||
|
||||
if (index != -1 && i != index) continue;
|
||||
|
||||
assert_nonzero((int) strlen(data[i].data) < 100, "i:%d strlen(data) %d >= 100\n", i, (int) strlen(data[i].data));
|
||||
strcpy(errtxt, data[i].data);
|
||||
ret = error_tag(errtxt, data[i].error_number);
|
||||
symbol.warn_level = data[i].warn_level;
|
||||
|
||||
ret = error_tag(&symbol, data[i].error_number, data[i].data);
|
||||
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
|
||||
assert_zero(strcmp(errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, errtxt, data[i].expected);
|
||||
assert_nonzero(strlen(errtxt) >= strlen(data[i].data), "i:%d strlen(errtxt) %d < %d\n", i, (int) strlen(errtxt), (int) strlen(data[i].data));
|
||||
assert_zero(strcmp(symbol.errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol.errtxt, data[i].expected);
|
||||
|
||||
if ((int) strlen(data[i].data) < 100) {
|
||||
strcpy(symbol.errtxt, data[i].data);
|
||||
ret = error_tag(&symbol, data[i].error_number, NULL);
|
||||
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
|
||||
assert_zero(strcmp(symbol.errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol.errtxt, data[i].expected);
|
||||
}
|
||||
}
|
||||
|
||||
testFinish();
|
||||
@ -682,10 +810,103 @@ static void test_zero_outfile(void) {
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_clear(void) {
|
||||
|
||||
int ret;
|
||||
struct zint_symbol *symbol;
|
||||
char *data = "1234";
|
||||
|
||||
testStart("test_clear");
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
symbol->symbology = BARCODE_MAXICODE;
|
||||
symbol->whitespace_width = 5;
|
||||
symbol->whitespace_height = 5;
|
||||
symbol->border_width = 2;
|
||||
symbol->output_options = BARCODE_BOX;
|
||||
strcpy(symbol->fgcolour, "000000AA");
|
||||
strcpy(symbol->bgcolour, "FFFFFFAA");
|
||||
|
||||
// Raster
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data, 0);
|
||||
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
|
||||
|
||||
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
|
||||
assert_nonzero(symbol->width, "ZBarcode_Encode() width 0\n");
|
||||
|
||||
ret = ZBarcode_Buffer(symbol, 0);
|
||||
assert_zero(ret, "ZBarcode_Buffer() ret %d != 0 (%s)\n", ret, symbol->errtxt);
|
||||
|
||||
assert_nonnull(symbol->bitmap, "ZBarcode_Buffer() bitmap NULL\n");
|
||||
assert_nonnull(symbol->alphamap, "ZBarcode_Buffer() alphamap NULL\n");
|
||||
assert_nonzero(symbol->bitmap_width, "ZBarcode_Buffer() bitmap_width 0\n");
|
||||
assert_nonzero(symbol->bitmap_height, "ZBarcode_Buffer() bitmap_height 0\n");
|
||||
|
||||
assert_nonzero(symbol->rows, "ZBarcode_Buffer() rows 0\n");
|
||||
assert_nonzero(symbol->width, "ZBarcode_Buffer() width 0\n");
|
||||
assert_zero(symbol->bitmap_byte_length, "ZBarcode_Buffer() bitmap_byte_length %d != 0\n", symbol->bitmap_byte_length);
|
||||
assert_null(symbol->vector, "ZBarcode_Buffer() vector != NULL\n");
|
||||
|
||||
ZBarcode_Clear(symbol);
|
||||
|
||||
assert_null(symbol->bitmap, "ZBarcode_Buffer() bitmap != NULL\n");
|
||||
assert_null(symbol->alphamap, "ZBarcode_Buffer() alphamap != NULL\n");
|
||||
assert_zero(symbol->bitmap_width, "ZBarcode_Buffer() bitmap_width %d != 0\n", symbol->bitmap_width);
|
||||
assert_zero(symbol->bitmap_height, "ZBarcode_Buffer() bitmap_height %d != 0\n", symbol->bitmap_height);
|
||||
|
||||
assert_zero(symbol->rows, "ZBarcode_Buffer() rows %d != 0\n", symbol->rows);
|
||||
assert_zero(symbol->width, "ZBarcode_Buffer() width %d != 0\n", symbol->width);
|
||||
assert_zero(symbol->bitmap_byte_length, "ZBarcode_Buffer() bitmap_byte_length %d != 0\n", symbol->bitmap_byte_length);
|
||||
assert_null(symbol->vector, "ZBarcode_Buffer() vector != NULL\n");
|
||||
|
||||
// Vector
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data, 0);
|
||||
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
|
||||
|
||||
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
|
||||
assert_nonzero(symbol->width, "ZBarcode_Encode() width 0\n");
|
||||
|
||||
ret = ZBarcode_Buffer_Vector(symbol, 0);
|
||||
assert_zero(ret, "ZBarcode_Buffer_Vector() ret %d != 0 (%s)\n", ret, symbol->errtxt);
|
||||
|
||||
assert_nonnull(symbol->vector, "ZBarcode_Buffer_Vector() vector NULL\n");
|
||||
assert_nonnull(symbol->vector->rectangles, "ZBarcode_Buffer_Vector() vector->rectangles NULL\n");
|
||||
assert_nonnull(symbol->vector->hexagons, "ZBarcode_Buffer_Vector() vector->hexagons NULL\n");
|
||||
assert_null(symbol->vector->strings, "ZBarcode_Buffer_Vector() vector->strings != NULL\n"); // MAXICODE no text
|
||||
assert_nonnull(symbol->vector->circles, "ZBarcode_Buffer_Vector() vector->circles NULL\n");
|
||||
|
||||
assert_nonzero(symbol->rows, "ZBarcode_Buffer_Vector() rows 0\n");
|
||||
assert_nonzero(symbol->width, "ZBarcode_Buffer_Vector() width 0\n");
|
||||
assert_null(symbol->bitmap, "ZBarcode_Buffer_Vector() bitmap != NULL\n");
|
||||
assert_null(symbol->alphamap, "ZBarcode_Buffer_Vector() alphamap != NULL\n");
|
||||
assert_zero(symbol->bitmap_byte_length, "ZBarcode_Buffer_Vector() bitmap_byte_length %d != 0\n", symbol->bitmap_byte_length);
|
||||
|
||||
ZBarcode_Clear(symbol);
|
||||
|
||||
assert_null(symbol->vector, "ZBarcode_Buffer_Vector() vector != NULL\n");
|
||||
|
||||
assert_zero(symbol->rows, "ZBarcode_Buffer_Vector() rows %d != 0\n", symbol->rows);
|
||||
assert_zero(symbol->width, "ZBarcode_Buffer_Vector() width %d != 0\n", symbol->width);
|
||||
assert_zero(symbol->bitmap_byte_length, "ZBarcode_Buffer_Vector() bitmap_byte_length %d != 0\n", symbol->bitmap_byte_length);
|
||||
assert_null(symbol->bitmap, "ZBarcode_Buffer_Vector() bitmap != NULL\n");
|
||||
assert_null(symbol->alphamap, "ZBarcode_Buffer_Vector() alphamap != NULL\n");
|
||||
assert_zero(symbol->bitmap_width, "ZBarcode_Buffer_Vector() bitmap_width %d != 0\n", symbol->bitmap_width);
|
||||
assert_zero(symbol->bitmap_height, "ZBarcode_Buffer_Vector() bitmap_height %d != 0\n", symbol->bitmap_height);
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
|
||||
{ "test_checks", test_checks, 1, 0, 1 },
|
||||
{ "test_symbologies", test_symbologies, 0, 0, 0 },
|
||||
{ "test_input_mode", test_input_mode, 1, 0, 1 },
|
||||
{ "test_escape_char_process", test_escape_char_process, 1, 1, 1 },
|
||||
{ "test_cap", test_cap, 1, 0, 0 },
|
||||
@ -698,6 +919,7 @@ int main(int argc, char *argv[]) {
|
||||
{ "test_error_tag", test_error_tag, 1, 0, 0 },
|
||||
{ "test_strip_bom", test_strip_bom, 0, 0, 0 },
|
||||
{ "test_zero_outfile", test_zero_outfile, 0, 0, 0 },
|
||||
{ "test_clear", test_clear, 0, 0, 0 },
|
||||
};
|
||||
|
||||
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
|
||||
|
@ -149,7 +149,7 @@ static void test_input(int index, int generate, int debug) {
|
||||
/* 17*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "ABCDE123456", 0, 30, "(144) 03 18 01 31 20 10 30 1E 20 1C 0F 38 38 1A 39 10 2F 37 22 12 01 21 21 21 21 21 21 21", "5-alphanumeric postcode" },
|
||||
/* 18*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "AAAAAA 840001", 0, 30, "(144) 13 10 10 10 10 10 00 12 07 00 17 36 2E 38 04 29 16 0D 27 16 01 21 21 21 21 21 21 21", "6-alphanumeric postcode with padding" },
|
||||
/* 19*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "AAAAA A840001", 0, 30, "(144) 03 18 10 10 10 10 00 12 07 00 19 07 29 31 26 01 23 2C 2E 07 01 21 21 21 21 21 21 21", "7-alphanumeric with embedded padding truncated" },
|
||||
/* 20*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "AA\015AAA840001", ZINT_ERROR_INVALID_DATA, 0, "Error 556: Invalid characters in postcode in Primary Message", "Alphanumeric postcode with CR" },
|
||||
/* 20*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "AA\015AAA840001", ZINT_ERROR_INVALID_DATA, 0, "Error 556: Invalid character in postcode in Primary Message", "Alphanumeric postcode with CR" },
|
||||
/* 21*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "A#%-/A840001", 0, 30, "(144) 13 30 1B 1B 39 18 00 12 07 00 3F 1E 25 07 2A 1E 14 3C 28 2D 01 21 21 21 21 21 21 21", "Alphanumeric postcode with non-control Code A chars" },
|
||||
/* 22*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "1A23456", ZINT_ERROR_INVALID_DATA, 0, "Error 552: Non-numeric country code or service class in Primary Message", "Non-numeric country code" },
|
||||
/* 23*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "12345678912345A", ZINT_ERROR_INVALID_DATA, 0, "Error 552: Non-numeric country code or service class in Primary Message", "Non-numeric service class" },
|
||||
|
@ -151,7 +151,7 @@ static void test_input(int index, int debug) {
|
||||
/* 2*/ { BARCODE_CODABAR, "A1234", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 359: Does not end with \"A\", \"B\", \"C\" or \"D\"" },
|
||||
/* 3*/ { BARCODE_CODABAR, "A1234E", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 359: Does not end with \"A\", \"B\", \"C\" or \"D\"" },
|
||||
/* 4*/ { BARCODE_CODABAR, "C123.D", 0, 1, 63, "" },
|
||||
/* 5*/ { BARCODE_CODABAR, "C123,D", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 357: Invalid characters in data" },
|
||||
/* 5*/ { BARCODE_CODABAR, "C123,D", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 357: Invalid character in data (\"0123456789-$:/.+ABCD\" only)" },
|
||||
/* 6*/ { BARCODE_CODABAR, "D:C", 0, 1, 33, "" },
|
||||
/* 7*/ { BARCODE_CODABAR, "DCC", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 363: Cannot contain \"A\", \"B\", \"C\" or \"D\"" },
|
||||
/* 8*/ { BARCODE_CODABAR, "AB", ZINT_ERROR_TOO_LONG, -1, -1, "Error 362: Input too short (3 character minimum)" },
|
||||
@ -160,18 +160,18 @@ static void test_input(int index, int debug) {
|
||||
/* 11*/ { BARCODE_PHARMA, "3", 0, 1, 4, "" },
|
||||
/* 12*/ { BARCODE_PHARMA, "2", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 352: Data out of range (3 to 131070)" },
|
||||
/* 13*/ { BARCODE_PHARMA, "1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 352: Data out of range (3 to 131070)" },
|
||||
/* 14*/ { BARCODE_PHARMA, "12A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 351: Invalid characters in data (digits only)" },
|
||||
/* 14*/ { BARCODE_PHARMA, "12A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 351: Invalid character in data (digits only)" },
|
||||
/* 15*/ { BARCODE_PHARMA_TWO, "64570080", 0, 2, 31, "" },
|
||||
/* 16*/ { BARCODE_PHARMA_TWO, "64570081", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)" },
|
||||
/* 17*/ { BARCODE_PHARMA_TWO, "4", 0, 2, 3, "" },
|
||||
/* 18*/ { BARCODE_PHARMA_TWO, "3", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)" },
|
||||
/* 19*/ { BARCODE_PHARMA_TWO, "2", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)" },
|
||||
/* 20*/ { BARCODE_PHARMA_TWO, "1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)" },
|
||||
/* 21*/ { BARCODE_PHARMA_TWO, "123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 355: Invalid characters in data (digits only)" },
|
||||
/* 21*/ { BARCODE_PHARMA_TWO, "123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 355: Invalid character in data (digits only)" },
|
||||
/* 22*/ { BARCODE_CODE32, "12345678", 0, 1, 103, "" },
|
||||
/* 23*/ { BARCODE_CODE32, "9", 0, 1, 103, "" },
|
||||
/* 24*/ { BARCODE_CODE32, "0", 0, 1, 103, "" },
|
||||
/* 25*/ { BARCODE_CODE32, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 361: Invalid characters in data (digits only)" },
|
||||
/* 25*/ { BARCODE_CODE32, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 361: Invalid character in data (digits only)" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
@ -160,8 +160,8 @@ static void test_reader_init(int index, int generate, int debug) {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -192,7 +192,7 @@ static void test_input(int index, int generate, int debug) {
|
||||
/* 2*/ { BARCODE_PDF417, UNICODE_MODE, 26, "é", 0, 26, 7, 103, "(14) 6 927 26 901 195 169 574 701 519 908 84 241 360 642", "" },
|
||||
/* 3*/ { BARCODE_PDF417, UNICODE_MODE, 9, "β", 0, 9, 7, 103, "(14) 6 927 9 913 226 900 487 92 418 278 838 500 576 84", "" },
|
||||
/* 4*/ { BARCODE_PDF417, UNICODE_MODE, -1, "β", ZINT_WARN_USES_ECI, 9, 7, 103, "Warning (14) 6 927 9 913 226 900 487 92 418 278 838 500 576 84", "" },
|
||||
/* 5*/ { BARCODE_PDF417, UNICODE_MODE, 3, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 204: Invalid characters in input data", "" },
|
||||
/* 5*/ { BARCODE_PDF417, UNICODE_MODE, 3, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 244: Invalid character in input data for ECI 3", "" },
|
||||
/* 6*/ { BARCODE_PDF417, UNICODE_MODE, 899, "A", 0, 899, 7, 103, "(14) 6 927 899 900 29 900 727 69 915 482 371 771 641 35", "" },
|
||||
/* 7*/ { BARCODE_PDF417, UNICODE_MODE, 900, "A", 0, 900, 7, 103, "(14) 6 926 0 0 900 29 56 795 921 763 468 267 410 129", "" },
|
||||
/* 8*/ { BARCODE_PDF417, UNICODE_MODE, 810899, "A", 0, 810899, 7, 103, "(14) 6 926 899 899 900 29 847 901 749 718 89 792 660 273", "" },
|
||||
@ -204,14 +204,14 @@ static void test_input(int index, int generate, int debug) {
|
||||
/* 14*/ { BARCODE_MICROPDF417, UNICODE_MODE, 26, "é", 0, 26, 6, 82, "(18) 927 26 901 195 169 900 288 96 509 365 709 784 713 403 219 81 851 866", "" },
|
||||
/* 15*/ { BARCODE_MICROPDF417, UNICODE_MODE, 9, "β", 0, 9, 11, 38, "(11) 927 9 913 226 23 103 74 194 394 667 324", "" },
|
||||
/* 16*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, "β", ZINT_WARN_USES_ECI, 9, 11, 38, "Warning (11) 927 9 913 226 23 103 74 194 394 667 324", "" },
|
||||
/* 17*/ { BARCODE_MICROPDF417, UNICODE_MODE, 3, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 204: Invalid characters in input data", "" },
|
||||
/* 17*/ { BARCODE_MICROPDF417, UNICODE_MODE, 3, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 244: Invalid character in input data for ECI 3", "" },
|
||||
/* 18*/ { BARCODE_MICROPDF417, UNICODE_MODE, 899, "A", 0, 899, 11, 38, "(11) 927 899 900 29 533 437 884 3 617 241 747", "" },
|
||||
/* 19*/ { BARCODE_MICROPDF417, UNICODE_MODE, 900, "A", 0, 900, 6, 82, "(18) 926 0 0 900 29 900 913 543 414 141 214 886 461 1 419 422 54 495", "" },
|
||||
/* 20*/ { BARCODE_MICROPDF417, UNICODE_MODE, 810899, "A", 0, 810899, 6, 82, "(18) 926 899 899 900 29 900 351 555 241 509 787 583 3 326 41 628 534 151", "" },
|
||||
/* 21*/ { BARCODE_MICROPDF417, UNICODE_MODE, 810900, "A", 0, 810900, 11, 38, "(11) 925 0 900 29 233 533 43 483 708 659 704", "" },
|
||||
/* 22*/ { BARCODE_MICROPDF417, UNICODE_MODE, 811800, "A", ZINT_ERROR_INVALID_OPTION, 811800, 0, 0, "Error 473: Invalid ECI", "" },
|
||||
/* 23*/ { BARCODE_HIBC_PDF, UNICODE_MODE, -1, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid characters in data", "" },
|
||||
/* 24*/ { BARCODE_HIBC_MICPDF, UNICODE_MODE, -1, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid characters in data", "" },
|
||||
/* 23*/ { BARCODE_HIBC_PDF, UNICODE_MODE, -1, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)", "" },
|
||||
/* 24*/ { BARCODE_HIBC_MICPDF, UNICODE_MODE, -1, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)", "" },
|
||||
/* 25*/ { BARCODE_PDF417, UNICODE_MODE, -1, "AB{} C#+ de{} {}F 12{} G{} H", 0, 0, 12, 120, "(36) 28 1 865 807 896 782 855 626 807 94 865 807 896 808 776 839 176 808 32 776 839 806 208", "" },
|
||||
/* 26*/ { BARCODE_PDF417, UNICODE_MODE, -1, "{} #+ de{} 12{} {} H", 0, 0, 10, 120, "(30) 22 865 807 896 808 470 807 94 865 807 896 808 32 776 839 806 865 807 896 787 900 900", "" },
|
||||
};
|
||||
@ -247,8 +247,8 @@ static void test_input(int index, int generate, int debug) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d symbol->eci %d != %d (%s)\n", i, symbol->eci, data[i].expected_eci, data[i].data);
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
|
@ -178,7 +178,7 @@ static void test_qr_input(int index, int generate, int debug) {
|
||||
/* 32*/ { UNICODE_MODE, 26, -1, "¥", 0, 26, "71 A4 02 C2 A5 00 EC 11 EC", "ECI-26 B2 (UTF-8)" },
|
||||
/* 33*/ { DATA_MODE, 0, -1, "¥", 0, 0, "40 2C 2A 50 EC 11 EC 11 EC", "B2 (UTF-8)" },
|
||||
/* 34*/ { UNICODE_MODE, 0, -1, "・", 0, 0, "40 1A 50 EC 11 EC 11 EC 11", "B1 (Shift JIS) single-byte codepoint A5 (same bytes as ¥ ISO 8859-1 above, so ambiguous)" },
|
||||
/* 35*/ { UNICODE_MODE, 3, -1, "・", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid characters in input data", "" },
|
||||
/* 35*/ { UNICODE_MODE, 3, -1, "・", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", "" },
|
||||
/* 36*/ { UNICODE_MODE, 20, -1, "・", 0, 20, "71 44 01 A5 00 EC 11 EC 11", "ECI-20 B1 (Shift JIS) single-byte codepoint A5" },
|
||||
/* 37*/ { UNICODE_MODE, 26, -1, "・", 0, 26, "71 A4 03 EF BD A5 00 EC 11", "ECI-26 B3 (UTF-8)" },
|
||||
/* 38*/ { DATA_MODE, 0, -1, "・", 0, 0, "40 3E FB DA 50 EC 11 EC 11", "B3 (UTF-8)" },
|
||||
@ -188,7 +188,7 @@ static void test_qr_input(int index, int generate, int debug) {
|
||||
/* 42*/ { UNICODE_MODE, 26, -1, "¿", 0, 26, "71 A4 02 C2 BF 00 EC 11 EC", "ECI-26 B2 (UTF-8)" },
|
||||
/* 43*/ { DATA_MODE, 0, -1, "¿", 0, 0, "40 2C 2B F0 EC 11 EC 11 EC", "B2 (UTF-8)" },
|
||||
/* 44*/ { UNICODE_MODE, 0, -1, "ソ", 0, 0, "40 1B F0 EC 11 EC 11 EC 11", "B1 (Shift JIS) single-byte codepoint BF (same bytes as ¿ ISO 8859-1 above, so ambiguous)" },
|
||||
/* 45*/ { UNICODE_MODE, 3, -1, "ソ", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid characters in input data", "" },
|
||||
/* 45*/ { UNICODE_MODE, 3, -1, "ソ", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", "" },
|
||||
/* 46*/ { UNICODE_MODE, 20, -1, "ソ", 0, 20, "71 44 01 BF 00 EC 11 EC 11", "ECI-20 B1 (Shift JIS) single-byte codepoint BF" },
|
||||
/* 47*/ { UNICODE_MODE, 26, -1, "ソ", 0, 26, "71 A4 03 EF BD BF 00 EC 11", "ECI-26 B3 (UTF-8)" },
|
||||
/* 48*/ { DATA_MODE, 0, -1, "ソ", 0, 0, "40 3E FB DB F0 EC 11 EC 11", "B3 (UTF-8)" },
|
||||
@ -196,19 +196,19 @@ static void test_qr_input(int index, int generate, int debug) {
|
||||
/* 50*/ { UNICODE_MODE, 3, -1, "~", 0, 3, "70 34 01 7E 00 EC 11 EC 11", "ECI-3 B1 (ASCII)" },
|
||||
/* 51*/ { UNICODE_MODE, 20, -1, "~", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input data", "tilde not in Shift JIS (codepoint used for overline)" },
|
||||
/* 52*/ { UNICODE_MODE, 0, -1, "‾", 0, 0, "40 17 E0 EC 11 EC 11 EC 11", "B1 (Shift JIS) single-byte codepoint 7E (same bytes as ~ ASCII above, so ambiguous)" },
|
||||
/* 53*/ { UNICODE_MODE, 3, -1, "‾", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid characters in input data", "" },
|
||||
/* 53*/ { UNICODE_MODE, 3, -1, "‾", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", "" },
|
||||
/* 54*/ { UNICODE_MODE, 20, -1, "‾", 0, 20, "71 44 01 7E 00 EC 11 EC 11", "ECI-20 B1 (Shift JIS) (to single-byte tilde codepoint 7E, so byte mode)" },
|
||||
/* 55*/ { UNICODE_MODE, 26, -1, "‾", 0, 26, "71 A4 03 E2 80 BE 00 EC 11", "ECI-26 B3 (UTF-8)" },
|
||||
/* 56*/ { DATA_MODE, 0, -1, "‾", 0, 0, "40 3E 28 0B E0 EC 11 EC 11", "B3 (UTF-8)" },
|
||||
/* 57*/ { UNICODE_MODE, 0, -1, "点", 0, 0, "80 16 CF 80 EC 11 EC 11 EC", "K1 (Shift JIS)" },
|
||||
/* 58*/ { UNICODE_MODE, 3, -1, "点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid characters in input data", "" },
|
||||
/* 58*/ { UNICODE_MODE, 3, -1, "点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", "" },
|
||||
/* 59*/ { UNICODE_MODE, 20, -1, "点", 0, 20, "71 48 01 6C F8 00 EC 11 EC", "ECI-20 K1 (Shift JIS)" },
|
||||
/* 60*/ { UNICODE_MODE, 26, -1, "点", 0, 26, "71 A4 03 E7 82 B9 00 EC 11", "ECI-26 B3 (UTF-8)" },
|
||||
/* 61*/ { DATA_MODE, 0, -1, "点", 0, 0, "40 3E 78 2B 90 EC 11 EC 11", "B3 (UTF-8)" },
|
||||
/* 62*/ { DATA_MODE, 0, -1, "\223\137", 0, 0, "40 29 35 F0 EC 11 EC 11 EC", "B2 (Shift JIS) (not full multibyte)" },
|
||||
/* 63*/ { DATA_MODE, 0, ZINT_FULL_MULTIBYTE, "\223\137", 0, 0, "80 16 CF 80 EC 11 EC 11 EC", "K1 (Shift JIS)" },
|
||||
/* 64*/ { UNICODE_MODE, 0, -1, "¥・点", 0, 0, "40 45 CA 59 35 F0 EC 11 EC", "B4 (Shift JIS) (optimized to byte mode only)" },
|
||||
/* 65*/ { UNICODE_MODE, 3, -1, "¥・点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid characters in input data", "" },
|
||||
/* 65*/ { UNICODE_MODE, 3, -1, "¥・点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", "" },
|
||||
/* 66*/ { UNICODE_MODE, 20, -1, "¥・点", 0, 20, "71 44 04 5C A5 93 5F 00 EC", "ECI-20 B4 (Shift JIS)" },
|
||||
/* 67*/ { UNICODE_MODE, 26, -1, "¥・点", 0, 26, "71 A4 08 C2 A5 EF BD A5 E7 82 B9 00 EC", "ECI-26 B8 (UTF-8)" },
|
||||
/* 68*/ { DATA_MODE, 0, -1, "\134\245\223\137", 0, 0, "40 45 CA 59 35 F0 EC 11 EC", "B8 (Shift JIS)" },
|
||||
@ -300,10 +300,9 @@ static void test_qr_input(int index, int generate, int debug) {
|
||||
testUtilErrorName(data[i].ret), ret < ZINT_ERROR ? symbol->eci : -1, symbol->errtxt, data[i].comment);
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n", i, symbol->eci, data[i].expected_eci);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -362,9 +361,7 @@ static void test_qr_gs1(int index, int generate, int debug) {
|
||||
printf(" /*%3d*/ { %s, \"%s\", %s, \"%s\", \"%s\" },\n",
|
||||
i, testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->errtxt, data[i].comment);
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -1585,9 +1582,7 @@ static void test_microqr_input(int index, int generate, int debug) {
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].option_3, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||
testUtilErrorName(data[i].ret), symbol->errtxt, data[i].comment);
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -1666,9 +1661,7 @@ static void test_microqr_padding(int index, int generate, int debug) {
|
||||
i, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].option_1,
|
||||
testUtilErrorName(data[i].ret), symbol->errtxt, data[i].comment);
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -2145,7 +2138,7 @@ static void test_upnqr_input(int index, int generate, int debug) {
|
||||
struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, "ĄŔ", 0, "(415) 70 44 00 02 A1 C0 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC", "ECI-4 B2 (ISO 8859-2)" },
|
||||
/* 1*/ { UNICODE_MODE, "é", 0, "(415) 70 44 00 01 E9 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11", "ECI-4 B1 (ISO 8859-2)" },
|
||||
/* 2*/ { UNICODE_MODE, "β", ZINT_ERROR_INVALID_DATA, "Error 572: Invalid characters in input data", "β not in ISO 8859-2" },
|
||||
/* 2*/ { UNICODE_MODE, "β", ZINT_ERROR_INVALID_DATA, "Error 572: Invalid character in input data for ECI 4", "β not in ISO 8859-2" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@ -2175,9 +2168,7 @@ static void test_upnqr_input(int index, int generate, int debug) {
|
||||
i, testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret),
|
||||
symbol->errtxt, data[i].comment);
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -2496,9 +2487,7 @@ static void test_rmqr_input(int index, int generate, int debug) {
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].option_3, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||
testUtilErrorName(data[i].ret), symbol->errtxt, data[i].comment);
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -2557,9 +2546,7 @@ static void test_rmqr_gs1(int index, int generate, int debug) {
|
||||
printf(" /*%3d*/ { %s, \"%s\", %s, \"%s\", \"%s\" },\n",
|
||||
i, testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->errtxt, data[i].comment);
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
|
@ -834,6 +834,7 @@ static void test_draw_string_wrap(int index, int debug) {
|
||||
|
||||
ret = ZBarcode_Print(symbol, 0);
|
||||
assert_zero(ret, "i:%d ZBarcode_Print(%d) ret %d != 0\n", i, data[i].symbology, ret);
|
||||
assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile);
|
||||
|
||||
text_bits_set = 0;
|
||||
row = data[i].expected_no_text_row;
|
||||
@ -902,6 +903,7 @@ static void test_code128_utf8(int index, int debug) {
|
||||
|
||||
ret = ZBarcode_Print(symbol, 0);
|
||||
assert_zero(ret, "i:%d ZBarcode_Print(%d) ret %d != 0\n", i, BARCODE_CODE128, ret);
|
||||
assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile);
|
||||
|
||||
text_bits_set = 0;
|
||||
row = data[i].expected_text_row;
|
||||
@ -1014,6 +1016,7 @@ static void test_scale(int index, int debug) {
|
||||
|
||||
ret = ZBarcode_Print(symbol, 0);
|
||||
assert_zero(ret, "i:%d ZBarcode_Print(%d) ret %d != 0\n", i, data[i].symbology, ret);
|
||||
assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile);
|
||||
|
||||
assert_nonzero(symbol->bitmap_height >= data[i].expected_set_rows, "i:%d (%d) symbol->bitmap_height %d < expected_set_rows %d\n",
|
||||
i, data[i].symbology, symbol->bitmap_height, data[i].expected_set_rows);
|
||||
|
@ -79,8 +79,8 @@ static void test_reader_init(int index, int generate, int debug) {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@ -176,9 +176,7 @@ static void test_input(int index, int generate, int debug) {
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, testUtilOption3Name(data[i].option_3),
|
||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->errtxt, data[i].comment);
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
|
@ -415,60 +415,107 @@ static void test_isbn_input(int index, int debug) {
|
||||
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
|
||||
struct item data[] = {
|
||||
/* 0*/ { "0", 0, 0 }, // Left zero-padded if < 10 chars
|
||||
/* 1*/ { "12345678", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 2*/ { "12345679", 0, 0 }, // 9 is correct check digit
|
||||
/* 3*/ { "98765434", 0, 0 }, // 4 is correct check digit
|
||||
/* 4*/ { "123456789", 0, 0 },
|
||||
/* 5*/ { "340013817", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 6*/ { "340013818", 0, 0 }, // 8 is correct check digit
|
||||
/* 7*/ { "902888455", 0, 0 }, // 5 is correct check digit
|
||||
/* 8*/ { "0123456789", 0, 0 },
|
||||
/* 9*/ { "1234567890", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 10*/ { "123456789X", 0, 0 }, // X is correct check digit
|
||||
/* 11*/ { "123456789x", 0, 0 }, // x is correct check digit
|
||||
/* 12*/ { "8175257660", 0, 0 }, // 0 is correct check digit
|
||||
/* 13*/ { "0590764845", 0, 0 }, // 5 is correct check digit
|
||||
/* 14*/ { "0906495741", 0, 0 }, // 1 is correct check digit
|
||||
/* 15*/ { "0140430016", 0, 0 }, // 6 is correct check digit
|
||||
/* 16*/ { "0571086187", 0, 0 }, // 7 is correct check digit
|
||||
/* 17*/ { "0486600882", 0, 0 }, // 2 is correct check digit
|
||||
/* 18*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 19*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 20*/ { "1234567890123", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 21*/ { "9784567890123", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 22*/ { "9784567890120", 0, 0 }, // 0 is correct check digit
|
||||
/* 23*/ { "9783161484100", 0, 0 }, // 0 is correct check digit
|
||||
/* 24*/ { "9781846688225", 0, 0 }, // 5 is correct check digit
|
||||
/* 25*/ { "9781847657954", 0, 0 }, // 4 is correct check digit
|
||||
/* 26*/ { "9781846688188", 0, 0 }, // 8 is correct check digit
|
||||
/* 27*/ { "9781847659293", 0, 0 }, // 3 is correct check digit
|
||||
/* 28*/ { "97845678901201", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 29*/ { "3954994+12", 0, 0 },
|
||||
/* 30*/ { "3954994+12345", 0, 0 },
|
||||
/* 31*/ { "3954994+123456", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 32*/ { "3954994+", 0, 0 },
|
||||
/* 33*/ { "61954993+1", 0, 0 },
|
||||
/* 34*/ { "61954992+123", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 35*/ { "61954993+123", 0, 0 },
|
||||
/* 36*/ { "361954990+12", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 37*/ { "361954999+12", 0, 0 },
|
||||
/* 38*/ { "361954999+1234", 0, 0 },
|
||||
/* 39*/ { "361954999+12", 0, 0 },
|
||||
/* 40*/ { "1999000030+12", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 41*/ { "199900003X+12", 0, 0 },
|
||||
/* 42*/ { "199900003x+12", 0, 0 },
|
||||
/* 43*/ { "1999000031+12345", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 44*/ { "199900003X+12345", 0, 0 },
|
||||
/* 45*/ { "199900003x+12345", 0, 0 },
|
||||
/* 46*/ { "9791234567895+12", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 47*/ { "9791234567896+12", 0, 0 },
|
||||
/* 48*/ { "9791234567897+12345", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 49*/ { "9791234567896+12345", 0, 0 },
|
||||
/* 50*/ { "9791234567892+", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 51*/ { "9791234567896+", 0, 0 },
|
||||
/* 52*/ { "97912345678961+", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 53*/ { "97912345678961+12345", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 54*/ { "9791234567896+123456", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 1*/ { "1", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 2*/ { "X", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 3*/ { "12", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 4*/ { "19", 0, 0, },
|
||||
/* 5*/ { "X9", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 6*/ { "123", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 7*/ { "124", 0, 0, },
|
||||
/* 8*/ { "1X4", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 9*/ { "1234", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 10*/ { "1236", 0, 0, },
|
||||
/* 11*/ { "12X6", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 12*/ { "12345", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 13*/ { "12343", 0, 0, },
|
||||
/* 14*/ { "123X3", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 15*/ { "123456", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 16*/ { "123455", 0, 0, },
|
||||
/* 17*/ { "1234X5", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 18*/ { "1234567", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 19*/ { "1234560", 0, 0, },
|
||||
/* 20*/ { "12345X0", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 21*/ { "12345678", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 22*/ { "12345679", 0, 0 }, // 9 is correct check digit
|
||||
/* 23*/ { "98765434", 0, 0 }, // 4 is correct check digit
|
||||
/* 24*/ { "123456X9", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 25*/ { "123456789", 0, 0 },
|
||||
/* 26*/ { "340013817", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 27*/ { "340013818", 0, 0 }, // 8 is correct check digit
|
||||
/* 28*/ { "902888455", 0, 0 }, // 5 is correct check digit
|
||||
/* 29*/ { "9028884X5", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 30*/ { "0123456789", 0, 0 },
|
||||
/* 31*/ { "1234567890", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 32*/ { "123456789X", 0, 0 }, // X is correct check digit
|
||||
/* 33*/ { "123456789x", 0, 0 }, // x is correct check digit
|
||||
/* 34*/ { "8175257660", 0, 0 }, // 0 is correct check digit
|
||||
/* 35*/ { "0590764845", 0, 0 }, // 5 is correct check digit
|
||||
/* 36*/ { "0906495741", 0, 0 }, // 1 is correct check digit
|
||||
/* 37*/ { "0140430016", 0, 0 }, // 6 is correct check digit
|
||||
/* 38*/ { "0571086187", 0, 0 }, // 7 is correct check digit
|
||||
/* 39*/ { "0486600882", 0, 0 }, // 2 is correct check digit
|
||||
/* 40*/ { "04866008X2", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 41*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 42*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 43*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 44*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 45*/ { "1234567890123", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 46*/ { "9784567890123", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 47*/ { "9784567890120", 0, 0 }, // 0 is correct check digit
|
||||
/* 48*/ { "9783161484100", 0, 0 }, // 0 is correct check digit
|
||||
/* 49*/ { "9781846688225", 0, 0 }, // 5 is correct check digit
|
||||
/* 50*/ { "9781847657954", 0, 0 }, // 4 is correct check digit
|
||||
/* 51*/ { "9781846688188", 0, 0 }, // 8 is correct check digit
|
||||
/* 52*/ { "9781847659293", 0, 0 }, // 3 is correct check digit
|
||||
/* 53*/ { "97845678901201", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 54*/ { "978456789012012", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 55*/ { "3954994+12", 0, 0 },
|
||||
/* 56*/ { "3954994+1X", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 57*/ { "39549X4+12", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 58*/ { "3954994+12345", 0, 0 },
|
||||
/* 59*/ { "3954994+1234X", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 60*/ { "39549X4+12345", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 61*/ { "3954994+123456", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/* 62*/ { "3954994+", 0, 0 },
|
||||
/* 63*/ { "3954X94+", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 64*/ { "61954993+1", 0, 0 },
|
||||
/* 65*/ { "61954993+X", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 66*/ { "619549X3+1", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 67*/ { "61954992+123", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 68*/ { "61954993+123", 0, 0 },
|
||||
/* 69*/ { "61954993+12X", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 70*/ { "619549X3+123", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 71*/ { "361954990+12", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 72*/ { "361954999+12", 0, 0 },
|
||||
/* 73*/ { "361954999+1X", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 74*/ { "3619549X9+12", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 75*/ { "361954999+1234", 0, 0 },
|
||||
/* 76*/ { "361954999+123X", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 77*/ { "3619549X9+1234", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 78*/ { "1999000030+12", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 79*/ { "199900003X+12", 0, 0 },
|
||||
/* 80*/ { "199900003x+12", 0, 0 },
|
||||
/* 81*/ { "19990000XX+12", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 82*/ { "199900003X+1X", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 83*/ { "1999000031+12345", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 84*/ { "199900003X+12345", 0, 0 },
|
||||
/* 85*/ { "199900003x+12345", 0, 0 },
|
||||
/* 86*/ { "199900003X+1234X", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 87*/ { "19990000XX+12345", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 88*/ { "9791234567895+12", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 89*/ { "9791234567896+12", 0, 0 },
|
||||
/* 90*/ { "9791234567896+1X", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 91*/ { "97912345678X6+12", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 92*/ { "9791234567897+12345", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 93*/ { "9791234567896+12345", 0, 0 },
|
||||
/* 94*/ { "9791234567896+1234X", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 95*/ { "979123456X896+12345", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 96*/ { "9791234567892+", ZINT_ERROR_INVALID_CHECK, -1 },
|
||||
/* 97*/ { "9791234567896+", 0, 0 },
|
||||
/* 98*/ { "97912345678X6+", ZINT_ERROR_INVALID_DATA, -1 },
|
||||
/* 99*/ { "97912345678961+", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/*100*/ { "97912345678961+12345", ZINT_ERROR_TOO_LONG, -1 },
|
||||
/*101*/ { "9791234567896+123456", ZINT_ERROR_TOO_LONG, -1 },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
Reference in New Issue
Block a user