mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-30 23:05:23 -04:00
general: change BARCODE_RAW_TEXT to write to new zint_symbol
fields `raw_segs` and `raw_seg_count` instead of `text`, and to do so for all symbologies, using new common funcs `rt_cpy()` etc. MICROPDF417: return ECC percentage in top byte of `option_1` DBAR_EXP_STK: return `option_2`/`option_3` feedback CLI: change warning text "ignoring" -> "**IGNORED**" GUI: show feedback for DBAR_EXP_STK, MICROPDF417, UPNQR ctest: fix recent inability to run tests via "ctest" on Windows (MSVC) by using cmake 3.22 feature `ENVIRONMENT_MODIFICATION` manual: document feedback and RAW_TEXT in new "Feedback" section; rephrase some symbology descriptions test suite: new general-use arg "-a"; add `func_name` to context; new "test_bwipp" test for testing BWIPP against ZXing-C++
This commit is contained in:
parent
d1bf02e156
commit
a6c225447e
120 changed files with 10511 additions and 5620 deletions
|
@ -45,6 +45,7 @@ zint_add_test(aztec test_aztec)
|
|||
zint_add_test(bc412 test_bc412)
|
||||
zint_add_test(big5 test_big5)
|
||||
zint_add_test(bmp test_bmp)
|
||||
zint_add_test(bwipp test_bwipp)
|
||||
zint_add_test(channel test_channel)
|
||||
zint_add_test(codabar test_codabar)
|
||||
zint_add_test(codablock test_codablock)
|
||||
|
|
|
@ -79,7 +79,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[4096] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -118,64 +118,65 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
int output_options;
|
||||
const char *data;
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_C25STANDARD, -1, -1, "123456789", "123456789" },
|
||||
/* 1*/ { BARCODE_C25STANDARD, -1, BARCODE_RAW_TEXT, "123456789", "123456789" },
|
||||
/* 2*/ { BARCODE_C25STANDARD, 1, -1, "123456789", "1234567895" },
|
||||
/* 3*/ { BARCODE_C25STANDARD, 1, BARCODE_RAW_TEXT, "123456789", "1234567895" },
|
||||
/* 4*/ { BARCODE_C25STANDARD, 2, -1, "123456789", "123456789" }, /* Suppresses printing of check digit */
|
||||
/* 5*/ { BARCODE_C25STANDARD, 2, BARCODE_RAW_TEXT, "123456789", "1234567895" }, /* Unless plain HRT */
|
||||
/* 6*/ { BARCODE_C25INTER, -1, -1, "123456789", "0123456789" }, /* Adds leading zero if odd */
|
||||
/* 7*/ { BARCODE_C25INTER, -1, BARCODE_RAW_TEXT, "123456789", "0123456789" },
|
||||
/* 8*/ { BARCODE_C25INTER, 1, -1, "123456789", "1234567895" }, /* Unless check digit added when it becomes even */
|
||||
/* 9*/ { BARCODE_C25INTER, 1, BARCODE_RAW_TEXT, "123456789", "1234567895" },
|
||||
/* 10*/ { BARCODE_C25INTER, 2, -1, "123456789", "123456789" },
|
||||
/* 11*/ { BARCODE_C25INTER, 2, BARCODE_RAW_TEXT, "123456789", "1234567895" },
|
||||
/* 12*/ { BARCODE_C25INTER, -1, -1, "1234567890", "1234567890" }, /* No leading zero if even */
|
||||
/* 13*/ { BARCODE_C25INTER, -1, BARCODE_RAW_TEXT, "1234567890", "1234567890" },
|
||||
/* 14*/ { BARCODE_C25INTER, 1, -1, "1234567890", "012345678905" }, /* Unless check digit added when it becomes odd */
|
||||
/* 15*/ { BARCODE_C25INTER, 1, BARCODE_RAW_TEXT, "1234567890", "012345678905" },
|
||||
/* 16*/ { BARCODE_C25INTER, 2, -1, "1234567890", "01234567890" },
|
||||
/* 17*/ { BARCODE_C25INTER, 2, BARCODE_RAW_TEXT, "1234567890", "012345678905" },
|
||||
/* 18*/ { BARCODE_C25IATA, -1, -1, "123456789", "123456789" },
|
||||
/* 19*/ { BARCODE_C25IATA, -1, BARCODE_RAW_TEXT, "123456789", "123456789" },
|
||||
/* 20*/ { BARCODE_C25IATA, 1, -1, "123456789", "1234567895" },
|
||||
/* 21*/ { BARCODE_C25IATA, 1, BARCODE_RAW_TEXT, "123456789", "1234567895" },
|
||||
/* 22*/ { BARCODE_C25IATA, 2, -1, "123456789", "123456789" },
|
||||
/* 23*/ { BARCODE_C25IATA, 2, BARCODE_RAW_TEXT, "123456789", "1234567895" },
|
||||
/* 24*/ { BARCODE_C25LOGIC, -1, -1, "123456789", "123456789" },
|
||||
/* 25*/ { BARCODE_C25LOGIC, -1, BARCODE_RAW_TEXT, "123456789", "123456789" },
|
||||
/* 26*/ { BARCODE_C25LOGIC, 1, -1, "123456789", "1234567895" },
|
||||
/* 27*/ { BARCODE_C25LOGIC, 1, BARCODE_RAW_TEXT, "123456789", "1234567895" },
|
||||
/* 28*/ { BARCODE_C25LOGIC, 2, -1, "123456789", "123456789" },
|
||||
/* 29*/ { BARCODE_C25LOGIC, 2, BARCODE_RAW_TEXT, "123456789", "1234567895" },
|
||||
/* 30*/ { BARCODE_C25IND, -1, -1, "123456789", "123456789" },
|
||||
/* 31*/ { BARCODE_C25IND, -1, BARCODE_RAW_TEXT, "123456789", "123456789" },
|
||||
/* 32*/ { BARCODE_C25IND, 1, -1, "123456789", "1234567895" },
|
||||
/* 33*/ { BARCODE_C25IND, 1, BARCODE_RAW_TEXT, "123456789", "1234567895" },
|
||||
/* 34*/ { BARCODE_C25IND, 2, -1, "123456789", "123456789" },
|
||||
/* 35*/ { BARCODE_C25IND, 2, BARCODE_RAW_TEXT, "123456789", "1234567895" },
|
||||
/* 36*/ { BARCODE_DPLEIT, -1, -1, "123456789", "00001.234.567.890" }, /* Leading zeroes added to make 13 + appended checksum */
|
||||
/* 37*/ { BARCODE_DPLEIT, -1, BARCODE_RAW_TEXT, "123456789", "00001234567890" },
|
||||
/* 38*/ { BARCODE_DPLEIT, -1, -1, "1234567890123", "12345.678.901.236" },
|
||||
/* 39*/ { BARCODE_DPLEIT, -1, BARCODE_RAW_TEXT, "1234567890123", "12345678901236" },
|
||||
/* 40*/ { BARCODE_DPIDENT, -1, -1, "123456789", "00.12 3.456.789 0" }, /* Leading zeroes added to make 11 + appended checksum */
|
||||
/* 41*/ { BARCODE_DPIDENT, -1, BARCODE_RAW_TEXT, "123456789", "001234567890" },
|
||||
/* 42*/ { BARCODE_DPIDENT, -1, -1, "12345678901", "12.34 5.678.901 6" },
|
||||
/* 43*/ { BARCODE_DPIDENT, -1, BARCODE_RAW_TEXT, "12345678901", "123456789016" },
|
||||
/* 44*/ { BARCODE_ITF14, -1, -1, "123456789", "00001234567895" }, /* Leading zeroes added to make 13 + appended checksum */
|
||||
/* 45*/ { BARCODE_ITF14, -1, BARCODE_RAW_TEXT, "123456789", "00001234567895" },
|
||||
/* 46*/ { BARCODE_ITF14, -1, -1, "1234567890123", "12345678901231" },
|
||||
/* 47*/ { BARCODE_ITF14, -1, BARCODE_RAW_TEXT, "1234567890123", "12345678901231" },
|
||||
/* 0*/ { BARCODE_C25STANDARD, -1, -1, "123456789", "123456789", "" },
|
||||
/* 1*/ { BARCODE_C25STANDARD, -1, BARCODE_RAW_TEXT, "123456789", "123456789", "123456789" },
|
||||
/* 2*/ { BARCODE_C25STANDARD, 1, -1, "123456789", "1234567895", "" },
|
||||
/* 3*/ { BARCODE_C25STANDARD, 1, BARCODE_RAW_TEXT, "123456789", "1234567895", "1234567895" },
|
||||
/* 4*/ { BARCODE_C25STANDARD, 2, -1, "123456789", "123456789", "" }, /* Suppresses printing of check digit */
|
||||
/* 5*/ { BARCODE_C25STANDARD, 2, BARCODE_RAW_TEXT, "123456789", "123456789", "1234567895" }, /* Not in raw text */
|
||||
/* 6*/ { BARCODE_C25INTER, -1, -1, "123456789", "0123456789", "" }, /* Adds leading zero if odd */
|
||||
/* 7*/ { BARCODE_C25INTER, -1, BARCODE_RAW_TEXT, "123456789", "0123456789", "0123456789" },
|
||||
/* 8*/ { BARCODE_C25INTER, 1, -1, "123456789", "1234567895", "" }, /* Unless check digit added when it becomes even */
|
||||
/* 9*/ { BARCODE_C25INTER, 1, BARCODE_RAW_TEXT, "123456789", "1234567895", "1234567895" },
|
||||
/* 10*/ { BARCODE_C25INTER, 2, -1, "123456789", "123456789", "" },
|
||||
/* 11*/ { BARCODE_C25INTER, 2, BARCODE_RAW_TEXT, "123456789", "123456789", "1234567895" },
|
||||
/* 12*/ { BARCODE_C25INTER, -1, -1, "1234567890", "1234567890", "" }, /* No leading zero if even */
|
||||
/* 13*/ { BARCODE_C25INTER, -1, BARCODE_RAW_TEXT, "1234567890", "1234567890", "1234567890" },
|
||||
/* 14*/ { BARCODE_C25INTER, 1, -1, "1234567890", "012345678905", "" }, /* Unless check digit added when it becomes odd */
|
||||
/* 15*/ { BARCODE_C25INTER, 1, BARCODE_RAW_TEXT, "1234567890", "012345678905", "012345678905" },
|
||||
/* 16*/ { BARCODE_C25INTER, 2, -1, "1234567890", "01234567890", "" },
|
||||
/* 17*/ { BARCODE_C25INTER, 2, BARCODE_RAW_TEXT, "1234567890", "01234567890", "012345678905" },
|
||||
/* 18*/ { BARCODE_C25IATA, -1, -1, "123456789", "123456789", "" },
|
||||
/* 19*/ { BARCODE_C25IATA, -1, BARCODE_RAW_TEXT, "123456789", "123456789", "123456789" },
|
||||
/* 20*/ { BARCODE_C25IATA, 1, -1, "123456789", "1234567895", "" },
|
||||
/* 21*/ { BARCODE_C25IATA, 1, BARCODE_RAW_TEXT, "123456789", "1234567895", "1234567895" },
|
||||
/* 22*/ { BARCODE_C25IATA, 2, -1, "123456789", "123456789", "" },
|
||||
/* 23*/ { BARCODE_C25IATA, 2, BARCODE_RAW_TEXT, "123456789", "123456789", "1234567895" },
|
||||
/* 24*/ { BARCODE_C25LOGIC, -1, -1, "123456789", "123456789", "" },
|
||||
/* 25*/ { BARCODE_C25LOGIC, -1, BARCODE_RAW_TEXT, "123456789", "123456789", "123456789" },
|
||||
/* 26*/ { BARCODE_C25LOGIC, 1, -1, "123456789", "1234567895", "" },
|
||||
/* 27*/ { BARCODE_C25LOGIC, 1, BARCODE_RAW_TEXT, "123456789", "1234567895", "1234567895" },
|
||||
/* 28*/ { BARCODE_C25LOGIC, 2, -1, "123456789", "123456789", "" },
|
||||
/* 29*/ { BARCODE_C25LOGIC, 2, BARCODE_RAW_TEXT, "123456789", "123456789", "1234567895" },
|
||||
/* 30*/ { BARCODE_C25IND, -1, -1, "123456789", "123456789", "" },
|
||||
/* 31*/ { BARCODE_C25IND, -1, BARCODE_RAW_TEXT, "123456789", "123456789", "123456789" },
|
||||
/* 32*/ { BARCODE_C25IND, 1, -1, "123456789", "1234567895", "" },
|
||||
/* 33*/ { BARCODE_C25IND, 1, BARCODE_RAW_TEXT, "123456789", "1234567895", "1234567895" },
|
||||
/* 34*/ { BARCODE_C25IND, 2, -1, "123456789", "123456789", "" },
|
||||
/* 35*/ { BARCODE_C25IND, 2, BARCODE_RAW_TEXT, "123456789", "123456789", "1234567895" },
|
||||
/* 36*/ { BARCODE_DPLEIT, -1, -1, "123456789", "00001.234.567.890", "" }, /* Leading zeroes added to make 13 + appended checksum */
|
||||
/* 37*/ { BARCODE_DPLEIT, -1, BARCODE_RAW_TEXT, "123456789", "00001.234.567.890", "00001234567890" },
|
||||
/* 38*/ { BARCODE_DPLEIT, -1, -1, "1234567890123", "12345.678.901.236", "" },
|
||||
/* 39*/ { BARCODE_DPLEIT, -1, BARCODE_RAW_TEXT, "1234567890123", "12345.678.901.236", "12345678901236" },
|
||||
/* 40*/ { BARCODE_DPIDENT, -1, -1, "123456789", "00.12 3.456.789 0", "" }, /* Leading zeroes added to make 11 + appended checksum */
|
||||
/* 41*/ { BARCODE_DPIDENT, -1, BARCODE_RAW_TEXT, "123456789", "00.12 3.456.789 0", "001234567890" },
|
||||
/* 42*/ { BARCODE_DPIDENT, -1, -1, "12345678901", "12.34 5.678.901 6", "" },
|
||||
/* 43*/ { BARCODE_DPIDENT, -1, BARCODE_RAW_TEXT, "12345678901", "12.34 5.678.901 6", "123456789016" },
|
||||
/* 44*/ { BARCODE_ITF14, -1, -1, "123456789", "00001234567895", "" }, /* Leading zeroes added to make 13 + appended checksum */
|
||||
/* 45*/ { BARCODE_ITF14, -1, BARCODE_RAW_TEXT, "123456789", "00001234567895", "00001234567895" },
|
||||
/* 46*/ { BARCODE_ITF14, -1, -1, "1234567890123", "12345678901231", "" },
|
||||
/* 47*/ { BARCODE_ITF14, -1, BARCODE_RAW_TEXT, "1234567890123", "12345678901231", "12345678901231" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -188,6 +189,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, data[i].option_2, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -196,6 +198,18 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -233,7 +247,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -369,10 +383,11 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
char cmp_buf[4096];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -381,14 +396,18 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
|
||||
-1 /*option_1*/, data[i].option_2, -1 /*option_3*/, -1 /*output_options*/,
|
||||
data[i].data, -1, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(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);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n",
|
||||
i, testUtilBarcodeName(data[i].symbology), data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||
i, testUtilBarcodeName(data[i].symbology), data[i].option_2,
|
||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
|
||||
testUtilModulesPrint(symbol, " ", "\n");
|
||||
printf(" },\n");
|
||||
|
@ -396,30 +415,40 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
if (ret < ZINT_ERROR) {
|
||||
int width, row;
|
||||
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
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);
|
||||
|
||||
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
|
||||
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
|
||||
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n",
|
||||
i, ret, width, row, data[i].data);
|
||||
|
||||
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) {
|
||||
ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL,
|
||||
cmp_buf, sizeof(cmp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected);
|
||||
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected);
|
||||
}
|
||||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[64];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -104,40 +104,41 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
const char *data;
|
||||
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_AUSPOST, -1, "12345678", "" }, /* None */
|
||||
/* 1*/ { BARCODE_AUSPOST, BARCODE_RAW_TEXT, "12345678", "1112345678" },
|
||||
/* 2*/ { BARCODE_AUSPOST, -1, "1234567890123", "" }, /* None */
|
||||
/* 3*/ { BARCODE_AUSPOST, BARCODE_RAW_TEXT, "1234567890123", "591234567890123" },
|
||||
/* 4*/ { BARCODE_AUSPOST, -1, "1234567890123456", "" }, /* None */
|
||||
/* 5*/ { BARCODE_AUSPOST, BARCODE_RAW_TEXT, "1234567890123456", "591234567890123456" },
|
||||
/* 6*/ { BARCODE_AUSPOST, -1, "123456789012345678", "" }, /* None */
|
||||
/* 7*/ { BARCODE_AUSPOST, BARCODE_RAW_TEXT, "123456789012345678", "62123456789012345678" },
|
||||
/* 8*/ { BARCODE_AUSPOST, -1, "12345678901234567890123", "" }, /* None */
|
||||
/* 9*/ { BARCODE_AUSPOST, BARCODE_RAW_TEXT, "12345678901234567890123", "6212345678901234567890123" },
|
||||
/* 10*/ { BARCODE_AUSREPLY, -1, "1234567", "" }, /* None */
|
||||
/* 11*/ { BARCODE_AUSREPLY, BARCODE_RAW_TEXT, "1234567", "4501234567" },
|
||||
/* 12*/ { BARCODE_AUSREPLY, -1, "12345678", "" }, /* None */
|
||||
/* 13*/ { BARCODE_AUSREPLY, BARCODE_RAW_TEXT, "12345678", "4512345678" },
|
||||
/* 14*/ { BARCODE_AUSROUTE, -1, "123456", "" }, /* None */
|
||||
/* 15*/ { BARCODE_AUSROUTE, BARCODE_RAW_TEXT, "123456", "8700123456" },
|
||||
/* 16*/ { BARCODE_AUSROUTE, -1, "12345678", "" }, /* None */
|
||||
/* 17*/ { BARCODE_AUSROUTE, BARCODE_RAW_TEXT, "12345678", "8712345678" },
|
||||
/* 18*/ { BARCODE_AUSROUTE, -1, "12345", "" }, /* None */
|
||||
/* 19*/ { BARCODE_AUSROUTE, BARCODE_RAW_TEXT, "12345", "8700012345" },
|
||||
/* 20*/ { BARCODE_AUSREDIRECT, -1, "12345678", "" }, /* None */
|
||||
/* 21*/ { BARCODE_AUSREDIRECT, BARCODE_RAW_TEXT, "12345678", "9212345678" },
|
||||
/* 22*/ { BARCODE_AUSREDIRECT, -1, "1234", "" }, /* None */
|
||||
/* 23*/ { BARCODE_AUSREDIRECT, BARCODE_RAW_TEXT, "1234", "9200001234" },
|
||||
/* 0*/ { BARCODE_AUSPOST, -1, "12345678", "", "" }, /* None */
|
||||
/* 1*/ { BARCODE_AUSPOST, BARCODE_RAW_TEXT, "12345678", "", "1112345678" },
|
||||
/* 2*/ { BARCODE_AUSPOST, -1, "1234567890123", "", "" }, /* None */
|
||||
/* 3*/ { BARCODE_AUSPOST, BARCODE_RAW_TEXT, "1234567890123", "", "591234567890123" },
|
||||
/* 4*/ { BARCODE_AUSPOST, -1, "1234567890123456", "", "" }, /* None */
|
||||
/* 5*/ { BARCODE_AUSPOST, BARCODE_RAW_TEXT, "1234567890123456", "", "591234567890123456" },
|
||||
/* 6*/ { BARCODE_AUSPOST, -1, "123456789012345678", "", "" }, /* None */
|
||||
/* 7*/ { BARCODE_AUSPOST, BARCODE_RAW_TEXT, "123456789012345678", "", "62123456789012345678" },
|
||||
/* 8*/ { BARCODE_AUSPOST, -1, "12345678901234567890123", "", "" }, /* None */
|
||||
/* 9*/ { BARCODE_AUSPOST, BARCODE_RAW_TEXT, "12345678901234567890123", "", "6212345678901234567890123" },
|
||||
/* 10*/ { BARCODE_AUSREPLY, -1, "1234567", "", "" }, /* None */
|
||||
/* 11*/ { BARCODE_AUSREPLY, BARCODE_RAW_TEXT, "1234567", "", "4501234567" },
|
||||
/* 12*/ { BARCODE_AUSREPLY, -1, "12345678", "", "" }, /* None */
|
||||
/* 13*/ { BARCODE_AUSREPLY, BARCODE_RAW_TEXT, "12345678", "", "4512345678" },
|
||||
/* 14*/ { BARCODE_AUSROUTE, -1, "123456", "", "" }, /* None */
|
||||
/* 15*/ { BARCODE_AUSROUTE, BARCODE_RAW_TEXT, "123456", "", "8700123456" },
|
||||
/* 16*/ { BARCODE_AUSROUTE, -1, "12345678", "", "" }, /* None */
|
||||
/* 17*/ { BARCODE_AUSROUTE, BARCODE_RAW_TEXT, "12345678", "", "8712345678" },
|
||||
/* 18*/ { BARCODE_AUSROUTE, -1, "12345", "", "" }, /* None */
|
||||
/* 19*/ { BARCODE_AUSROUTE, BARCODE_RAW_TEXT, "12345", "", "8700012345" },
|
||||
/* 20*/ { BARCODE_AUSREDIRECT, -1, "12345678", "", "" }, /* None */
|
||||
/* 21*/ { BARCODE_AUSREDIRECT, BARCODE_RAW_TEXT, "12345678", "", "9212345678" },
|
||||
/* 22*/ { BARCODE_AUSREDIRECT, -1, "1234", "", "" }, /* None */
|
||||
/* 23*/ { BARCODE_AUSREDIRECT, BARCODE_RAW_TEXT, "1234", "", "9200001234" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -150,6 +151,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -158,6 +160,18 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -209,7 +223,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -352,7 +366,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -422,7 +436,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_fuzz", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -43,50 +43,55 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int expected_rows;
|
||||
int expected_width;
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
const char *comment;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, "123456", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 792: Input length 6 too short (minimum 7)", "" },
|
||||
/* 1*/ { UNICODE_MODE, -1, "1234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 790: Input length 19 too long (maximum 18)", "" },
|
||||
/* 2*/ { UNICODE_MODE, -1, "1234567", -1, 0, 1, 102, "1U234567", "" },
|
||||
/* 3*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "1234567", -1, 0, 1, 102, "1U234567", "" }, /* No difference */
|
||||
/* 4*/ { UNICODE_MODE, -1, "1234567 ", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 791: Invalid character at position 8 in input (alphanumerics only, excluding \"O\")", "" },
|
||||
/* 5*/ { UNICODE_MODE, -1, "ABCDEFGHIJKLMNOPQR", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 791: Invalid character at position 15 in input (alphanumerics only, excluding \"O\")", "" },
|
||||
/* 6*/ { UNICODE_MODE, -1, "ABCDEFGHIJKLMNPQRS", -1, 0, 1, 234, "AQBCDEFGHIJKLMNPQRS", "" },
|
||||
/* 7*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "ABCDEFGHIJKLMNPQRS", -1, 0, 1, 234, "AQBCDEFGHIJKLMNPQRS", "" }, /* No difference */
|
||||
/* 8*/ { UNICODE_MODE, -1, "STUVWXYZ1234567890", -1, 0, 1, 234, "SCTUVWXYZ1234567890", "" },
|
||||
/* 9*/ { UNICODE_MODE, -1, "abcdefghijklmnpqrs", -1, 0, 1, 234, "AQBCDEFGHIJKLMNPQRS", "" },
|
||||
/* 10*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "abcdefghijklmnpqrs", -1, 0, 1, 234, "AQBCDEFGHIJKLMNPQRS", "" }, /* No difference */
|
||||
/* 11*/ { UNICODE_MODE, -1, "123456789012345678", -1, 0, 1, 234, "1223456789012345678", "" },
|
||||
/* 12*/ { UNICODE_MODE, -1, "MMMMMMMMMMMMMMMMMM", -1, 0, 1, 234, "MTMMMMMMMMMMMMMMMMM", "" },
|
||||
/* 13*/ { UNICODE_MODE, -1, "00000000", -1, 0, 1, 114, "000000000", "" },
|
||||
/* 14*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "00000000", -1, 0, 1, 114, "000000000", "" }, /* No difference */
|
||||
/* 15*/ { UNICODE_MODE, -1, "000000000", -1, 0, 1, 126, "0000000000", "" },
|
||||
/* 16*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "000000000", -1, 0, 1, 126, "0000000000", "" }, /* No difference */
|
||||
/* 17*/ { UNICODE_MODE, -1, "000S0S000S", -1, 0, 1, 138, "0S00S0S000S", "" },
|
||||
/* 18*/ { UNICODE_MODE, -1, "ZYXWVUTSRQP", -1, 0, 1, 150, "Z0YXWVUTSRQP", "" },
|
||||
/* 19*/ { UNICODE_MODE, -1, "0R9GLVHA8EZ4", -1, 0, 1, 162, "0DR9GLVHA8EZ4", "" },
|
||||
/* 20*/ { UNICODE_MODE, -1, "NTS1J2Q6C7DYK", -1, 0, 1, 174, "NRTS1J2Q6C7DYK", "" },
|
||||
/* 21*/ { UNICODE_MODE, -1, "TS1J2Q6C7DYKBU", -1, 0, 1, 186, "TWS1J2Q6C7DYKBU", "" },
|
||||
/* 22*/ { UNICODE_MODE, -1, "IX3FWP5M0R9GLVH", -1, 0, 1, 198, "IBX3FWP5M0R9GLVH", "" },
|
||||
/* 23*/ { UNICODE_MODE, -1, "R9GLVHA8EZ4NTS1J", -1, 0, 1, 210, "RY9GLVHA8EZ4NTS1J", "" },
|
||||
/* 24*/ { UNICODE_MODE, -1, "M5PWF3XIUBKYD7C6Q", -1, 0, 1, 222, "M35PWF3XIUBKYD7C6Q", "" },
|
||||
/* 25*/ { UNICODE_MODE, -1, "2J1STN4ZE8AHVLG90R", -1, 0, 1, 234, "2PJ1STN4ZE8AHVLG90R", "" },
|
||||
/* 26*/ { UNICODE_MODE, -1, "JJJJJJJJJJJJJJJJJJ", -1, 0, 1, 234, "J9JJJJJJJJJJJJJJJJJ", "" },
|
||||
/* 27*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "JJJJJJJJJJJJJJJJJJ", -1, 0, 1, 234, "J9JJJJJJJJJJJJJJJJJ", "" }, /* No difference */
|
||||
/* 0*/ { UNICODE_MODE, -1, "123456", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 792: Input length 6 too short (minimum 7)", "", "" },
|
||||
/* 1*/ { UNICODE_MODE, -1, "1234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 790: Input length 19 too long (maximum 18)", "", "" },
|
||||
/* 2*/ { UNICODE_MODE, -1, "1234567", -1, 0, 1, 102, "1U234567", "", "" },
|
||||
/* 3*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "1234567", -1, 0, 1, 102, "1U234567", "1U234567", "No difference" },
|
||||
/* 4*/ { UNICODE_MODE, -1, "1234567 ", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 791: Invalid character at position 8 in input (alphanumerics only, excluding \"O\")", "", "" },
|
||||
/* 5*/ { UNICODE_MODE, -1, "ABCDEFGHIJKLMNOPQR", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 791: Invalid character at position 15 in input (alphanumerics only, excluding \"O\")", "", "" },
|
||||
/* 6*/ { UNICODE_MODE, -1, "ABCDEFGHIJKLMNPQRS", -1, 0, 1, 234, "AQBCDEFGHIJKLMNPQRS", "", "" },
|
||||
/* 7*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "ABCDEFGHIJKLMNPQRS", -1, 0, 1, 234, "AQBCDEFGHIJKLMNPQRS", "AQBCDEFGHIJKLMNPQRS", "No difference" },
|
||||
/* 8*/ { UNICODE_MODE, -1, "STUVWXYZ1234567890", -1, 0, 1, 234, "SCTUVWXYZ1234567890", "", "" },
|
||||
/* 9*/ { UNICODE_MODE, -1, "abcdefghijklmnpqrs", -1, 0, 1, 234, "AQBCDEFGHIJKLMNPQRS", "", "" },
|
||||
/* 10*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "abcdefghijklmnpqrs", -1, 0, 1, 234, "AQBCDEFGHIJKLMNPQRS", "AQBCDEFGHIJKLMNPQRS", "No difference" },
|
||||
/* 11*/ { UNICODE_MODE, -1, "123456789012345678", -1, 0, 1, 234, "1223456789012345678", "", "" },
|
||||
/* 12*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "123456789012345678", -1, 0, 1, 234, "1223456789012345678", "1223456789012345678", "No difference" },
|
||||
/* 13*/ { UNICODE_MODE, -1, "MMMMMMMMMMMMMMMMMM", -1, 0, 1, 234, "MTMMMMMMMMMMMMMMMMM", "", "" },
|
||||
/* 14*/ { UNICODE_MODE, -1, "00000000", -1, 0, 1, 114, "000000000", "", "" },
|
||||
/* 15*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "00000000", -1, 0, 1, 114, "000000000", "000000000", "" },
|
||||
/* 16*/ { UNICODE_MODE, -1, "000000000", -1, 0, 1, 126, "0000000000", "", "" },
|
||||
/* 17*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "000000000", -1, 0, 1, 126, "0000000000", "0000000000", "" },
|
||||
/* 18*/ { UNICODE_MODE, -1, "000S0S000S", -1, 0, 1, 138, "0S00S0S000S", "", "" },
|
||||
/* 19*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "000S0S000S", -1, 0, 1, 138, "0S00S0S000S", "0S00S0S000S", "" },
|
||||
/* 20*/ { UNICODE_MODE, -1, "ZYXWVUTSRQP", -1, 0, 1, 150, "Z0YXWVUTSRQP", "", "" },
|
||||
/* 21*/ { UNICODE_MODE, -1, "0R9GLVHA8EZ4", -1, 0, 1, 162, "0DR9GLVHA8EZ4", "", "" },
|
||||
/* 22*/ { UNICODE_MODE, -1, "NTS1J2Q6C7DYK", -1, 0, 1, 174, "NRTS1J2Q6C7DYK", "", "" },
|
||||
/* 23*/ { UNICODE_MODE, -1, "TS1J2Q6C7DYKBU", -1, 0, 1, 186, "TWS1J2Q6C7DYKBU", "", "" },
|
||||
/* 24*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "TS1J2Q6C7DYKBU", -1, 0, 1, 186, "TWS1J2Q6C7DYKBU", "TWS1J2Q6C7DYKBU", "" },
|
||||
/* 25*/ { UNICODE_MODE, -1, "IX3FWP5M0R9GLVH", -1, 0, 1, 198, "IBX3FWP5M0R9GLVH", "", "" },
|
||||
/* 26*/ { UNICODE_MODE, -1, "R9GLVHA8EZ4NTS1J", -1, 0, 1, 210, "RY9GLVHA8EZ4NTS1J", "", "" },
|
||||
/* 27*/ { UNICODE_MODE, -1, "M5PWF3XIUBKYD7C6Q", -1, 0, 1, 222, "M35PWF3XIUBKYD7C6Q", "", "" },
|
||||
/* 28*/ { UNICODE_MODE, -1, "2J1STN4ZE8AHVLG90R", -1, 0, 1, 234, "2PJ1STN4ZE8AHVLG90R", "", "" },
|
||||
/* 29*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "2J1STN4ZE8AHVLG90R", -1, 0, 1, 234, "2PJ1STN4ZE8AHVLG90R", "2PJ1STN4ZE8AHVLG90R", "" },
|
||||
/* 30*/ { UNICODE_MODE, -1, "JJJJJJJJJJJJJJJJJJ", -1, 0, 1, 234, "J9JJJJJJJJJJJJJJJJJ", "", "" },
|
||||
/* 31*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "JJJJJJJJJJJJJJJJJJ", -1, 0, 1, 234, "J9JJJJJJJJJJJJJJJJJ", "J9JJJJJJJJJJJJJJJJJ", "" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
char bwipp_buf[8192];
|
||||
char bwipp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -99,6 +104,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(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);
|
||||
|
@ -112,6 +118,18 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
|
||||
char modules_dump[8192 + 1];
|
||||
|
@ -165,7 +183,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ static void test_u_big5_int(const testCtx *const p_ctx) {
|
|||
(void)debug;
|
||||
#endif
|
||||
|
||||
testStart("test_u_big5_int");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
#ifdef TEST_JUST_SAY_GNO
|
||||
if ((debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */
|
||||
|
@ -199,7 +199,7 @@ static void test_big5_utf8(const testCtx *const p_ctx) {
|
|||
struct zint_symbol symbol = {0};
|
||||
unsigned int b5data[20];
|
||||
|
||||
testStart("test_big5_utf8");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_length;
|
||||
|
|
|
@ -67,7 +67,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
|
|||
|
||||
const char *const have_identify = testUtilHaveIdentify();
|
||||
|
||||
testStart("test_pixel_plot");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int size;
|
||||
|
@ -160,7 +160,7 @@ static void test_print(const testCtx *const p_ctx) {
|
|||
|
||||
const char *const have_identify = testUtilHaveIdentify();
|
||||
|
||||
testStart("test_print");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
char data_dir_path[1024];
|
||||
|
@ -255,7 +255,7 @@ static void test_outfile(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_outfile");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol.symbology = BARCODE_CODE128;
|
||||
symbol.bitmap = data;
|
||||
|
|
321
backend/tests/test_bwipp.c
Normal file
321
backend/tests/test_bwipp.c
Normal file
|
@ -0,0 +1,321 @@
|
|||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2025 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the project nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#include "testcommon.h"
|
||||
|
||||
static int aztec_width(const int bwipp_len) {
|
||||
static const int width_lens[33] = {
|
||||
15 * 15, 19 * 19, 23 * 23, 27 * 27, 31 * 31, 37 * 37, 41 * 41, 45 * 45, 49 * 49, 53 * 53,
|
||||
57 * 57, 61 * 61, 67 * 67, 71 * 71, 75 * 75, 79 * 79, 83 * 83, 87 * 87, 91 * 91, 95 * 95,
|
||||
101 * 101, 105 * 105, 109 * 109, 113 * 113, 117 * 117, 121 * 121, 125 * 125, 131 * 131, 135 * 135, 139 * 139,
|
||||
143 * 143, 147 * 147, 151 * 151,
|
||||
};
|
||||
static const int widths[33] = {
|
||||
15, 19, 23, 27, 31, 37, 41, 45, 49, 53,
|
||||
57, 61, 67, 71, 75, 79, 83, 87, 91, 95,
|
||||
101, 105, 109, 113, 117, 121, 125, 131, 135, 139,
|
||||
143, 147, 151,
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = ARRAY_SIZE(width_lens) - 1; i >= 0 && width_lens[i] != bwipp_len; i--);
|
||||
return i >= 0 ? widths[i] : 0;
|
||||
}
|
||||
|
||||
static int cnv_hex_data(const char *hex, char *buf, const int buf_size) {
|
||||
const char *h = hex;
|
||||
const char *const he = hex + strlen(hex);
|
||||
char *str_end;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < buf_size && h < he; i++) {
|
||||
buf[i] = (char) strtol(h, &str_end, 16);
|
||||
if (str_end == h) {
|
||||
return -1;
|
||||
}
|
||||
h = str_end + 1;
|
||||
}
|
||||
if (i < buf_size) buf[i] = '\0';
|
||||
return i == buf_size ? -1 : i;
|
||||
}
|
||||
|
||||
static void test_aztec_random(const testCtx *const p_ctx) {
|
||||
#ifndef _WIN32
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
int i, length, ret;
|
||||
#endif
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
#ifndef _WIN32
|
||||
int symbology = BARCODE_AZTEC;
|
||||
int input_mode = DATA_MODE;
|
||||
int eci = 899;
|
||||
int option_1 = 1;
|
||||
int option_2 = -1;
|
||||
int option_3 = -1;
|
||||
int output_options = -1;
|
||||
|
||||
char data_buf[4096];
|
||||
char bwipp_buf[32768];
|
||||
char escaped[8192];
|
||||
char escaped2[8192];
|
||||
char cmp_buf[8192];
|
||||
char cmp_msg[8192];
|
||||
char ret_buf[8192] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
const int iterations = p_ctx->arg ? p_ctx->arg : 10000; /* Use "-a N" to set iterations */
|
||||
|
||||
/* Requires to be run with "-d 1024" (see ZINT_DEBUG_TEST_BWIPP_ZXINGCPP in "testcommon.h") */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP_ZXINGCPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_BWIPP_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
#endif
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
#ifdef _WIN32
|
||||
testSkip("Test not implemented on Windows");
|
||||
#else
|
||||
if (!do_bwipp || !do_zxingcpp) {
|
||||
testSkip("Test requires BWIPP and ZXing-C++");
|
||||
return;
|
||||
}
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
printf(" iterations %d\n", iterations);
|
||||
|
||||
for (i = 0; i < iterations; i++) {
|
||||
int bwipp_len, cmp_len, ret_len;
|
||||
|
||||
length = arc4random_uniform(1800) + 1;
|
||||
|
||||
arc4random_buf(data_buf, length);
|
||||
|
||||
testUtilSetSymbol(symbol, symbology, input_mode, eci, option_1, option_2, option_3,
|
||||
output_options, data_buf, length, debug);
|
||||
|
||||
assert_nonzero(testUtilCanBwipp(i, symbol, option_1, option_2, option_3, debug),
|
||||
"i:%d testUtilCanBwipp != 0\n", i);
|
||||
assert_nonzero(testUtilCanZXingCPP(i, symbol, data_buf, length, debug), "i:%d testUtilCanZXingCPP != 0\n", i);
|
||||
|
||||
symbol->rows = 0;
|
||||
ret = testUtilBwipp(i, symbol, option_1, option_2, option_3, data_buf, length, NULL, bwipp_buf,
|
||||
sizeof(bwipp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
bwipp_len = strlen(bwipp_buf);
|
||||
assert_nonzero(bwipp_len, "i:%d bwipp_len %d = 0\n", i, bwipp_len);
|
||||
|
||||
symbol->width = aztec_width(bwipp_len);
|
||||
assert_equal(symbol->width * symbol->width, bwipp_len,
|
||||
"i:%d symbol->width^2 %d != bwipp_len %d (symbol->width %d)\n",
|
||||
i, symbol->width * symbol->width, bwipp_len, symbol->width);
|
||||
|
||||
ret = testUtilZXingCPP(i, symbol, data_buf, length, bwipp_buf, 1 /*zxingcpp_cmp*/, cmp_buf, sizeof(cmp_buf),
|
||||
&cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
/*fprintf(stderr, "cmp_len %d\n", cmp_len);*/
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data_buf, length, NULL /*primary*/,
|
||||
ret_buf, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg,
|
||||
testUtilEscape(cmp_buf, cmp_len, escaped, sizeof(escaped)),
|
||||
testUtilEscape(ret_buf, ret_len, escaped2, sizeof(escaped2)));
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
|
||||
testFinish();
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
static void test_aztec_bwipjs_354(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
const char *data;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { "08 77 00 81 A2 2E 20 47 C3 92 B8 F1 AD" },
|
||||
/* 1*/ { "86 A0 B3 0D 0A 41 86 66 8E FD 43" },
|
||||
/* 2*/ { "AE 45 C1 84 90 0D 0A 59 8C 4D DB 33 44" },
|
||||
/* 3*/ { "38 15 AC B3 FA 3A 20 56 0A 94 66 A7 D7" },
|
||||
/* 4*/ { "7D 82 BC 46 6A 0D 0A 4A CA 89 B3 D4 66" },
|
||||
/* 5*/ { "BD 9C 7F 2C 20 F2 99 D0 66 49 7F 3E F2 44 CD 10 EC 1B 38 3E 27 07 2C 58 5E 42 A3 B4 D3 D9 98 61 F1 B6 E6 0F 82 3A FE FB 05 09 A2 22 8C E6 56 33 49 66 00 3B 5D 0B 5F 81 51 72 BA 6A B0 8C D2 68 2D FA 71 F6 C1 1A FC 1A 85 18 30 89 0F BC FD 44 CB D5 B3 84 5D FE 25 4E 70 86 12 D9 65 D7 6F 3D CD 97 27 07 31 46 F3 85 9A 0A 87 D4 02 B8 98 56 44 56 17 00 7F 21 81 C8 5F 37 81 C0 CC 98 87 2C 2D C5 8D 53 7D 46 8D 6E 8C 20 8A 9B 79 4E 33 C6 55 07 A2 05 C8 82 D0 EF CF 86 F1 79 00 0A 6F 4E 18 52 D8 64 51 0F 0A C5 9A CD 6B BD C0 A0 AB 24 F5 1D 2F E3 4D CF B7 92 7F 9C 24 48 6C D5 CD 21 AD 3C FE 65 5B 19 51 F5 8C 72 01 5D 51 CC 9C 50 7C 95 12 D5 32 E4 17 6F 39 EB 91 37 36 C2 D5 5B 30 DE F6 F1 FF 83 8F 80 75 24 E4 2A EF AA AD C5 A3 5B F0 B3 94 73 9C C9 00 D0 52 DF 1A 8A 2D DE E7 F4 45 FA FE EA 50 4D 12 DF 51 D5 5E D1 97 74 95 48 D6 C5 CB 7D E0 23 91 67 4B F3 DD 07 19 61 05 CC 91 52 D8 33 BB B8 B6 87 16 1C C5 28 72 6C 31 A8 04 7E 90 E8 23 94 4F C6 37 E7 5F 38 01 81 42 08 44 45 56 44 56 11 04 21" },
|
||||
/* 6*/ { "CF 03 28 05 68 3A 20 4A DF 7B 82 61 24" },
|
||||
/* 7*/ { "AD F2 EF 17 99 3A 20 53 94 9F C3 1D 87" },
|
||||
/* 8*/ { "63 F4 F5 FE 28 0D 0A 4C 05 02 DA DA 3F" },
|
||||
/* 9*/ { "C5 8C 5F D5 DF 2C 20 56 F3 25 91 57 A0" },
|
||||
/* 10*/ { "CC A4 68 67 8D 3A 20 51 38 90 71 50 D8" },
|
||||
/* 11*/ { "A9 CE F9 ED 9E 2E 20 53 42 BC 8E 12 57" },
|
||||
/* 12*/ { "2D CD 5A 50 8A 0D 0A 46 A4 84 6B B0 6F" },
|
||||
/* 13*/ { "C1 30 C4 53 C2 2E 20 4A DF 14 48 94 B1" },
|
||||
/* 14*/ { "06 CF 01 7A 73 3A 20 59 76 E0 B2 A4 52" },
|
||||
/* 15*/ { "63 D3 1A A2 86 2C 20 1F 2E 20 F4 F9 BB 72 D6 40 15 47 29 4B 7F 18 E2 E6 FF C7 B5 70 8B 0C 66 4D EF 68 9A 05 56 44 56 17 00 7F 21 81 C8 5F 37 81 C0 CC 98 87 2C 2D C5 8D 53 7D 46 8D 6E 8C 20 8A 9B 79 4E 33 C6 55 07 A2 05 C8 82 D0 EF CF 86 F1 79 00 0A 6F 4E 18 52 D8 64 51 0F 0A C5 9A CD 6B BD C0 A0 AB 24 F5 1D 2F E3 4D CF B7 92 7F 9C 24 48 6C D5 CD 21 AD 3C FE 65 5B 19 51 F5 8C 72 01 5D 51 CC 9C 50 7C 95 12 D5 32 E4 17 6F 39 EB 91 37 36 C2 D5 5B 30 DE F6 F1 FF 83 8F 80 75 24 E4 2A EF AA AD C5 A3 5B F0 B3 94 73 9C C9 00 D0 52 DF 1A 8A 2D DE E7 F4 45 FA FE EA 50 4D 12 DF 51 D5 5E D1 97 74 95 48 D6 C5 CB 7D E0 23 91 67 4B F3 DD 07 19 61 05 CC 91 52 D8 33 BB B8 B6 87 16 1C C5 28 72 6C 31 A8 04 7E 90 E8 23 94 4F C6 37 E7 5F 38 01 81 42 08 44 45 56 44 56 11 04 21" },
|
||||
/* 16*/ { "D4 E0 65 86 30 3A 20 49 0B F7 A3 2B 84" },
|
||||
/* 17*/ { "14 76 23 3A 20 44 7E 4B E9 D5 2C" },
|
||||
/* 18*/ { "D1 45 B1 02 EF 0D 0A 34 C6 33 27 FF B5 80 3F EB 3D 06 CD 34 17 FA 73 7F 23 31 83 F9 03 F8 47 60 03 BD 4B 13 58 15 E4 B8 A7 BD CA 0E 1C 6D BC D0 92 18 73 4B A9 EB 50 07 73 2A 59 F0 0F 8B 27 A3 1D 0E 7B CB FB 9C B3 10 38 03 0D 2D C4 5D B0 3F 61 FE FF BA 3B 45 8F 11 83 A6 74 2B 72 BB D3 A0 B8 10 1F D8 6A 42 BC 3F EA 57 9A 05 56 44 56 17 00 7F 21 81 C8 5F 37 81 C0 CC 98 87 2C 2D C5 8D 53 7D 46 8D 6E 8C 20 8A 9B 79 4E 33 C6 55 07 A2 05 C8 82 D0 EF CF 86 F1 79 00 0A 6F 4E 18 52 D8 64 51 0F 0A C5 9A CD 6B BD C0 A0 AB 24 F5 1D 2F E3 4D CF B7 92 7F 9C 24 48 6C D5 CD 21 AD 3C FE 65 5B 19 51 F5 8C 72 01 5D 51 CC 9C 50 7C 95 12 D5 32 E4 17 6F 39 EB 91 37 36 C2 D5 5B 30 DE F6 F1 FF 83 8F 80 75 24 E4 2A EF AA AD C5 A3 5B F0 B3 94 73 9C C9 00 D0 52 DF 1A 8A 2D DE E7 F4 45 FA FE EA 50 4D 12 DF 51 D5 5E D1 97 74 95 48 D6 C5 CB 7D E0 23 91 67 4B F3 DD 07 19 61 05 CC 91 52 D8 33 BB B8 B6 87 16 1C C5 28 72 6C 31 A8 04 7E 90 E8 23 94 4F C6 37 E7 5F 38 01 81 42 08 44 45 56 44 56 11 04 21" },
|
||||
/* 19*/ { "E8 F4 51 3F F4 3A 20 0D 84 DA 14 44 E8" },
|
||||
/* 20*/ { "2B F2 AB 75 3D 2C 20 3B 50 49 03 2B CD" },
|
||||
/* 21*/ { "D8 31 62 57 6E 0D 0A 49 04 10 D2 6A E8" },
|
||||
/* 22*/ { "81 80 2E 66 91 2C 20 59 35 4D C5 79 89" },
|
||||
/* 23*/ { "37 5D 72 EB DD 2C 20 DB 6C 8C B8 34 46 FE 45 86 14 92 33 B0 AC 87 59 29 3B AF EE 45 ED 99 3A EA FB F5 A5 B4 14 61 5A 09 CB C9 29 F5 83 E7 9B C2 0B F6 E6 5B D6 4A 7F 37 EE 76 8E 03 FB 04 2D E2 20 5D 5D C4 79 F6 64 03 C9 D4 1E C1 3C CA 36 C3 DA 5D 79 90 2F 88 BD 8E FE 60 AA DF 77 28 5E 73 59 69 21 44 71 01 F2 AA 99 3A 9A 05 56 44 56 17 00 7F 21 81 C8 5F 37 81 C0 48 CA D1 84 F0 E7 DC 2E 97 1E 24 29 57 8B 24 01 45 78 F3 05 68 57 89 72 14 BB 01 D7 FA 34 D6 A6 DE 23 52 B9 1E 70 AA 27 C0 3C 84 56 05 24 8B 97 0A A6 27 D9 47 35 07 60 F5 92 B4 B9 C2 9C 8A 40 F7 FE 53 7C 60 8E 89 77 BB B6 07 DF 3F FC DA 11 56 13 51 52 A7 68 57 D7 60 45 22 C5 06 7B D6 1F 70 D6 A5 4B 7F F2 C9 2E B4 54 C4 5E 06 8D 6E 76 A2 C3 2F 22 8A 04 45 E4 C1 5D 82 3C CC 88 22 16 68 77 DB 3F E0 61 01 1C B3 83 4B 6B 54 44 24 03 AF DE 4F E4 10 38 86 E4 D3 BE 18 E9 8E AC AC 9F 38 DD F5 6A 4F AB AF E5 87 47 9B 9A A6 0F 66 B2 A1 B2 EE 71 7A AB EE 48 16 DE 51 B0 53 EB 3C 06 5F 38 01 81 42 08 44 45 56 44 56 11 04 21" },
|
||||
/* 24*/ { "C7 C6 DA A1 0D 0A 20 03 CF 8F 2E 8E" },
|
||||
/* 25*/ { "D1 A5 72 92 8D 0D 0A 4B 86 38 C8 92 A2" },
|
||||
/* 26*/ { "4D 62 77 F8 E6 3A 20 47 AB 2C 1A 17 74" },
|
||||
/* 27*/ { "A0 6D 63 A3 92 2C 20 58 F5 4B F4 4B 37" },
|
||||
/* 28*/ { "1D 14 1A D3 98 2C 20 20 70 7D D0 E9 23" },
|
||||
/* 29*/ { "7A 60 61 0F EE 2E 20 53 B0 82 59 52 2E" },
|
||||
/* 30*/ { "27 CB FE 95 25 2C 20 46 20 8A AB B1 4E" },
|
||||
/* 31*/ { "D5 CD 8C 8E B2 2C 20 52 13 16 8B C9 69" },
|
||||
/* 32*/ { "22 BA 6C 8B A6 0D 0A B7 22 F8 FC F8 40 7C 47 26 F6 0E F1 1D 9A 51 B9 A8 E0 09 C8 B6 A9 27 C9 A9 EB F1 8F D8 82 CA 6B BA 27 B6 72 44 12 D9 EC C5 CF 6B BD 94 1F F9 9C C7 4C 1B 1C 77 40 8A 21 74 22 4C DC E6 38 D1 9D 41 9E 95 48 87 35 85 D1 32 D4 9E F6 20 D2 38 5E B5 77 E9 07 DF F4 84 44 8B DB 9D 09 80 78 9E 2C DA 7B 1B 9A 05 56 44 56 17 00 7F 21 81 C8 5F 37 81 C0 CC 98 87 2C 2D C5 8D 53 7D 46 8D 6E 8C 20 8A 9B 79 4E 33 C6 55 07 A2 05 C8 82 D0 EF CF 86 F1 79 00 0A 6F 4E 18 52 D8 64 51 0F 0A C5 9A CD 6B BD C0 A0 AB 24 F5 1D 2F E3 4D CF B7 92 7F 9C 24 48 6C D5 CD 21 AD 3C FE 65 5B 19 51 F5 8C 72 01 5D 51 CC 9C 50 7C 95 12 D5 32 E4 17 6F 39 EB 91 37 36 C2 D5 5B 30 DE F6 F1 FF 83 8F 80 75 24 E4 2A EF AA AD C5 A3 5B F0 B3 94 73 9C C9 00 D0 52 DF 1A 8A 2D DE E7 F4 45 FA FE EA 50 4D 12 DF 51 D5 5E D1 97 74 95 48 D6 C5 CB 7D E0 23 91 67 4B F3 DD 07 19 61 05 CC 91 52 D8 33 BB B8 B6 87 16 1C C5 28 72 6C 31 A8 04 7E 90 E8 23 94 4F C6 37 E7 5F 38 01 81 42 08 44 45 56 44 56 11 04 21" },
|
||||
/* 33*/ { "3A 3B A3 B0 3D 2E 20 4C 12 7A 39 06 CB" },
|
||||
/* 34*/ { "4E C6 3E B8 DD 3A 20 6E 72 67 2B BE 56 92 DB" },
|
||||
/* 35*/ { "C5 48 67 EA FB 3A 20 07 1F 01 F3 EF 82 85 F0 18 1C 86 E4 E7 70 AD 9A 2A 68 73 4A 82 8A 09 33 16 9C CC 83 61 2D 36 E0 EF 57 96 DB 64 08 90 1B 69 23 77 E9 97 9D 4B 2A 2B F8 09 D8 85 86 BC 80 F7 D0 5E B9 8E 5E D3 33 4E C1 13 58 0D 6A 68 77 CE 6C B0 49 C4 9F 58 86 D3 95 F7 CE A6 DD F0 6E 9A 05 56 44 56 17 00 7F 21 81 C8 5F 37 81 C0 CC 98 87 2C 2D C5 8D 53 7D 46 8D 6E 8C 20 8A 9B 79 4E 33 C6 55 07 A2 05 C8 82 D0 EF CF 86 F1 79 00 0A 6F 4E 18 52 D8 64 51 0F 0A C5 9A CD 6B BD C0 A0 AB 24 F5 1D 2F E3 4D CF B7 92 7F 9C 24 48 6C D5 CD 21 AD 3C FE 65 5B 19 51 F5 8C 72 01 5D 51 CC 9C 50 7C 95 12 D5 32 E4 17 6F 39 EB 91 37 36 C2 D5 5B 30 DE F6 F1 FF 83 8F 80 75 24 E4 2A EF AA AD C5 A3 5B F0 B3 94 73 9C C9 00 D0 52 DF 1A 8A 2D DE E7 F4 45 FA FE EA 50 4D 12 DF 51 D5 5E D1 97 74 95 48 D6 C5 CB 7D E0 23 91 67 4B F3 DD 07 19 61 05 CC 91 52 D8 33 BB B8 B6 87 16 1C C5 28 72 6C 31 A8 04 7E 90 E8 23 94 4F C6 37 E7 5F 38 01 81 42 08 44 45 56 44 56 11 04 21" },
|
||||
/* 36*/ { "24 47 8C DF B9 2C 20 4A 72 4D 7A 46 BF" },
|
||||
/* 37*/ { "D4 2A 1D CE A4 2E 20 44 04 BD 19 7D A4" },
|
||||
/* 38*/ { "1F AB 7C 69 B4 3A 20 4B FE 23 7D 5B CD" },
|
||||
/* 39*/ { "2B 2F 40 94 6D 2E 20 55 69 DE 3D 15 74" },
|
||||
/* 40*/ { "17 CC A0 F7 7D 2C 20 5A 2B 13 72 7F 7B" },
|
||||
/* 41*/ { "E6 48 F3 56 A9 3A 20 58 F5 77 45 B8 71" },
|
||||
/* 42*/ { "0D 0A 4C FA D8 67 95 EA" },
|
||||
/* 43*/ { "52 38 A1 5F F9 2E 20 41 A0 6E 06 6D CD" },
|
||||
/* 44*/ { "D6 FD C4 7D 2D 0D 0A 52 A0 CA 01 A0 A8" },
|
||||
/* 45*/ { "DB 89 AD 70 F3 2E 20 4A 53 5E 00 DB E1" },
|
||||
/* 46*/ { "8C A1 D2 FB F2 3A 20 71 7A 35 97 55 31 3C" },
|
||||
/* 47*/ { "81 80 25 A8 BE 2C 20 49 EE C0 B9 81 7F" },
|
||||
/* 48*/ { "2E 20 20 27 37 7E AA E4" },
|
||||
/* 49*/ { "76 60 3D D7 32 2C 20 48 39 D9 86 CA 93" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int symbology = BARCODE_AZTEC;
|
||||
int input_mode = DATA_MODE;
|
||||
int eci = 899;
|
||||
int option_1 = 1;
|
||||
int option_2 = -1;
|
||||
int option_3 = -1;
|
||||
int output_options = -1;
|
||||
|
||||
char data_buf[4096];
|
||||
char bwipp_buf[32768];
|
||||
char escaped[8192];
|
||||
char escaped2[8192];
|
||||
char cmp_buf[8192];
|
||||
char cmp_msg[8192];
|
||||
char ret_buf[8192] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
/* Requires to be run with "-d 1024" (see ZINT_DEBUG_TEST_BWIPP_ZXINGCPP in "testcommon.h") */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP_ZXINGCPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_BWIPP_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
if (!do_bwipp || !do_zxingcpp) {
|
||||
testSkip("Test requires BWIPP and ZXing-C++");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int bwipp_len, cmp_len, ret_len;
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = cnv_hex_data(data[i].data, data_buf, ARRAY_SIZE(data_buf));
|
||||
assert_nonzero(length, "i:%d cnv_hex_data length zero\n", i);
|
||||
|
||||
#if 0
|
||||
debug_print_escape(TCU(data_buf), length, NULL);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
testUtilSetSymbol(symbol, symbology, input_mode, eci, option_1, option_2, option_3,
|
||||
output_options, data_buf, length, debug);
|
||||
|
||||
assert_nonzero(testUtilCanBwipp(i, symbol, option_1, option_2, option_3, debug),
|
||||
"i:%d testUtilCanBwipp != 0\n", i);
|
||||
assert_nonzero(testUtilCanZXingCPP(i, symbol, data_buf, length, debug), "i:%d testUtilCanZXingCPP != 0\n", i);
|
||||
|
||||
symbol->rows = 0;
|
||||
ret = testUtilBwipp(i, symbol, option_1, option_2, option_3, data_buf, length, NULL, bwipp_buf,
|
||||
sizeof(bwipp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
bwipp_len = strlen(bwipp_buf);
|
||||
assert_nonzero(bwipp_len, "i:%d bwipp_len %d = 0\n", i, bwipp_len);
|
||||
|
||||
symbol->width = aztec_width(bwipp_len);
|
||||
assert_equal(symbol->width * symbol->width, bwipp_len,
|
||||
"i:%d symbol->width^2 %d != bwipp_len %d (symbol->width %d)\n",
|
||||
i, symbol->width * symbol->width, bwipp_len, symbol->width);
|
||||
|
||||
ret = testUtilZXingCPP(i, symbol, data_buf, length, bwipp_buf, 1 /*zxingcpp_cmp*/, cmp_buf, sizeof(cmp_buf),
|
||||
&cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
/*fprintf(stderr, "cmp_len %d\n", cmp_len);*/
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data_buf, length, NULL /*primary*/,
|
||||
ret_buf, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg,
|
||||
testUtilEscape(cmp_buf, cmp_len, escaped, sizeof(escaped)),
|
||||
testUtilEscape(ret_buf, ret_len, escaped2, sizeof(escaped2)));
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
testFunction funcs[] = { /* name, func */
|
||||
{ "test_aztec_random", test_aztec_random },
|
||||
{ "test_aztec_bwipjs_354", test_aztec_bwipjs_354 },
|
||||
};
|
||||
|
||||
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
|
||||
|
||||
testReport();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
|
@ -57,32 +57,42 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
/* 10*/ { 5, -1, "12", -1, "0012" },
|
||||
/* 11*/ { 5, BARCODE_RAW_TEXT, "12", -1, "0012" },
|
||||
/* 12*/ { 5, -1, "1", -1, "0001" },
|
||||
/* 13*/ { 5, -1, "1234", -1, "1234" },
|
||||
/* 14*/ { 6, -1, "1234", -1, "01234" },
|
||||
/* 15*/ { 6, -1, "123", -1, "00123" },
|
||||
/* 16*/ { 6, -1, "12", -1, "00012" },
|
||||
/* 17*/ { 6, -1, "1", -1, "00001" },
|
||||
/* 18*/ { 7, -1, "1234", -1, "001234" },
|
||||
/* 19*/ { 7, -1, "12345", -1, "012345" },
|
||||
/* 20*/ { 7, -1, "123456", -1, "123456" },
|
||||
/* 21*/ { 7, -1, "1", -1, "000001" },
|
||||
/* 22*/ { 8, -1, "12345", -1, "0012345" },
|
||||
/* 23*/ { 8, BARCODE_RAW_TEXT, "12345", -1, "0012345" },
|
||||
/* 24*/ { 8, -1, "123456", -1, "0123456" },
|
||||
/* 25*/ { 8, BARCODE_RAW_TEXT, "123456", -1, "0123456" },
|
||||
/* 26*/ { 8, -1, "1234567", -1, "1234567" },
|
||||
/* 27*/ { 8, BARCODE_RAW_TEXT, "1234567", -1, "1234567" },
|
||||
/* 28*/ { 8, -1, "12", -1, "0000012" },
|
||||
/* 29*/ { 8, BARCODE_RAW_TEXT, "12", -1, "0000012" },
|
||||
/* 30*/ { 8, -1, "1", -1, "0000001" },
|
||||
/* 31*/ { 8, BARCODE_RAW_TEXT, "1", -1, "0000001" },
|
||||
/* 13*/ { 5, BARCODE_RAW_TEXT, "1", -1, "0001" },
|
||||
/* 14*/ { 5, -1, "1234", -1, "1234" },
|
||||
/* 15*/ { 5, BARCODE_RAW_TEXT, "1234", -1, "1234" },
|
||||
/* 16*/ { 6, -1, "1234", -1, "01234" },
|
||||
/* 17*/ { 6, BARCODE_RAW_TEXT, "1234", -1, "01234" },
|
||||
/* 18*/ { 6, -1, "123", -1, "00123" },
|
||||
/* 19*/ { 6, BARCODE_RAW_TEXT, "123", -1, "00123" },
|
||||
/* 20*/ { 6, -1, "12", -1, "00012" },
|
||||
/* 21*/ { 6, BARCODE_RAW_TEXT, "12", -1, "00012" },
|
||||
/* 22*/ { 6, -1, "1", -1, "00001" },
|
||||
/* 23*/ { 6, BARCODE_RAW_TEXT, "1", -1, "00001" },
|
||||
/* 24*/ { 7, -1, "1234", -1, "001234" },
|
||||
/* 25*/ { 7, BARCODE_RAW_TEXT, "1234", -1, "001234" },
|
||||
/* 26*/ { 7, -1, "12345", -1, "012345" },
|
||||
/* 27*/ { 7, BARCODE_RAW_TEXT, "12345", -1, "012345" },
|
||||
/* 28*/ { 7, -1, "123456", -1, "123456" },
|
||||
/* 29*/ { 7, BARCODE_RAW_TEXT, "123456", -1, "123456" },
|
||||
/* 30*/ { 7, -1, "1", -1, "000001" },
|
||||
/* 31*/ { 7, BARCODE_RAW_TEXT, "1", -1, "000001" },
|
||||
/* 32*/ { 8, -1, "12345", -1, "0012345" },
|
||||
/* 33*/ { 8, BARCODE_RAW_TEXT, "12345", -1, "0012345" },
|
||||
/* 34*/ { 8, -1, "123456", -1, "0123456" },
|
||||
/* 35*/ { 8, BARCODE_RAW_TEXT, "123456", -1, "0123456" },
|
||||
/* 36*/ { 8, -1, "1234567", -1, "1234567" },
|
||||
/* 37*/ { 8, BARCODE_RAW_TEXT, "1234567", -1, "1234567" },
|
||||
/* 38*/ { 8, -1, "12", -1, "0000012" },
|
||||
/* 39*/ { 8, BARCODE_RAW_TEXT, "12", -1, "0000012" },
|
||||
/* 40*/ { 8, -1, "1", -1, "0000001" },
|
||||
/* 41*/ { 8, BARCODE_RAW_TEXT, "1", -1, "0000001" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -103,6 +113,18 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected, expected_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -183,7 +205,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -447,7 +469,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
char bwipp_buf[8192];
|
||||
char bwipp_msg[1024];
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[128];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -96,28 +96,29 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
const char *data;
|
||||
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_CODABAR, -1, -1, "A1234B", "A1234B" },
|
||||
/* 1*/ { BARCODE_CODABAR, -1, BARCODE_RAW_TEXT, "A1234B", "A1234B" },
|
||||
/* 2*/ { BARCODE_CODABAR, -1, -1, "a1234c", "A1234C" }, /* Converts to upper */
|
||||
/* 3*/ { BARCODE_CODABAR, -1, BARCODE_RAW_TEXT, "a1234c", "A1234C" },
|
||||
/* 4*/ { BARCODE_CODABAR, 1, -1, "A1234B", "A1234B" }, /* Check not included */
|
||||
/* 5*/ { BARCODE_CODABAR, 1, BARCODE_RAW_TEXT, "A1234B", "A12345B" },
|
||||
/* 6*/ { BARCODE_CODABAR, 2, -1, "A1234B", "A12345B" }, /* Check included */
|
||||
/* 7*/ { BARCODE_CODABAR, 2, BARCODE_RAW_TEXT, "A1234B", "A12345B" },
|
||||
/* 8*/ { BARCODE_CODABAR, 1, -1, "A123456A", "A123456A" }, /* Check not included */
|
||||
/* 9*/ { BARCODE_CODABAR, 1, BARCODE_RAW_TEXT, "A123456A", "A123456$A" },
|
||||
/* 10*/ { BARCODE_CODABAR, 2, -1, "A123456A", "A123456$A" }, /* Check included */
|
||||
/* 11*/ { BARCODE_CODABAR, 2, BARCODE_RAW_TEXT, "A123456A", "A123456$A" },
|
||||
/* 0*/ { BARCODE_CODABAR, -1, -1, "A1234B", "A1234B", "" },
|
||||
/* 1*/ { BARCODE_CODABAR, -1, BARCODE_RAW_TEXT, "A1234B", "A1234B", "A1234B" },
|
||||
/* 2*/ { BARCODE_CODABAR, -1, -1, "a1234c", "A1234C", "" }, /* Converts to upper */
|
||||
/* 3*/ { BARCODE_CODABAR, -1, BARCODE_RAW_TEXT, "a1234c", "A1234C", "A1234C" },
|
||||
/* 4*/ { BARCODE_CODABAR, 1, -1, "A1234B", "A1234B", "" }, /* Check not included */
|
||||
/* 5*/ { BARCODE_CODABAR, 1, BARCODE_RAW_TEXT, "A1234B", "A1234B", "A12345B" },
|
||||
/* 6*/ { BARCODE_CODABAR, 2, -1, "A1234B", "A12345B", "" }, /* Check included */
|
||||
/* 7*/ { BARCODE_CODABAR, 2, BARCODE_RAW_TEXT, "A1234B", "A12345B", "A12345B" },
|
||||
/* 8*/ { BARCODE_CODABAR, 1, -1, "A123456A", "A123456A", "" }, /* Check not included */
|
||||
/* 9*/ { BARCODE_CODABAR, 1, BARCODE_RAW_TEXT, "A123456A", "A123456A", "A123456$A" },
|
||||
/* 10*/ { BARCODE_CODABAR, 2, -1, "A123456A", "A123456$A", "" }, /* Check included */
|
||||
/* 11*/ { BARCODE_CODABAR, 2, BARCODE_RAW_TEXT, "A123456A", "A123456$A", "A123456$A" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -130,6 +131,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, data[i].option_2, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -138,6 +140,18 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -180,7 +194,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -263,7 +277,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -304,13 +318,18 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[ZINT_MAX_DATA_LEN + 2];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -169,7 +169,7 @@ static void test_options(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_options", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -227,7 +227,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
|
|||
|
||||
char escaped[1024];
|
||||
|
||||
testStartSymbol("test_reader_init", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -267,26 +267,42 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
|
||||
struct item {
|
||||
int symbology;
|
||||
int input_mode;
|
||||
int option_1;
|
||||
int option_2;
|
||||
int output_options;
|
||||
const char *data;
|
||||
int length;
|
||||
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
int expected_raw_length;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_CODABLOCKF, -1, -1, -1, "12345623456", "" }, /* None */
|
||||
/* 1*/ { BARCODE_CODABLOCKF, -1, -1, BARCODE_RAW_TEXT, "12345623456", "" }, /* No difference */
|
||||
/* 2*/ { BARCODE_CODABLOCKF, 1, -1, -1, "12345623456", "" }, /* None (CODE128) */
|
||||
/* 3*/ { BARCODE_CODABLOCKF, 1, -1, BARCODE_RAW_TEXT, "12345623456", "" }, /* No difference */
|
||||
/* 0*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, -1, "12345623456", -1, "", "", -1 }, /* None */
|
||||
/* 1*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, BARCODE_RAW_TEXT, "12345623456", -1, "", "12345623456", -1 },
|
||||
/* 2*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 1, -1, -1, "12345623456", -1, "", "", -1 }, /* None (CODE128) */
|
||||
/* 3*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 1, -1, BARCODE_RAW_TEXT, "12345623456", -1, "", "12345623456", -1 },
|
||||
/* 4*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 1, -1, -1, "12345623456\012é", -1, "", "", -1 }, /* None (CODE128) */
|
||||
/* 5*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 1, -1, BARCODE_RAW_TEXT, "12345623456\012é", -1, "", "12345623456\012\351", -1 },
|
||||
/* 6*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, -1, "12345623456\012é", -1, "", "", -1 }, /* None */
|
||||
/* 7*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, BARCODE_RAW_TEXT, "12345623456\012é", -1, "", "12345623456\012\351", -1 },
|
||||
/* 8*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, -1, "12345623456\000\012é", -1, "", "", -1 }, /* None */
|
||||
/* 9*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, BARCODE_RAW_TEXT, "12345623456\000\012é", 15, "", "12345623456\000\012\351", 14 },
|
||||
/* 10*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, -1, "12345623456\000\012é", 15, "", "", -1 }, /* None */
|
||||
/* 11*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, BARCODE_RAW_TEXT, "12345623456\000\012é", 15, "", "12345623456\000\012é", 15 },
|
||||
/* 12*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, -1, "12345623456\000\012\351", 14, "", "", -1 }, /* None */
|
||||
/* 13*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, BARCODE_RAW_TEXT, "12345623456\000\012\351", 14, "", "12345623456\000\012\351", 14 },
|
||||
/* 14*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, -1, -1, -1, "H123ABC01234567890", -1, "", "", -1 }, /* None */
|
||||
/* 15*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, -1, -1, BARCODE_RAW_TEXT, "H123ABC01234567890", -1, "", "+H123ABC01234567890D", -1 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -295,10 +311,11 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/,
|
||||
data[i].option_1, data[i].option_2, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = data[i].expected_raw_length == -1 ? (int) strlen(data[i].expected_raw) : data[i].expected_raw_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -307,6 +324,19 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(memcmp(symbol->text, data[i].expected, expected_length), "i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->text, data[i].expected, expected_length);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%.*s, %.*s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, expected_raw_length,
|
||||
data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -328,6 +358,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int expected_rows;
|
||||
int expected_width;
|
||||
int bwipp_cmp;
|
||||
int zxingcpp_cmp;
|
||||
const char *expected;
|
||||
const char *comment;
|
||||
};
|
||||
|
@ -347,59 +378,59 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
ÿ U+00FF (\377, 255), UTF-8 C3BF, CodeB-only extended ASCII
|
||||
*/
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "A", -1, 0, 2, 101, 1, "67 64 40 21 63 64 63 42 6A 67 64 0B 63 64 2B 40 4F 6A", "Fillings 5" },
|
||||
/* 1*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAA", -1, 0, 2, 101, 1, "67 64 40 21 21 21 63 55 6A 67 64 0B 63 64 0E 57 48 6A", "Fillings 3" },
|
||||
/* 2*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAAA", -1, 0, 2, 101, 1, "67 64 40 21 21 21 21 65 6A 67 64 0B 63 64 1A 0E 03 6A", "Fillings 2" },
|
||||
/* 3*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAAAA", -1, 0, 2, 101, 1, "67 64 40 21 21 21 21 65 6A 67 64 0B 21 63 1D 30 14 6A", "Fillings 1" },
|
||||
/* 4*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAAAAA", -1, 0, 2, 101, 1, "67 64 40 21 21 21 21 65 6A 67 64 0B 21 21 35 5D 2B 6A", "Fillings 0" },
|
||||
/* 5*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "1234", -1, 0, 2, 101, 1, "67 63 00 0C 22 64 63 1A 6A 67 64 0B 63 64 3A 1C 29 6A", "Fillings 4" },
|
||||
/* 6*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "12345", -1, 0, 2, 101, 1, "67 63 00 0C 22 64 15 49 6A 67 64 0B 63 64 41 44 07 6A", "Fillings 2 (not counting CodeB at end of 1st line)" },
|
||||
/* 7*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "123456", -1, 0, 2, 101, 1, "67 63 00 0C 22 38 64 12 6A 67 64 0B 63 64 2D 50 52 6A", "Fillings 3" },
|
||||
/* 8*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "1234567", -1, 0, 2, 101, 1, "67 63 00 0C 22 38 64 12 6A 67 64 0B 17 63 16 02 5B 6A", "Fillings 1 (not counting CodeB at end of 1st line)" },
|
||||
/* 9*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "12345678", -1, 0, 2, 101, 1, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 63 64 08 1C 64 6A", "Fillings 2" },
|
||||
/* 10*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "123456789", -1, 0, 2, 101, 1, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 19 63 25 4C 65 6A", "Fillings 1" },
|
||||
/* 11*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "1234567890", -1, 0, 2, 101, 0, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 19 10 41 38 62 6A", "Fillings 0; BWIPP different encodation (CodeB 9 0 instead of CodeC 90" },
|
||||
/* 12*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "A123ñ", -1, 0, 2, 101, 1, "67 64 40 21 11 12 13 54 6A 67 64 0B 64 51 42 28 50 6A", "K1/K2 example in Annex F" },
|
||||
/* 13*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aß", -1, 0, 2, 101, 1, "67 64 40 41 64 3F 63 54 6A 67 64 0B 63 64 5B 1D 06 6A", "CodeB a FNC4 ß fits 1st line" },
|
||||
/* 14*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037ß", -1, 0, 2, 101, 1, "67 62 40 5F 65 3F 63 49 6A 67 64 0B 63 64 0F 1D 26 6A", "CodeA US FNC4 ß fits 1st line" },
|
||||
/* 15*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaß", -1, 0, 2, 101, 1, "67 64 40 41 41 64 3F 10 6A 67 64 0B 63 64 4E 5B 04 6A", "CodeB a a FNC4 ß fits 1st line" },
|
||||
/* 16*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037ß", -1, 0, 2, 101, 1, "67 62 40 5F 5F 65 3F 17 6A 67 64 0B 63 64 34 0F 24 6A", "CodeA US US FNC4 ß fits 1st line" },
|
||||
/* 17*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaaß", -1, 0, 2, 101, 1, "67 64 40 41 41 41 63 39 6A 67 64 0B 64 3F 4C 4E 50 6A", "CodeB a (3) / CodeB FNC4 ß fully on next line" },
|
||||
/* 18*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037\037ß", -1, 0, 2, 101, 1, "67 62 40 5F 5F 5F 63 03 6A 67 64 0B 64 3F 0E 34 1A 6A", "CodeA US (3) / CodeB FNC4 ß fully on next line" },
|
||||
/* 19*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aà", -1, 0, 2, 101, 1, "67 64 40 41 64 40 63 59 6A 67 64 0B 63 64 5D 1E 16 6A", "CodeB a FNC4 à fits 1st line" },
|
||||
/* 20*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037à", -1, 0, 2, 101, 0, "67 62 40 5F 65 62 40 26 6A 67 64 0B 63 64 1B 1E 01 6A", "CodeA US FNC4 Shift à fits 1st line; BWIPP different encodation (CodeB instead of Shift)" },
|
||||
/* 21*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037àa", -1, 0, 2, 101, 0, "67 62 40 5F 64 64 40 2C 6A 67 64 0B 41 63 52 4A 16 6A", "CodeA US LatchB FNC4 à fits 1st line / Code B a; BWIPP diffent encodation (as above)" },
|
||||
/* 22*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaà", -1, 0, 2, 101, 1, "67 64 40 41 41 64 40 16 6A 67 64 0B 63 64 51 5D 1F 6A", "CodeB a a FNC4 à fits 1st line" },
|
||||
/* 23*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037à", -1, 0, 2, 101, 1, "67 62 40 5F 5F 63 64 1D 6A 67 64 0B 64 40 37 1B 55 6A", "CodeA US US / Code B FNC4 à fully on next line" },
|
||||
/* 24*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaaà", -1, 0, 2, 101, 1, "67 64 40 41 41 41 63 39 6A 67 64 0B 64 40 50 51 13 6A", "CodeB a (3) / Code B FNC4 à fully on next line" },
|
||||
/* 25*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037\037à", -1, 0, 2, 101, 1, "67 62 40 5F 5F 5F 63 03 6A 67 64 0B 64 40 1C 37 0F 6A", "CodeA US (3) / CodeB FNC4 à fully on next line" },
|
||||
/* 26*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\037\200", -1, 0, 2, 101, 1, "67 62 40 5F 65 40 63 4E 6A 67 64 0B 63 64 5D 0A 05 6A", "CodeA US FNC4 PAD fits 1st line" },
|
||||
/* 27*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\200", -1, 0, 2, 101, 0, "67 64 40 41 64 62 40 31 6A 67 64 0B 63 64 49 0A 08 6A", "CodeB a FNC4 Shift PAD fits 1st line; BWIPP different encodation (CodeA instead of Shift)" },
|
||||
/* 28*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\200\037", -1, 0, 2, 101, 0, "67 64 40 41 65 65 40 44 6A 67 62 0B 5F 63 10 12 3E 6A", "CodeB a LatchA FNC4 PAD fits 1st line / CodeA US; BWIPP diffent encodation (as above)" },
|
||||
/* 29*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\037\037\200", -1, 0, 2, 101, 1, "67 62 40 5F 5F 65 40 1D 6A 67 64 0B 63 64 0F 5D 0A 6A", "CodeA US US FNC4 PAD fits 1st line" },
|
||||
/* 30*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\141\200", -1, 0, 2, 101, 1, "67 64 40 41 41 63 64 1B 6A 67 62 0B 65 40 33 49 21 6A", "CodeB a a / CodeA FNC4 PAD fully on next line" },
|
||||
/* 31*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\037\037\037\200", -1, 0, 2, 101, 1, "67 62 40 5F 5F 5F 63 03 6A 67 62 0B 65 40 4A 0F 06 6A", "CodeA US (3) / CodeA FNC4 PAD fully on next line" },
|
||||
/* 32*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\141\141\200", -1, 0, 2, 101, 1, "67 64 40 41 41 41 63 39 6A 67 62 0B 65 40 28 33 34 6A", "CodeB a (3) / CodeA FNC4 PAD fully on next line" },
|
||||
/* 33*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, 10, "\200\240\237\340\337\341\377", -1, 0, 4, 112, 0, "(40) 67 62 42 65 40 65 00 63 1E 6A 67 62 0B 65 5F 64 64 40 55 6A 67 64 0C 64 3F 64 41 63", "BWIPP different encodation (CodeB before FNC4 instead of after)" },
|
||||
/* 34*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\000a\037\177}12", 7, 0, 3, 101, 1, "67 62 41 40 62 41 5F 3B 6A 67 64 0B 5F 5D 11 12 2D 6A 67 64 0C 63 64 40 05 26 6A", "" },
|
||||
/* 35*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "abcdéf", -1, 0, 3, 101, 1, "67 64 41 41 42 43 44 5D 6A 67 64 0B 64 49 46 63 0A 6A 67 64 0C 63 64 4F 26 02 6A", "" },
|
||||
/* 36*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "a12é\000", 6, 0, 3, 101, 0, "67 64 41 41 11 12 63 2C 6A 67 64 0B 64 49 62 40 2B 6A 67 64 0C 63 64 33 34 31 6A", "BWIPP different encodation (CodeA instead of Shift)" },
|
||||
/* 37*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, 11, "1234\001", -1, 0, 2, 123, 1, "67 63 00 0C 22 65 41 63 64 54 6A 67 64 0B 63 64 63 64 3F 20 24 6A", "" },
|
||||
/* 38*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 3, -1, "ÁÁÁÁÁÁ99999999999999ÁÁÁÁÁÁÁ99999999999999Á", -1, 0, 3, 244, 1, "(66) 67 64 41 64 21 64 21 64 21 64 21 64 21 64 21 63 63 63 63 63 56 6A 67 63 2B 63 63 63", "Latching to extended ASCII not used by `codablockf()` (see test_code128 Okapi)" },
|
||||
/* 39*/ { BARCODE_CODABLOCKF, DATA_MODE, 2, -1, "@g(\302\302\302\302\3025555\302\302\302\302\302\302\302\302", -1, 0, 2, 255, 1, "(46) 67 64 40 20 47 08 64 22 64 22 64 22 64 22 64 22 63 37 37 64 63 4B 6A 67 64 0B 64 22", "Must allow for FNC4 when testing if enough room when switching from CodeC" },
|
||||
/* 40*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿ\012àa\0121\012àAà", -1, 0, 5, 101, 0, "(45) 67 64 43 64 5F 65 4A 09 6A 67 64 0B 64 40 41 63 34 6A 67 62 0C 4A 11 4A 63 25 6A 67", "BWIPP different encoding (Shift instead of CodeA)" },
|
||||
/* 41*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 112, 0, "(70) 67 64 45 64 5F 59 11 12 2E 6A 67 62 0B 13 14 4A 63 64 43 6A 67 64 0C 64 40 41 65 4A", "BWIPP different encoding (Shift instead of CodeA)" },
|
||||
/* 42*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 8, 134, 0, "(96) 67 64 46 64 5F 63 0C 22 38 4E 5E 6A 67 62 0B 4A 64 64 40 63 0C 22 2B 6A 67 63 2C 38", "BWIPP different encoding (CodeB before FNC4 instead of after)" },
|
||||
/* 43*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé12345123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2" "B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé6789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\012123456à\012à\012à\0123Ä4Ä5Ä6AÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécéÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécéÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé", -1, 0, 44, 739, 0, "(2948) 67 63 2A 0C 22 38 4E 5A 0C 22 65 15 21 22 23 24 25 26 27 28 29 4A 63 0C 22 38 64", "BWIPP gs command too long" },
|
||||
/* 44*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890ààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄ2ÄÄÄÄÄÄ4ÄÄÄÄÄÄaÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\0122567890àààààABCDEFGààà\012\012\012HIJK\012\012\0122à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄ2Ä4ÄaÄé1é2é34é56Ä78é9éAéBéCééaébécé123456789012345ABCDEF\012123456ÿ123456\012à12345678abcdef\012\0121234\012\0127890àABCDà\012\012ààGHIJKàLMabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890ààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2", -1, 0, 33, 387, 0, "(1155) 67 64 5F 64 5F 63 0C 22 38 4E 65 4A 64 64 40 63 0C 22 38 4E 64 41 42 43 44 45 46", "BWIPP different encodation" },
|
||||
/* 45*/ { BARCODE_CODABLOCKF, DATA_MODE | ESCAPE_MODE, -1, -1, "\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09", -1, 0, 3, 101, 1, "67 62 41 41 42 43 44 5B 6A 67 62 0B 45 46 47 48 37 6A 67 62 0C 49 63 1B 44 2C 6A", "Okapi control-chars-1.png" },
|
||||
/* 46*/ { BARCODE_CODABLOCKF, DATA_MODE | ESCAPE_MODE, 4, -1, "\\x80\\x81\\x82\\x83\\x9E\\x9F\\xA0", -1, 0, 4, 101, 1, "(36) 67 62 42 65 40 65 41 24 6A 67 62 0B 65 42 65 43 31 6A 67 62 0C 65 5E 65 5F 16 6A 67", "Okapi control-chars-2.png" },
|
||||
/* 47*/ { BARCODE_CODABLOCKF, DATA_MODE | ESCAPE_MODE, -1, -1, "\\x00z", -1, 0, 2, 101, 0, "67 62 40 40 62 5A 63 00 6A 67 64 0B 63 64 32 04 3F 6A", "Okapi data-null-z.png; BWIPP different encodation" },
|
||||
/* 48*/ { BARCODE_CODABLOCKF, UNICODE_MODE | ESCAPE_MODE, -1, -1, "2610\\u00F2", -1, 0, 2, 101, 1, "67 63 00 1A 0A 64 63 4B 6A 67 64 0B 64 52 33 26 64 6A", "Okapi data-fuzz-19.png" },
|
||||
/* 49*/ { BARCODE_CODABLOCKF, DATA_MODE | ESCAPE_MODE, 7, -1, "*\\r\\xF2\\x82\\x82(\\x982\\x82\\x82*\\r\\xF2\\x82\\xA8\\x82\\x82\\x82\\x82", -1, 0, 7, 123, 0, "(77) 67 62 45 0A 4D 64 64 52 63 35 6A 67 62 0B 65 42 65 42 08 63 43 6A 67 62 0C 65 58 12", "Okapi data-fuzz-20.png; BWIPP different encodation" },
|
||||
/* 50*/ { BARCODE_CODABLOCKF, UNICODE_MODE | ESCAPE_MODE, -1, -1, "\\u0018\\u00F2", -1, 0, 2, 101, 0, "67 62 40 58 65 62 52 16 6A 67 64 0B 63 64 38 30 30 6A", "Okapi data-fuzz-21.png; BWIPP different encodation" },
|
||||
/* 51*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, -1, -1, "A99912345/$$52001510X3", -1, 0, 6, 101, 1, "(54) 67 64 44 0B 21 19 19 3A 6A 67 63 2B 5B 17 2D 64 24 6A 67 64 0C 0F 04 04 15 16 6A 67", "" },
|
||||
/* 52*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, -1, -1, "A99912345/$$520:1510X3", -1, ZINT_ERROR_INVALID_DATA, -1, -1, 1, "Error 203: Invalid character at position 16 in input (alphanumerics, space and \"-.$/+%\" only)", "" },
|
||||
/* 0*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "A", -1, 0, 2, 101, 1, 1, "67 64 40 21 63 64 63 42 6A 67 64 0B 63 64 2B 40 4F 6A", "Fillings 5" },
|
||||
/* 1*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAA", -1, 0, 2, 101, 1, 1, "67 64 40 21 21 21 63 55 6A 67 64 0B 63 64 0E 57 48 6A", "Fillings 3" },
|
||||
/* 2*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAAA", -1, 0, 2, 101, 1, 1, "67 64 40 21 21 21 21 65 6A 67 64 0B 63 64 1A 0E 03 6A", "Fillings 2" },
|
||||
/* 3*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAAAA", -1, 0, 2, 101, 1, 1, "67 64 40 21 21 21 21 65 6A 67 64 0B 21 63 1D 30 14 6A", "Fillings 1" },
|
||||
/* 4*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAAAAA", -1, 0, 2, 101, 1, 1, "67 64 40 21 21 21 21 65 6A 67 64 0B 21 21 35 5D 2B 6A", "Fillings 0" },
|
||||
/* 5*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "1234", -1, 0, 2, 101, 1, 1, "67 63 00 0C 22 64 63 1A 6A 67 64 0B 63 64 3A 1C 29 6A", "Fillings 4" },
|
||||
/* 6*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "12345", -1, 0, 2, 101, 1, 1, "67 63 00 0C 22 64 15 49 6A 67 64 0B 63 64 41 44 07 6A", "Fillings 2 (not counting CodeB at end of 1st line)" },
|
||||
/* 7*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "123456", -1, 0, 2, 101, 1, 1, "67 63 00 0C 22 38 64 12 6A 67 64 0B 63 64 2D 50 52 6A", "Fillings 3" },
|
||||
/* 8*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "1234567", -1, 0, 2, 101, 1, 1, "67 63 00 0C 22 38 64 12 6A 67 64 0B 17 63 16 02 5B 6A", "Fillings 1 (not counting CodeB at end of 1st line)" },
|
||||
/* 9*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "12345678", -1, 0, 2, 101, 1, 1, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 63 64 08 1C 64 6A", "Fillings 2" },
|
||||
/* 10*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "123456789", -1, 0, 2, 101, 1, 1, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 19 63 25 4C 65 6A", "Fillings 1" },
|
||||
/* 11*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "1234567890", -1, 0, 2, 101, 0, 1, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 19 10 41 38 62 6A", "Fillings 0; BWIPP different encodation (CodeB 9 0 instead of CodeC 90" },
|
||||
/* 12*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "A123ñ", -1, 0, 2, 101, 1, 1, "67 64 40 21 11 12 13 54 6A 67 64 0B 64 51 42 28 50 6A", "K1/K2 example in Annex F" },
|
||||
/* 13*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aß", -1, 0, 2, 101, 1, 1, "67 64 40 41 64 3F 63 54 6A 67 64 0B 63 64 5B 1D 06 6A", "CodeB a FNC4 ß fits 1st line" },
|
||||
/* 14*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037ß", -1, 0, 2, 101, 1, 1, "67 62 40 5F 65 3F 63 49 6A 67 64 0B 63 64 0F 1D 26 6A", "CodeA US FNC4 ß fits 1st line" },
|
||||
/* 15*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaß", -1, 0, 2, 101, 1, 1, "67 64 40 41 41 64 3F 10 6A 67 64 0B 63 64 4E 5B 04 6A", "CodeB a a FNC4 ß fits 1st line" },
|
||||
/* 16*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037ß", -1, 0, 2, 101, 1, 1, "67 62 40 5F 5F 65 3F 17 6A 67 64 0B 63 64 34 0F 24 6A", "CodeA US US FNC4 ß fits 1st line" },
|
||||
/* 17*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaaß", -1, 0, 2, 101, 1, 1, "67 64 40 41 41 41 63 39 6A 67 64 0B 64 3F 4C 4E 50 6A", "CodeB a (3) / CodeB FNC4 ß fully on next line" },
|
||||
/* 18*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037\037ß", -1, 0, 2, 101, 1, 1, "67 62 40 5F 5F 5F 63 03 6A 67 64 0B 64 3F 0E 34 1A 6A", "CodeA US (3) / CodeB FNC4 ß fully on next line" },
|
||||
/* 19*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aà", -1, 0, 2, 101, 1, 1, "67 64 40 41 64 40 63 59 6A 67 64 0B 63 64 5D 1E 16 6A", "CodeB a FNC4 à fits 1st line" },
|
||||
/* 20*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037à", -1, 0, 2, 101, 0, 1, "67 62 40 5F 65 62 40 26 6A 67 64 0B 63 64 1B 1E 01 6A", "CodeA US FNC4 Shift à fits 1st line; BWIPP different encodation (CodeB instead of Shift)" },
|
||||
/* 21*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037àa", -1, 0, 2, 101, 0, 1, "67 62 40 5F 64 64 40 2C 6A 67 64 0B 41 63 52 4A 16 6A", "CodeA US LatchB FNC4 à fits 1st line / Code B a; BWIPP diffent encodation (as above)" },
|
||||
/* 22*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaà", -1, 0, 2, 101, 1, 1, "67 64 40 41 41 64 40 16 6A 67 64 0B 63 64 51 5D 1F 6A", "CodeB a a FNC4 à fits 1st line" },
|
||||
/* 23*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037à", -1, 0, 2, 101, 1, 1, "67 62 40 5F 5F 63 64 1D 6A 67 64 0B 64 40 37 1B 55 6A", "CodeA US US / Code B FNC4 à fully on next line" },
|
||||
/* 24*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaaà", -1, 0, 2, 101, 1, 1, "67 64 40 41 41 41 63 39 6A 67 64 0B 64 40 50 51 13 6A", "CodeB a (3) / Code B FNC4 à fully on next line" },
|
||||
/* 25*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037\037à", -1, 0, 2, 101, 1, 1, "67 62 40 5F 5F 5F 63 03 6A 67 64 0B 64 40 1C 37 0F 6A", "CodeA US (3) / CodeB FNC4 à fully on next line" },
|
||||
/* 26*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\037\200", -1, 0, 2, 101, 1, 899, "67 62 40 5F 65 40 63 4E 6A 67 64 0B 63 64 5D 0A 05 6A", "CodeA US FNC4 PAD fits 1st line" },
|
||||
/* 27*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\200", -1, 0, 2, 101, 0, 899, "67 64 40 41 64 62 40 31 6A 67 64 0B 63 64 49 0A 08 6A", "CodeB a FNC4 Shift PAD fits 1st line; BWIPP different encodation (CodeA instead of Shift)" },
|
||||
/* 28*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\200\037", -1, 0, 2, 101, 0, 899, "67 64 40 41 65 65 40 44 6A 67 62 0B 5F 63 10 12 3E 6A", "CodeB a LatchA FNC4 PAD fits 1st line / CodeA US; BWIPP diffent encodation (as above)" },
|
||||
/* 29*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\037\037\200", -1, 0, 2, 101, 1, 899, "67 62 40 5F 5F 65 40 1D 6A 67 64 0B 63 64 0F 5D 0A 6A", "CodeA US US FNC4 PAD fits 1st line" },
|
||||
/* 30*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\141\200", -1, 0, 2, 101, 1, 899, "67 64 40 41 41 63 64 1B 6A 67 62 0B 65 40 33 49 21 6A", "CodeB a a / CodeA FNC4 PAD fully on next line" },
|
||||
/* 31*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\037\037\037\200", -1, 0, 2, 101, 1, 899, "67 62 40 5F 5F 5F 63 03 6A 67 62 0B 65 40 4A 0F 06 6A", "CodeA US (3) / CodeA FNC4 PAD fully on next line" },
|
||||
/* 32*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\141\141\200", -1, 0, 2, 101, 1, 899, "67 64 40 41 41 41 63 39 6A 67 62 0B 65 40 28 33 34 6A", "CodeB a (3) / CodeA FNC4 PAD fully on next line" },
|
||||
/* 33*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, 10, "\200\240\237\340\337\341\377", -1, 0, 4, 112, 0, 899, "(40) 67 62 42 65 40 65 00 63 1E 6A 67 62 0B 65 5F 64 64 40 55 6A 67 64 0C 64 3F 64 41 63", "BWIPP different encodation (CodeB before FNC4 instead of after)" },
|
||||
/* 34*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\000a\037\177}12", 7, 0, 3, 101, 1, 1, "67 62 41 40 62 41 5F 3B 6A 67 64 0B 5F 5D 11 12 2D 6A 67 64 0C 63 64 40 05 26 6A", "" },
|
||||
/* 35*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "abcdéf", -1, 0, 3, 101, 1, 1, "67 64 41 41 42 43 44 5D 6A 67 64 0B 64 49 46 63 0A 6A 67 64 0C 63 64 4F 26 02 6A", "" },
|
||||
/* 36*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "a12é\000", 6, 0, 3, 101, 0, 1, "67 64 41 41 11 12 63 2C 6A 67 64 0B 64 49 62 40 2B 6A 67 64 0C 63 64 33 34 31 6A", "BWIPP different encodation (CodeA instead of Shift)" },
|
||||
/* 37*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, 11, "1234\001", -1, 0, 2, 123, 1, 1, "67 63 00 0C 22 65 41 63 64 54 6A 67 64 0B 63 64 63 64 3F 20 24 6A", "" },
|
||||
/* 38*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 3, -1, "ÁÁÁÁÁÁ99999999999999ÁÁÁÁÁÁÁ99999999999999Á", -1, 0, 3, 244, 1, 1, "(66) 67 64 41 64 21 64 21 64 21 64 21 64 21 64 21 63 63 63 63 63 56 6A 67 63 2B 63 63 63", "Latching to extended ASCII not used by `codablockf()` (see test_code128 Okapi)" },
|
||||
/* 39*/ { BARCODE_CODABLOCKF, DATA_MODE, 2, -1, "@g(\302\302\302\302\3025555\302\302\302\302\302\302\302\302", -1, 0, 2, 255, 1, 899, "(46) 67 64 40 20 47 08 64 22 64 22 64 22 64 22 64 22 63 37 37 64 63 4B 6A 67 64 0B 64 22", "Must allow for FNC4 when testing if enough room when switching from CodeC" },
|
||||
/* 40*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿ\012àa\0121\012àAà", -1, 0, 5, 101, 0, 1, "(45) 67 64 43 64 5F 65 4A 09 6A 67 64 0B 64 40 41 63 34 6A 67 62 0C 4A 11 4A 63 25 6A 67", "BWIPP different encoding (Shift instead of CodeA)" },
|
||||
/* 41*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 112, 0, 1, "(70) 67 64 45 64 5F 59 11 12 2E 6A 67 62 0B 13 14 4A 63 64 43 6A 67 64 0C 64 40 41 65 4A", "BWIPP different encoding (Shift instead of CodeA)" },
|
||||
/* 42*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 8, 134, 0, 1, "(96) 67 64 46 64 5F 63 0C 22 38 4E 5E 6A 67 62 0B 4A 64 64 40 63 0C 22 2B 6A 67 63 2C 38", "BWIPP different encoding (CodeB before FNC4 instead of after)" },
|
||||
/* 43*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé12345123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2" "B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé6789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\012123456à\012à\012à\0123Ä4Ä5Ä6AÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécéÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécéÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé", -1, 0, 44, 739, 0, 1, "(2948) 67 63 2A 0C 22 38 4E 5A 0C 22 65 15 21 22 23 24 25 26 27 28 29 4A 63 0C 22 38 64", "BWIPP gs command too long" },
|
||||
/* 44*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890ààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄ2ÄÄÄÄÄÄ4ÄÄÄÄÄÄaÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\0122567890àààààABCDEFGààà\012\012\012HIJK\012\012\0122à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄ2Ä4ÄaÄé1é2é34é56Ä78é9éAéBéCééaébécé123456789012345ABCDEF\012123456ÿ123456\012à12345678abcdef\012\0121234\012\0127890àABCDà\012\012ààGHIJKàLMabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890ààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2", -1, 0, 33, 387, 0, 1, "(1155) 67 64 5F 64 5F 63 0C 22 38 4E 65 4A 64 64 40 63 0C 22 38 4E 64 41 42 43 44 45 46", "BWIPP different encodation" },
|
||||
/* 45*/ { BARCODE_CODABLOCKF, DATA_MODE | ESCAPE_MODE, -1, -1, "\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09", -1, 0, 3, 101, 1, 1, "67 62 41 41 42 43 44 5B 6A 67 62 0B 45 46 47 48 37 6A 67 62 0C 49 63 1B 44 2C 6A", "Okapi control-chars-1.png" },
|
||||
/* 46*/ { BARCODE_CODABLOCKF, DATA_MODE | ESCAPE_MODE, 4, -1, "\\x80\\x81\\x82\\x83\\x9E\\x9F\\xA0", -1, 0, 4, 101, 1, 899, "(36) 67 62 42 65 40 65 41 24 6A 67 62 0B 65 42 65 43 31 6A 67 62 0C 65 5E 65 5F 16 6A 67", "Okapi control-chars-2.png" },
|
||||
/* 47*/ { BARCODE_CODABLOCKF, DATA_MODE | ESCAPE_MODE, -1, -1, "\\x00z", -1, 0, 2, 101, 0, 1, "67 62 40 40 62 5A 63 00 6A 67 64 0B 63 64 32 04 3F 6A", "Okapi data-null-z.png; BWIPP different encodation" },
|
||||
/* 48*/ { BARCODE_CODABLOCKF, UNICODE_MODE | ESCAPE_MODE, -1, -1, "2610\\u00F2", -1, 0, 2, 101, 1, 1, "67 63 00 1A 0A 64 63 4B 6A 67 64 0B 64 52 33 26 64 6A", "Okapi data-fuzz-19.png" },
|
||||
/* 49*/ { BARCODE_CODABLOCKF, DATA_MODE | ESCAPE_MODE, 7, -1, "*\\r\\xF2\\x82\\x82(\\x982\\x82\\x82*\\r\\xF2\\x82\\xA8\\x82\\x82\\x82\\x82", -1, 0, 7, 123, 0, 899, "(77) 67 62 45 0A 4D 64 64 52 63 35 6A 67 62 0B 65 42 65 42 08 63 43 6A 67 62 0C 65 58 12", "Okapi data-fuzz-20.png; BWIPP different encodation" },
|
||||
/* 50*/ { BARCODE_CODABLOCKF, UNICODE_MODE | ESCAPE_MODE, -1, -1, "\\u0018\\u00F2", -1, 0, 2, 101, 0, 1, "67 62 40 58 65 62 52 16 6A 67 64 0B 63 64 38 30 30 6A", "Okapi data-fuzz-21.png; BWIPP different encodation" },
|
||||
/* 51*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, -1, -1, "A99912345/$$52001510X3", -1, 0, 6, 101, 1, 1, "(54) 67 64 44 0B 21 19 19 3A 6A 67 63 2B 5B 17 2D 64 24 6A 67 64 0C 0F 04 04 15 16 6A 67", "" },
|
||||
/* 52*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, -1, -1, "A99912345/$$520:1510X3", -1, ZINT_ERROR_INVALID_DATA, -1, -1, 1, 1, "Error 203: Invalid character at position 16 in input (alphanumerics, space and \"-.$/+%\" only)", "" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
@ -409,10 +440,11 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
char cmp_buf[32768];
|
||||
char cmp_msg[32768];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -423,16 +455,20 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
symbol->debug = ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */
|
||||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/,
|
||||
data[i].option_1, data[i].option_2, -1 /*option_3*/, -1 /*output_options*/,
|
||||
data[i].data, data[i].length, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(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 (p_ctx->generate) {
|
||||
printf(" /*%3d*/ { %s, %s, %d, %d, \"%s\", %d, %s, %d, %d, %d, \"%s\", \"%s\" },\n",
|
||||
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2,
|
||||
printf(" /*%3d*/ { %s, %s, %d, %d, \"%s\", %d, %s, %d, %d, %d, %d, \"%s\", \"%s\" },\n",
|
||||
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
|
||||
data[i].option_1, data[i].option_2,
|
||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
|
||||
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, symbol->errtxt, data[i].comment);
|
||||
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp,
|
||||
data[i].zxingcpp_cmp, symbol->errtxt, data[i].comment);
|
||||
} else {
|
||||
assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
if (ret < ZINT_ERROR) {
|
||||
|
@ -456,13 +492,19 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[32768];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_nonzero(data[i].zxingcpp_cmp, "i:%d data[i].zxingcpp_cmp == 0", i);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, data[i].zxingcpp_cmp,
|
||||
cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -585,10 +627,11 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
char cmp_buf[8192];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -597,14 +640,18 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/,
|
||||
data[i].option_1, data[i].option_2, -1 /*option_3*/, -1 /*output_options*/,
|
||||
data[i].data, -1, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(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);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
printf(" /*%3d*/ { %s, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n",
|
||||
i, testUtilBarcodeName(data[i].symbology), data[i].option_1, data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||
i, testUtilBarcodeName(data[i].symbology), data[i].option_1, data[i].option_2,
|
||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
|
||||
testUtilModulesPrint(symbol, " ", "\n");
|
||||
printf(" },\n");
|
||||
|
@ -612,34 +659,48 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
if (ret < ZINT_ERROR) {
|
||||
int width, row;
|
||||
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
|
||||
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);
|
||||
|
||||
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
|
||||
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
|
||||
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row,
|
||||
data[i].data);
|
||||
|
||||
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) {
|
||||
if (!data[i].bwipp_cmp) {
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) {
|
||||
printf("i:%d %s not BWIPP compatible (%s)\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
}
|
||||
} else {
|
||||
ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length,
|
||||
NULL, cmp_buf, sizeof(cmp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i,
|
||||
testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected);
|
||||
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf,
|
||||
data[i].expected);
|
||||
}
|
||||
}
|
||||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[4096];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf,
|
||||
ret_len, escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -661,10 +722,11 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
int length;
|
||||
int ret;
|
||||
int bwipp_cmp;
|
||||
int zxingcpp_cmp;
|
||||
const char *comment;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { -1, -1, "\034\034I", 3, 0, 1, "" },
|
||||
/* 0*/ { -1, -1, "\034\034I", 3, 0, 1, 1, "" },
|
||||
/* 1*/ { 6, -2147483647 - 1 /*Suppress MSVC warning C4146*/,
|
||||
"\134\000\377\153\143\163\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061"
|
||||
"\071\065\062\000\000\000\000\061\061\061\061\061\061\366\366\366\366\366\366\366\366\366\366\007\366\366\366\366\366\366\366\061\061\061\061\061\061\061\061\061"
|
||||
|
@ -672,7 +734,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
"\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\312\061\061\061\061\061\061\061"
|
||||
"\061\366\366\366\366\366\366\366\366\366\366\007\366\366\366\366\366\366\366\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\323\323\323\323\000"
|
||||
"\200\135\000\362\362\362\362\000\167\027\000\000\000\000\000\000\000\000\000\167\167\167\167\000\000\000\154\000\043\000\000\000\000\000\000\000\000\153",
|
||||
238, 0, 0, "BWIPP different (better) encodation"
|
||||
238, 0, 0, 899, "BWIPP different (better) encodation"
|
||||
}, /* #300 (#9) Andre Maute */
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
|
@ -683,10 +745,11 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
char cmp_buf[32768];
|
||||
char cmp_msg[32768];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_fuzz", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -719,13 +782,19 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[32768];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_nonzero(data[i].zxingcpp_cmp, "i:%d data[i].zxingcpp_cmp == 0", i);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, data[i].zxingcpp_cmp, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/,
|
||||
escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[4096];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -117,80 +117,82 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
const char *expected_raw;
|
||||
int expected_raw_length;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_CODE39, -1, -1, "ABC1234", -1, "*ABC1234*", -1 },
|
||||
/* 1*/ { BARCODE_CODE39, -1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC1234", -1 },
|
||||
/* 2*/ { BARCODE_CODE39, 1, -1, "ABC1234", -1, "*ABC12340*", -1 }, /* With visible check digit */
|
||||
/* 3*/ { BARCODE_CODE39, 1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC12340", -1 },
|
||||
/* 4*/ { BARCODE_CODE39, -1, -1, "abc1234", -1, "*ABC1234*", -1 }, /* Converts to upper */
|
||||
/* 5*/ { BARCODE_CODE39, -1, BARCODE_RAW_TEXT, "abc1234", -1, "ABC1234", -1 },
|
||||
/* 6*/ { BARCODE_CODE39, 1, -1, "abc1234", -1, "*ABC12340*", -1 }, /* Converts to upper */
|
||||
/* 7*/ { BARCODE_CODE39, 1, BARCODE_RAW_TEXT, "abc1234", -1, "ABC12340", -1 },
|
||||
/* 8*/ { BARCODE_CODE39, 1, -1, "ab", -1, "*ABL*", -1 }, /* Converts to upper */
|
||||
/* 9*/ { BARCODE_CODE39, 1, BARCODE_RAW_TEXT, "ab", -1, "ABL", -1 },
|
||||
/* 10*/ { BARCODE_CODE39, -1, -1, "123456789", -1, "*123456789*", -1 },
|
||||
/* 11*/ { BARCODE_CODE39, -1, BARCODE_RAW_TEXT, "123456789", -1, "123456789", -1 },
|
||||
/* 12*/ { BARCODE_CODE39, 1, -1, "123456789", -1, "*1234567892*", -1 }, /* With visible check digit */
|
||||
/* 13*/ { BARCODE_CODE39, 1, BARCODE_RAW_TEXT, "123456789", -1, "1234567892", -1 },
|
||||
/* 14*/ { BARCODE_CODE39, 2, -1, "123456789", -1, "*123456789*", -1 }, /* With hidden check digit */
|
||||
/* 15*/ { BARCODE_CODE39, 2, BARCODE_RAW_TEXT, "123456789", -1, "1234567892", -1 }, /* Includes check digit */
|
||||
/* 16*/ { BARCODE_EXCODE39, -1, -1, "ABC1234", -1, "ABC1234", -1 },
|
||||
/* 17*/ { BARCODE_EXCODE39, -1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC1234", -1 },
|
||||
/* 18*/ { BARCODE_EXCODE39, 1, -1, "ABC1234", -1, "ABC12340", -1 }, /* With visible check digit */
|
||||
/* 19*/ { BARCODE_EXCODE39, 1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC12340", -1 },
|
||||
/* 20*/ { BARCODE_EXCODE39, -1, -1, "abc1234", -1, "abc1234", -1 },
|
||||
/* 21*/ { BARCODE_EXCODE39, -1, BARCODE_RAW_TEXT, "abc1234", -1, "abc1234", -1 },
|
||||
/* 22*/ { BARCODE_EXCODE39, 1, -1, "abc1234", -1, "abc1234.", -1 }, /* With visible check digit (previously was hidden) */
|
||||
/* 23*/ { BARCODE_EXCODE39, 1, BARCODE_RAW_TEXT, "abc1234", -1, "abc1234.", -1 },
|
||||
/* 24*/ { BARCODE_EXCODE39, 2, -1, "abc1234", -1, "abc1234", -1 }, /* With hidden check digit */
|
||||
/* 25*/ { BARCODE_EXCODE39, 2, BARCODE_RAW_TEXT, "abc1234", -1, "abc1234.", -1 }, /* Includes check digit */
|
||||
/* 26*/ { BARCODE_EXCODE39, -1, -1, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~", -1 }, /* NUL, ctrls and DEL replaced with spaces */
|
||||
/* 27*/ { BARCODE_EXCODE39, -1, BARCODE_RAW_TEXT, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a%\000\001$\177z\033\037!+/\\@A~", 16 }, /* No replacements */
|
||||
/* 28*/ { BARCODE_EXCODE39, 1, -1, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~L", -1 }, /* With visible check digit */
|
||||
/* 29*/ { BARCODE_EXCODE39, 1, BARCODE_RAW_TEXT, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a%\000\001$\177z\033\037!+/\\@A~L", 17 },
|
||||
/* 30*/ { BARCODE_EXCODE39, 2, -1, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~", -1 }, /* With hidden check digit */
|
||||
/* 31*/ { BARCODE_EXCODE39, 2, BARCODE_RAW_TEXT, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a%\000\001$\177z\033\037!+/\\@A~L", 17 }, /* Includes check digit */
|
||||
/* 32*/ { BARCODE_LOGMARS, -1, -1, "ABC1234", -1, "ABC1234", -1 },
|
||||
/* 33*/ { BARCODE_LOGMARS, -1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC1234", -1 },
|
||||
/* 34*/ { BARCODE_LOGMARS, -1, -1, "abc1234", -1, "ABC1234", -1 }, /* Converts to upper */
|
||||
/* 35*/ { BARCODE_LOGMARS, -1, BARCODE_RAW_TEXT, "abc1234", -1, "ABC1234", -1 },
|
||||
/* 36*/ { BARCODE_LOGMARS, 1, -1, "abc1234", -1, "ABC12340", -1 }, /* With check digit */
|
||||
/* 37*/ { BARCODE_LOGMARS, 1, BARCODE_RAW_TEXT, "abc1234", -1, "ABC12340", -1 },
|
||||
/* 38*/ { BARCODE_LOGMARS, 1, -1, "12345/ABCDE", -1, "12345/ABCDET", -1 }, /* With visible check digit */
|
||||
/* 39*/ { BARCODE_LOGMARS, 1, BARCODE_RAW_TEXT, "12345/ABCDE", -1, "12345/ABCDET", -1 },
|
||||
/* 40*/ { BARCODE_LOGMARS, 2, -1, "12345/ABCDE", -1, "12345/ABCDE", -1 }, /* With hidden check digit */
|
||||
/* 41*/ { BARCODE_LOGMARS, 2, BARCODE_RAW_TEXT, "12345/ABCDE", -1, "12345/ABCDET", -1 }, /* Includes check digit */
|
||||
/* 42*/ { BARCODE_CODE93, -1, -1, "ABC1234", -1, "ABC1234", -1 }, /* No longer shows 2 check chars added (same as BWIPP and TEC-IT) */
|
||||
/* 43*/ { BARCODE_CODE93, -1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC1234S5", -1 }, /* Unless BARCODE_RAW_TEXT */
|
||||
/* 44*/ { BARCODE_CODE93, 1, -1, "ABC1234", -1, "ABC1234S5", -1 }, /* Unless requested */
|
||||
/* 45*/ { BARCODE_CODE93, 1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC1234S5", -1 },
|
||||
/* 46*/ { BARCODE_CODE93, -1, -1, "abc1234", -1, "abc1234", -1 },
|
||||
/* 47*/ { BARCODE_CODE93, -1, BARCODE_RAW_TEXT, "abc1234", -1, "abc1234ZG", -1 },
|
||||
/* 48*/ { BARCODE_CODE93, 1, -1, "abc1234", -1, "abc1234ZG", -1 },
|
||||
/* 49*/ { BARCODE_CODE93, 1, BARCODE_RAW_TEXT, "abc1234", -1, "abc1234ZG", -1 },
|
||||
/* 50*/ { BARCODE_CODE93, -1, -1, "A\001a\000b\177d\037e", 9, "A a b d e", -1 }, /* NUL, ctrls and DEL replaced with spaces */
|
||||
/* 51*/ { BARCODE_CODE93, -1, BARCODE_RAW_TEXT, "A\001a\000b\177d\037e", 9, "A\001a\000b\177d\037e1R", 11 }, /* No replacements */
|
||||
/* 52*/ { BARCODE_CODE93, 1, -1, "A\001a\000b\177d\037e", 9, "A a b d e1R", -1 },
|
||||
/* 53*/ { BARCODE_CODE93, 1, BARCODE_RAW_TEXT, "A\001a\000b\177d\037e", 9, "A\001a\000b\177d\037e1R", 11 },
|
||||
/* 54*/ { BARCODE_VIN, -1, -1, "1FTCR10UXTPA78180", -1, "1FTCR10UXTPA78180", -1 },
|
||||
/* 55*/ { BARCODE_VIN, -1, BARCODE_RAW_TEXT, "1FTCR10UXTPA78180", -1, "1FTCR10UXTPA78180", -1 },
|
||||
/* 56*/ { BARCODE_VIN, 1, -1, "2FTPX28L0XCA15511", -1, "2FTPX28L0XCA15511", -1 }, /* Include Import char - no change */
|
||||
/* 57*/ { BARCODE_VIN, 1, BARCODE_RAW_TEXT, "2FTPX28L0XCA15511", -1, "I2FTPX28L0XCA15511", -1 }, /* Unless BARCODE_RAW_TEXT */
|
||||
/* 58*/ { BARCODE_HIBC_39, -1, -1, "ABC1234", -1, "*+ABC1234+*", -1 },
|
||||
/* 59*/ { BARCODE_HIBC_39, -1, BARCODE_RAW_TEXT, "ABC1234", -1, "+ABC1234+", -1 },
|
||||
/* 60*/ { BARCODE_HIBC_39, -1, -1, "abc1234", -1, "*+ABC1234+*", -1 }, /* Converts to upper */
|
||||
/* 61*/ { BARCODE_HIBC_39, -1, BARCODE_RAW_TEXT, "abc1234", -1, "+ABC1234+", -1 },
|
||||
/* 62*/ { BARCODE_HIBC_39, -1, -1, "123456789", -1, "*+1234567890*", -1 },
|
||||
/* 63*/ { BARCODE_HIBC_39, -1, BARCODE_RAW_TEXT, "123456789", -1, "+1234567890", -1 },
|
||||
/* 0*/ { BARCODE_CODE39, -1, -1, "ABC1234", -1, "*ABC1234*", -1, "", -1 },
|
||||
/* 1*/ { BARCODE_CODE39, -1, BARCODE_RAW_TEXT, "ABC1234", -1, "*ABC1234*", -1, "ABC1234", -1 },
|
||||
/* 2*/ { BARCODE_CODE39, 1, -1, "ABC1234", -1, "*ABC12340*", -1, "", -1 }, /* With visible check digit */
|
||||
/* 3*/ { BARCODE_CODE39, 1, BARCODE_RAW_TEXT, "ABC1234", -1, "*ABC12340*", -1, "ABC12340", -1 },
|
||||
/* 4*/ { BARCODE_CODE39, -1, -1, "abc1234", -1, "*ABC1234*", -1, "", -1 }, /* Converts to upper */
|
||||
/* 5*/ { BARCODE_CODE39, -1, BARCODE_RAW_TEXT, "abc1234", -1, "*ABC1234*", -1, "ABC1234", -1 },
|
||||
/* 6*/ { BARCODE_CODE39, 1, -1, "abc1234", -1, "*ABC12340*", -1, "", -1 }, /* Converts to upper */
|
||||
/* 7*/ { BARCODE_CODE39, 1, BARCODE_RAW_TEXT, "abc1234", -1, "*ABC12340*", -1, "ABC12340", -1 },
|
||||
/* 8*/ { BARCODE_CODE39, 1, -1, "ab", -1, "*ABL*", -1, "", -1 }, /* Converts to upper */
|
||||
/* 9*/ { BARCODE_CODE39, 1, BARCODE_RAW_TEXT, "ab", -1, "*ABL*", -1, "ABL", -1 },
|
||||
/* 10*/ { BARCODE_CODE39, -1, -1, "123456789", -1, "*123456789*", -1, "", -1 },
|
||||
/* 11*/ { BARCODE_CODE39, -1, BARCODE_RAW_TEXT, "123456789", -1, "*123456789*", -1, "123456789", -1 },
|
||||
/* 12*/ { BARCODE_CODE39, 1, -1, "123456789", -1, "*1234567892*", -1, "", -1 }, /* With visible check digit */
|
||||
/* 13*/ { BARCODE_CODE39, 1, BARCODE_RAW_TEXT, "123456789", -1, "*1234567892*", -1, "1234567892", -1 },
|
||||
/* 14*/ { BARCODE_CODE39, 2, -1, "123456789", -1, "*123456789*", -1, "", -1 }, /* With hidden check digit */
|
||||
/* 15*/ { BARCODE_CODE39, 2, BARCODE_RAW_TEXT, "123456789", -1, "*123456789*", -1, "1234567892", -1 }, /* Includes check digit */
|
||||
/* 16*/ { BARCODE_EXCODE39, -1, -1, "ABC1234", -1, "ABC1234", -1, "", -1 },
|
||||
/* 17*/ { BARCODE_EXCODE39, -1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC1234", -1, "ABC1234", -1 },
|
||||
/* 18*/ { BARCODE_EXCODE39, 1, -1, "ABC1234", -1, "ABC12340", -1, "", -1 }, /* With visible check digit */
|
||||
/* 19*/ { BARCODE_EXCODE39, 1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC12340", -1, "ABC12340", -1 },
|
||||
/* 20*/ { BARCODE_EXCODE39, -1, -1, "abc1234", -1, "abc1234", -1, "", -1 },
|
||||
/* 21*/ { BARCODE_EXCODE39, -1, BARCODE_RAW_TEXT, "abc1234", -1, "abc1234", -1, "abc1234", -1 },
|
||||
/* 22*/ { BARCODE_EXCODE39, 1, -1, "abc1234", -1, "abc1234.", -1, "", -1 }, /* With visible check digit (previously was hidden) */
|
||||
/* 23*/ { BARCODE_EXCODE39, 1, BARCODE_RAW_TEXT, "abc1234", -1, "abc1234.", -1, "abc1234.", -1 },
|
||||
/* 24*/ { BARCODE_EXCODE39, 2, -1, "abc1234", -1, "abc1234", -1, "", -1 }, /* With hidden check digit */
|
||||
/* 25*/ { BARCODE_EXCODE39, 2, BARCODE_RAW_TEXT, "abc1234", -1, "abc1234", -1, "abc1234.", -1 }, /* Includes check digit */
|
||||
/* 26*/ { BARCODE_EXCODE39, -1, -1, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~", -1, "", -1 }, /* NUL, ctrls and DEL replaced with spaces */
|
||||
/* 27*/ { BARCODE_EXCODE39, -1, BARCODE_RAW_TEXT, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~", -1, "a%\000\001$\177z\033\037!+/\\@A~", 16 }, /* No replacements */
|
||||
/* 28*/ { BARCODE_EXCODE39, 1, -1, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~L", -1, "", -1 }, /* With visible check digit */
|
||||
/* 29*/ { BARCODE_EXCODE39, 1, BARCODE_RAW_TEXT, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~L", -1, "a%\000\001$\177z\033\037!+/\\@A~L", 17 },
|
||||
/* 30*/ { BARCODE_EXCODE39, 2, -1, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~", -1, "", -1 }, /* With hidden check digit */
|
||||
/* 31*/ { BARCODE_EXCODE39, 2, BARCODE_RAW_TEXT, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~", -1, "a%\000\001$\177z\033\037!+/\\@A~L", 17 }, /* Includes check digit */
|
||||
/* 32*/ { BARCODE_LOGMARS, -1, -1, "ABC1234", -1, "ABC1234", -1, "", -1 },
|
||||
/* 33*/ { BARCODE_LOGMARS, -1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC1234", -1, "ABC1234", -1 },
|
||||
/* 34*/ { BARCODE_LOGMARS, -1, -1, "abc1234", -1, "ABC1234", -1, "", -1 }, /* Converts to upper */
|
||||
/* 35*/ { BARCODE_LOGMARS, -1, BARCODE_RAW_TEXT, "abc1234", -1, "ABC1234", -1, "ABC1234", -1 },
|
||||
/* 36*/ { BARCODE_LOGMARS, 1, -1, "abc1234", -1, "ABC12340", -1, "", -1 }, /* With check digit */
|
||||
/* 37*/ { BARCODE_LOGMARS, 1, BARCODE_RAW_TEXT, "abc1234", -1, "ABC12340", -1, "ABC12340", -1 },
|
||||
/* 38*/ { BARCODE_LOGMARS, 1, -1, "12345/ABCDE", -1, "12345/ABCDET", -1, "", -1 }, /* With visible check digit */
|
||||
/* 39*/ { BARCODE_LOGMARS, 1, BARCODE_RAW_TEXT, "12345/ABCDE", -1, "12345/ABCDET", -1, "12345/ABCDET", -1 },
|
||||
/* 40*/ { BARCODE_LOGMARS, 2, -1, "12345/ABCDE", -1, "12345/ABCDE", -1, "", -1 }, /* With hidden check digit */
|
||||
/* 41*/ { BARCODE_LOGMARS, 2, BARCODE_RAW_TEXT, "12345/ABCDE", -1, "12345/ABCDE", -1, "12345/ABCDET", -1 }, /* Includes check digit */
|
||||
/* 42*/ { BARCODE_CODE93, -1, -1, "ABC1234", -1, "ABC1234", -1, "", -1 }, /* No longer shows 2 check chars added (same as BWIPP and TEC-IT) */
|
||||
/* 43*/ { BARCODE_CODE93, -1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC1234", -1, "ABC1234S5", -1 }, /* Unless BARCODE_RAW_TEXT */
|
||||
/* 44*/ { BARCODE_CODE93, 1, -1, "ABC1234", -1, "ABC1234S5", -1, "", -1 }, /* Unless requested */
|
||||
/* 45*/ { BARCODE_CODE93, 1, BARCODE_RAW_TEXT, "ABC1234", -1, "ABC1234S5", -1, "ABC1234S5", -1 },
|
||||
/* 46*/ { BARCODE_CODE93, -1, -1, "abc1234", -1, "abc1234", -1, "", -1 },
|
||||
/* 47*/ { BARCODE_CODE93, -1, BARCODE_RAW_TEXT, "abc1234", -1, "abc1234", -1, "abc1234ZG", -1 },
|
||||
/* 48*/ { BARCODE_CODE93, 1, -1, "abc1234", -1, "abc1234ZG", -1, "", -1 },
|
||||
/* 49*/ { BARCODE_CODE93, 1, BARCODE_RAW_TEXT, "abc1234", -1, "abc1234ZG", -1, "abc1234ZG", -1 },
|
||||
/* 50*/ { BARCODE_CODE93, -1, -1, "A\001a\000b\177d\037e", 9, "A a b d e", -1, "", -1 }, /* NUL, ctrls and DEL replaced with spaces */
|
||||
/* 51*/ { BARCODE_CODE93, -1, BARCODE_RAW_TEXT, "A\001a\000b\177d\037e", 9, "A a b d e", -1, "A\001a\000b\177d\037e1R", 11 }, /* No replacements */
|
||||
/* 52*/ { BARCODE_CODE93, 1, -1, "A\001a\000b\177d\037e", 9, "A a b d e1R", -1, "", -1 },
|
||||
/* 53*/ { BARCODE_CODE93, 1, BARCODE_RAW_TEXT, "A\001a\000b\177d\037e", 9, "A a b d e1R", -1, "A\001a\000b\177d\037e1R", 11 },
|
||||
/* 54*/ { BARCODE_VIN, -1, -1, "1FTCR10UXTPA78180", -1, "1FTCR10UXTPA78180", -1, "", -1 },
|
||||
/* 55*/ { BARCODE_VIN, -1, BARCODE_RAW_TEXT, "1FTCR10UXTPA78180", -1, "1FTCR10UXTPA78180", -1, "1FTCR10UXTPA78180", -1 },
|
||||
/* 56*/ { BARCODE_VIN, 1, -1, "2FTPX28L0XCA15511", -1, "2FTPX28L0XCA15511", -1, "", -1 }, /* Include Import char - no change in HRT */
|
||||
/* 57*/ { BARCODE_VIN, 1, BARCODE_RAW_TEXT, "2FTPX28L0XCA15511", -1, "2FTPX28L0XCA15511", -1, "I2FTPX28L0XCA15511", -1 }, /* Included in BARCODE_RAW_TEXT */
|
||||
/* 58*/ { BARCODE_HIBC_39, -1, -1, "ABC1234", -1, "*+ABC1234+*", -1, "", -1 },
|
||||
/* 59*/ { BARCODE_HIBC_39, -1, BARCODE_RAW_TEXT, "ABC1234", -1, "*+ABC1234+*", -1, "+ABC1234+", -1 },
|
||||
/* 60*/ { BARCODE_HIBC_39, -1, -1, "abc1234", -1, "*+ABC1234+*", -1, "", -1 }, /* Converts to upper */
|
||||
/* 61*/ { BARCODE_HIBC_39, -1, BARCODE_RAW_TEXT, "abc1234", -1, "*+ABC1234+*", -1, "+ABC1234+", -1 },
|
||||
/* 62*/ { BARCODE_HIBC_39, -1, -1, "123456789", -1, "*+1234567890*", -1, "", -1 },
|
||||
/* 63*/ { BARCODE_HIBC_39, -1, BARCODE_RAW_TEXT, "123456789", -1, "*+1234567890*", -1, "+1234567890", -1 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -203,6 +205,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, data[i].option_2, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
expected_raw_length = data[i].expected_raw_length == -1 ? (int) strlen(data[i].expected_raw) : data[i].expected_raw_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -211,6 +214,19 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(memcmp(symbol->text, data[i].expected, expected_length), "i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->text, data[i].expected, expected_length);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%.*s, %.*s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, expected_raw_length,
|
||||
data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -293,7 +309,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -453,10 +469,11 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
char cmp_buf[8192];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -497,13 +514,18 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[4096];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -294,7 +294,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2901,7 +2901,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3290,7 +3290,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode_segs", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3363,6 +3363,183 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int eci;
|
||||
int option_2;
|
||||
int output_options;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
int expected_eci;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
int expected_raw_eci;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, -1, "é", -1, 0, 0, "", -1, 0 },
|
||||
/* 1*/ { UNICODE_MODE, -1, -1, BARCODE_RAW_TEXT, "é", -1, 0, 0, "\351", -1, 3 },
|
||||
/* 2*/ { UNICODE_MODE, -1, -1, -1, "ก", -1, ZINT_WARN_USES_ECI, 13, "", -1, 0 },
|
||||
/* 3*/ { UNICODE_MODE, -1, -1, BARCODE_RAW_TEXT, "ก", -1, ZINT_WARN_USES_ECI, 13, "\241", -1, 13 },
|
||||
/* 4*/ { DATA_MODE, -1, -1, -1, "\351", -1, 0, 0, "", -1, 0 },
|
||||
/* 5*/ { DATA_MODE, -1, -1, BARCODE_RAW_TEXT, "\351", -1, 0, 0, "\351", -1, 3 },
|
||||
/* 6*/ { UNICODE_MODE, 26, -1, -1, "é", -1, 0, 26, "", -1, 0 },
|
||||
/* 7*/ { UNICODE_MODE, 26, -1, BARCODE_RAW_TEXT, "é", -1, 0, 26, "é", -1, 26 },
|
||||
/* 8*/ { UNICODE_MODE, 899, -1, -1, "é", -1, 0, 899, "", -1, 0 },
|
||||
/* 9*/ { UNICODE_MODE, 899, -1, BARCODE_RAW_TEXT, "é", -1, 0, 899, "é", -1, 899 },
|
||||
/* 10*/ { GS1_MODE, -1, -1, -1, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "", -1, 0 },
|
||||
/* 11*/ { GS1_MODE, -1, -1, BARCODE_RAW_TEXT, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "01049123451234591597033130128\03510ABC123", -1, 3 },
|
||||
/* 12*/ { UNICODE_MODE, -1, 9, -1, "12345", -1, 0, 0, "", -1, 0 }, /* Version S */
|
||||
/* 13*/ { UNICODE_MODE, -1, 9, BARCODE_RAW_TEXT, "12345", -1, 0, 0, "12345", -1, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_CODEONE, data[i].input_mode, data[i].eci,
|
||||
-1 /*option_1*/, data[i].option_2, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n",
|
||||
i, symbol->eci, data[i].expected_eci);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->raw_segs[0].source, symbol->raw_segs[0].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[0].eci, data[i].expected_raw_eci,
|
||||
"i:%d raw_segs[0].eci %d != expected_raw_eci %d\n",
|
||||
i, symbol->raw_segs[0].eci, data[i].expected_raw_eci);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt_segs(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int output_options;
|
||||
struct zint_seg segs[3];
|
||||
int ret;
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
struct zint_seg expected_raw_segs[3];
|
||||
int expected_raw_seg_count;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, {0} }, 0, 16, 18, {{0}}, 0 },
|
||||
/* 1*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 16, 18, { { TU("\266"), 1, 3 }, { TU("\266"), 1, 7 }, {0} }, 2 },
|
||||
/* 2*/ { UNICODE_MODE, -1, { { TU("éé"), -1, 0 }, { TU("กขฯ"), -1, 0 }, { TU("βββ"), -1, 0 } }, ZINT_WARN_USES_ECI, 28, 32, {{0}}, 0 },
|
||||
/* 3*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("éé"), -1, 0 }, { TU("กขฯ"), -1, 0 }, { TU("βββ"), -1, 0 } }, ZINT_WARN_USES_ECI, 28, 32, { { TU("\351\351"), 2, 3 }, { TU("\241\242\317"), 3, 13 }, { TU("\342\342\342"), 3, 9 } }, 3 },
|
||||
/* 4*/ { DATA_MODE, -1, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("\223\137"), -1, 20 } }, 0, 28, 32, {{0}}, 0 },
|
||||
/* 5*/ { DATA_MODE, BARCODE_RAW_TEXT, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("\223\137"), -1, 20 } }, 0, 28, 32, { { TU("¶"), 2, 26 }, { TU("\320\226"), 2, 3 }, { TU("\223\137"), 2, 20 } }, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, j, seg_count, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
testUtilSetSymbol(symbol, BARCODE_CODEONE, data[i].input_mode, -1 /*eci*/,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
NULL, 0, debug);
|
||||
for (j = 0, seg_count = 0; j < 3 && data[i].segs[j].length; j++, seg_count++);
|
||||
|
||||
ret = ZBarcode_Encode_Segs(symbol, data[i].segs, seg_count);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode_Segs ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (width %d)\n",
|
||||
i, symbol->rows, data[i].expected_rows, symbol->width);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n",
|
||||
i, symbol->width, data[i].expected_width);
|
||||
|
||||
assert_equal(symbol->raw_seg_count, data[i].expected_raw_seg_count, "i:%d symbol->raw_seg_count %d != %d\n",
|
||||
i, symbol->raw_seg_count, data[i].expected_raw_seg_count);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
for (j = 0; j < symbol->raw_seg_count; j++) {
|
||||
assert_nonnull(symbol->raw_segs[j].source, "i:%d raw_segs[%d].source NULL\n", i, j);
|
||||
|
||||
expected_length = data[i].expected_raw_segs[j].length;
|
||||
|
||||
assert_equal(symbol->raw_segs[j].length, expected_length,
|
||||
"i:%d raw_segs[%d].length %d != expected_length %d\n",
|
||||
i, j, symbol->raw_segs[j].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[j].source, data[i].expected_raw_segs[j].source, expected_length),
|
||||
"i:%d raw_segs[%d].source memcmp(%s, %s, %d) != 0\n", i, j,
|
||||
testUtilEscape((const char *) symbol->raw_segs[j].source, expected_length, escaped,
|
||||
sizeof(escaped)),
|
||||
testUtilEscape((const char *) data[i].expected_raw_segs[j].source, expected_length,
|
||||
escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[j].eci, data[i].expected_raw_segs[j].eci,
|
||||
"i:%d raw_segs[%d].eci %d != expected_raw_segs.eci %d\n",
|
||||
i, j, symbol->raw_segs[j].eci, data[i].expected_raw_segs[j].eci);
|
||||
}
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_fuzz(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
|
@ -3392,7 +3569,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_fuzz", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3436,6 +3613,8 @@ int main(int argc, char *argv[]) {
|
|||
{ "test_input", test_input },
|
||||
{ "test_encode", test_encode },
|
||||
{ "test_encode_segs", test_encode_segs },
|
||||
{ "test_rt", test_rt },
|
||||
{ "test_rt_segs", test_rt_segs },
|
||||
{ "test_fuzz", test_fuzz },
|
||||
};
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[4096] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -115,7 +115,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -136,6 +136,18 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected, expected_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -173,7 +185,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -243,10 +255,11 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
char cmp_buf[8192];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -288,12 +301,15 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -62,7 +62,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[4096];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -117,7 +117,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
|
|||
|
||||
char escaped[1024];
|
||||
|
||||
testStartSymbol("test_reader_init", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -166,6 +166,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int expected_rows;
|
||||
int expected_width;
|
||||
int bwipp_cmp;
|
||||
int zxingcpp_cmp;
|
||||
const char *expected;
|
||||
int expected_option_1;
|
||||
int expected_option_3;
|
||||
|
@ -181,53 +182,53 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII
|
||||
*/
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, 0, "\037", -1, 0, 2, 70, 1, "(10) 0 95 103 103 103 103 103 103 22 42", 2, 0, "ModeA US Pad (6)" },
|
||||
/* 1*/ { UNICODE_MODE, -1, -1, 0, "A", -1, 0, 2, 70, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 0, "ModeB A Pad (6)" },
|
||||
/* 2*/ { UNICODE_MODE, -1, -1, 0, "12", -1, 0, 2, 70, 1, "(10) 2 12 103 103 103 103 103 103 98 27", 2, 0, "ModeC 12 Pad (6)" },
|
||||
/* 3*/ { GS1_MODE, -1, -1, 0, "[90]A", -1, 0, 2, 70, 1, "(10) 3 25 16 33 103 103 103 103 83 20", 2, 0, "ModeBFNC1 9 0 A Pad (4)" },
|
||||
/* 4*/ { GS1_MODE, -1, -1, 0, "[90]12", -1, 0, 2, 70, 1, "(10) 4 90 12 103 103 103 103 103 79 62", 2, 0, "ModeCFNC1 90 12 Pad (5)" },
|
||||
/* 5*/ { GS1_MODE, -1, -1, 0, "[90]12[20]12", -1, 0, 2, 70, 1, "(10) 4 90 12 102 20 12 103 103 9 72", 2, 0, "ModeCFNC1 90 12 FNC1 20 12 Pad (2)" },
|
||||
/* 6*/ { GS1_MODE, -1, -1, 0, "[90]123[20]12", -1, 0, 3, 70, 1, "(15) 11 90 12 100 19 99 102 20 12 103 103 103 103 102 11", 3, 0, "ModeCFNC1 90 CodeB 3 CodeC FNC1 20 12 Pad (4)" },
|
||||
/* 7*/ { GS1_MODE, -1, -1, 0, "[90]123[91]1A3[20]12", -1, 0, 4, 70, 1, "(20) 18 90 12 100 19 102 25 99 11 100 33 19 99 102 20 12 103 103 0 3", 4, 0, "ModeCFNC1 90 12 CodeB 3 FNC1 9 CodeC 11 CodeB A 3 CodeC FNC1 20 12 Pad (2)" },
|
||||
/* 8*/ { GS1_MODE, -1, -1, 0, "[90]123A[91]123", -1, 0, 3, 70, 1, "(15) 11 90 12 100 19 33 102 25 99 11 23 103 103 81 56", 3, 0, "ModeCFNC1 90 12 CodeB 3 A FNC1 9 CodeC 11 23 Pad (2)" },
|
||||
/* 9*/ { GS1_MODE | GS1PARENS_MODE, -1, -1, 0, "(90)12", -1, 0, 2, 70, 1, "(10) 4 90 12 103 103 103 103 103 79 62", 2, 0, "ModeCFNC1 90 12 Pad (5)" },
|
||||
/* 10*/ { UNICODE_MODE, -1, -1, 0, "a0123456789", -1, 0, 2, 70, 1, "(10) 5 65 1 23 45 67 89 103 27 86", 2, 0, "ModeC1SB a 01 23 45 67 89 Pad" },
|
||||
/* 11*/ { UNICODE_MODE, -1, -1, 0, "ab0123456789", -1, 0, 2, 70, 1, "(10) 6 65 66 1 23 45 67 89 19 42", 2, 0, "ModeC2SB a b 01 23 45 67 89" },
|
||||
/* 12*/ { UNICODE_MODE, -1, -1, 0, "1234\037a", -1, 0, 2, 70, 0, "(10) 2 12 34 101 95 98 65 103 67 53", 2, 0, "ModeC 12 34 CodeA US 1SB a Pad; BWIPP different encodation, CodeB instead of 1SB" },
|
||||
/* 13*/ { UNICODE_MODE, -1, -1, 0, "\000\037ß", 4, 0, 2, 70, 1, "(10) 0 64 95 101 63 103 103 103 75 11", 2, 0, "ModeA NUL US FNC4 ß Pad (3)" },
|
||||
/* 14*/ { UNICODE_MODE, -1, -1, 0, "\000\037é", 4, 0, 2, 70, 0, "(10) 0 64 95 101 98 73 103 103 75 6", 2, 0, "ModeA NUL US FNC4 1SB é Pad (2); BWIPP different encodation, CodeB instead of 1SB" },
|
||||
/* 15*/ { UNICODE_MODE, -1, -1, 0, "\000\037éa", 5, 0, 2, 70, 0, "(10) 0 64 95 100 100 73 65 103 99 69", 2, 0, "ModeA NUL US CodeB FNC4 é a Pad; BWIPP different encodation, FNC4 before CodeB" },
|
||||
/* 16*/ { UNICODE_MODE, -1, -1, 0, "abß", -1, 0, 2, 70, 1, "(10) 1 65 66 100 63 103 103 103 66 56", 2, 0, "ModeB a b FNC4 ß Pad (3)" },
|
||||
/* 17*/ { DATA_MODE, -1, -1, 0, "\141\142\237", -1, 0, 2, 70, 0, "(10) 1 65 66 100 98 95 103 103 6 71", 2, 0, "ModeB a b FNC4 1SA APC Pad (2); BWIPP different encodation, CodeA instead of 1SA" },
|
||||
/* 18*/ { DATA_MODE, -1, -1, 0, "\141\142\237\037", -1, 0, 2, 70, 0, "(10) 1 65 66 101 101 95 95 103 72 93", 2, 0, "ModeB a b CodeA FNC4 APC US Pad; BWIPP different encodation, FNC4 before CodeA" },
|
||||
/* 19*/ { UNICODE_MODE, -1, -1, 0, "ééé", -1, 0, 2, 70, 0, "(10) 1 100 73 100 73 100 73 103 105 106", 2, 0, "ModeB FNC4 é FNC4 é FNC4 é Pad; BWIPP different encodation, uses double FNC4 latch" },
|
||||
/* 20*/ { UNICODE_MODE, -1, -1, 0, "aééééb", -1, 0, 3, 70, 1, "(15) 8 65 100 73 100 73 100 73 100 73 66 103 103 39 83", 3, 0, "ModeB a FNC4 é (4) b Pad (2)" },
|
||||
/* 21*/ { UNICODE_MODE, -1, -1, 0, "aéééééb", -1, 0, 3, 70, 0, "(15) 8 65 100 73 100 73 100 73 100 73 100 73 66 74 106", 3, 0, "ModeB a FNC4 é (5) b; BWIPP different encodation, uses double FNC4 latch" },
|
||||
/* 22*/ { UNICODE_MODE, -1, -1, 0, "aééééébcdeé", -1, 0, 4, 70, 0, "(20) 15 65 100 73 100 73 100 73 100 73 100 73 66 67 68 69 100 73 14 69", 4, 0, "ModeB a FNC4 é (5) b c d e FNC4 é; BWIPP different encodation, uses double FNC4 latch then FNC4 escapes" },
|
||||
/* 23*/ { UNICODE_MODE, -1, -1, 0, "123456789012345678901234", -1, 0, 3, 70, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "3 rows" },
|
||||
/* 24*/ { UNICODE_MODE, -1, 2, 0, "123456789012345678901234", -1, 0, 3, 70, 0, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "Min 2 rows (no change); BWIPP doesn't support min rows < required" },
|
||||
/* 25*/ { UNICODE_MODE, -1, 3, 0, "123456789012345678901234", -1, 0, 3, 70, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "Min 3 rows (no change)" },
|
||||
/* 26*/ { UNICODE_MODE, -1, 4, 0, "123456789012345678901234", -1, 0, 4, 70, 1, "(20) 16 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 66 96", 4, 0, "Min 4 rows" },
|
||||
/* 27*/ { UNICODE_MODE, -1, 5, 0, "123456789012345678901234", -1, 0, 5, 70, 1, "(25) 23 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 68 61", 5, 0, "Min 5 rows" },
|
||||
/* 28*/ { UNICODE_MODE, -1, 16, 0, "123456789012345678901234", -1, 0, 16, 70, 1, "(80) 100 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 103", 16, 0, "Min 16 rows" },
|
||||
/* 29*/ { UNICODE_MODE, -1, 1, 0, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, 1, "Error 424: Minimum number of rows '1' out of range (2 to 16)", 1, 0, "" },
|
||||
/* 30*/ { UNICODE_MODE, -1, 17, 0, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, 1, "Error 424: Minimum number of rows '17' out of range (2 to 16)", 17, 0, "" },
|
||||
/* 31*/ { UNICODE_MODE, -1, -1, 0, "ÁÁÁÁÁÁ99999999999999Á", -1, 0, 6, 70, 0, "(30) 29 100 33 100 33 100 33 100 33 100 33 100 33 99 99 99 99 99 99 99 99 100 100 33 103", 6, 0, "BWIPP different encodation, uses double FNC4 latch" },
|
||||
/* 32*/ { UNICODE_MODE, -1, -1, 0, "ÿ\012àa\0121\012àAà", -1, 0, 4, 70, 0, "(20) 15 100 95 98 74 100 64 65 98 74 17 98 74 100 64 33 100 64 47 35", 4, 0, "BWIPP different encodation, uses CodeA instead of 1SA" },
|
||||
/* 33*/ { UNICODE_MODE, -1, -1, 0, "ÿ\012àa\0121\012àAà\012à", -1, 0, 5, 70, 0, "(25) 22 100 95 98 74 100 64 65 98 74 17 98 74 100 64 33 100 64 98 74 100 64 103 89 18", 5, 0, "BWIPP different encodation, uses CodeA instead of 1SA" },
|
||||
/* 34*/ { UNICODE_MODE, -1, -1, 0, "y1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 70, 0, "(35) 40 89 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100 64 36 100", 7, 0, "BWIPP different encodation, uses Sh2B + other differences" },
|
||||
/* 35*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 70, 0, "(35) 41 100 95 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100 64 36", 7, 0, "BWIPP different encodation" },
|
||||
/* 36*/ { UNICODE_MODE, -1, -1, 0, "yÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, "(40) 43 89 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", 8, 0, "BWIPP different encodation (and fits in 7 rows)" },
|
||||
/* 37*/ { UNICODE_MODE, -1, -1, 0, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, "(40) 43 100 95 89 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", 8, 0, "BWIPP different encodation (and fits in 7 rows)" },
|
||||
/* 38*/ { UNICODE_MODE, -1, -1, 0, "ÿÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, "(40) 43 100 95 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33", 8, 0, "BWIPP different encodation (and fits in 7 rows)" },
|
||||
/* 39*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012àa\0121\01223456\0127890àAàDà\012à", -1, 0, 8, 70, 0, "(40) 48 100 95 12 34 101 74 100 100 64 65 98 74 17 98 74 18 99 34 56 101 74 99 78 90 100", 8, 0, "BWIPP different encodation, uses Sh2B + other differences" },
|
||||
/* 40*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012à1234a\0121\01223456\0127890àAàDà\012à", -1, 0, 9, 70, 0, "(45) 55 100 95 12 34 101 74 101 98 64 99 12 34 100 65 98 74 17 98 74 18 99 34 56 101 74 99", 9, 0, "BWIPP different encodation, uses Sh2C + other differences" },
|
||||
/* 41*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012à1234ab\0121\01223456\012\0127890àAàBCDà\012\012à", -1, 0, 10, 70, 0, "(50) 62 100 95 12 34 101 74 101 98 64 99 12 34 100 65 66 98 74 17 98 74 18 99 34 56 101 74", 10, 0, "BWIPP different encodation, uses Sh2C + other differences" },
|
||||
/* 42*/ { UNICODE_MODE, -1, -1, 0, "ÿ123456\012à123456abcd\0121\01223456\012\0127890àAàBCDEà\012\012à", -1, 0, 11, 70, 0, "(55) 69 100 95 12 34 56 101 74 101 98 64 99 12 34 56 100 65 66 67 68 98 74 17 98 74 18 99", 11, 0, "BWIPP different encodation, uses Sh3C + other differences" },
|
||||
/* 43*/ { UNICODE_MODE, -1, -1, 0, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 12, 70, 0, "(60) 76 100 95 12 34 56 78 101 74 101 98 64 99 12 34 56 78 100 65 66 67 68 69 70 98 74 17", 12, 0, "BWIPP different encodation, uses Sh2C + other differences" },
|
||||
/* 44*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 4, "A", -1, 0, 2, 70, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 4, "option_3 separator" },
|
||||
/* 45*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 5, "A", -1, 0, 2, 70, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 1, "option_3 invalid 5 -> 1" },
|
||||
/* 46*/ { UNICODE_MODE, -1, -1, 5, "A", -1, 0, 2, 70, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 5, "option_3 invalid 5 ignored unless COMPLIANT_HEIGHT" },
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, 0, "\037", -1, 0, 2, 70, 1, 1, "(10) 0 95 103 103 103 103 103 103 22 42", 2, 0, "ModeA US Pad (6)" },
|
||||
/* 1*/ { UNICODE_MODE, -1, -1, 0, "A", -1, 0, 2, 70, 1, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 0, "ModeB A Pad (6)" },
|
||||
/* 2*/ { UNICODE_MODE, -1, -1, 0, "12", -1, 0, 2, 70, 1, 1, "(10) 2 12 103 103 103 103 103 103 98 27", 2, 0, "ModeC 12 Pad (6)" },
|
||||
/* 3*/ { GS1_MODE, -1, -1, 0, "[90]A", -1, 0, 2, 70, 1, 1, "(10) 3 25 16 33 103 103 103 103 83 20", 2, 0, "ModeBFNC1 9 0 A Pad (4)" },
|
||||
/* 4*/ { GS1_MODE, -1, -1, 0, "[90]12", -1, 0, 2, 70, 1, 1, "(10) 4 90 12 103 103 103 103 103 79 62", 2, 0, "ModeCFNC1 90 12 Pad (5)" },
|
||||
/* 5*/ { GS1_MODE, -1, -1, 0, "[90]12[20]12", -1, 0, 2, 70, 1, 1, "(10) 4 90 12 102 20 12 103 103 9 72", 2, 0, "ModeCFNC1 90 12 FNC1 20 12 Pad (2)" },
|
||||
/* 6*/ { GS1_MODE, -1, -1, 0, "[90]123[20]12", -1, 0, 3, 70, 1, 1, "(15) 11 90 12 100 19 99 102 20 12 103 103 103 103 102 11", 3, 0, "ModeCFNC1 90 CodeB 3 CodeC FNC1 20 12 Pad (4)" },
|
||||
/* 7*/ { GS1_MODE, -1, -1, 0, "[90]123[91]1A3[20]12", -1, 0, 4, 70, 1, 1, "(20) 18 90 12 100 19 102 25 99 11 100 33 19 99 102 20 12 103 103 0 3", 4, 0, "ModeCFNC1 90 12 CodeB 3 FNC1 9 CodeC 11 CodeB A 3 CodeC FNC1 20 12 Pad (2)" },
|
||||
/* 8*/ { GS1_MODE, -1, -1, 0, "[90]123A[91]123", -1, 0, 3, 70, 1, 1, "(15) 11 90 12 100 19 33 102 25 99 11 23 103 103 81 56", 3, 0, "ModeCFNC1 90 12 CodeB 3 A FNC1 9 CodeC 11 23 Pad (2)" },
|
||||
/* 9*/ { GS1_MODE | GS1PARENS_MODE, -1, -1, 0, "(90)12", -1, 0, 2, 70, 1, 1, "(10) 4 90 12 103 103 103 103 103 79 62", 2, 0, "ModeCFNC1 90 12 Pad (5)" },
|
||||
/* 10*/ { UNICODE_MODE, -1, -1, 0, "a0123456789", -1, 0, 2, 70, 1, 1, "(10) 5 65 1 23 45 67 89 103 27 86", 2, 0, "ModeC1SB a 01 23 45 67 89 Pad" },
|
||||
/* 11*/ { UNICODE_MODE, -1, -1, 0, "ab0123456789", -1, 0, 2, 70, 1, 1, "(10) 6 65 66 1 23 45 67 89 19 42", 2, 0, "ModeC2SB a b 01 23 45 67 89" },
|
||||
/* 12*/ { UNICODE_MODE, -1, -1, 0, "1234\037a", -1, 0, 2, 70, 0, 1, "(10) 2 12 34 101 95 98 65 103 67 53", 2, 0, "ModeC 12 34 CodeA US 1SB a Pad; BWIPP different encodation, CodeB instead of 1SB" },
|
||||
/* 13*/ { UNICODE_MODE, -1, -1, 0, "\000\037ß", 4, 0, 2, 70, 1, 1, "(10) 0 64 95 101 63 103 103 103 75 11", 2, 0, "ModeA NUL US FNC4 ß Pad (3)" },
|
||||
/* 14*/ { UNICODE_MODE, -1, -1, 0, "\000\037é", 4, 0, 2, 70, 0, 1, "(10) 0 64 95 101 98 73 103 103 75 6", 2, 0, "ModeA NUL US FNC4 1SB é Pad (2); BWIPP different encodation, CodeB instead of 1SB" },
|
||||
/* 15*/ { UNICODE_MODE, -1, -1, 0, "\000\037éa", 5, 0, 2, 70, 0, 1, "(10) 0 64 95 100 100 73 65 103 99 69", 2, 0, "ModeA NUL US CodeB FNC4 é a Pad; BWIPP different encodation, FNC4 before CodeB" },
|
||||
/* 16*/ { UNICODE_MODE, -1, -1, 0, "abß", -1, 0, 2, 70, 1, 1, "(10) 1 65 66 100 63 103 103 103 66 56", 2, 0, "ModeB a b FNC4 ß Pad (3)" },
|
||||
/* 17*/ { DATA_MODE, -1, -1, 0, "\141\142\237", -1, 0, 2, 70, 0, 899, "(10) 1 65 66 100 98 95 103 103 6 71", 2, 0, "ModeB a b FNC4 1SA APC Pad (2); BWIPP different encodation, CodeA instead of 1SA" },
|
||||
/* 18*/ { DATA_MODE, -1, -1, 0, "\141\142\237\037", -1, 0, 2, 70, 0, 899, "(10) 1 65 66 101 101 95 95 103 72 93", 2, 0, "ModeB a b CodeA FNC4 APC US Pad; BWIPP different encodation, FNC4 before CodeA" },
|
||||
/* 19*/ { UNICODE_MODE, -1, -1, 0, "ééé", -1, 0, 2, 70, 0, 1, "(10) 1 100 73 100 73 100 73 103 105 106", 2, 0, "ModeB FNC4 é FNC4 é FNC4 é Pad; BWIPP different encodation, uses double FNC4 latch" },
|
||||
/* 20*/ { UNICODE_MODE, -1, -1, 0, "aééééb", -1, 0, 3, 70, 1, 1, "(15) 8 65 100 73 100 73 100 73 100 73 66 103 103 39 83", 3, 0, "ModeB a FNC4 é (4) b Pad (2)" },
|
||||
/* 21*/ { UNICODE_MODE, -1, -1, 0, "aéééééb", -1, 0, 3, 70, 0, 1, "(15) 8 65 100 73 100 73 100 73 100 73 100 73 66 74 106", 3, 0, "ModeB a FNC4 é (5) b; BWIPP different encodation, uses double FNC4 latch" },
|
||||
/* 22*/ { UNICODE_MODE, -1, -1, 0, "aééééébcdeé", -1, 0, 4, 70, 0, 1, "(20) 15 65 100 73 100 73 100 73 100 73 100 73 66 67 68 69 100 73 14 69", 4, 0, "ModeB a FNC4 é (5) b c d e FNC4 é; BWIPP different encodation, uses double FNC4 latch then FNC4 escapes" },
|
||||
/* 23*/ { UNICODE_MODE, -1, -1, 0, "123456789012345678901234", -1, 0, 3, 70, 1, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "3 rows" },
|
||||
/* 24*/ { UNICODE_MODE, -1, 2, 0, "123456789012345678901234", -1, 0, 3, 70, 0, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "Min 2 rows (no change); BWIPP doesn't support min rows < required" },
|
||||
/* 25*/ { UNICODE_MODE, -1, 3, 0, "123456789012345678901234", -1, 0, 3, 70, 1, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "Min 3 rows (no change)" },
|
||||
/* 26*/ { UNICODE_MODE, -1, 4, 0, "123456789012345678901234", -1, 0, 4, 70, 1, 1, "(20) 16 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 66 96", 4, 0, "Min 4 rows" },
|
||||
/* 27*/ { UNICODE_MODE, -1, 5, 0, "123456789012345678901234", -1, 0, 5, 70, 1, 1, "(25) 23 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 68 61", 5, 0, "Min 5 rows" },
|
||||
/* 28*/ { UNICODE_MODE, -1, 16, 0, "123456789012345678901234", -1, 0, 16, 70, 1, 1, "(80) 100 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 103", 16, 0, "Min 16 rows" },
|
||||
/* 29*/ { UNICODE_MODE, -1, 1, 0, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 1, "Error 424: Minimum number of rows '1' out of range (2 to 16)", 1, 0, "" },
|
||||
/* 30*/ { UNICODE_MODE, -1, 17, 0, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 1, "Error 424: Minimum number of rows '17' out of range (2 to 16)", 17, 0, "" },
|
||||
/* 31*/ { UNICODE_MODE, -1, -1, 0, "ÁÁÁÁÁÁ99999999999999Á", -1, 0, 6, 70, 0, 1, "(30) 29 100 33 100 33 100 33 100 33 100 33 100 33 99 99 99 99 99 99 99 99 100 100 33 103", 6, 0, "BWIPP different encodation, uses double FNC4 latch" },
|
||||
/* 32*/ { UNICODE_MODE, -1, -1, 0, "ÿ\012àa\0121\012àAà", -1, 0, 4, 70, 0, 1, "(20) 15 100 95 98 74 100 64 65 98 74 17 98 74 100 64 33 100 64 47 35", 4, 0, "BWIPP different encodation, uses CodeA instead of 1SA" },
|
||||
/* 33*/ { UNICODE_MODE, -1, -1, 0, "ÿ\012àa\0121\012àAà\012à", -1, 0, 5, 70, 0, 1, "(25) 22 100 95 98 74 100 64 65 98 74 17 98 74 100 64 33 100 64 98 74 100 64 103 89 18", 5, 0, "BWIPP different encodation, uses CodeA instead of 1SA" },
|
||||
/* 34*/ { UNICODE_MODE, -1, -1, 0, "y1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 70, 0, 1, "(35) 40 89 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100 64 36 100", 7, 0, "BWIPP different encodation, uses Sh2B + other differences" },
|
||||
/* 35*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 70, 0, 1, "(35) 41 100 95 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100 64 36", 7, 0, "BWIPP different encodation" },
|
||||
/* 36*/ { UNICODE_MODE, -1, -1, 0, "yÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 43 89 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", 8, 0, "BWIPP different encodation (and fits in 7 rows)" },
|
||||
/* 37*/ { UNICODE_MODE, -1, -1, 0, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 43 100 95 89 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", 8, 0, "BWIPP different encodation (and fits in 7 rows)" },
|
||||
/* 38*/ { UNICODE_MODE, -1, -1, 0, "ÿÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 43 100 95 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33", 8, 0, "BWIPP different encodation (and fits in 7 rows)" },
|
||||
/* 39*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012àa\0121\01223456\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 48 100 95 12 34 101 74 100 100 64 65 98 74 17 98 74 18 99 34 56 101 74 99 78 90 100", 8, 0, "BWIPP different encodation, uses Sh2B + other differences" },
|
||||
/* 40*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012à1234a\0121\01223456\0127890àAàDà\012à", -1, 0, 9, 70, 0, 1, "(45) 55 100 95 12 34 101 74 101 98 64 99 12 34 100 65 98 74 17 98 74 18 99 34 56 101 74 99", 9, 0, "BWIPP different encodation, uses Sh2C + other differences" },
|
||||
/* 41*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012à1234ab\0121\01223456\012\0127890àAàBCDà\012\012à", -1, 0, 10, 70, 0, 1, "(50) 62 100 95 12 34 101 74 101 98 64 99 12 34 100 65 66 98 74 17 98 74 18 99 34 56 101 74", 10, 0, "BWIPP different encodation, uses Sh2C + other differences" },
|
||||
/* 42*/ { UNICODE_MODE, -1, -1, 0, "ÿ123456\012à123456abcd\0121\01223456\012\0127890àAàBCDEà\012\012à", -1, 0, 11, 70, 0, 1, "(55) 69 100 95 12 34 56 101 74 101 98 64 99 12 34 56 100 65 66 67 68 98 74 17 98 74 18 99", 11, 0, "BWIPP different encodation, uses Sh3C + other differences" },
|
||||
/* 43*/ { UNICODE_MODE, -1, -1, 0, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 12, 70, 0, 1, "(60) 76 100 95 12 34 56 78 101 74 101 98 64 99 12 34 56 78 100 65 66 67 68 69 70 98 74 17", 12, 0, "BWIPP different encodation, uses Sh2C + other differences" },
|
||||
/* 44*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 4, "A", -1, 0, 2, 70, 1, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 4, "option_3 separator" },
|
||||
/* 45*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 5, "A", -1, 0, 2, 70, 1, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 1, "option_3 invalid 5 -> 1" },
|
||||
/* 46*/ { UNICODE_MODE, -1, -1, 5, "A", -1, 0, 2, 70, 1, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 5, "option_3 invalid 5 ignored unless COMPLIANT_HEIGHT" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
@ -237,10 +238,11 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
char cmp_buf[8192];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -259,12 +261,12 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
printf(" /*%3d*/ { %s, %s, %d, %d, \"%s\", %d, %s, %d, %d, %d, \"%s\", %d, %d, \"%s\" },\n",
|
||||
printf(" /*%3d*/ { %s, %s, %d, %d, \"%s\", %d, %s, %d, %d, %d, %d, \"%s\", %d, %d, \"%s\" },\n",
|
||||
i, testUtilInputModeName(data[i].input_mode), testUtilOutputOptionsName(data[i].output_options),
|
||||
data[i].option_1, data[i].option_3,
|
||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
|
||||
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp,
|
||||
symbol->errtxt, symbol->option_1, symbol->option_3, data[i].comment);
|
||||
data[i].zxingcpp_cmp, symbol->errtxt, symbol->option_1, symbol->option_3, data[i].comment);
|
||||
} else {
|
||||
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) {
|
||||
|
@ -288,13 +290,19 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[4096];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_nonzero(data[i].zxingcpp_cmp, "i:%d data[i].zxingcpp_cmp == 0", i);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, data[i].zxingcpp_cmp,
|
||||
cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
assert_equal(symbol->option_1, data[i].expected_option_1, "i:%d symbol->option_1 %d != %d\n",
|
||||
|
@ -375,10 +383,11 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
char cmp_buf[8192];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -420,13 +429,18 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[4096];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -437,6 +451,84 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int output_options;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
int expected_eci;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
int expected_raw_eci;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, "é", -1, 0, 0, "", -1, 0 },
|
||||
/* 1*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "é", -1, 0, 0, "\351", -1, 3 },
|
||||
/* 2*/ { DATA_MODE, -1, "\351", -1, 0, 0, "", -1, 0 },
|
||||
/* 3*/ { DATA_MODE, BARCODE_RAW_TEXT, "\351", -1, 0, 0, "\351", -1, 3 },
|
||||
/* 4*/ { GS1_MODE, -1, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "", -1, 0 },
|
||||
/* 5*/ { GS1_MODE, BARCODE_RAW_TEXT, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "01049123451234591597033130128\03510ABC123", -1, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n",
|
||||
i, symbol->eci, data[i].expected_eci);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->raw_segs[0].source, symbol->raw_segs[0].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[0].eci, data[i].expected_raw_eci,
|
||||
"i:%d raw_segs[0].eci %d != expected_raw_eci %d\n",
|
||||
i, symbol->raw_segs[0].eci, data[i].expected_raw_eci);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
testFunction funcs[] = { /* name, func */
|
||||
|
@ -444,6 +536,7 @@ int main(int argc, char *argv[]) {
|
|||
{ "test_reader_init", test_reader_init },
|
||||
{ "test_input", test_input },
|
||||
{ "test_encode", test_encode },
|
||||
{ "test_rt", test_rt },
|
||||
};
|
||||
|
||||
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
|
||||
|
|
|
@ -55,7 +55,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[4096];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -149,7 +149,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -256,7 +256,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -304,12 +304,91 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int output_options;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
int expected_eci;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
int expected_raw_eci;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, "AB\000123", 6, 0, 0, "", -1, 0 },
|
||||
/* 1*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "AB\000123", 6, 0, 0, "AB\000123", 6, 3 },
|
||||
/* 2*/ { DATA_MODE, -1, "AB\000123", 6, 0, 0, "", -1, 0 },
|
||||
/* 3*/ { DATA_MODE, BARCODE_RAW_TEXT, "AB\000123", 6, 0, 0, "AB\000123", 6, 3 },
|
||||
/* 4*/ { GS1_MODE, -1, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "", -1, 0 },
|
||||
/* 5*/ { GS1_MODE, BARCODE_RAW_TEXT, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "01049123451234591597033130128\03510ABC123", -1, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_CODE49, data[i].input_mode, -1 /*eci*/,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n",
|
||||
i, symbol->eci, data[i].expected_eci);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->raw_segs[0].source, symbol->raw_segs[0].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[0].eci, data[i].expected_raw_eci,
|
||||
"i:%d raw_segs[0].eci %d != expected_raw_eci %d\n",
|
||||
i, symbol->raw_segs[0].eci, data[i].expected_raw_eci);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
testFunction funcs[] = { /* name, func */
|
||||
{ "test_large", test_large },
|
||||
{ "test_input", test_input },
|
||||
{ "test_encode", test_encode },
|
||||
{ "test_rt", test_rt },
|
||||
};
|
||||
|
||||
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
|
||||
|
|
|
@ -70,7 +70,7 @@ static void test_to_int(const testCtx *const p_ctx) {
|
|||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
||||
testStart("test_to_int");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -104,7 +104,7 @@ static void test_to_upper(const testCtx *const p_ctx) {
|
|||
|
||||
unsigned char buf[512];
|
||||
|
||||
testStart("test_to_upper");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -140,7 +140,7 @@ static void test_chr_cnt(const testCtx *const p_ctx) {
|
|||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
||||
testStart("test_chr_cnt");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -176,7 +176,7 @@ static void test_is_chr(const testCtx *const p_ctx) {
|
|||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, ret;
|
||||
|
||||
testStart("test_is_chr");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -290,7 +290,7 @@ static void test_not_sane(const testCtx *const p_ctx) {
|
|||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, j, length, ret;
|
||||
|
||||
testStart("test_not_sane");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -344,7 +344,7 @@ static void test_not_sane_lookup(const testCtx *const p_ctx) {
|
|||
int test_length;
|
||||
int posns[32] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_not_sane_lookup");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -396,7 +396,7 @@ static void test_errtxt(const testCtx *const p_ctx) {
|
|||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
|
||||
testStart("test_errtxt");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -529,7 +529,7 @@ static void test_errtxtf(const testCtx *const p_ctx) {
|
|||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
|
||||
testStart("test_errtxtf");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -600,7 +600,7 @@ static void test_cnt_digits(const testCtx *const p_ctx) {
|
|||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
||||
testStart("test_cnt_digits");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -639,7 +639,7 @@ static void test_is_valid_utf8(const testCtx *const p_ctx) {
|
|||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
||||
testStart("test_is_valid_utf8");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -682,7 +682,7 @@ static void test_utf8_to_unicode(const testCtx *const p_ctx) {
|
|||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
|
||||
testStart("test_utf8_to_unicode");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol->debug = debug;
|
||||
|
||||
|
@ -721,8 +721,6 @@ static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) {
|
|||
int length;
|
||||
int ret;
|
||||
const char *expected;
|
||||
const char *expected_plain;
|
||||
int expected_plain_length;
|
||||
const char *comment;
|
||||
};
|
||||
/*
|
||||
|
@ -732,28 +730,28 @@ static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) {
|
|||
*/
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { "", -1, 0, "", NULL, -1, "" },
|
||||
/* 1*/ { "abc", -1, 0, "abc", NULL, -1, "" },
|
||||
/* 2*/ { "\000A\001B\002\036\037C ~\177", 11, 0, " A B C ~ ", "\000A\001B\002\036\037C ~\177", 11, "" },
|
||||
/* 3*/ { "~\177\200\201\237\240", -1, 0, "~ \302\240", "~\177\302\200\302\201\302\237\302\240", -1, "" },
|
||||
/* 4*/ { "\241\242\243\244\257\260", -1, 0, "¡¢£¤¯°", NULL, -1, "" },
|
||||
/* 5*/ { "\276\277\300\337\377", -1, 0, "¾¿Àßÿ", NULL, -1, "" },
|
||||
/* 6*/ { "\351", -1, 0, "é", NULL, -1, "" },
|
||||
/* 7*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 0, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", NULL, -1, "127 \241" },
|
||||
/* 8*/ { "a\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 0, "a¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", NULL, -1, "a + 127 \241" },
|
||||
/* 9*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241a", -1, 0, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡a", NULL, -1, "127 \241 + a" },
|
||||
/* 10*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", NULL, -1, "128 \241 (truncated)" },
|
||||
/* 11*/ { "a\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "a¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", NULL, -1, "a + 128 \241 (truncated)" },
|
||||
/* 12*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241a", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", NULL, -1, "128 \241 + a (truncated)" },
|
||||
/* 13*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", NULL, -1, "129 \241 (truncated)" },
|
||||
/* 14*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 0, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", NULL, -1, "127 \351" },
|
||||
/* 15*/ { "a\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 0, "aééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", NULL, -1, "a + 127 \351" },
|
||||
/* 16*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351a", -1, 0, "éééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééa", NULL, -1, "127 \351 + a" },
|
||||
/* 17*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", NULL, -1, "128 \351 (truncated)" },
|
||||
/* 18*/ { "a\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "aééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", NULL, -1, "a + 128 \351 (truncated)" },
|
||||
/* 19*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351a", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", NULL, -1, "128 \351 + a (truncated)" },
|
||||
/* 20*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", NULL, -1, "129 \351 (truncated)" },
|
||||
/* 21*/ { "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", NULL, -1, "256 A (truncated)" },
|
||||
/* 0*/ { "", -1, 0, "", "" },
|
||||
/* 1*/ { "abc", -1, 0, "abc", "" },
|
||||
/* 2*/ { "\000A\001B\002\036\037C ~\177", 11, 0, " A B C ~ ", "" },
|
||||
/* 3*/ { "~\177\200\201\237\240", -1, 0, "~ \302\240", "" },
|
||||
/* 4*/ { "\241\242\243\244\257\260", -1, 0, "¡¢£¤¯°", "" },
|
||||
/* 5*/ { "\276\277\300\337\377", -1, 0, "¾¿Àßÿ", "" },
|
||||
/* 6*/ { "\351", -1, 0, "é", "" },
|
||||
/* 7*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 0, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "127 \241" },
|
||||
/* 8*/ { "a\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 0, "a¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "a + 127 \241" },
|
||||
/* 9*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241a", -1, 0, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡a", "127 \241 + a" },
|
||||
/* 10*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "128 \241 (truncated)" },
|
||||
/* 11*/ { "a\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "a¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "a + 128 \241 (truncated)" },
|
||||
/* 12*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241a", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "128 \241 + a (truncated)" },
|
||||
/* 13*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "129 \241 (truncated)" },
|
||||
/* 14*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 0, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "127 \351" },
|
||||
/* 15*/ { "a\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 0, "aééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "a + 127 \351" },
|
||||
/* 16*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351a", -1, 0, "éééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééa", "127 \351 + a" },
|
||||
/* 17*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "128 \351 (truncated)" },
|
||||
/* 18*/ { "a\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "aééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "a + 128 \351 (truncated)" },
|
||||
/* 19*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351a", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "128 \351 + a (truncated)" },
|
||||
/* 20*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "129 \351 (truncated)" },
|
||||
/* 21*/ { "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "256 A (truncated)" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
@ -761,9 +759,8 @@ static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) {
|
|||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
int expected_length;
|
||||
const char *expected;
|
||||
|
||||
testStart("test_hrt_cpy_iso8859_1");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol->debug = debug;
|
||||
|
||||
|
@ -784,31 +781,12 @@ static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) {
|
|||
}
|
||||
}
|
||||
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
|
||||
assert_nonzero(testUtilIsValidUTF8(symbol->text, symbol->text_length), "i:%d testUtilIsValidUTF8(%s) != 1\n",
|
||||
i, symbol->text);
|
||||
assert_nonzero(testUtilIsValidUTF8(symbol->text, (int) ustrlen(symbol->text)),
|
||||
"i:%d testUtilIsValidUTF8(%s) != 1\n", i, symbol->text);
|
||||
assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d\n",
|
||||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d symbol->text (%s) != expected (%s)\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
|
||||
memset(symbol, 0, sizeof(*symbol));
|
||||
symbol->output_options = BARCODE_RAW_TEXT;
|
||||
|
||||
if (data[i].expected_plain == NULL) {
|
||||
expected = data[i].expected;
|
||||
expected_length = (int) strlen(expected);
|
||||
} else {
|
||||
expected = data[i].expected_plain;
|
||||
expected_length = data[i].expected_plain_length == -1 ? (int) strlen(expected) : data[i].expected_plain_length;
|
||||
}
|
||||
|
||||
ret = hrt_cpy_iso8859_1(symbol, (unsigned char *) data[i].data, length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
|
||||
assert_nonzero(testUtilIsValidUTF8(symbol->text, symbol->text_length), "i:%d testUtilIsValidUTF8(%s) != 1\n",
|
||||
i, symbol->text);
|
||||
assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d\n",
|
||||
i, symbol->text_length, expected_length);
|
||||
assert_zero(memcmp(symbol->text, expected, symbol->text_length), "i:%d symbol->text (%s) != expected (%s)\n", i, symbol->text, expected);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
|
@ -853,7 +831,7 @@ static void test_hrt_cpy_nochk(const testCtx *const p_ctx) {
|
|||
struct zint_symbol *symbol = &s_symbol;
|
||||
int expected_length;
|
||||
|
||||
testStart("test_hrt_cpy_nochk");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol->debug = debug;
|
||||
|
||||
|
@ -896,6 +874,71 @@ static void test_hrt_cpy_nochk(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_hrt_cpy_cat_nochk(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
const char *source;
|
||||
int length;
|
||||
char separator;
|
||||
const char *cat;
|
||||
int cat_length;
|
||||
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { NULL, -1, '\xFF', NULL, -1, "", -1 },
|
||||
/* 1*/ { "", 0, '\xFF', NULL, -1, "", -1 },
|
||||
/* 2*/ { "", 0, '\xFF', "", 0, "", -1 },
|
||||
/* 3*/ { NULL, 0, '\xFF', "", 0, "", -1 },
|
||||
/* 4*/ { "ABC", 3, ':', "DEF", 3, "ABC:DEF", -1 },
|
||||
/* 5*/ { "", 0, ':', "DEF", 3, ":DEF", -1 },
|
||||
/* 6*/ { "", 0, '\xFF', "DEF", 3, "DEF", -1 },
|
||||
/* 7*/ { "ABC", 3, ':', "", 0, "ABC:", -1 },
|
||||
/* 8*/ { "ABC", 3, '\xFF', "", 0, "ABC", -1 },
|
||||
/* 9*/ { "", 0, ':', "", 0, ":", -1 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i;
|
||||
|
||||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
int expected_length;
|
||||
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol->debug = debug;
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int j;
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
memset(symbol, 0, sizeof(*symbol));
|
||||
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
|
||||
hrt_cpy_cat_nochk(symbol, TCU(data[i].source), data[i].length, data[i].separator, TCU(data[i].cat), data[i].cat_length);
|
||||
|
||||
if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) {
|
||||
for (j = 0; j < symbol->text_length; j++) {
|
||||
fprintf(stderr, "symbol->text[%d] %2X\n", j, symbol->text[j]);
|
||||
}
|
||||
}
|
||||
|
||||
assert_nonzero(testUtilIsValidUTF8(symbol->text, (int) ustrlen(symbol->text)),
|
||||
"i:%d testUtilIsValidUTF8(%s) != 1\n", i, symbol->text);
|
||||
assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d\n",
|
||||
i, symbol->text_length, expected_length);
|
||||
assert_zero(memcmp(symbol->text, data[i].expected, expected_length), "i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->text, data[i].expected, expected_length);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_hrt_printf_nochk(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
|
@ -919,7 +962,7 @@ static void test_hrt_printf_nochk(const testCtx *const p_ctx) {
|
|||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
|
||||
testStart("test_hrt_printf_nochk");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol->debug = debug;
|
||||
|
||||
|
@ -974,7 +1017,7 @@ static void test_hrt_conv_gs1_brackets_nochk(const testCtx *const p_ctx) {
|
|||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
|
||||
testStart("test_hrt_conv_gs1_brackets_nochk");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol->debug = debug;
|
||||
|
||||
|
@ -995,6 +1038,236 @@ static void test_hrt_conv_gs1_brackets_nochk(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt_cpy_seg(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int seg_count;
|
||||
int seg_idx;
|
||||
struct zint_seg seg;
|
||||
unsigned int ddata[8];
|
||||
int ddata_size;
|
||||
int ddata_eci;
|
||||
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
int expected_eci;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { 1, 0, { TU("A"), 1, 0 }, {0}, 0, 0, "A", -1, 3 },
|
||||
/* 1*/ { 1, 0, { TU("A"), 1, 900 }, {0}, 0, 0, "A", -1, 900 },
|
||||
/* 2*/ { 2, 1, { TU("A"), 1, 0 }, {0}, 0, 0, "A", -1, 3 },
|
||||
/* 3*/ { 1, 0, { TU("ABCDE"), 5, 0 }, { 'B', 0xFF, 'C', 0xFF00, 'D' }, 5, 0, "B\377C\377\000D", 6, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, ret;
|
||||
|
||||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol->debug = debug;
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int seg_idx;
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
|
||||
assert_nonzero(data[i].seg_count, "i:%d seg_count zero\n", i);
|
||||
|
||||
ret = rt_init_segs(symbol, data[i].seg_count);
|
||||
assert_zero(ret, "i:%d rt_init_segs(%d) %d != 0\n", i, data[i].seg_count, ret);
|
||||
|
||||
seg_idx = data[i].seg_idx;
|
||||
assert_nonzero(seg_idx >= 0, "i:%d seg_idx %d < 0\n", i, seg_idx);
|
||||
assert_nonzero(seg_idx < data[i].seg_count, "i:%d seg_idx %d >= seg_count 0%d\n",
|
||||
i, seg_idx, data[i].seg_count);
|
||||
|
||||
if (data[i].ddata_size > 0) {
|
||||
assert_equal(data[i].seg.length, data[i].ddata_size, "i:%d seg_length %d != ddata_size %d\n",
|
||||
i, data[i].seg.length, data[i].ddata_size);
|
||||
ret = rt_cpy_seg_ddata(symbol, seg_idx, &data[i].seg, data[i].ddata_eci, data[i].ddata);
|
||||
assert_zero(ret, "i:%d rt_cpy_seg_ddata %d != 0\n", i, ret);
|
||||
} else {
|
||||
ret = rt_cpy_seg(symbol, seg_idx, &data[i].seg);
|
||||
assert_zero(ret, "i:%d rt_cpy_segs %d != 0\n", i, ret);
|
||||
}
|
||||
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[seg_idx].source, "i:%d raw_segs[%d].source NULL\n", i, seg_idx);
|
||||
assert_equal(symbol->raw_segs[seg_idx].length, expected_length,
|
||||
"i:%d raw_segs[%d].length %d != expected_length %d\n",
|
||||
i, seg_idx, symbol->raw_segs[seg_idx].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[seg_idx].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[%d].source memcmp(%s, %s, %d) != 0\n", i, seg_idx,
|
||||
testUtilEscape((const char *) symbol->raw_segs[seg_idx].source, symbol->raw_segs[seg_idx].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[seg_idx].eci, data[i].expected_eci,
|
||||
"i:%d raw_segs[%d].eci %d != expected_eci %d\n",
|
||||
i, seg_idx, symbol->raw_segs[seg_idx].eci, data[i].expected_eci);
|
||||
|
||||
ZBarcode_Clear(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt_cpy(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int seg_count;
|
||||
int seg_idx;
|
||||
|
||||
const char *source;
|
||||
int length;
|
||||
char separator;
|
||||
const char *cat;
|
||||
int cat_length;
|
||||
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
int expected_eci;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { 1, 0, "A", -1, '\0', "", -1, "A", -1, 3 },
|
||||
/* 1*/ { 1, 0, "A", -1, ':', "B", -1, "A:B", -1, 3 },
|
||||
/* 2*/ { 1, 0, "A", -1, '\xFF', "B", -1, "AB", -1, 3 },
|
||||
/* 3*/ { 1, 0, "A", -1, '\0', "B", -1, "A\000B", 3, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
||||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol->debug = debug;
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int cat_length;
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
|
||||
ret = rt_init_segs(symbol, 1);
|
||||
assert_zero(ret, "i:%d rt_init_segs %d != 0\n", i, ret);
|
||||
|
||||
length = data[i].length == -1 ? (int) strlen(data[i].source) : data[i].length;
|
||||
|
||||
if ((cat_length = data[i].cat_length == -1 ? (int) strlen(data[i].cat) : data[i].cat_length)) {
|
||||
ret = rt_cpy_cat(symbol, TCU(data[i].source), length, data[i].separator, TCU(data[i].cat), cat_length);
|
||||
assert_zero(ret, "i:%d rt_cpy_cat %d != 0\n", i, ret);
|
||||
} else {
|
||||
ret = rt_cpy(symbol, TCU(data[i].source), length);
|
||||
assert_zero(ret, "i:%d rt_cpy %d != 0\n", i, ret);
|
||||
}
|
||||
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->raw_segs[0].source, symbol->raw_segs[0].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[0].eci, data[i].expected_eci,
|
||||
"i:%d raw_segs[0].eci %d != expected_eci %d\n",
|
||||
i, symbol->raw_segs[0].eci, data[i].expected_eci);
|
||||
|
||||
ZBarcode_Clear(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt_printf_256(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
const char *fmt;
|
||||
int num_args;
|
||||
const char *data1;
|
||||
const char *data2;
|
||||
const char *expected;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { "", 1, "", "", "" },
|
||||
/* 1*/ { "*%s*", 1, "gosh", "", "*gosh*" },
|
||||
/* 2*/ { "%.1s.%.2s", 2, "gosh", "wow", "g.wo" },
|
||||
/* 3*/ { "ABCDEFGHIJKLMNOPQRST%sABCDEFGHIJKLMNOPQRST%sABCDEFGHIJKLMNO", 2, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "ABCDEFGHIJKLMNOPQRST1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890ABCDEFGHIJKLMNOPQRST1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890ABCDEFGHIJKLMNO" }, /* Max 255 - 1 more and overflow */
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, ret;
|
||||
|
||||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol->debug = debug;
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
|
||||
ret = rt_init_segs(symbol, 1);
|
||||
assert_zero(ret, "i:%d rt_init_segs %d != 0\n", i, ret);
|
||||
|
||||
if (data[i].num_args == 1) {
|
||||
ret = rt_printf_256(symbol, data[i].fmt, data[i].data1);
|
||||
} else if (data[i].num_args == 2) {
|
||||
ret = rt_printf_256(symbol, data[i].fmt, data[i].data1, data[i].data2);
|
||||
} else {
|
||||
assert_zero(1, "i:%d, bad num_args\n", i);
|
||||
}
|
||||
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->raw_segs[0].source, symbol->raw_segs[0].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[0].eci, 3, "i:%d raw_segs[0].eci %d != 3\n", i, symbol->raw_segs[0].eci);
|
||||
|
||||
ZBarcode_Clear(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_set_height(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
|
@ -1034,7 +1307,7 @@ static void test_set_height(const testCtx *const p_ctx) {
|
|||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
|
||||
testStart("set_height");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol->debug = debug;
|
||||
|
||||
|
@ -1080,7 +1353,7 @@ static void test_debug_test_codeword_dump_int(const testCtx *const p_ctx) {
|
|||
struct zint_symbol s_symbol;
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
|
||||
testStart("test_debug_test_codeword_dump_int");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol->debug = debug;
|
||||
|
||||
|
@ -1112,8 +1385,12 @@ int main(int argc, char *argv[]) {
|
|||
{ "test_utf8_to_unicode", test_utf8_to_unicode },
|
||||
{ "test_hrt_cpy_iso8859_1", test_hrt_cpy_iso8859_1 },
|
||||
{ "test_hrt_cpy_nochk", test_hrt_cpy_nochk },
|
||||
{ "test_hrt_cpy_cat_nochk", test_hrt_cpy_cat_nochk },
|
||||
{ "test_hrt_printf_nochk", test_hrt_printf_nochk },
|
||||
{ "test_hrt_conv_gs1_brackets_nochk", test_hrt_conv_gs1_brackets_nochk },
|
||||
{ "test_rt_cpy_seg", test_rt_cpy_seg },
|
||||
{ "test_rt_cpy", test_rt_cpy },
|
||||
{ "test_rt_printf_256", test_rt_printf_256 },
|
||||
{ "test_set_height", test_set_height },
|
||||
{ "test_debug_test_codeword_dump_int", test_debug_test_codeword_dump_int },
|
||||
};
|
||||
|
|
|
@ -77,7 +77,7 @@ static void test_eanx_leading_zeroes(const testCtx *const p_ctx) {
|
|||
int i, length, composite_length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_eanx_leading_zeroes", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1539,7 +1539,7 @@ static void test_examples(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_examples", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1712,7 +1712,7 @@ static void test_odd_numbered_numeric(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_odd_numbered_numeric", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1841,7 +1841,7 @@ static void test_ean128_cc_shift(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_ean128_cc_shift", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1922,7 +1922,7 @@ static void test_ean128_cc_width(const testCtx *const p_ctx) {
|
|||
int i, length, composite_length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_ean128_cc_width", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2389,7 +2389,7 @@ static void test_encodation_0(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encodation_0", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2527,7 +2527,7 @@ static void test_encodation_10(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encodation_10", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2943,7 +2943,7 @@ static void test_encodation_11(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encodation_11", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3096,7 +3096,7 @@ static void test_addongap(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_addongap", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3187,7 +3187,7 @@ static void test_gs1parens(const testCtx *const p_ctx) {
|
|||
int i, length, composite_length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_gs1parens", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3226,65 +3226,68 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
|
||||
int ret;
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_EANX_CC, -1, -1, "1234567", "[20]12", 0, "12345670" }, /* EAN-8 */
|
||||
/* 1*/ { BARCODE_EANX_CC, -1, BARCODE_RAW_TEXT, "1234567", "[20]12", 0, "12345670" }, /* EAN-8 */
|
||||
/* 2*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[20]12", 0, "1234567890128" }, /* EAN-13 */
|
||||
/* 3*/ { BARCODE_EANX_CC, -1, BARCODE_RAW_TEXT, "123456789012", "[20]12", 0, "1234567890128" }, /* EAN-13 */
|
||||
/* 4*/ { BARCODE_EANX_CC, -1, -1, "1234567890128", "[20]12", 0, "1234567890128" },
|
||||
/* 5*/ { BARCODE_EANX_CC, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, "" },
|
||||
/* 6*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, "" }, /* Still checked */
|
||||
/* 7*/ { BARCODE_EANX_CC, -1, -1, "1234567890128", "[20]1A", ZINT_WARN_NONCOMPLIANT, "1234567890128" }, /* AI (20) should be 2 nos. */
|
||||
/* 8*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "1234567890128", "[20]1A", 0, "1234567890128" },
|
||||
/* 9*/ { BARCODE_EANX_CC, -1, -1, "1234567890128+12", "[20]12", 0, "1234567890128+12" },
|
||||
/* 10*/ { BARCODE_EANX_CC, -1, BARCODE_RAW_TEXT, "1234567890128+12", "[20]12", 0, "1234567890128+12" },
|
||||
/* 11*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]12", 0, "(01)12345678901231" },
|
||||
/* 12*/ { BARCODE_DBAR_OMN_CC, -1, BARCODE_RAW_TEXT, "1234567890123", "[20]12", 0, "0112345678901231" },
|
||||
/* 13*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901231", "[20]12", 0, "(01)12345678901231" },
|
||||
/* 14*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "" },
|
||||
/* 15*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "" }, /* Still checked */
|
||||
/* 16*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231" }, /* AI (20) should be 2 nos. */
|
||||
/* 17*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[20]1A", 0, "(01)12345678901231" },
|
||||
/* 18*/ { BARCODE_DBAR_LTD_CC, -1, -1, "1234567890123", "[20]12", 0, "(01)12345678901231" },
|
||||
/* 19*/ { BARCODE_DBAR_LTD_CC, -1, BARCODE_RAW_TEXT, "1234567890123", "[20]12", 0, "0112345678901231" },
|
||||
/* 20*/ { BARCODE_DBAR_LTD_CC, -1, -1, "12345678901231", "[20]12", 0, "(01)12345678901231" },
|
||||
/* 21*/ { BARCODE_DBAR_LTD_CC, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "" },
|
||||
/* 22*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "" }, /* Still checked */
|
||||
/* 23*/ { BARCODE_DBAR_LTD_CC, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231" }, /* AI (20) should be 2 nos. */
|
||||
/* 24*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[20]1A", 0, "(01)12345678901231" },
|
||||
/* 25*/ { BARCODE_UPCA_CC, -1, -1, "12345678901", "[20]12", 0, "123456789012" },
|
||||
/* 26*/ { BARCODE_UPCA_CC, -1, BARCODE_RAW_TEXT, "12345678901", "[20]12", 0, "123456789012" },
|
||||
/* 27*/ { BARCODE_UPCA_CC, -1, -1, "123456789012", "[20]12", 0, "123456789012" },
|
||||
/* 28*/ { BARCODE_UPCA_CC, -1, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, "" },
|
||||
/* 29*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, "" }, /* Still checked */
|
||||
/* 30*/ { BARCODE_UPCA_CC, -1, -1, "123456789012", "[20]1A", ZINT_WARN_NONCOMPLIANT, "123456789012" }, /* AI (20) should be 2 nos. */
|
||||
/* 31*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, "123456789012", "[20]1A", 0, "123456789012" },
|
||||
/* 32*/ { BARCODE_UPCA_CC, -1, -1, "123456789012+123", "[20]12", 0, "123456789012+00123" },
|
||||
/* 33*/ { BARCODE_UPCA_CC, -1, BARCODE_RAW_TEXT, "123456789012+123", "[20]12", 0, "123456789012+00123" },
|
||||
/* 34*/ { BARCODE_UPCE_CC, -1, -1, "123456", "[20]12", 0, "01234565" },
|
||||
/* 35*/ { BARCODE_UPCE_CC, -1, BARCODE_RAW_TEXT, "123456", "[20]12", 0, "01234565" },
|
||||
/* 36*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]12", 0, "12345670" },
|
||||
/* 37*/ { BARCODE_UPCE_CC, -1, -1, "12345670", "[20]12", 0, "12345670" },
|
||||
/* 38*/ { BARCODE_UPCE_CC, -1, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, "" },
|
||||
/* 39*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, "" }, /* Still checked */
|
||||
/* 40*/ { BARCODE_UPCE_CC, -1, -1, "12345670", "[20]12", 0, "12345670" }, /* Check digit can now be given for UPCE_CC, like UPCA_CC */
|
||||
/* 41*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]1A", ZINT_WARN_NONCOMPLIANT, "12345670" }, /* AI (20) should be 2 nos. */
|
||||
/* 42*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, "1234567", "[20]1A", 0, "12345670" },
|
||||
/* 43*/ { BARCODE_UPCE_CC, -1, -1, "1234567+2", "[20]12", 0, "12345670+02" },
|
||||
/* 44*/ { BARCODE_UPCE_CC, -1, BARCODE_RAW_TEXT, "1234567+2", "[20]12", 0, "12345670+02" },
|
||||
/* 45*/ { BARCODE_DBAR_STK_CC, -1, -1, "12345678901231", "[20]12", 0, "" }, /* No HRT for stacked symbologies */
|
||||
/* 46*/ { BARCODE_DBAR_STK_CC, -1, BARCODE_RAW_TEXT, "12345678901231", "[20]12", 0, "0112345678901231" }, /* Unless RAW_TEXT */
|
||||
/* 47*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "12345678901231", "[20]12", 0, "" },
|
||||
/* 48*/ { BARCODE_DBAR_OMNSTK_CC, -1, BARCODE_RAW_TEXT, "12345678901231", "[20]12", 0, "0112345678901231" },
|
||||
/* 0*/ { BARCODE_EANX_CC, -1, -1, "1234567", "[20]12", 0, "12345670", "" }, /* EAN-8 */
|
||||
/* 1*/ { BARCODE_EANX_CC, -1, BARCODE_RAW_TEXT, "1234567", "[20]12", 0, "12345670", "12345670|2012" }, /* EAN-8 */
|
||||
/* 2*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[20]12", 0, "1234567890128", "" }, /* EAN-13 */
|
||||
/* 3*/ { BARCODE_EANX_CC, -1, BARCODE_RAW_TEXT, "123456789012", "[20]12", 0, "1234567890128", "1234567890128|2012" }, /* EAN-13 */
|
||||
/* 4*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[10]LOT123[20]12", 0, "1234567890128", "" }, /* EAN-13 */
|
||||
/* 5*/ { BARCODE_EANX_CC, -1, BARCODE_RAW_TEXT, "123456789012", "[10]LOT123[20]12", 0, "1234567890128", "1234567890128|10LOT123\0352012" }, /* EAN-13 */
|
||||
/* 6*/ { BARCODE_EANX_CC, -1, -1, "1234567890128", "[20]12", 0, "1234567890128", "" },
|
||||
/* 7*/ { BARCODE_EANX_CC, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" },
|
||||
/* 8*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" }, /* Still checked */
|
||||
/* 9*/ { BARCODE_EANX_CC, -1, -1, "1234567890128", "[20]1A", ZINT_WARN_NONCOMPLIANT, "1234567890128", "" }, /* AI (20) should be 2 nos. */
|
||||
/* 10*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "1234567890128", "[20]1A", 0, "1234567890128", "" },
|
||||
/* 11*/ { BARCODE_EANX_CC, -1, -1, "1234567890128+12", "[20]12", 0, "1234567890128+12", "" },
|
||||
/* 12*/ { BARCODE_EANX_CC, -1, BARCODE_RAW_TEXT, "1234567890128+12", "[20]12", 0, "1234567890128+12", "1234567890128+12|2012" },
|
||||
/* 13*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]12", 0, "(01)12345678901231", "" },
|
||||
/* 14*/ { BARCODE_DBAR_OMN_CC, -1, BARCODE_RAW_TEXT, "1234567890123", "[20]12", 0, "(01)12345678901231", "12345678901231|2012" },
|
||||
/* 15*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901231", "[20]12", 0, "(01)12345678901231", "" },
|
||||
/* 16*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" },
|
||||
/* 17*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" }, /* Still checked */
|
||||
/* 18*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231", "" }, /* AI (20) should be 2 nos. */
|
||||
/* 19*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[20]1A", 0, "(01)12345678901231", "" },
|
||||
/* 20*/ { BARCODE_DBAR_LTD_CC, -1, -1, "1234567890123", "[20]12", 0, "(01)12345678901231", "" },
|
||||
/* 21*/ { BARCODE_DBAR_LTD_CC, -1, BARCODE_RAW_TEXT, "1234567890123", "[20]12", 0, "(01)12345678901231", "12345678901231|2012" },
|
||||
/* 22*/ { BARCODE_DBAR_LTD_CC, -1, -1, "12345678901231", "[20]12", 0, "(01)12345678901231", "" },
|
||||
/* 23*/ { BARCODE_DBAR_LTD_CC, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" },
|
||||
/* 24*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" }, /* Still checked */
|
||||
/* 25*/ { BARCODE_DBAR_LTD_CC, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231", "" }, /* AI (20) should be 2 nos. */
|
||||
/* 26*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[20]1A", 0, "(01)12345678901231", "" },
|
||||
/* 27*/ { BARCODE_UPCA_CC, -1, -1, "12345678901", "[20]12", 0, "123456789012", "" },
|
||||
/* 28*/ { BARCODE_UPCA_CC, -1, BARCODE_RAW_TEXT, "12345678901", "[20]12", 0, "123456789012", "123456789012|2012" },
|
||||
/* 29*/ { BARCODE_UPCA_CC, -1, -1, "123456789012", "[20]12", 0, "123456789012", "" },
|
||||
/* 30*/ { BARCODE_UPCA_CC, -1, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" },
|
||||
/* 31*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" }, /* Still checked */
|
||||
/* 32*/ { BARCODE_UPCA_CC, -1, -1, "123456789012", "[20]1A", ZINT_WARN_NONCOMPLIANT, "123456789012", "" }, /* AI (20) should be 2 nos. */
|
||||
/* 33*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, "123456789012", "[20]1A", 0, "123456789012", "" },
|
||||
/* 34*/ { BARCODE_UPCA_CC, -1, -1, "123456789012+123", "[20]12", 0, "123456789012+00123", "" },
|
||||
/* 35*/ { BARCODE_UPCA_CC, -1, BARCODE_RAW_TEXT, "123456789012+123", "[20]12", 0, "123456789012+00123", "123456789012+00123|2012" },
|
||||
/* 36*/ { BARCODE_UPCE_CC, -1, -1, "123456", "[20]12", 0, "01234565", "" },
|
||||
/* 37*/ { BARCODE_UPCE_CC, -1, BARCODE_RAW_TEXT, "123456", "[20]12", 0, "01234565", "01234565|2012" },
|
||||
/* 38*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]12", 0, "12345670", "" },
|
||||
/* 39*/ { BARCODE_UPCE_CC, -1, -1, "12345670", "[20]12", 0, "12345670", "" },
|
||||
/* 40*/ { BARCODE_UPCE_CC, -1, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" },
|
||||
/* 41*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" }, /* Still checked */
|
||||
/* 42*/ { BARCODE_UPCE_CC, -1, -1, "12345670", "[20]12", 0, "12345670", "" }, /* Check digit can now be given for UPCE_CC, like UPCA_CC */
|
||||
/* 43*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]1A", ZINT_WARN_NONCOMPLIANT, "12345670", "" }, /* AI (20) should be 2 nos. */
|
||||
/* 44*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, "1234567", "[20]1A", 0, "12345670", "" },
|
||||
/* 45*/ { BARCODE_UPCE_CC, -1, -1, "1234567+2", "[20]12", 0, "12345670+02", "" },
|
||||
/* 46*/ { BARCODE_UPCE_CC, -1, BARCODE_RAW_TEXT, "1234567+2", "[20]12", 0, "12345670+02", "12345670+02|2012" },
|
||||
/* 47*/ { BARCODE_DBAR_STK_CC, -1, -1, "12345678901231", "[20]12", 0, "", "" }, /* No HRT for stacked symbologies */
|
||||
/* 48*/ { BARCODE_DBAR_STK_CC, -1, BARCODE_RAW_TEXT, "12345678901231", "[20]12", 0, "", "12345678901231|2012" }, /* But have RAW_TEXT */
|
||||
/* 49*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "12345678901231", "[20]12", 0, "", "" },
|
||||
/* 50*/ { BARCODE_DBAR_OMNSTK_CC, -1, BARCODE_RAW_TEXT, "12345678901231", "[20]12", 0, "", "12345678901231|2012" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, composite_length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3300,6 +3303,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
strcpy(symbol->primary, data[i].data);
|
||||
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
composite_length = (int) strlen(data[i].composite);
|
||||
|
||||
|
@ -3308,7 +3312,20 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
|
||||
assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d\n",
|
||||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((const char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
|
||||
assert_zero(strcmp((const char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -3463,7 +3480,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int i, length, composite_length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3539,7 +3556,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_fuzz", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -56,7 +56,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[4096];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -128,7 +128,7 @@ static void test_options(const testCtx *const p_ctx) {
|
|||
|
||||
char option_3_buf[64];
|
||||
|
||||
testStartSymbol("test_options", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -177,51 +177,52 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int ret;
|
||||
const char *expected;
|
||||
int bwipp_cmp;
|
||||
int zxingcpp_cmp;
|
||||
const char *comment;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "A", -1, 0, "66 21 6A", 1, "" },
|
||||
/* 1*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "A", -1, 0, "6C 03 66 21", 1, "" },
|
||||
/* 2*/ { UNICODE_MODE, 40, 18, -1, { 0, 0, "" }, "A", -1, 0, "6C 28 00 00 66 21", 1, "" },
|
||||
/* 3*/ { UNICODE_MODE, 113, 18, -1, { 0, 0, "" }, "A", -1, 0, "6C 28 00 49 66 21", 1, "" },
|
||||
/* 4*/ { UNICODE_MODE, 899, 18, -1, { 0, 0, "" }, "A", -1, 0, "6C 28 07 44 66 21", 1, "" },
|
||||
/* 5*/ { UNICODE_MODE, 12769, 18, 8 << 8, { 0, 0, "" }, "A", -1, 0, "6C 28 70 49 66 21", 1, "" },
|
||||
/* 6*/ { UNICODE_MODE, 811799, 18, -1, { 0, 0, "" }, "A", -1, 0, "6C 67 40 50 66 21", 1, "" },
|
||||
/* 7*/ { UNICODE_MODE, 811800, -1, -1, { 0, 0, "" }, "A", -1, ZINT_ERROR_INVALID_OPTION, "Error 525: ECI code '811800' out of range (0 to 811799)", 1, "" },
|
||||
/* 8*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\000", 1, 0, "65 40 6A", 1, "LatchA (0x65) NUL PAD" },
|
||||
/* 9*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\010", -1, 0, "65 48 6A", 1, "LatchA (0x65) BS PAD" },
|
||||
/* 10*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\011", -1, 0, "65 49 6A", 1, "Lead special; LatchA (0x65) HT PAD" },
|
||||
/* 11*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\034", -1, 0, "65 5C 6A", 1, "Lead special; LatchA (0x65) FS PAD" },
|
||||
/* 12*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\035", -1, 0, "65 5D 6A", 1, "Lead special; LatchA (0x65) GS PAD" },
|
||||
/* 13*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\036", -1, 0, "65 5E 6A", 1, "Lead special; LatchA (0x65) RS PAD" },
|
||||
/* 14*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\037", -1, 0, "65 5F 6A", 1, "LatchA (0x65) US PAD" },
|
||||
/* 15*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\177", -1, 0, "66 5F 6A", 1, "ShiftB (0x66) DEL PAD" },
|
||||
/* 16*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "[)>\03605\035A\036\004", -1, 0, "6A 61 21", 1, "[)>RS 05 GS A RS EOT; LatchB (0x6A) Macro97 (0x61) A" },
|
||||
/* 17*/ { UNICODE_MODE, -1, 17, -1, { 0, 0, "" }, "[)>\03606\035\011\034\035\036\036\004", -1, 0, "6A 62 61 62 63 64 6A", 1, "[)>RS 06 GS HT FS GS RS RS EOT; LatchB (0x6A) Macro98 (0x62) HT FS GS RS PAD" },
|
||||
/* 18*/ { UNICODE_MODE, -1, 17, -1, { 0, 0, "" }, "[)>\03612\03512345\036\004", -1, 0, "6A 63 11 67 17 2D 6A", 1, "[)>RS 12 GS A RS EOT; LatchB (0x6A) Macro99 (0x63) 1 2xShiftC (0x67) 23 45 PAD" },
|
||||
/* 19*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "[)>\03601Blah\004", -1, 0, "6A 64 10 11 22 4C 41 48 6A", 1, "[)>RS 01 Blah EOT; LatchB (0x6A) Macro100 (0x64) 0 1 B l a h PAD" },
|
||||
/* 20*/ { UNICODE_MODE, -1, 22, -1, { 0, 0, "" }, "[)>\03605\035A\004", -1, 0, "65 3B 09 1E 5E 10 15 5D 21 44", 1, "NOTE: no longer using Macro for malformed 05/06/12" },
|
||||
/* 21*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "[)>\03606A\004", -1, 0, "65 3B 09 1E 5E 10 16 21 44", 1, "NOTE: no longer using Macro for malformed 05/06/12" },
|
||||
/* 22*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "[)>\036991\036\004", -1, 0, "6A 64 19 19 11 64", 1, "[)>RS 99 1 RS EOT; LatchB (0x6A) Macro100 (0x64) 9 9 1 RS" },
|
||||
/* 23*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "1712345610", -1, 0, "6B 64 0C 22 38", 1, "FNC1 (0x6B) 17..10 12 34 56" },
|
||||
/* 24*/ { GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[17]123456[10]123", -1, ZINT_WARN_NONCOMPLIANT, "64 0C 22 38 0C 66 13", 0, "17..10 12 34 56 12 ShiftB (0x66) 3; BWIPP does not allow bad month" },
|
||||
/* 25*/ { GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[90]ABC[90]abc[90]123", -1, 0, "5A 6A 21 22 23 6B 19 10 41 42 43 6B 19 67 01 17 6A", 1, "90 LatchB (0x6A) A B C FNC1 (0x6B) 9 0 a b c FNC1 (0x6B) 9 2xShitfC (0x67) 01 23 PAD" },
|
||||
/* 26*/ { GS1_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(90)ABC(90)abc(90)123", -1, 0, "5A 6A 21 22 23 6B 19 10 41 42 43 6B 19 67 01 17 6A", 1, "90 LatchB (0x6A) A B C FNC1 (0x6B) 9 0 a b c FNC1 (0x6B) 9 2xShitfC (0x67) 01 23 PAD" },
|
||||
/* 27*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "99aA[{00\000", 9, 0, "6B 63 6A 41 21 3B 5B 10 10 65 40", 1, "FNC1 (0x6B) 99 LatchB (0x6A) a A [ { 0 0 ShiftA (0x65) NUL" },
|
||||
/* 28*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015\012", -1, 0, "66 60", 0, "ShiftB (0x66) CR/LF; BWIPP different encodation" },
|
||||
/* 29*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A\015\012", -1, 0, "67 21 60", 0, "2xShiftB (0x67) A CR/LF; BWIPP different encodation" },
|
||||
/* 30*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015\015\012", -1, 0, "65 4D 4D 4A", 1, "LatchA (0x65) CR CR LF" },
|
||||
/* 31*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "ABCDE12345678", -1, 0, "6A 21 22 23 24 25 69 0C 22 38 4E", 1, "LatchB (0x6A) A B C D 4xShiftC 12 34 56 78" },
|
||||
/* 32*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\000ABCD1234567890", 15, 0, "65 40 21 22 23 24 6A 0C 22 38 4E 5A 6A", 1, "LatchA (0x65) NULL A B C D LatchC (0x6A) 12 34 56 78 90 PAD" },
|
||||
/* 33*/ { DATA_MODE, -1, -1, 2 << 8, { 0, 0, "" }, "\141\142\143\144\145\200\201\202\203\204\377", -1, 0, "6A 41 42 43 44 45 70 31 5A 35 21 5A 5F 02 31", 1, "LatchB (0x6A) a b c d e BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x84 0xFF" },
|
||||
/* 34*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\200\061\062\240\063\064\201\202\065\066", -1, 0, "6E 40 0C 6F 00 22 70 03 10 42 6E 15 16", 1, "UpperShiftA (0x6E) NUL 12 UpperShiftB (0x6F) SP 34 BinaryLatch (0x70) 0x81 0x82 TermB (0x6E) 5 6" },
|
||||
/* 35*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\200\201\202\203\061\062\063\064", -1, 0, "70 13 56 0A 59 2C 67 0C 22", 1, "BinaryLatch (0x70) 0x80 0x81 0x82 0x83 Intr2xShiftC (0x67) 12 3" },
|
||||
/* 36*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\001\200\201\202\203\204\200\201\202\203\204", -1, 0, "65 41 70 31 5A 35 21 5A 5F 31 5A 35 21 5A 5F", 1, "LatchA (0x65) SOH BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x80 0x81 0x82 0x83" },
|
||||
/* 37*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\001abc\011\015\012\036", -1, 0, "65 41 65 41 42 43 61 60 64", 1, "LatchA (0x65) SOH 6xShiftB (0x65) a b c HT CR/LF RS" },
|
||||
/* 38*/ { UNICODE_MODE, -1, -1, -1, { 35, 35, "" }, "ABCDE", -1, 0, "6A 21 22 23 24 25 3A 3A 6C", 1, "LatchB (0x6A) A B C D E Z Z FNC2" },
|
||||
/* 39*/ { UNICODE_MODE, -1, -1, -1, { 9, 10, "" }, "1234567890", -1, 0, "6B 0C 22 38 4E 5A 65 19 21 6C", 1, "FNC1 (0x6B) 12 34 56 78 90 LatchA (0x65) 9 A FNC2" },
|
||||
/* 40*/ { UNICODE_MODE, -1, -1, -1, { 2, 3, "" }, "\001\002\003\004", -1, 0, "65 41 42 43 44 6A 12 13 6C", 1, "LatchA (0x65) <SOH> <STX> <ETX> <EOT> PAD 2 3 FNC2" },
|
||||
/* 41*/ { DATA_MODE, -1, -1, -1, { 1, 34, "" }, "\200\201\202\203", -1, 0, "70 13 56 0A 59 2C 6D 11 39 6C", 1, "BinaryLatch (0x70) (...) TermA (0x6D) 1 Y FNC2" },
|
||||
/* 0*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "A", -1, 0, "66 21 6A", 1, 1, "" },
|
||||
/* 1*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "A", -1, 0, "6C 03 66 21", 1, 1, "" },
|
||||
/* 2*/ { UNICODE_MODE, 40, 18, -1, { 0, 0, "" }, "A", -1, 0, "6C 28 00 00 66 21", 1, 1, "" },
|
||||
/* 3*/ { UNICODE_MODE, 113, 18, -1, { 0, 0, "" }, "A", -1, 0, "6C 28 00 49 66 21", 1, 1, "" },
|
||||
/* 4*/ { UNICODE_MODE, 899, 18, -1, { 0, 0, "" }, "A", -1, 0, "6C 28 07 44 66 21", 1, 1, "" },
|
||||
/* 5*/ { UNICODE_MODE, 12769, 18, 8 << 8, { 0, 0, "" }, "A", -1, 0, "6C 28 70 49 66 21", 1, 1, "" },
|
||||
/* 6*/ { UNICODE_MODE, 811799, 18, -1, { 0, 0, "" }, "A", -1, 0, "6C 67 40 50 66 21", 1, 1, "" },
|
||||
/* 7*/ { UNICODE_MODE, 811800, -1, -1, { 0, 0, "" }, "A", -1, ZINT_ERROR_INVALID_OPTION, "Error 525: ECI code '811800' out of range (0 to 811799)", 1, 1, "" },
|
||||
/* 8*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\000", 1, 0, "65 40 6A", 1, 1, "LatchA (0x65) NUL PAD" },
|
||||
/* 9*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\010", -1, 0, "65 48 6A", 1, 1, "LatchA (0x65) BS PAD" },
|
||||
/* 10*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\011", -1, 0, "65 49 6A", 1, 1, "Lead special; LatchA (0x65) HT PAD" },
|
||||
/* 11*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\034", -1, 0, "65 5C 6A", 1, 1, "Lead special; LatchA (0x65) FS PAD" },
|
||||
/* 12*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\035", -1, 0, "65 5D 6A", 1, 1, "Lead special; LatchA (0x65) GS PAD" },
|
||||
/* 13*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\036", -1, 0, "65 5E 6A", 1, 1, "Lead special; LatchA (0x65) RS PAD" },
|
||||
/* 14*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\037", -1, 0, "65 5F 6A", 1, 1, "LatchA (0x65) US PAD" },
|
||||
/* 15*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\177", -1, 0, "66 5F 6A", 1, 1, "ShiftB (0x66) DEL PAD" },
|
||||
/* 16*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "[)>\03605\035A\036\004", -1, 0, "6A 61 21", 1, 1, "[)>RS 05 GS A RS EOT; LatchB (0x6A) Macro97 (0x61) A" },
|
||||
/* 17*/ { UNICODE_MODE, -1, 17, -1, { 0, 0, "" }, "[)>\03606\035\011\034\035\036\036\004", -1, 0, "6A 62 61 62 63 64 6A", 1, 1, "[)>RS 06 GS HT FS GS RS RS EOT; LatchB (0x6A) Macro98 (0x62) HT FS GS RS PAD" },
|
||||
/* 18*/ { UNICODE_MODE, -1, 17, -1, { 0, 0, "" }, "[)>\03612\03512345\036\004", -1, 0, "6A 63 11 67 17 2D 6A", 1, 1, "[)>RS 12 GS A RS EOT; LatchB (0x6A) Macro99 (0x63) 1 2xShiftC (0x67) 23 45 PAD" },
|
||||
/* 19*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "[)>\03601Blah\004", -1, 0, "6A 64 10 11 22 4C 41 48 6A", 1, 1, "[)>RS 01 Blah EOT; LatchB (0x6A) Macro100 (0x64) 0 1 B l a h PAD" },
|
||||
/* 20*/ { UNICODE_MODE, -1, 22, -1, { 0, 0, "" }, "[)>\03605\035A\004", -1, 0, "65 3B 09 1E 5E 10 15 5D 21 44", 1, 1, "NOTE: no longer using Macro for malformed 05/06/12" },
|
||||
/* 21*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "[)>\03606A\004", -1, 0, "65 3B 09 1E 5E 10 16 21 44", 1, 1, "NOTE: no longer using Macro for malformed 05/06/12" },
|
||||
/* 22*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "[)>\036991\036\004", -1, 0, "6A 64 19 19 11 64", 1, 1, "[)>RS 99 1 RS EOT; LatchB (0x6A) Macro100 (0x64) 9 9 1 RS" },
|
||||
/* 23*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "1712345610", -1, 0, "6B 64 0C 22 38", 1, 1, "FNC1 (0x6B) 17..10 12 34 56" },
|
||||
/* 24*/ { GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[17]123456[10]123", -1, ZINT_WARN_NONCOMPLIANT, "64 0C 22 38 0C 66 13", 0, 1, "17..10 12 34 56 12 ShiftB (0x66) 3; BWIPP does not allow bad month" },
|
||||
/* 25*/ { GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[90]ABC[90]abc[90]123", -1, 0, "5A 6A 21 22 23 6B 19 10 41 42 43 6B 19 67 01 17 6A", 1, 1, "90 LatchB (0x6A) A B C FNC1 (0x6B) 9 0 a b c FNC1 (0x6B) 9 2xShitfC (0x67) 01 23 PAD" },
|
||||
/* 26*/ { GS1_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(90)ABC(90)abc(90)123", -1, 0, "5A 6A 21 22 23 6B 19 10 41 42 43 6B 19 67 01 17 6A", 1, 1, "90 LatchB (0x6A) A B C FNC1 (0x6B) 9 0 a b c FNC1 (0x6B) 9 2xShitfC (0x67) 01 23 PAD" },
|
||||
/* 27*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "99aA[{00\000", 9, 0, "6B 63 6A 41 21 3B 5B 10 10 65 40", 1, 1, "FNC1 (0x6B) 99 LatchB (0x6A) a A [ { 0 0 ShiftA (0x65) NUL" },
|
||||
/* 28*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015\012", -1, 0, "66 60", 0, 1, "ShiftB (0x66) CR/LF; BWIPP different encodation" },
|
||||
/* 29*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A\015\012", -1, 0, "67 21 60", 0, 1, "2xShiftB (0x67) A CR/LF; BWIPP different encodation" },
|
||||
/* 30*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015\015\012", -1, 0, "65 4D 4D 4A", 1, 1, "LatchA (0x65) CR CR LF" },
|
||||
/* 31*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "ABCDE12345678", -1, 0, "6A 21 22 23 24 25 69 0C 22 38 4E", 1, 1, "LatchB (0x6A) A B C D 4xShiftC 12 34 56 78" },
|
||||
/* 32*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\000ABCD1234567890", 15, 0, "65 40 21 22 23 24 6A 0C 22 38 4E 5A 6A", 1, 1, "LatchA (0x65) NULL A B C D LatchC (0x6A) 12 34 56 78 90 PAD" },
|
||||
/* 33*/ { DATA_MODE, -1, -1, 2 << 8, { 0, 0, "" }, "\141\142\143\144\145\200\201\202\203\204\377", -1, 0, "6A 41 42 43 44 45 70 31 5A 35 21 5A 5F 02 31", 1, 899, "LatchB (0x6A) a b c d e BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x84 0xFF" },
|
||||
/* 34*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\200\061\062\240\063\064\201\202\065\066", -1, 0, "6E 40 0C 6F 00 22 70 03 10 42 6E 15 16", 1, 899, "UpperShiftA (0x6E) NUL 12 UpperShiftB (0x6F) SP 34 BinaryLatch (0x70) 0x81 0x82 TermB (0x6E) 5 6" },
|
||||
/* 35*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\200\201\202\203\061\062\063\064", -1, 0, "70 13 56 0A 59 2C 67 0C 22", 1, 899, "BinaryLatch (0x70) 0x80 0x81 0x82 0x83 Intr2xShiftC (0x67) 12 3" },
|
||||
/* 36*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\001\200\201\202\203\204\200\201\202\203\204", -1, 0, "65 41 70 31 5A 35 21 5A 5F 31 5A 35 21 5A 5F", 1, 899, "LatchA (0x65) SOH BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x80 0x81 0x82 0x83" },
|
||||
/* 37*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\001abc\011\015\012\036", -1, 0, "65 41 65 41 42 43 61 60 64", 1, 1, "LatchA (0x65) SOH 6xShiftB (0x65) a b c HT CR/LF RS" },
|
||||
/* 38*/ { UNICODE_MODE, -1, -1, -1, { 35, 35, "" }, "ABCDE", -1, 0, "6A 21 22 23 24 25 3A 3A 6C", 1, 1, "LatchB (0x6A) A B C D E Z Z FNC2" },
|
||||
/* 39*/ { UNICODE_MODE, -1, -1, -1, { 9, 10, "" }, "1234567890", -1, 0, "6B 0C 22 38 4E 5A 65 19 21 6C", 1, 1, "FNC1 (0x6B) 12 34 56 78 90 LatchA (0x65) 9 A FNC2" },
|
||||
/* 40*/ { UNICODE_MODE, -1, -1, -1, { 2, 3, "" }, "\001\002\003\004", -1, 0, "65 41 42 43 44 6A 12 13 6C", 1, 1, "LatchA (0x65) <SOH> <STX> <ETX> <EOT> PAD 2 3 FNC2" },
|
||||
/* 41*/ { DATA_MODE, -1, -1, -1, { 1, 34, "" }, "\200\201\202\203", -1, 0, "70 13 56 0A 59 2C 6D 11 39 6C", 1, 899, "BinaryLatch (0x70) (...) TermA (0x6D) 1 Y FNC2" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
@ -231,10 +232,11 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
char cmp_buf[32768];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -256,11 +258,12 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
printf(" /*%3d*/ { %s, %d, %d, %d, { %d, %d, \"%s\" }, \"%s\", %d, %s, \"%s\", %d, \"%s\" },\n",
|
||||
printf(" /*%3d*/ { %s, %d, %d, %d, { %d, %d, \"%s\" }, \"%s\", %d, %s, \"%s\", %d, %d, \"%s\" },\n",
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_2, data[i].option_3,
|
||||
data[i].structapp.index, data[i].structapp.count, data[i].structapp.id,
|
||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||
data[i].length, testUtilErrorName(data[i].ret), symbol->errtxt, data[i].bwipp_cmp, data[i].comment);
|
||||
data[i].length, testUtilErrorName(data[i].ret), symbol->errtxt, data[i].bwipp_cmp,
|
||||
data[i].zxingcpp_cmp, data[i].comment);
|
||||
} else {
|
||||
assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
|
||||
|
||||
|
@ -276,19 +279,25 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
|
||||
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
|
||||
}
|
||||
}
|
||||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[200 * 200 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_nonzero(data[i].zxingcpp_cmp, "i:%d data[i].zxingcpp_cmp == 0", i);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, data[i].zxingcpp_cmp,
|
||||
cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -883,7 +892,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"10100000001010000"
|
||||
"01010001000101000"
|
||||
},
|
||||
/* 40*/ { DATA_MODE, -1, -1, { 0, 0, "" }, "\101\102\103\104\105\106\107\200\101\102\240\101", -1, 0, 18, 27, 1, 1, "Code Set B Upper Shift A Upper Shift B",
|
||||
/* 40*/ { DATA_MODE, -1, -1, { 0, 0, "" }, "\101\102\103\104\105\106\107\200\101\102\240\101", -1, 0, 18, 27, 1, 899, "Code Set B Upper Shift A Upper Shift B",
|
||||
"101010100000101000101000001"
|
||||
"010100010101000100010101000"
|
||||
"000010001010100000101010101"
|
||||
|
@ -963,7 +972,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"0001010000010100000100010101"
|
||||
"1010100010000000101010101010"
|
||||
},
|
||||
/* 44*/ { DATA_MODE, -1, -1, { 0, 0, "" }, "\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\200", -1, 0, 20, 29, 1, 1, "Binary Latch C",
|
||||
/* 44*/ { DATA_MODE, -1, -1, { 0, 0, "" }, "\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\200", -1, 0, 20, 29, 1, 899, "Binary Latch C",
|
||||
"10101010000010100010101010001"
|
||||
"01010001000101010001000000010"
|
||||
"00001010101000101010001000001"
|
||||
|
@ -1098,10 +1107,11 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
char cmp_buf[8192];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1155,13 +1165,18 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
} else {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[16384];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, data[i].zxingcpp_cmp,
|
||||
cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf,
|
||||
ret_len, escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1321,7 +1336,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
"10100000100000001010101010101010001010001010000010100010001010101010000010001010000000100010001"
|
||||
"01000001000100000101000101010100000000010001000100000101000100000100010101010101000101010100010"
|
||||
},
|
||||
/* 5*/ { DATA_MODE, -1, -1, { 0, 0, "" }, { { TU("\266"), 1, 0 }, { TU("\266"), 1, 7 }, { TU("\266"), 1, 0 } }, 0, 15, 22, 1, 1, "Standard example + extra seg, data mode",
|
||||
/* 5*/ { DATA_MODE, -1, -1, { 0, 0, "" }, { { TU("\266"), 1, 0 }, { TU("\266"), 1, 7 }, { TU("\266"), 1, 0 } }, 0, 15, 22, 1, 0, "Standard example + extra seg, data mode",
|
||||
"1000101010000000001000"
|
||||
"0100000101000101000001"
|
||||
"1000001000100010101000"
|
||||
|
@ -1363,7 +1378,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
"01010000010100010001010000010000010101"
|
||||
"10000010100000001010100000100010001010"
|
||||
},
|
||||
/* 7*/ { UNICODE_MODE, 29, -1, { 0, 0, "" }, { { TU("çèéêëì"), -1, 0 }, { TU("òóô"), -1, 899 }, { TU(""), 0, 0 } }, 0, 20, 29, 1, 0, "BIN_LATCH ECI > 0xFF; ZXing-C++ test can't handle binary",
|
||||
/* 7*/ { UNICODE_MODE, 29, -1, { 0, 0, "" }, { { TU("çèéêëì"), -1, 0 }, { TU("òóô"), -1, 899 }, { TU(""), 0, 0 } }, 0, 20, 29, 1, 0, "BIN_LATCH ECI > 0xFF; ZXing-C++ test can't handle UTF-8 binary",
|
||||
"10001010001010101000000010001"
|
||||
"01000001000100010100010101010"
|
||||
"10000000100000100000000010101"
|
||||
|
@ -1385,7 +1400,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
"10101000101010000010001010001"
|
||||
"01010101010100010001010001010"
|
||||
},
|
||||
/* 8*/ { UNICODE_MODE, 29, -1, { 0, 0, "" }, { { TU("çèéêëì"), -1, 0 }, { TU("òóô"), -1, 65536 }, { TU(""), 0, 0 } }, 0, 22, 29, 1, 0, "BIN_LATCH ECI > 0xFFFF; ZXing-C++ test can't handle binary",
|
||||
/* 8*/ { UNICODE_MODE, 29, -1, { 0, 0, "" }, { { TU("çèéêëì"), -1, 0 }, { TU("òóô"), -1, 65536 }, { TU(""), 0, 0 } }, 0, 22, 29, 1, 0, "BIN_LATCH ECI > 0xFFFF; ZXing-C++ test can't handle UTF-8 binary",
|
||||
"10101000100000101000001010001"
|
||||
"00010101000000000100010100000"
|
||||
"10100010001010000010101010100"
|
||||
|
@ -1481,7 +1496,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode_segs", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1543,21 +1558,25 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not ZXing-C++ compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
} else if (data[i].input_mode == DATA_MODE) {
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) {
|
||||
printf("i:%d multiple segments in DATA_MODE not currently supported for ZXing-C++ testing (%s)\n",
|
||||
printf("i:%d %s multiple segments in DATA_MODE not currently supported for ZXing-C++ testing\n",
|
||||
i, testUtilBarcodeName(symbol->symbology));
|
||||
}
|
||||
} else {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[16384];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, (const char *) data[i].segs[0].source, data[i].segs[0].length,
|
||||
modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, (const char *) data[i].segs[0].source,
|
||||
data[i].segs[0].length, modules_dump, data[i].zxingcpp_cmp, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmpSegs(symbol, cmp_msg, cmp_buf, cmp_len, data[i].segs, seg_count,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmpSegs %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf,
|
||||
ret_len, escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1569,6 +1588,181 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int eci;
|
||||
int output_options;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
int expected_eci;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
int expected_raw_eci;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, "é", -1, 0, 0, "", -1, 0 },
|
||||
/* 1*/ { UNICODE_MODE, -1, BARCODE_RAW_TEXT, "é", -1, 0, 0, "\351", -1, 3 },
|
||||
/* 2*/ { UNICODE_MODE, -1, -1, "ก", -1, ZINT_WARN_USES_ECI, 13, "", -1, 0 },
|
||||
/* 3*/ { UNICODE_MODE, -1, BARCODE_RAW_TEXT, "ก", -1, ZINT_WARN_USES_ECI, 13, "\241", -1, 13 },
|
||||
/* 4*/ { UNICODE_MODE | ESCAPE_MODE, -1, -1, "[)>\\R05\\GA\\R\\E", -1, 0, 0, "", -1, 0 },
|
||||
/* 5*/ { UNICODE_MODE | ESCAPE_MODE, -1, BARCODE_RAW_TEXT, "[)>\\R05\\GA\\R\\E", -1, 0, 0, "[)>\03605\035A\036\004", -1, 3 },
|
||||
/* 6*/ { DATA_MODE, -1, -1, "\351", -1, 0, 0, "", -1, 0 },
|
||||
/* 7*/ { DATA_MODE, -1, BARCODE_RAW_TEXT, "\351", -1, 0, 0, "\351", -1, 3 },
|
||||
/* 8*/ { UNICODE_MODE, 26, -1, "é", -1, 0, 26, "", -1, 0 },
|
||||
/* 9*/ { UNICODE_MODE, 26, BARCODE_RAW_TEXT, "é", -1, 0, 26, "é", -1, 26 },
|
||||
/* 10*/ { UNICODE_MODE, 899, -1, "é", -1, 0, 899, "", -1, 0 },
|
||||
/* 11*/ { UNICODE_MODE, 899, BARCODE_RAW_TEXT, "é", -1, 0, 899, "é", -1, 899 },
|
||||
/* 12*/ { GS1_MODE, -1, -1, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "", -1, 0 },
|
||||
/* 13*/ { GS1_MODE, -1, BARCODE_RAW_TEXT, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "01049123451234591597033130128\03510ABC123", -1, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_DOTCODE, data[i].input_mode, data[i].eci,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n",
|
||||
i, symbol->eci, data[i].expected_eci);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->raw_segs[0].source, symbol->raw_segs[0].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[0].eci, data[i].expected_raw_eci,
|
||||
"i:%d raw_segs[0].eci %d != expected_raw_eci %d\n",
|
||||
i, symbol->raw_segs[0].eci, data[i].expected_raw_eci);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt_segs(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int output_options;
|
||||
struct zint_seg segs[3];
|
||||
int ret;
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
struct zint_seg expected_raw_segs[3];
|
||||
int expected_raw_seg_count;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, {0} }, 0, 12, 19, {{0}}, 0 },
|
||||
/* 1*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 12, 19, { { TU("\266"), 1, 3 }, { TU("\266"), 1, 7 }, {0} }, 2 },
|
||||
/* 2*/ { UNICODE_MODE, -1, { { TU("éé"), -1, 0 }, { TU("กขฯ"), -1, 0 }, { TU("βββ"), -1, 0 } }, ZINT_WARN_USES_ECI, 19, 28, {{0}}, 0 },
|
||||
/* 3*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("éé"), -1, 0 }, { TU("กขฯ"), -1, 0 }, { TU("βββ"), -1, 0 } }, ZINT_WARN_USES_ECI, 19, 28, { { TU("\351\351"), 2, 3 }, { TU("\241\242\317"), 3, 13 }, { TU("\342\342\342"), 3, 9 } }, 3 },
|
||||
/* 4*/ { DATA_MODE, -1, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("\223\137"), -1, 20 } }, 0, 19, 28, {{0}}, 0 },
|
||||
/* 5*/ { DATA_MODE, BARCODE_RAW_TEXT, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("\223\137"), -1, 20 } }, 0, 19, 28, { { TU("¶"), 2, 26 }, { TU("\320\226"), 2, 3 }, { TU("\223\137"), 2, 20 } }, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, j, seg_count, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
testUtilSetSymbol(symbol, BARCODE_DOTCODE, data[i].input_mode, -1 /*eci*/,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
NULL, 0, debug);
|
||||
for (j = 0, seg_count = 0; j < 3 && data[i].segs[j].length; j++, seg_count++);
|
||||
|
||||
ret = ZBarcode_Encode_Segs(symbol, data[i].segs, seg_count);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode_Segs ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (width %d)\n",
|
||||
i, symbol->rows, data[i].expected_rows, symbol->width);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n",
|
||||
i, symbol->width, data[i].expected_width);
|
||||
|
||||
assert_equal(symbol->raw_seg_count, data[i].expected_raw_seg_count, "i:%d symbol->raw_seg_count %d != %d\n",
|
||||
i, symbol->raw_seg_count, data[i].expected_raw_seg_count);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
for (j = 0; j < symbol->raw_seg_count; j++) {
|
||||
assert_nonnull(symbol->raw_segs[j].source, "i:%d raw_segs[%d].source NULL\n", i, j);
|
||||
|
||||
expected_length = data[i].expected_raw_segs[j].length;
|
||||
|
||||
assert_equal(symbol->raw_segs[j].length, expected_length,
|
||||
"i:%d raw_segs[%d].length %d != expected_length %d\n",
|
||||
i, j, symbol->raw_segs[j].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[j].source, data[i].expected_raw_segs[j].source, expected_length),
|
||||
"i:%d raw_segs[%d].source memcmp(%s, %s, %d) != 0\n", i, j,
|
||||
testUtilEscape((const char *) symbol->raw_segs[j].source, expected_length, escaped,
|
||||
sizeof(escaped)),
|
||||
testUtilEscape((const char *) data[i].expected_raw_segs[j].source, expected_length,
|
||||
escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[j].eci, data[i].expected_raw_segs[j].eci,
|
||||
"i:%d raw_segs[%d].eci %d != expected_raw_segs.eci %d\n",
|
||||
i, j, symbol->raw_segs[j].eci, data[i].expected_raw_segs[j].eci);
|
||||
}
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
/* #181 Christian Hartlage / Nico Gunkel OSS-Fuzz */
|
||||
static void test_fuzz(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
@ -1608,7 +1802,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_fuzz", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1771,6 +1965,8 @@ int main(int argc, char *argv[]) {
|
|||
{ "test_input", test_input },
|
||||
{ "test_encode", test_encode },
|
||||
{ "test_encode_segs", test_encode_segs },
|
||||
{ "test_rt", test_rt },
|
||||
{ "test_rt_segs", test_rt_segs },
|
||||
{ "test_fuzz", test_fuzz },
|
||||
{ "test_generate", test_generate },
|
||||
{ "test_perf", test_perf },
|
||||
|
|
|
@ -39,30 +39,31 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
const char *data;
|
||||
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { -1, "79-7", "" }, /* None */
|
||||
/* 1*/ { BARCODE_RAW_TEXT, "79-7", "1271" },
|
||||
/* 2*/ { -1, "1271", "" }, /* None */
|
||||
/* 3*/ { BARCODE_RAW_TEXT, "1271", "1271" },
|
||||
/* 4*/ { -1, "012710", "" }, /* None */
|
||||
/* 5*/ { BARCODE_RAW_TEXT, "012710", "1271" },
|
||||
/* 6*/ { -1, "1-0", "" }, /* None */
|
||||
/* 7*/ { BARCODE_RAW_TEXT, "1-0", "0016" },
|
||||
/* 8*/ { -1, "2047/63A", "" }, /* None */
|
||||
/* 9*/ { BARCODE_RAW_TEXT, "2047/63A", "204763A" },
|
||||
/* 10*/ { -1, "79-7/1", "" }, /* None */
|
||||
/* 11*/ { BARCODE_RAW_TEXT, "79-7/1", "12711" },
|
||||
/* 12*/ { -1, "79-7/sa", "" }, /* None */
|
||||
/* 13*/ { BARCODE_RAW_TEXT, "79-7/sa", "127162A" },
|
||||
/* 0*/ { -1, "79-7", "", "" }, /* None */
|
||||
/* 1*/ { BARCODE_RAW_TEXT, "79-7", "", "1271" },
|
||||
/* 2*/ { -1, "1271", "", "" }, /* None */
|
||||
/* 3*/ { BARCODE_RAW_TEXT, "1271", "", "1271" },
|
||||
/* 4*/ { -1, "012710", "", "" }, /* None */
|
||||
/* 5*/ { BARCODE_RAW_TEXT, "012710", "", "1271" },
|
||||
/* 6*/ { -1, "1-0", "", "" }, /* None */
|
||||
/* 7*/ { BARCODE_RAW_TEXT, "1-0", "", "0016" },
|
||||
/* 8*/ { -1, "2047/63A", "", "" }, /* None */
|
||||
/* 9*/ { BARCODE_RAW_TEXT, "2047/63A", "", "204763A" },
|
||||
/* 10*/ { -1, "79-7/1", "", "" }, /* None */
|
||||
/* 11*/ { BARCODE_RAW_TEXT, "79-7/1", "", "12711" },
|
||||
/* 12*/ { -1, "79-7/sa", "", "" }, /* None */
|
||||
/* 13*/ { BARCODE_RAW_TEXT, "79-7/sa", "", "127162A" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -75,6 +76,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -83,6 +85,18 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length, symbol->text);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -133,7 +147,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -283,9 +297,10 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
char cmp_buf[4096];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -318,13 +333,18 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ static void test_bom(const testCtx *const p_ctx) {
|
|||
|
||||
int width, height;
|
||||
|
||||
testStart("test_bom");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
@ -98,7 +98,7 @@ static void test_iso_8859_16(const testCtx *const p_ctx) {
|
|||
int length, ret;
|
||||
struct zint_symbol *symbol;
|
||||
|
||||
testStart("test_iso_8859_16");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
@ -385,7 +385,7 @@ static void test_reduced_charset_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol;
|
||||
|
||||
testStart("test_reduced_charset_input");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -695,7 +695,7 @@ static void test_utf8_to_eci_sb(const testCtx *const p_ctx) {
|
|||
unsigned char source[5];
|
||||
unsigned char dest[2] = {0};
|
||||
|
||||
testStart("test_utf8_to_eci_sb");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int j;
|
||||
|
@ -774,7 +774,7 @@ static void test_utf8_to_eci_ascii(const testCtx *const p_ctx) {
|
|||
|
||||
char dest[128] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_utf8_to_eci_ascii");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int out_length;
|
||||
|
@ -825,7 +825,7 @@ static void test_utf8_to_eci_utf16be(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
const int eci = 25;
|
||||
|
||||
testStart("test_utf8_to_eci_utf16be");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int out_length, eci_length;
|
||||
|
@ -890,7 +890,7 @@ static void test_utf8_to_eci_utf16le(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
const int eci = 33;
|
||||
|
||||
testStart("test_utf8_to_eci_utf16le");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int out_length, eci_length;
|
||||
|
@ -952,7 +952,7 @@ static void test_utf8_to_eci_utf32be(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
const int eci = 34;
|
||||
|
||||
testStart("test_utf8_to_eci_utf32be");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int out_length, eci_length;
|
||||
|
@ -1016,7 +1016,7 @@ static void test_utf8_to_eci_utf32le(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
const int eci = 35;
|
||||
|
||||
testStart("test_utf8_to_eci_utf32le");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int out_length, eci_length;
|
||||
|
@ -1084,7 +1084,7 @@ static void test_utf8_to_eci_sjis(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
const int eci = 20;
|
||||
|
||||
testStart("test_utf8_to_eci_sjis");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int out_length, eci_length;
|
||||
|
@ -1130,7 +1130,7 @@ static void test_utf8_to_eci_big5(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
const int eci = 28;
|
||||
|
||||
testStart("test_utf8_to_eci_big5");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int out_length, eci_length;
|
||||
|
@ -1176,7 +1176,7 @@ static void test_utf8_to_eci_gb2312(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
const int eci = 29;
|
||||
|
||||
testStart("test_utf8_to_eci_gb2312");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int out_length, eci_length;
|
||||
|
@ -1222,7 +1222,7 @@ static void test_utf8_to_eci_euc_kr(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
const int eci = 30;
|
||||
|
||||
testStart("test_utf8_to_eci_euc_kr");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int out_length, eci_length;
|
||||
|
@ -1268,7 +1268,7 @@ static void test_utf8_to_eci_gbk(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
const int eci = 31;
|
||||
|
||||
testStart("test_utf8_to_eci_gbk");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int out_length, eci_length;
|
||||
|
@ -1314,7 +1314,7 @@ static void test_utf8_to_eci_gb18030(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
const int eci = 32;
|
||||
|
||||
testStart("test_utf8_to_eci_gb18030");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int out_length, eci_length;
|
||||
|
@ -1366,7 +1366,7 @@ static void test_is_eci_convertible_segs(const testCtx *const p_ctx) {
|
|||
|
||||
int convertible[3];
|
||||
|
||||
testStart("test_is_eci_convertible_segs");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1405,7 +1405,7 @@ static void test_get_best_eci(const testCtx *const p_ctx) {
|
|||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
||||
testStart("test_get_best_eci");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ static void test_get_best_eci_segs(const testCtx *const p_ctx) {
|
|||
int i, j, seg_count, ret;
|
||||
struct zint_symbol *symbol;
|
||||
|
||||
testStart("test_get_best_eci_segs");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ static void test_print(const testCtx *const p_ctx) {
|
|||
have_libreoffice = testUtilHaveLibreOffice();
|
||||
}
|
||||
|
||||
testStartSymbol("test_print", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
char data_dir_path[1024];
|
||||
|
@ -219,7 +219,7 @@ static void test_outfile(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_outfile");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol.symbology = BARCODE_CODE128;
|
||||
symbol.vector = &vector;
|
||||
|
|
|
@ -73,7 +73,7 @@ static void test_svg(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_svg", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -154,7 +154,7 @@ static void test_putsf(const testCtx *const p_ctx) {
|
|||
char buf[512] = {0}; /* Suppress clang-16/17 run-time exception MemorySanitizer: use-of-uninitialized-value */
|
||||
#endif
|
||||
|
||||
testStart("test_putsf");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (j = 0; j < 2; j++) { /* 1st `memfile`, then file */
|
||||
#ifdef ZINT_TEST_NO_FMEMOPEN
|
||||
|
@ -247,7 +247,7 @@ static void test_printf(const testCtx *const p_ctx) {
|
|||
|
||||
(void)debug;
|
||||
|
||||
testStart("test_printf");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (j = 0; j < 2; j++) { /* 1st memfile, then file */
|
||||
ZBarcode_Reset(symbol);
|
||||
|
@ -344,7 +344,7 @@ static void test_seek(const testCtx *const p_ctx) {
|
|||
|
||||
(void)debug;
|
||||
|
||||
testStart("test_seek");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (j = 0; j < 2; j++) { /* 1st memfile, then file */
|
||||
ZBarcode_Reset(symbol);
|
||||
|
@ -434,7 +434,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
(void)debug;
|
||||
|
||||
testStart("test_large");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
|
|
@ -173,7 +173,7 @@ static void test_u_gb18030_int(const testCtx *const p_ctx) {
|
|||
(void)debug;
|
||||
#endif
|
||||
|
||||
testStart("test_u_gb18030_int");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
#ifdef TEST_JUST_SAY_GNO
|
||||
if ((debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */
|
||||
|
@ -284,7 +284,7 @@ static void test_gb18030_utf8(const testCtx *const p_ctx) {
|
|||
struct zint_symbol symbol = {0};
|
||||
unsigned int gbdata[30] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_gb18030_utf8");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_length;
|
||||
|
@ -401,7 +401,7 @@ static void test_gb18030_utf8_to_eci(const testCtx *const p_ctx) {
|
|||
|
||||
unsigned int gbdata[30] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_gb18030_utf8_to_eci");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_length;
|
||||
|
@ -457,7 +457,7 @@ static void test_gb18030_cpy(const testCtx *const p_ctx) {
|
|||
|
||||
unsigned int gbdata[30] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_gb18030_cpy");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_length;
|
||||
|
@ -508,7 +508,7 @@ static void test_u_gbk_int(const testCtx *const p_ctx) {
|
|||
unsigned int val, val2;
|
||||
unsigned int i;
|
||||
|
||||
testStart("test_u_gbk_int");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < 0xFFFE; i++) {
|
||||
if (i >= 0xD800 && i <= 0xDFFF) { /* UTF-16 surrogates */
|
||||
|
|
|
@ -92,7 +92,7 @@ static void test_u_gb2312_int(const testCtx *const p_ctx) {
|
|||
(void)debug;
|
||||
#endif
|
||||
|
||||
testStart("test_u_gb2312_int");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
#ifdef TEST_JUST_SAY_GNO
|
||||
if ((debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */
|
||||
|
@ -190,7 +190,7 @@ static void test_gb2312_utf8(const testCtx *const p_ctx) {
|
|||
struct zint_symbol symbol = {0};
|
||||
unsigned int gbdata[20] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_gb2312_utf8");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_length;
|
||||
|
@ -292,7 +292,7 @@ static void test_gb2312_utf8_to_eci(const testCtx *const p_ctx) {
|
|||
|
||||
unsigned int gbdata[20] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_gb2312_utf8_to_eci");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_length;
|
||||
|
@ -348,7 +348,7 @@ static void test_gb2312_cpy(const testCtx *const p_ctx) {
|
|||
|
||||
unsigned int gbdata[20] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_gb2312_cpy");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_length;
|
||||
|
|
|
@ -68,7 +68,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
|
|||
|
||||
const char *const have_identify = testUtilHaveIdentify();
|
||||
|
||||
testStart("test_pixel_plot");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int size;
|
||||
|
@ -196,7 +196,7 @@ static void test_print(const testCtx *const p_ctx) {
|
|||
|
||||
const char *const have_identify = testUtilHaveIdentify();
|
||||
|
||||
testStartSymbol("test_print", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
char data_dir_path[1024];
|
||||
|
@ -303,7 +303,7 @@ static void test_outfile(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_outfile");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol.symbology = BARCODE_CODE128;
|
||||
symbol.bitmap = data;
|
||||
|
@ -341,7 +341,7 @@ static void test_large_scale(const testCtx *const p_ctx) {
|
|||
struct zint_symbol symbol = {0};
|
||||
char data[] = "1";
|
||||
|
||||
testStart("test_large_scale");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
length = (int) strlen(data);
|
||||
|
||||
|
@ -373,7 +373,7 @@ static void test_too_big(const testCtx *const p_ctx) {
|
|||
|
||||
(void)debug;
|
||||
|
||||
testStart("test_too_big");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
length = (int) strlen(data);
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[2800 + 1];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -173,7 +173,7 @@ static void test_options(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_options", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -364,7 +364,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
char escaped[1024];
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -520,7 +520,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -857,7 +857,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
|
||||
char escaped[8192];
|
||||
|
||||
testStartSymbol("test_encode_segs", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -907,6 +907,190 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int eci;
|
||||
int option_3;
|
||||
int output_options;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
int expected_eci;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
int expected_raw_eci;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, -1, "é", -1, 0, 0, "", -1, 0 },
|
||||
/* 1*/ { UNICODE_MODE, -1, -1, BARCODE_RAW_TEXT, "é", -1, 0, 0, "\250\246", -1, 29 },
|
||||
/* 2*/ { UNICODE_MODE, -1, -1, -1, "ก", -1, ZINT_WARN_USES_ECI, 13, "", -1, 0 },
|
||||
/* 3*/ { UNICODE_MODE, -1, -1, BARCODE_RAW_TEXT, "ก", -1, ZINT_WARN_USES_ECI, 13, "\241", -1, 13 },
|
||||
/* 4*/ { UNICODE_MODE, -1, -1, -1, "电", -1, 0, 0, "", -1, 0 },
|
||||
/* 5*/ { UNICODE_MODE, -1, -1, BARCODE_RAW_TEXT, "电", -1, 0, 0, "\265\347", -1, 29 },
|
||||
/* 6*/ { DATA_MODE, -1, -1, -1, "\351", -1, 0, 0, "", -1, 0 },
|
||||
/* 7*/ { DATA_MODE, -1, -1, BARCODE_RAW_TEXT, "\351", -1, 0, 0, "\351", -1, 29 },
|
||||
/* 8*/ { DATA_MODE, -1, ZINT_FULL_MULTIBYTE, -1, "\351", -1, 0, 0, "", -1, 0 },
|
||||
/* 9*/ { DATA_MODE, -1, ZINT_FULL_MULTIBYTE, BARCODE_RAW_TEXT, "\351", -1, 0, 0, "\351", -1, 29 },
|
||||
/* 10*/ { DATA_MODE, -1, ZINT_FULL_MULTIBYTE, -1, "\265\347", -1, 0, 0, "", -1, 0 },
|
||||
/* 11*/ { DATA_MODE, -1, ZINT_FULL_MULTIBYTE, BARCODE_RAW_TEXT, "\265\347", -1, 0, 0, "\265\347", -1, 29 },
|
||||
/* 12*/ { UNICODE_MODE, 26, -1, -1, "é", -1, 0, 26, "", -1, 0 },
|
||||
/* 13*/ { UNICODE_MODE, 26, -1, BARCODE_RAW_TEXT, "é", -1, 0, 26, "é", -1, 26 },
|
||||
/* 14*/ { UNICODE_MODE, 899, -1, -1, "é", -1, 0, 899, "", -1, 0 },
|
||||
/* 15*/ { UNICODE_MODE, 899, -1, BARCODE_RAW_TEXT, "é", -1, 0, 899, "é", -1, 899 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, data[i].input_mode, data[i].eci,
|
||||
-1 /*option_1*/, -1 /*option_2*/, data[i].option_3, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n",
|
||||
i, symbol->eci, data[i].expected_eci);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->raw_segs[0].source, symbol->raw_segs[0].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[0].eci, data[i].expected_raw_eci,
|
||||
"i:%d raw_segs[0].eci %d != expected_raw_eci %d\n",
|
||||
i, symbol->raw_segs[0].eci, data[i].expected_raw_eci);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt_segs(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int output_options;
|
||||
struct zint_seg segs[3];
|
||||
int ret;
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
struct zint_seg expected_raw_segs[3];
|
||||
int expected_raw_seg_count;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, {0} }, ZINT_WARN_USES_ECI, 30, 30, {{0}}, 0 },
|
||||
/* 1*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, ZINT_WARN_USES_ECI, 30, 30, { { TU("\266"), 1, 3 }, { TU("\266"), 1, 7 }, {0} }, 2 },
|
||||
/* 2*/ { UNICODE_MODE, -1, { { TU("ก"), -1, 0 }, { TU("Ж"), -1, 7 }, {0} }, ZINT_WARN_USES_ECI, 30, 30, {{0}}, 0 },
|
||||
/* 3*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("ก"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, ZINT_WARN_USES_ECI, 30, 30, { { TU("\241"), 1, 13 }, { TU("\266"), 1, 7 }, {0} }, 2 },
|
||||
/* 4*/ { UNICODE_MODE, -1, { { TU("电"), -1, 0 }, { TU("Ж"), -1, 7 }, {0} }, 0, 30, 30, {{0}}, 0 },
|
||||
/* 5*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("电"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 30, 30, { { TU("\265\347"), 2, 29 }, { TU("\266"), 1, 7 }, {0} }, 2 },
|
||||
/* 6*/ { UNICODE_MODE, -1, { { TU("电电"), -1, 0 }, { TU("กขฯ"), -1, 13 }, { TU("βββ"), -1, 9 } }, 0, 30, 30, {{0}}, 0 },
|
||||
/* 7*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("电电"), -1, 0 }, { TU("กขฯ"), -1, 13 }, { TU("βββ"), -1, 9 } }, 0, 30, 30, { { TU("\265\347\265\347"), 4, 29 }, { TU("\241\242\317"), 3, 13 }, { TU("\342\342\342"), 3, 9 } }, 3 },
|
||||
/* 8*/ { UNICODE_MODE, -1, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("点"), -1, 20 } }, 0, 30, 30, {{0}}, 0 },
|
||||
/* 9*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("点"), -1, 20 } }, 0, 30, 30, { { TU("¶"), 2, 26 }, { TU("\247\250"), 2, 29 }, { TU("\223\137"), 2, 20 } }, 3 },
|
||||
/* 10*/ { DATA_MODE, -1, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("\223\137"), -1, 20 } }, 0, 30, 30, {{0}}, 0 },
|
||||
/* 11*/ { DATA_MODE, BARCODE_RAW_TEXT, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("\223\137"), -1, 20 } }, 0, 30, 30, { { TU("¶"), 2, 26 }, { TU("\320\226"), 2, 29 }, { TU("\223\137"), 2, 20 } }, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, j, seg_count, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, data[i].input_mode, -1 /*eci*/,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
NULL, 0, debug);
|
||||
for (j = 0, seg_count = 0; j < 3 && data[i].segs[j].length; j++, seg_count++);
|
||||
|
||||
ret = ZBarcode_Encode_Segs(symbol, data[i].segs, seg_count);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode_Segs ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (width %d)\n",
|
||||
i, symbol->rows, data[i].expected_rows, symbol->width);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n",
|
||||
i, symbol->width, data[i].expected_width);
|
||||
|
||||
assert_equal(symbol->raw_seg_count, data[i].expected_raw_seg_count, "i:%d symbol->raw_seg_count %d != %d\n",
|
||||
i, symbol->raw_seg_count, data[i].expected_raw_seg_count);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
for (j = 0; j < symbol->raw_seg_count; j++) {
|
||||
assert_nonnull(symbol->raw_segs[j].source, "i:%d raw_segs[%d].source NULL\n", i, j);
|
||||
|
||||
expected_length = data[i].expected_raw_segs[j].length;
|
||||
|
||||
assert_equal(symbol->raw_segs[j].length, expected_length,
|
||||
"i:%d raw_segs[%d].length %d != expected_length %d\n",
|
||||
i, j, symbol->raw_segs[j].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[j].source, data[i].expected_raw_segs[j].source, expected_length),
|
||||
"i:%d raw_segs[%d].source memcmp(%s, %s, %d) != 0\n", i, j,
|
||||
testUtilEscape((const char *) symbol->raw_segs[j].source, expected_length, escaped,
|
||||
sizeof(escaped)),
|
||||
testUtilEscape((const char *) data[i].expected_raw_segs[j].source, expected_length,
|
||||
escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[j].eci, data[i].expected_raw_segs[j].eci,
|
||||
"i:%d raw_segs[%d].eci %d != expected_raw_segs.eci %d\n",
|
||||
i, j, symbol->raw_segs[j].eci, data[i].expected_raw_segs[j].eci);
|
||||
}
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#define TEST_PERF_ITERATIONS 1000
|
||||
|
@ -1001,6 +1185,8 @@ int main(int argc, char *argv[]) {
|
|||
{ "test_input", test_input },
|
||||
{ "test_encode", test_encode },
|
||||
{ "test_encode_segs", test_encode_segs },
|
||||
{ "test_rt", test_rt },
|
||||
{ "test_rt_segs", test_rt_segs },
|
||||
{ "test_perf", test_perf },
|
||||
};
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ static void test_gs1_reduce(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_gs1_reduce", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -271,107 +271,108 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
|
||||
int ret;
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_GS1_128, -1, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12" }, /* Incorrect check digit */
|
||||
/* 1*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "", 0, "(01)12345678901234(20)12" },
|
||||
/* 2*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "01123456789012342012" },
|
||||
/* 3*/ { BARCODE_GS1_128, -1, -1, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12" },
|
||||
/* 4*/ { BARCODE_GS1_128, -1, -1, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB" }, /* AI (20) should be 2 nos. */
|
||||
/* 5*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]10[20]AB", "", 0, "(01)12345678901231(10)10(20)AB" },
|
||||
/* 6*/ { BARCODE_GS1_128, -1, -1, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12" },
|
||||
/* 7*/ { BARCODE_GS1_128, -1, -1, "[91]ABCDEF]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDEF]GH" }, /* Invalid CSET 82 character */
|
||||
/* 8*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, -1, "[91]ABCDEF]GH", "", 0, "(91)ABCDEF]GH" },
|
||||
/* 9*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[91]ABCDEF]GH", "", ZINT_WARN_NONCOMPLIANT, "91ABCDEF]GH" },
|
||||
/* 10*/ { BARCODE_GS1_128, -1, -1, "[91]ABCDEF)GH", "", 0, "(91)ABCDEF)GH" },
|
||||
/* 11*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[91]ABCDEF)GH", "", 0, "91ABCDEF)GH" },
|
||||
/* 12*/ { BARCODE_GS1_128, -1, -1, "[91]ABCDEF(GH", "", 0, "(91)ABCDEF(GH" },
|
||||
/* 13*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[91]ABCDEF(GH", "", 0, "91ABCDEF(GH" },
|
||||
/* 14*/ { BARCODE_GS1_128, -1, -1, "[91]ABCDE(20)12", "", 0, "(91)ABCDE(20)12" },
|
||||
/* 15*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[91]ABCDE(20)12", "", 0, "91ABCDE(20)12" },
|
||||
/* 16*/ { BARCODE_GS1_128, -1, -1, "[90]1234[91]ABCDE(20)12", "", 0, "(90)1234(91)ABCDE(20)12" },
|
||||
/* 17*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[90]1234[91]ABCDE(20)12", "", 0, "901234\03591ABCDE(20)12" },
|
||||
/* 18*/ { BARCODE_GS1_128, -1, -1, "[90]1234[91]ABCDE(20)12[20]12", "", 0, "(90)1234(91)ABCDE(20)12(20)12" },
|
||||
/* 19*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[90]1234[91]ABCDE(20)12[20]12", "", 0, "901234\03591ABCDE(20)12\0352012" },
|
||||
/* 20*/ { BARCODE_GS1_128, GS1PARENS_MODE, -1, "(91)ABCDEF]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDEF]GH" }, /* Invalid CSET 82 character */
|
||||
/* 21*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "(91)ABCDEF]GH", "", 0, "(91)ABCDEF]GH" },
|
||||
/* 22*/ { BARCODE_GS1_128, GS1PARENS_MODE, BARCODE_RAW_TEXT, "(91)ABCDEF]GH", "", ZINT_WARN_NONCOMPLIANT, "91ABCDEF]GH" },
|
||||
/* 23*/ { BARCODE_GS1_128, GS1PARENS_MODE, -1, "(91)ABCDEF)GH", "", 0, "(91)ABCDEF)GH" },
|
||||
/* 24*/ { BARCODE_GS1_128, GS1PARENS_MODE, BARCODE_RAW_TEXT, "(91)ABCDEF)GH", "", 0, "91ABCDEF)GH" },
|
||||
/* 25*/ { BARCODE_GS1_128, GS1PARENS_MODE, -1, "(91)ABCDE[FGH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDE[FGH" }, /* Invalid CSET 82 character */
|
||||
/* 26*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "(91)ABCDE[FGH", "", 0, "(91)ABCDE[FGH" },
|
||||
/* 27*/ { BARCODE_GS1_128, GS1PARENS_MODE, BARCODE_RAW_TEXT, "(91)ABCDE[FGH", "", ZINT_WARN_NONCOMPLIANT, "91ABCDE[FGH" },
|
||||
/* 28*/ { BARCODE_GS1_128, GS1PARENS_MODE, -1, "(91)ABCDE[92]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDE[92]GH" }, /* Invalid CSET 82 character */
|
||||
/* 29*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "(91)ABCDE[92]GH", "", 0, "(91)ABCDE[92]GH" },
|
||||
/* 30*/ { BARCODE_GS1_128, GS1PARENS_MODE, BARCODE_RAW_TEXT, "(91)ABCDE[92]GH", "", ZINT_WARN_NONCOMPLIANT, "91ABCDE[92]GH" },
|
||||
/* 31*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12" }, /* Incorrect check digit */
|
||||
/* 32*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "[21]12345", 0, "(01)12345678901234(20)12" },
|
||||
/* 33*/ { BARCODE_GS1_128_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "01123456789012342012" },
|
||||
/* 34*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[20]12", "[21]12345", 0, "(01)12345678901231(20)12" },
|
||||
/* 35*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]12[20]AB", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB" }, /* AI (20) should be 2 nos. */
|
||||
/* 36*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]12[20]AB", "[21]12345", 0, "(01)12345678901231(10)12(20)AB" },
|
||||
/* 37*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]AB[20]12", "[21]12345", 0, "(01)12345678901231(10)AB(20)12" },
|
||||
/* 38*/ { BARCODE_GS1_128_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12", "[21]12345", 0, "011234567890123110AB\0352012" },
|
||||
/* 39*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]AB[20]12", "[30]1234567A", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)AB(20)12" },
|
||||
/* 40*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]AB[20]12", "[30]1234567A", 0, "(01)12345678901231(10)AB(20)12" },
|
||||
/* 41*/ { BARCODE_EAN14, -1, -1, "1234567890123", "", 0, "(01)12345678901231" },
|
||||
/* 42*/ { BARCODE_EAN14, -1, BARCODE_RAW_TEXT, "1234567890123", "", 0, "0112345678901231" },
|
||||
/* 43*/ { BARCODE_EAN14, -1, -1, "1234", "", 0, "(01)00000000012348" },
|
||||
/* 44*/ { BARCODE_EAN14, -1, BARCODE_RAW_TEXT, "1234", "", 0, "0100000000012348" },
|
||||
/* 45*/ { BARCODE_EAN14, -1, -1, "12345", "", 0, "(01)00000000123457" },
|
||||
/* 46*/ { BARCODE_EAN14, -1, -1, "12340", "", 0, "(01)00000000123402" },
|
||||
/* 47*/ { BARCODE_NVE18, -1, -1, "12345678901234567", "", 0, "(00)123456789012345675" },
|
||||
/* 48*/ { BARCODE_NVE18, -1, BARCODE_RAW_TEXT, "12345678901234567", "", 0, "00123456789012345675" },
|
||||
/* 49*/ { BARCODE_NVE18, -1, -1, "1234", "", 0, "(00)000000000000012348" },
|
||||
/* 50*/ { BARCODE_NVE18, -1, BARCODE_RAW_TEXT, "1234", "", 0, "00000000000000012348" },
|
||||
/* 51*/ { BARCODE_NVE18, -1, -1, "12345", "", 0, "(00)000000000000123457" },
|
||||
/* 52*/ { BARCODE_NVE18, -1, -1, "12340", "", 0, "(00)000000000000123402" },
|
||||
/* 53*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12" }, /* Incorrect check digit */
|
||||
/* 54*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "", 0, "(01)12345678901234(20)12" },
|
||||
/* 55*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "01123456789012342012" },
|
||||
/* 56*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12" },
|
||||
/* 57*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[20]12", "", 0, "01123456789012312012" },
|
||||
/* 58*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB" }, /* AI (20) should be 2 nos. */
|
||||
/* 59*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]12[20]AB", "", 0, "(01)12345678901231(10)12(20)AB" },
|
||||
/* 60*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "01123456789012311012\03520AB" },
|
||||
/* 61*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12" },
|
||||
/* 62*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12", "", 0, "011234567890123110AB\0352012" },
|
||||
/* 63*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(2012", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(2012" },
|
||||
/* 64*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(2012", "", 0, "011234567890123110AB\035201290ABC(2012" },
|
||||
/* 65*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC20)12" },
|
||||
/* 66*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "011234567890123110AB\035201290ABC20)12" },
|
||||
/* 67*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12" },
|
||||
/* 68*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(20)12", "", 0, "011234567890123110AB\035201290ABC(20)12" },
|
||||
/* 69*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(20)12[91]12(", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12(91)12(" },
|
||||
/* 70*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(20)12[91]12(", "", 0, "011234567890123110AB\035201290ABC(20)12\0359112(" },
|
||||
/* 71*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901234", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234" },
|
||||
/* 72*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234", "[21]12345", 0, "(01)12345678901234" },
|
||||
/* 73*/ { BARCODE_DBAR_EXP_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234", "[21]12345", ZINT_WARN_NONCOMPLIANT, "0112345678901234" },
|
||||
/* 74*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231", "[21]12345", 0, "(01)12345678901231" },
|
||||
/* 75*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231[20]12[21]12345", "[21]12345", 0, "(01)12345678901231(20)12(21)12345" },
|
||||
/* 76*/ { BARCODE_DBAR_EXP_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[20]12[21]12345", "[21]12345", 0, "011234567890123120122112345" },
|
||||
/* 77*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "" },
|
||||
/* 78*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "", 0, "" },
|
||||
/* 79*/ { BARCODE_DBAR_EXPSTK, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "01123456789012342012" },
|
||||
/* 80*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231[20]12", "", 0, "" },
|
||||
/* 81*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "" },
|
||||
/* 82*/ { BARCODE_DBAR_EXPSTK, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "011234567890123110AB\035201290ABC20)12" },
|
||||
/* 83*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "" },
|
||||
/* 84*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "[21]12345", 0, "" },
|
||||
/* 85*/ { BARCODE_DBAR_EXPSTK_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "01123456789012342012" },
|
||||
/* 86*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231[20]12", "[21]12345", 0, "" },
|
||||
/* 87*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "[21]12345", 0, "" },
|
||||
/* 88*/ { BARCODE_DBAR_EXPSTK_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "[21]12345", 0, "011234567890123110AB\035201290ABC20)12" },
|
||||
/* 0*/ { BARCODE_GS1_128, -1, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "" }, /* Incorrect check digit */
|
||||
/* 1*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "", 0, "(01)12345678901234(20)12", "" },
|
||||
/* 2*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "01123456789012342012" },
|
||||
/* 3*/ { BARCODE_GS1_128, -1, -1, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12", "" },
|
||||
/* 4*/ { BARCODE_GS1_128, -1, -1, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB", "" }, /* AI (20) should be 2 nos. */
|
||||
/* 5*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]10[20]AB", "", 0, "(01)12345678901231(10)10(20)AB", "" },
|
||||
/* 6*/ { BARCODE_GS1_128, -1, -1, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12", "" },
|
||||
/* 7*/ { BARCODE_GS1_128, -1, -1, "[91]ABCDEF]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDEF]GH", "" }, /* Invalid CSET 82 character */
|
||||
/* 8*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, -1, "[91]ABCDEF]GH", "", 0, "(91)ABCDEF]GH", "" },
|
||||
/* 9*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[91]ABCDEF]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDEF]GH", "91ABCDEF]GH" },
|
||||
/* 10*/ { BARCODE_GS1_128, -1, -1, "[91]ABCDEF)GH", "", 0, "(91)ABCDEF)GH", "" },
|
||||
/* 11*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[91]ABCDEF)GH", "", 0, "(91)ABCDEF)GH", "91ABCDEF)GH" },
|
||||
/* 12*/ { BARCODE_GS1_128, -1, -1, "[91]ABCDEF(GH", "", 0, "(91)ABCDEF(GH", "" },
|
||||
/* 13*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[91]ABCDEF(GH", "", 0, "(91)ABCDEF(GH", "91ABCDEF(GH" },
|
||||
/* 14*/ { BARCODE_GS1_128, -1, -1, "[91]ABCDE(20)12", "", 0, "(91)ABCDE(20)12", "" },
|
||||
/* 15*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[91]ABCDE(20)12", "", 0, "(91)ABCDE(20)12", "91ABCDE(20)12" },
|
||||
/* 16*/ { BARCODE_GS1_128, -1, -1, "[90]1234[91]ABCDE(20)12", "", 0, "(90)1234(91)ABCDE(20)12", "" },
|
||||
/* 17*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[90]1234[91]ABCDE(20)12", "", 0, "(90)1234(91)ABCDE(20)12", "901234\03591ABCDE(20)12" },
|
||||
/* 18*/ { BARCODE_GS1_128, -1, -1, "[90]1234[91]ABCDE(20)12[20]12", "", 0, "(90)1234(91)ABCDE(20)12(20)12", "" },
|
||||
/* 19*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[90]1234[91]ABCDE(20)12[20]12", "", 0, "(90)1234(91)ABCDE(20)12(20)12", "901234\03591ABCDE(20)12\0352012" },
|
||||
/* 20*/ { BARCODE_GS1_128, GS1PARENS_MODE, -1, "(91)ABCDEF]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDEF]GH", "" }, /* Invalid CSET 82 character */
|
||||
/* 21*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "(91)ABCDEF]GH", "", 0, "(91)ABCDEF]GH", "" },
|
||||
/* 22*/ { BARCODE_GS1_128, GS1PARENS_MODE, BARCODE_RAW_TEXT, "(91)ABCDEF]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDEF]GH", "91ABCDEF]GH" },
|
||||
/* 23*/ { BARCODE_GS1_128, GS1PARENS_MODE, -1, "(91)ABCDEF)GH", "", 0, "(91)ABCDEF)GH", "" },
|
||||
/* 24*/ { BARCODE_GS1_128, GS1PARENS_MODE, BARCODE_RAW_TEXT, "(91)ABCDEF)GH", "", 0, "(91)ABCDEF)GH", "91ABCDEF)GH" },
|
||||
/* 25*/ { BARCODE_GS1_128, GS1PARENS_MODE, -1, "(91)ABCDE[FGH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDE[FGH", "" }, /* Invalid CSET 82 character */
|
||||
/* 26*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "(91)ABCDE[FGH", "", 0, "(91)ABCDE[FGH", "" },
|
||||
/* 27*/ { BARCODE_GS1_128, GS1PARENS_MODE, BARCODE_RAW_TEXT, "(91)ABCDE[FGH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDE[FGH", "91ABCDE[FGH" },
|
||||
/* 28*/ { BARCODE_GS1_128, GS1PARENS_MODE, -1, "(91)ABCDE[92]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDE[92]GH", "" }, /* Invalid CSET 82 character */
|
||||
/* 29*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "(91)ABCDE[92]GH", "", 0, "(91)ABCDE[92]GH", "" },
|
||||
/* 30*/ { BARCODE_GS1_128, GS1PARENS_MODE, BARCODE_RAW_TEXT, "(91)ABCDE[92]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDE[92]GH", "91ABCDE[92]GH" },
|
||||
/* 31*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "" }, /* Incorrect check digit */
|
||||
/* 32*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "[21]12345", 0, "(01)12345678901234(20)12", "" },
|
||||
/* 33*/ { BARCODE_GS1_128_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "01123456789012342012|2112345" },
|
||||
/* 34*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[20]12", "[21]12345", 0, "(01)12345678901231(20)12", "" },
|
||||
/* 35*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]12[20]AB", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB", "" }, /* AI (20) should be 2 nos. */
|
||||
/* 36*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]12[20]AB", "[21]12345", 0, "(01)12345678901231(10)12(20)AB", "" },
|
||||
/* 37*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]AB[20]12", "[21]12345", 0, "(01)12345678901231(10)AB(20)12", "" },
|
||||
/* 38*/ { BARCODE_GS1_128_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12", "[21]12345", 0, "(01)12345678901231(10)AB(20)12", "011234567890123110AB\0352012|2112345" },
|
||||
/* 39*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]AB[20]12", "[30]1234567A", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)AB(20)12", "" },
|
||||
/* 40*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]AB[20]12", "[30]1234567A", 0, "(01)12345678901231(10)AB(20)12", "" },
|
||||
/* 41*/ { BARCODE_EAN14, -1, -1, "1234567890123", "", 0, "(01)12345678901231", "" },
|
||||
/* 42*/ { BARCODE_EAN14, -1, BARCODE_RAW_TEXT, "1234567890123", "", 0, "(01)12345678901231", "0112345678901231" },
|
||||
/* 43*/ { BARCODE_EAN14, -1, -1, "1234", "", 0, "(01)00000000012348", "" },
|
||||
/* 44*/ { BARCODE_EAN14, -1, BARCODE_RAW_TEXT, "1234", "", 0, "(01)00000000012348", "0100000000012348" },
|
||||
/* 45*/ { BARCODE_EAN14, -1, -1, "12345", "", 0, "(01)00000000123457", "" },
|
||||
/* 46*/ { BARCODE_EAN14, -1, -1, "12340", "", 0, "(01)00000000123402", "" },
|
||||
/* 47*/ { BARCODE_NVE18, -1, -1, "12345678901234567", "", 0, "(00)123456789012345675", "" },
|
||||
/* 48*/ { BARCODE_NVE18, -1, BARCODE_RAW_TEXT, "12345678901234567", "", 0, "(00)123456789012345675", "00123456789012345675" },
|
||||
/* 49*/ { BARCODE_NVE18, -1, -1, "1234", "", 0, "(00)000000000000012348", "" },
|
||||
/* 50*/ { BARCODE_NVE18, -1, BARCODE_RAW_TEXT, "1234", "", 0, "(00)000000000000012348", "00000000000000012348" },
|
||||
/* 51*/ { BARCODE_NVE18, -1, -1, "12345", "", 0, "(00)000000000000123457", "" },
|
||||
/* 52*/ { BARCODE_NVE18, -1, -1, "12340", "", 0, "(00)000000000000123402", "" },
|
||||
/* 53*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "" }, /* Incorrect check digit */
|
||||
/* 54*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "", 0, "(01)12345678901234(20)12", "" },
|
||||
/* 55*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "01123456789012342012" },
|
||||
/* 56*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12", "" },
|
||||
/* 57*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12", "01123456789012312012" },
|
||||
/* 58*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB", "" }, /* AI (20) should be 2 nos. */
|
||||
/* 59*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]12[20]AB", "", 0, "(01)12345678901231(10)12(20)AB", "" },
|
||||
/* 60*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB", "01123456789012311012\03520AB" },
|
||||
/* 61*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12", "" },
|
||||
/* 62*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12", "011234567890123110AB\0352012" },
|
||||
/* 63*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(2012", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(2012", "" },
|
||||
/* 64*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(2012", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(2012", "011234567890123110AB\035201290ABC(2012" },
|
||||
/* 65*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC20)12", "" },
|
||||
/* 66*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC20)12", "011234567890123110AB\035201290ABC20)12" },
|
||||
/* 67*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12", "" },
|
||||
/* 68*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12", "011234567890123110AB\035201290ABC(20)12" },
|
||||
/* 69*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(20)12[91]12(", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12(91)12(" , ""},
|
||||
/* 70*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(20)12[91]12(", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12(91)12(" , "011234567890123110AB\035201290ABC(20)12\0359112(" },
|
||||
/* 71*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901234", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234", "" },
|
||||
/* 72*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234", "[21]12345", 0, "(01)12345678901234", "" },
|
||||
/* 73*/ { BARCODE_DBAR_EXP_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234", "0112345678901234|2112345" },
|
||||
/* 74*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231", "[21]12345", 0, "(01)12345678901231", "" },
|
||||
/* 75*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231[20]12[21]12345", "[21]12345", 0, "(01)12345678901231(20)12(21)12345", "" },
|
||||
/* 76*/ { BARCODE_DBAR_EXP_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[20]12[21]12345", "[21]12345", 0, "(01)12345678901231(20)12(21)12345", "011234567890123120122112345|2112345" },
|
||||
/* 77*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "", "" },
|
||||
/* 78*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "", 0, "", "" },
|
||||
/* 79*/ { BARCODE_DBAR_EXPSTK, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "", "01123456789012342012" },
|
||||
/* 80*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231[20]12", "", 0, "", "" },
|
||||
/* 81*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "", "" },
|
||||
/* 82*/ { BARCODE_DBAR_EXPSTK, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "", "011234567890123110AB\035201290ABC20)12" },
|
||||
/* 83*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "" , ""},
|
||||
/* 84*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "[21]12345", 0, "", "" },
|
||||
/* 85*/ { BARCODE_DBAR_EXPSTK_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "", "01123456789012342012|2112345" },
|
||||
/* 86*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231[20]12", "[21]12345", 0, "", "" },
|
||||
/* 87*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "[21]12345", 0, "", "" },
|
||||
/* 88*/ { BARCODE_DBAR_EXPSTK_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "[21]12345", 0, "", "011234567890123110AB\035201290ABC20)12|2112345" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -390,6 +391,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
text, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(text), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, data[i].ret, ret, symbol->errtxt);
|
||||
|
@ -398,6 +400,16 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length, "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length), "i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -1455,7 +1467,7 @@ static void test_gs1_verify(const testCtx *const p_ctx) {
|
|||
char reduced[1024] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
char escaped[1024];
|
||||
|
||||
testStartSymbol("test_gs1_verify", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2165,7 +2177,7 @@ static void test_gs1_lint(const testCtx *const p_ctx) {
|
|||
char escaped[1024];
|
||||
char escaped2[1024];
|
||||
|
||||
testStartSymbol("test_gs1_lint", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2336,7 +2348,7 @@ static void test_input_mode(const testCtx *const p_ctx) {
|
|||
|
||||
struct zint_symbol previous_symbol;
|
||||
|
||||
testStartSymbol("test_input_mode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2566,7 +2578,7 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) {
|
|||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol("test_gs1nocheck_mode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -70,7 +70,7 @@ static void test_csv(const testCtx *const p_ctx) {
|
|||
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_csv", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
if (test_performance) {
|
||||
printf("test_csv perf iterations: %d\n", perf_iterations);
|
||||
|
@ -170,18 +170,19 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
int output_options;
|
||||
const char *data;
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { -1, "53379777234994544928-51135759461", "" }, /* None */
|
||||
/* 1*/ { BARCODE_RAW_TEXT, "53379777234994544928-51135759461", "53379777234994544928-51135759461" },
|
||||
/* 0*/ { -1, "53379777234994544928-51135759461", "", "" }, /* None */
|
||||
/* 1*/ { BARCODE_RAW_TEXT, "53379777234994544928-51135759461", "", "53379777234994544928-51135759461" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -194,6 +195,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -202,6 +204,18 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -244,7 +258,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -310,7 +324,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ static void test_numeric(const testCtx *const p_ctx) {
|
|||
int data_size = ARRAY_SIZE(data);
|
||||
int i, ret;
|
||||
|
||||
testStart("test_numeric");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -440,7 +440,7 @@ static void test_numeric_bc(const testCtx *const p_ctx) {
|
|||
|
||||
int i, ret, bc_ret;
|
||||
|
||||
testStart("test_numeric_bc");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < 1001; i++) {
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
@ -679,7 +679,7 @@ static void test_alpha2(const testCtx *const p_ctx) {
|
|||
int data_size = ARRAY_SIZE(data);
|
||||
int i, ret;
|
||||
|
||||
testStart("test_alpha2");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -746,7 +746,7 @@ static void test_alpha2_bc(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_alpha2_bc");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < 128; i++) {
|
||||
int j;
|
||||
|
|
|
@ -1047,7 +1047,7 @@ static void test_numeric(const testCtx *const p_ctx) {
|
|||
int data_size = ARRAY_SIZE(data);
|
||||
int i, ret;
|
||||
|
||||
testStart("test_numeric");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1103,7 +1103,7 @@ static void test_numeric_bc(const testCtx *const p_ctx) {
|
|||
|
||||
int i, ret, bc_ret;
|
||||
|
||||
testStart("test_numeric_bc");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < 1001; i++) {
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
|
|
@ -111,7 +111,7 @@ static void test_u_ksx1001_int(const testCtx *const p_ctx) {
|
|||
(void)debug;
|
||||
#endif
|
||||
|
||||
testStart("test_u_ksx1001_int");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
#ifdef TEST_JUST_SAY_GNO
|
||||
if ((debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */
|
||||
|
|
|
@ -196,7 +196,7 @@ static void test_clz_u64(const testCtx *const p_ctx) {
|
|||
int data_size = ARRAY_SIZE(data);
|
||||
int i, ret;
|
||||
|
||||
testStart("test_clz_u64");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -229,7 +229,7 @@ static void test_load(const testCtx *const p_ctx) {
|
|||
char t_dump[35];
|
||||
char expected_dump[35];
|
||||
|
||||
testStart("test_load");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -270,7 +270,7 @@ static void test_load_str_u64(const testCtx *const p_ctx) {
|
|||
char t_dump[35];
|
||||
char expected_dump[35];
|
||||
|
||||
testStart("test_load_str_u64");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -314,7 +314,7 @@ static void test_add_u64(const testCtx *const p_ctx) {
|
|||
char t_dump[35];
|
||||
char expected_dump[35];
|
||||
|
||||
testStart("test_add_u64");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -358,7 +358,7 @@ static void test_sub_u64(const testCtx *const p_ctx) {
|
|||
char t_dump[35];
|
||||
char expected_dump[35];
|
||||
|
||||
testStart("test_sub_u64");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -415,7 +415,7 @@ static void test_mul_u64(const testCtx *const p_ctx) {
|
|||
char t_dump[35];
|
||||
char expected_dump[35];
|
||||
|
||||
testStart("test_mul_u64");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -540,7 +540,7 @@ static void test_div_u64(const testCtx *const p_ctx) {
|
|||
char t_dump[35];
|
||||
char expected_dump[35];
|
||||
|
||||
testStart("test_div_u64");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -706,7 +706,7 @@ static void test_unset_bit(const testCtx *const p_ctx) {
|
|||
char t_dump[35];
|
||||
char expected_dump[35];
|
||||
|
||||
testStart("test_unset_bit");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -780,7 +780,7 @@ static void test_uint_array(const testCtx *const p_ctx) {
|
|||
unsigned char uchar_array[130];
|
||||
unsigned char uchar_expected_array[130];
|
||||
|
||||
testStart("test_uint_array");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -871,7 +871,7 @@ static void test_dump(const testCtx *const p_ctx) {
|
|||
|
||||
char dump[35];
|
||||
|
||||
testStart("test_dump");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ static void test_checks(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_checks", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -313,7 +313,7 @@ static void test_checks_segs(const testCtx *const p_ctx) {
|
|||
int i, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_checks_segs", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -368,7 +368,7 @@ static void test_input_data(const testCtx *const p_ctx) {
|
|||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol("test_input_data", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -521,7 +521,7 @@ static void test_symbologies(const testCtx *const p_ctx) {
|
|||
struct zint_symbol s_symbol = {0};
|
||||
struct zint_symbol *symbol = &s_symbol;
|
||||
|
||||
testStart("test_symbologies");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = -1; i < 148; i++) {
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
@ -576,7 +576,7 @@ static void test_input_mode(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input_mode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -711,7 +711,7 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
|
|||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol("test_escape_char_process", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -812,7 +812,7 @@ static void test_escape_char_process_test(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
|
||||
|
||||
testStart("test_escape_char_process_test");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -869,7 +869,7 @@ static void test_cap(const testCtx *const p_ctx) {
|
|||
int i;
|
||||
unsigned int uret;
|
||||
|
||||
testStart("test_cap");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -886,7 +886,7 @@ static void test_cap_compliant_height(const testCtx *const p_ctx) {
|
|||
int symbol_id;
|
||||
unsigned int uret;
|
||||
|
||||
testStart("test_cap_compliant_height");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (symbol_id = 1; symbol_id <= BARCODE_LAST; symbol_id++) {
|
||||
if (!ZBarcode_ValidID(symbol_id)) continue;
|
||||
|
@ -986,7 +986,7 @@ static void test_encode_file_empty(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStartSymbol("test_encode_file_empty", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
@ -1018,7 +1018,7 @@ static void test_encode_file_too_large(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStartSymbol("test_encode_file_too_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
@ -1056,7 +1056,7 @@ static void test_encode_file_unreadable(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStartSymbol("test_encode_file_unreadable", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
#ifdef _WIN32
|
||||
testSkip("Test not implemented on Windows");
|
||||
|
@ -1097,7 +1097,7 @@ static void test_encode_file_directory(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStartSymbol("test_encode_file_directory", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
#if defined(__NetBSD__) || defined(_AIX)
|
||||
/* Reading a directory works on NetBSD, and get `code128()` ZINT_ERROR_TOO_LONG instead */
|
||||
|
@ -1133,7 +1133,7 @@ static void test_encode_file(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStartSymbol("test_encode_file", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
(void) testUtilRemove(filename); /* In case junk hanging around */
|
||||
(void) testUtilRemove(outfile); /* In case junk hanging around */
|
||||
|
@ -1196,7 +1196,7 @@ static void test_encode_print_outfile_directory(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStartSymbol("test_encode_print_outfile_directory", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
@ -1241,7 +1241,7 @@ static void test_bad_args(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStartSymbol("test_bad_args", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
/* These just return, no error */
|
||||
ZBarcode_Clear(NULL);
|
||||
|
@ -1380,7 +1380,7 @@ static void test_valid_id(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_valid_id");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (symbol_id = -1; symbol_id < 160; symbol_id++) {
|
||||
ret = ZBarcode_ValidID(symbol_id);
|
||||
|
@ -1582,7 +1582,7 @@ static void test_barcode_name(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_barcode_name");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (symbol_id = -1; symbol_id < 160; symbol_id++) {
|
||||
int prev_ret;
|
||||
|
@ -1625,25 +1625,23 @@ static void test_error_tag(const testCtx *const p_ctx) {
|
|||
/* 5*/ { 0, ZINT_WARN_NONCOMPLIANT, WARN_FAIL_ALL, "", ZINT_ERROR_NONCOMPLIANT, "Error " },
|
||||
/* 6*/ { 0, ZINT_WARN_HRT_TRUNCATED, -1, "", ZINT_WARN_HRT_TRUNCATED, "Warning " },
|
||||
/* 7*/ { 0, ZINT_WARN_HRT_TRUNCATED, WARN_FAIL_ALL, "", ZINT_ERROR_HRT_TRUNCATED, "Error " },
|
||||
/* 8*/ { 0, ZINT_WARN_HRT_RAW_TEXT, -1, "", ZINT_WARN_HRT_RAW_TEXT, "Warning " },
|
||||
/* 9*/ { 0, ZINT_WARN_HRT_RAW_TEXT, WARN_FAIL_ALL, "", ZINT_ERROR_HRT_RAW_TEXT, "Error " },
|
||||
/* 10*/ { 0, ZINT_ERROR_TOO_LONG, WARN_DEFAULT, "", ZINT_ERROR_TOO_LONG, "Error " },
|
||||
/* 11*/ { 0, ZINT_ERROR_TOO_LONG, WARN_FAIL_ALL, "", ZINT_ERROR_TOO_LONG, "Error " },
|
||||
/* 12*/ { 0, ZINT_WARN_USES_ECI, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 13*/ { 1, ZINT_WARN_USES_ECI, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 14*/ { 0, ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 15*/ { 1, ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 16*/ { 0, ZINT_ERROR_INVALID_DATA, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 17*/ { 1, ZINT_ERROR_INVALID_DATA, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 18*/ { 1, ZINT_ERROR_INVALID_DATA, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 19*/ { 1, ZINT_WARN_USES_ECI, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 20*/ { 1, ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 21*/ { 1, ZINT_ERROR_INVALID_DATA, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 8*/ { 0, ZINT_ERROR_TOO_LONG, WARN_DEFAULT, "", ZINT_ERROR_TOO_LONG, "Error " },
|
||||
/* 9*/ { 0, ZINT_ERROR_TOO_LONG, WARN_FAIL_ALL, "", ZINT_ERROR_TOO_LONG, "Error " },
|
||||
/* 10*/ { 0, ZINT_WARN_USES_ECI, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 11*/ { 1, ZINT_WARN_USES_ECI, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 12*/ { 0, ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 13*/ { 1, ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 14*/ { 0, ZINT_ERROR_INVALID_DATA, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 15*/ { 1, ZINT_ERROR_INVALID_DATA, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 16*/ { 1, ZINT_ERROR_INVALID_DATA, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 17*/ { 1, ZINT_WARN_USES_ECI, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 18*/ { 1, ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 19*/ { 1, ZINT_ERROR_INVALID_DATA, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, ret;
|
||||
|
||||
testStart("test_error_tag");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
struct zint_symbol s_symbol = {0};
|
||||
|
@ -1680,7 +1678,7 @@ static void test_strip_bom(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_strip_bom");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
strcpy(buf, data);
|
||||
length = (int) strlen(buf);
|
||||
|
@ -1708,7 +1706,7 @@ static void test_zero_outfile(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStartSymbol("test_zero_outfile", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
@ -1741,7 +1739,7 @@ static void test_clear(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStartSymbol("test_clear", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
@ -1861,7 +1859,7 @@ static void test_reset(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_reset");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol_def = ZBarcode_Create();
|
||||
assert_nonnull(symbol_def, "Default symbol not created\n");
|
||||
|
@ -2082,7 +2080,7 @@ static void test_scale_from_xdimdp(const testCtx *const p_ctx) {
|
|||
float x_dim_from_scale;
|
||||
float dpmm_from_dpi;
|
||||
|
||||
testStart("test_scale_from_xdimdp");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2156,7 +2154,7 @@ static void test_xdimdp_from_scale(const testCtx *const p_ctx) {
|
|||
float ret;
|
||||
float dpmm_from_dpi;
|
||||
|
||||
testStart("test_xdimdp_from_scale");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2247,7 +2245,7 @@ static void test_utf8_to_eci(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
int expected_length;
|
||||
|
||||
testStart("test_utf8_to_eci");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_dest;
|
||||
|
@ -2287,6 +2285,177 @@ static void test_utf8_to_eci(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_raw_text(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int symbology;
|
||||
int input_mode;
|
||||
const char *data;
|
||||
const char *expected;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_CODE11, -1, "1234567890", "123456789019" },
|
||||
/* 1*/ { BARCODE_C25STANDARD, -1, "1234567890", "" },
|
||||
/* 2*/ { BARCODE_C25INTER, -1, "1234567890", "" },
|
||||
/* 3*/ { BARCODE_C25IATA, -1, "1234567890", "" },
|
||||
/* 4*/ { BARCODE_C25LOGIC, -1, "1234567890", "" },
|
||||
/* 5*/ { BARCODE_C25IND, -1, "1234567890", "" },
|
||||
/* 6*/ { BARCODE_CODE39, -1, "1234567890", "" },
|
||||
/* 7*/ { BARCODE_EXCODE39, -1, "1234567890", "" },
|
||||
/* 8*/ { BARCODE_EANX, -1, "123456789012", "1234567890128" },
|
||||
/* 9*/ { BARCODE_EANX_CHK, -1, "1234567890128", "" },
|
||||
/* 10*/ { BARCODE_GS1_128, -1, "[01]12345678901231", "0112345678901231" },
|
||||
/* 11*/ { BARCODE_CODABAR, -1, "A00000000B", "" },
|
||||
/* 12*/ { BARCODE_CODE128, -1, "1234567890", "" },
|
||||
/* 13*/ { BARCODE_DPLEIT, -1, "1234567890123", "12345678901236" },
|
||||
/* 14*/ { BARCODE_DPIDENT, -1, "12345678901", "123456789016" },
|
||||
/* 15*/ { BARCODE_CODE16K, -1, "1234567890", "" },
|
||||
/* 16*/ { BARCODE_CODE16K, GS1_MODE, "[01]12345678901231", "0112345678901231" },
|
||||
/* 17*/ { BARCODE_CODE49, -1, "1234567890", "" },
|
||||
/* 18*/ { BARCODE_CODE49, GS1_MODE, "[01]12345678901231", "0112345678901231" },
|
||||
/* 19*/ { BARCODE_CODE93, -1, "1234567890", "1234567890M%" },
|
||||
/* 20*/ { BARCODE_FLAT, -1, "1234567890", "" },
|
||||
/* 21*/ { BARCODE_DBAR_OMN, -1, "1234567890123", "12345678901231" },
|
||||
/* 22*/ { BARCODE_DBAR_LTD, -1, "1234567890123", "12345678901231" },
|
||||
/* 23*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", "0112345678901231" },
|
||||
/* 24*/ { BARCODE_TELEPEN, -1, "1234567890", "1234567890n" },
|
||||
/* 25*/ { BARCODE_UPCA, -1, "12345678901", "123456789012" },
|
||||
/* 26*/ { BARCODE_UPCA_CHK, -1, "123456789012", "123456789012" },
|
||||
/* 27*/ { BARCODE_UPCE, -1, "1234567", "12345670" },
|
||||
/* 28*/ { BARCODE_UPCE_CHK, -1, "12345670", "" },
|
||||
/* 29*/ { BARCODE_POSTNET, -1, "12345678901", "123456789014" },
|
||||
/* 30*/ { BARCODE_MSI_PLESSEY, -1, "1234567890", "" },
|
||||
/* 31*/ { BARCODE_FIM, -1, "A", "" },
|
||||
/* 32*/ { BARCODE_LOGMARS, -1, "1234567890", "" },
|
||||
/* 33*/ { BARCODE_PHARMA, -1, "123456", "" },
|
||||
/* 34*/ { BARCODE_PZN, -1, "123456", "-01234562" },
|
||||
/* 35*/ { BARCODE_PHARMA_TWO, -1, "12345678", "" },
|
||||
/* 36*/ { BARCODE_CEPNET, -1, "12345678", "123456784" },
|
||||
/* 37*/ { BARCODE_PDF417, -1, "1234567890", "" },
|
||||
/* 38*/ { BARCODE_PDF417COMP, -1, "1234567890", "" },
|
||||
/* 39*/ { BARCODE_MAXICODE, -1, "1234567890", "" },
|
||||
/* 40*/ { BARCODE_QRCODE, -1, "1234567890", "" },
|
||||
/* 41*/ { BARCODE_QRCODE, UNICODE_MODE, "1234567890", "" },
|
||||
/* 42*/ { BARCODE_QRCODE, GS1_MODE, "[01]12345678901231", "0112345678901231" },
|
||||
/* 43*/ { BARCODE_CODE128AB, -1, "1234567890", "" },
|
||||
/* 44*/ { BARCODE_AUSPOST, -1, "12345678901234567890123", "6212345678901234567890123" },
|
||||
/* 45*/ { BARCODE_AUSREPLY, -1, "12345678", "4512345678" },
|
||||
/* 46*/ { BARCODE_AUSROUTE, -1, "12345678", "8712345678" },
|
||||
/* 47*/ { BARCODE_AUSREDIRECT, -1, "12345678", "9212345678" },
|
||||
/* 48*/ { BARCODE_ISBNX, -1, "123456789", "9780123456786" },
|
||||
/* 49*/ { BARCODE_RM4SCC, -1, "1234567890", "12345678906" },
|
||||
/* 50*/ { BARCODE_DATAMATRIX, -1, "ABC", "" },
|
||||
/* 51*/ { BARCODE_DATAMATRIX, GS1_MODE, "[01]12345678901231", "0112345678901231" },
|
||||
/* 52*/ { BARCODE_EAN14, -1, "1234567890123", "0112345678901231" },
|
||||
/* 53*/ { BARCODE_VIN, -1, "12345678701234567", "" },
|
||||
/* 54*/ { BARCODE_CODABLOCKF, -1, "1234567890", "" },
|
||||
/* 55*/ { BARCODE_NVE18, -1, "12345678901234567", "00123456789012345675" },
|
||||
/* 56*/ { BARCODE_JAPANPOST, -1, "1234567890", "" },
|
||||
/* 57*/ { BARCODE_KOREAPOST, -1, "123456", "1234569" },
|
||||
/* 58*/ { BARCODE_DBAR_STK, -1, "1234567890123", "12345678901231" },
|
||||
/* 59*/ { BARCODE_DBAR_OMNSTK, -1, "1234567890123", "12345678901231" },
|
||||
/* 60*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", "0112345678901231" },
|
||||
/* 61*/ { BARCODE_PLANET, -1, "12345678901", "123456789014" },
|
||||
/* 62*/ { BARCODE_MICROPDF417, -1, "1234567890", "" },
|
||||
/* 63*/ { BARCODE_USPS_IMAIL, -1, "12345678901234567890", "" },
|
||||
/* 64*/ { BARCODE_PLESSEY, -1, "1234567890", "12345678906E" },
|
||||
/* 65*/ { BARCODE_TELEPEN_NUM, -1, "1234567890", "1234567890g" },
|
||||
/* 66*/ { BARCODE_ITF14, -1, "1234567890", "00012345678905" },
|
||||
/* 67*/ { BARCODE_KIX, -1, "123456ABCDE", "" },
|
||||
/* 68*/ { BARCODE_AZTEC, -1, "1234567890AB", "" },
|
||||
/* 69*/ { BARCODE_DAFT, -1, "DAFTDAFTDAFTDAFT", "" },
|
||||
/* 70*/ { BARCODE_DPD, -1, "0123456789012345678901234567", "" },
|
||||
/* 71*/ { BARCODE_MICROQR, -1, "12345", "" },
|
||||
/* 72*/ { BARCODE_MICROQR, UNICODE_MODE, "12345", "" },
|
||||
/* 73*/ { BARCODE_HIBC_128, -1, "1234567890", "+12345678900" },
|
||||
/* 74*/ { BARCODE_HIBC_39, -1, "1234567890", "+12345678900" },
|
||||
/* 75*/ { BARCODE_HIBC_DM, -1, "ABC", "+ABCV" },
|
||||
/* 76*/ { BARCODE_HIBC_QR, -1, "1234567890AB", "+1234567890ABL" },
|
||||
/* 77*/ { BARCODE_HIBC_PDF, -1, "1234567890", "+12345678900" },
|
||||
/* 78*/ { BARCODE_HIBC_MICPDF, -1, "1234567890", "+12345678900" },
|
||||
/* 79*/ { BARCODE_HIBC_BLOCKF, -1, "1234567890", "+12345678900" },
|
||||
/* 80*/ { BARCODE_HIBC_AZTEC, -1, "1234567890AB", "+1234567890ABL" },
|
||||
/* 81*/ { BARCODE_DOTCODE, -1, "ABC", "" },
|
||||
/* 82*/ { BARCODE_HANXIN, -1, "1234567890AB", "" },
|
||||
/* 83*/ { BARCODE_HANXIN, UNICODE_MODE, "1234567890AB", "" },
|
||||
/* 84*/ { BARCODE_MAILMARK_2D, -1, "012100123412345678AB19XY1A 0", "JGB 012100123412345678AB19XY1A 0 " },
|
||||
/* 85*/ { BARCODE_UPU_S10, -1, "EE876543216CA", "" },
|
||||
/* 86*/ { BARCODE_MAILMARK_4S, -1, "01000000000000000AA00AA0A", "01000000000000000AA00AA0A " },
|
||||
/* 87*/ { BARCODE_AZRUNE, -1, "255", "" },
|
||||
/* 88*/ { BARCODE_CODE32, -1, "12345678", "3PRM8N" },
|
||||
/* 89*/ { BARCODE_EANX_CC, -1, "123456789012", "1234567890128|2001" },
|
||||
/* 90*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "0112345678901231|2001" },
|
||||
/* 91*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "12345678901231|2001" },
|
||||
/* 92*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "12345678901231|2001" },
|
||||
/* 93*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "0112345678901231|2001" },
|
||||
/* 94*/ { BARCODE_UPCA_CC, -1, "12345678901", "123456789012|2001" },
|
||||
/* 95*/ { BARCODE_UPCE_CC, -1, "1234567", "12345670|2001" },
|
||||
/* 96*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "12345678901231|2001" },
|
||||
/* 97*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "12345678901231|2001" },
|
||||
/* 98*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "0112345678901231|2001" },
|
||||
/* 99*/ { BARCODE_CHANNEL, -1, "01", "" },
|
||||
/*100*/ { BARCODE_CODEONE, -1, "12345678901234567890", "" },
|
||||
/*101*/ { BARCODE_CODEONE, GS1_MODE, "[01]12345678901231", "0112345678901231" },
|
||||
/*102*/ { BARCODE_GRIDMATRIX, -1, "ABC", "" },
|
||||
/*103*/ { BARCODE_GRIDMATRIX, UNICODE_MODE, "ABC", "" },
|
||||
/*104*/ { BARCODE_UPNQR, -1, "1234567890AB", "" },
|
||||
/*105*/ { BARCODE_ULTRA, -1, "1234567890", "" },
|
||||
/*106*/ { BARCODE_ULTRA, GS1_MODE, "[01]12345678901231", "0112345678901231" },
|
||||
/*107*/ { BARCODE_RMQR, -1, "12345", "" },
|
||||
/*108*/ { BARCODE_RMQR, UNICODE_MODE, "12345", "" },
|
||||
/*109*/ { BARCODE_RMQR, GS1_MODE, "[01]12345678901231", "0112345678901231" },
|
||||
/*110*/ { BARCODE_BC412, -1, "1234567", "1U234567" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
if (is_composite(data[i].symbology)) {
|
||||
text = "[20]01";
|
||||
strcpy(symbol->primary, data[i].data);
|
||||
} else {
|
||||
text = data[i].data;
|
||||
}
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, BARCODE_RAW_TEXT,
|
||||
text, -1, debug);
|
||||
expected = data[i].expected[0] ? data[i].expected : data[i].data;
|
||||
expected_length = (int) strlen(expected);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(text), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d (%.*s) != expected_length %d (%s)\n",
|
||||
i, symbol->raw_segs[0].length, symbol->raw_segs[0].length, symbol->raw_segs[0].source,
|
||||
expected_length, expected);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, expected, expected_length),
|
||||
"i:%d memcmp(%.*s, %.*s, %d) != 0\n",
|
||||
i, expected_length, symbol->raw_segs[0].source, expected_length, expected, expected_length);
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
testFunction funcs[] = { /* name, func */
|
||||
|
@ -2316,6 +2485,7 @@ int main(int argc, char *argv[]) {
|
|||
{ "test_scale_from_xdimdp", test_scale_from_xdimdp },
|
||||
{ "test_xdimdp_from_scale", test_xdimdp_from_scale },
|
||||
{ "test_utf8_to_eci", test_utf8_to_eci },
|
||||
{ "test_raw_text", test_raw_text },
|
||||
};
|
||||
|
||||
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
|
||||
|
|
|
@ -39,26 +39,27 @@ static void test_4s_hrt(const testCtx *const p_ctx) {
|
|||
const char *data;
|
||||
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { -1, "1100000000000XY11", "" }, /* None */
|
||||
/* 1*/ { BARCODE_RAW_TEXT, "1100000000000XY11", "1100000000000XY11 " },
|
||||
/* 2*/ { -1, "1100000000000XY11 ", "" }, /* None */
|
||||
/* 3*/ { BARCODE_RAW_TEXT, "1100000000000XY11 ", "1100000000000XY11 " },
|
||||
/* 4*/ { -1, "0100000000000A00AA0A", "" }, /* None */
|
||||
/* 5*/ { BARCODE_RAW_TEXT, "0100000000000A00AA0A", "0100000000000A00AA0A " }, /* None */
|
||||
/* 6*/ { -1, "41038422416563762XY11 ", "" }, /* None */
|
||||
/* 7*/ { BARCODE_RAW_TEXT, "41038422416563762XY11 ", "41038422416563762XY11 " },
|
||||
/* 8*/ { -1, "01000000000000000AA000AA0A", "" }, /* None */
|
||||
/* 9*/ { BARCODE_RAW_TEXT, "01000000000000000AA000AA0A", "01000000000000000AA000AA0A" },
|
||||
/* 0*/ { -1, "1100000000000XY11", "", "" }, /* None */
|
||||
/* 1*/ { BARCODE_RAW_TEXT, "1100000000000XY11", "", "1100000000000XY11 " },
|
||||
/* 2*/ { -1, "1100000000000XY11 ", "", "" }, /* None */
|
||||
/* 3*/ { BARCODE_RAW_TEXT, "1100000000000XY11 ", "", "1100000000000XY11 " },
|
||||
/* 4*/ { -1, "0100000000000A00AA0A", "", "" }, /* None */
|
||||
/* 5*/ { BARCODE_RAW_TEXT, "0100000000000A00AA0A", "", "0100000000000A00AA0A " }, /* None */
|
||||
/* 6*/ { -1, "41038422416563762XY11 ", "", "" }, /* None */
|
||||
/* 7*/ { BARCODE_RAW_TEXT, "41038422416563762XY11 ", "", "41038422416563762XY11 " },
|
||||
/* 8*/ { -1, "01000000000000000AA000AA0A", "", "" }, /* None */
|
||||
/* 9*/ { BARCODE_RAW_TEXT, "01000000000000000AA000AA0A", "", "01000000000000000AA000AA0A" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_4s_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -71,6 +72,7 @@ static void test_4s_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -79,6 +81,18 @@ static void test_4s_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length, symbol->text);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -159,7 +173,7 @@ static void test_4s_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_4s_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -229,7 +243,7 @@ static void test_4s_encode_vector(const testCtx *const p_ctx) {
|
|||
|
||||
char actual_daft[80];
|
||||
|
||||
testStartSymbol("test_4s_encode_vector", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -283,7 +297,7 @@ static void test_4s_encode(const testCtx *const p_ctx) {
|
|||
|
||||
char escaped[1024];
|
||||
|
||||
testStartSymbol("test_4s_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -374,7 +388,7 @@ static void test_2d_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_2d_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -597,10 +611,11 @@ static void test_2d_encode(const testCtx *const p_ctx) {
|
|||
char cmp_buf[32768];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_2d_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -646,12 +661,14 @@ static void test_2d_encode(const testCtx *const p_ctx) {
|
|||
int cmp_len, ret_len;
|
||||
char modules_dump[144 * 144 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -662,6 +679,81 @@ static void test_2d_encode(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_2d_rt(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int output_options;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
int expected_eci;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
int expected_raw_eci;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, "jgb 012100123412345678ab19xy1a 0", -1, 0, 0, "", -1, 0 },
|
||||
/* 1*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "jgb 012100123412345678ab19xy1a 0", -1, 0, 0, "JGB 012100123412345678AB19XY1A 0 ", -1, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_MAILMARK_2D, data[i].input_mode, -1 /*eci*/,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n",
|
||||
i, symbol->eci, data[i].expected_eci);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->raw_segs[0].source, symbol->raw_segs[0].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[0].eci, data[i].expected_raw_eci,
|
||||
"i:%d raw_segs[0].eci %d != expected_raw_eci %d\n",
|
||||
i, symbol->raw_segs[0].eci, data[i].expected_raw_eci);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
testFunction funcs[] = { /* name, func */
|
||||
|
@ -671,6 +763,7 @@ int main(int argc, char *argv[]) {
|
|||
{ "test_4s_encode", test_4s_encode },
|
||||
{ "test_2d_input", test_2d_input },
|
||||
{ "test_2d_encode", test_2d_encode },
|
||||
{ "test_2d_rt", test_2d_rt },
|
||||
};
|
||||
|
||||
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
|
||||
|
|
|
@ -44,45 +44,46 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
int expected_rows;
|
||||
int expected_width;
|
||||
int bwipp_cmp;
|
||||
int zxingcpp_cmp;
|
||||
const char *comment;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { -1, -1, "1", 138, "", 0, 33, 30, 1, "Mode 4 (138 agrees with ISO/IEC 16023:2000)" },
|
||||
/* 1*/ { -1, -1, "1", 139, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 2*/ { -1, -1, "1", 144, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 3*/ { -1, -1, "1", 145, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "Absolute max" },
|
||||
/* 4*/ { -1, -1, "A", 93, "", 0, 33, 30, 1, "" },
|
||||
/* 5*/ { -1, -1, "A", 94, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 6*/ { -1, -1, "\001", 91, "", 0, 33, 30, 1, "" },
|
||||
/* 7*/ { -1, -1, "\001", 92, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 8*/ { -1, -1, "\200", 91, "", 0, 33, 30, 1, "" },
|
||||
/* 9*/ { -1, -1, "\200", 92, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 10*/ { 2, -1, "1", 126, "123456789123123", 0, 33, 30, 1, "" },
|
||||
/* 11*/ { 2, -1, "1", 127, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 12*/ { 2, -1, "A", 84, "123456789123123", 0, 33, 30, 1, "" },
|
||||
/* 13*/ { 2, -1, "A", 85, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 14*/ { 2, 96 + 1, "1", 109, "123456789123123", 0, 33, 30, 1, "" },
|
||||
/* 15*/ { 2, 96 + 1, "1", 110, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 16*/ { 2, 96 + 1, "1", 136, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "Absolute max with SCM vv" },
|
||||
/* 17*/ { 3, -1, "1", 126, "ABCDEF123123", 0, 33, 30, 1, "" },
|
||||
/* 18*/ { 3, -1, "1", 127, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 19*/ { 3, -1, "A", 84, "ABCDEF123123", 0, 33, 30, 1, "" },
|
||||
/* 20*/ { 3, -1, "A", 85, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 21*/ { 3, 96 + 1, "1", 109, "ABCDEF123123", 0, 33, 30, 1, "" },
|
||||
/* 22*/ { 3, 96 + 1, "1", 110, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 23*/ { 0, -1, "1", 126, "123456789123123", 0, 33, 30, 1, "Mode 2" },
|
||||
/* 24*/ { 0, -1, "1", 127, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 25*/ { 0, -1, "1", 126, "ABCDEF123123", 0, 33, 30, 1, "Mode 3" },
|
||||
/* 26*/ { 0, -1, "1", 127, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 27*/ { 5, -1, "1", 113, "", 0, 33, 30, 1, "Extra EEC" },
|
||||
/* 28*/ { 5, -1, "1", 114, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 29*/ { 5, -1, "A", 77, "", 0, 33, 30, 1, "" },
|
||||
/* 30*/ { 5, -1, "A", 78, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 31*/ { 6, -1, "1", 138, "", 0, 33, 30, 1, "" },
|
||||
/* 32*/ { 6, -1, "1", 139, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 33*/ { 6, -1, "A", 93, "", 0, 33, 30, 1, "" },
|
||||
/* 34*/ { 6, -1, "A", 94, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" },
|
||||
/* 0*/ { -1, -1, "1", 138, "", 0, 33, 30, 1, 1, "Mode 4 (138 agrees with ISO/IEC 16023:2000)" },
|
||||
/* 1*/ { -1, -1, "1", 139, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 2*/ { -1, -1, "1", 144, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 3*/ { -1, -1, "1", 145, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "Absolute max" },
|
||||
/* 4*/ { -1, -1, "A", 93, "", 0, 33, 30, 1, 1, "" },
|
||||
/* 5*/ { -1, -1, "A", 94, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 6*/ { -1, -1, "\001", 91, "", 0, 33, 30, 1, 1, "" },
|
||||
/* 7*/ { -1, -1, "\001", 92, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 8*/ { -1, -1, "\200", 91, "", 0, 33, 30, 1, 899, "" },
|
||||
/* 9*/ { -1, -1, "\200", 92, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, 899, "" },
|
||||
/* 10*/ { 2, -1, "1", 126, "123456789123123", 0, 33, 30, 1, 1, "" },
|
||||
/* 11*/ { 2, -1, "1", 127, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 12*/ { 2, -1, "A", 84, "123456789123123", 0, 33, 30, 1, 1, "" },
|
||||
/* 13*/ { 2, -1, "A", 85, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 14*/ { 2, 96 + 1, "1", 109, "123456789123123", 0, 33, 30, 1, 1, "" },
|
||||
/* 15*/ { 2, 96 + 1, "1", 110, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 16*/ { 2, 96 + 1, "1", 136, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "Absolute max with SCM vv" },
|
||||
/* 17*/ { 3, -1, "1", 126, "ABCDEF123123", 0, 33, 30, 1, 1, "" },
|
||||
/* 18*/ { 3, -1, "1", 127, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 19*/ { 3, -1, "A", 84, "ABCDEF123123", 0, 33, 30, 1, 1, "" },
|
||||
/* 20*/ { 3, -1, "A", 85, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 21*/ { 3, 96 + 1, "1", 109, "ABCDEF123123", 0, 33, 30, 1, 1, "" },
|
||||
/* 22*/ { 3, 96 + 1, "1", 110, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 23*/ { 0, -1, "1", 126, "123456789123123", 0, 33, 30, 1, 1, "Mode 2" },
|
||||
/* 24*/ { 0, -1, "1", 127, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 25*/ { 0, -1, "1", 126, "ABCDEF123123", 0, 33, 30, 1, 1, "Mode 3" },
|
||||
/* 26*/ { 0, -1, "1", 127, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 27*/ { 5, -1, "1", 113, "", 0, 33, 30, 1, 1, "Extra EEC" },
|
||||
/* 28*/ { 5, -1, "1", 114, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 29*/ { 5, -1, "A", 77, "", 0, 33, 30, 1, 1, "" },
|
||||
/* 30*/ { 5, -1, "A", 78, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 31*/ { 6, -1, "1", 138, "", 0, 33, 30, 1, 1, "" },
|
||||
/* 32*/ { 6, -1, "1", 139, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
/* 33*/ { 6, -1, "A", 93, "", 0, 33, 30, 1, 1, "" },
|
||||
/* 34*/ { 6, -1, "A", 94, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, 1, "" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
@ -94,10 +95,11 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
char cmp_msg[1024];
|
||||
const char expected_errtxt[] = "Error 553: Input too long, requires too many codewords (maximum 144)";
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -141,13 +143,18 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data_buf, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[33 * 33 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data_buf, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data_buf, length, modules_dump, data[i].zxingcpp_cmp, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data_buf, length, symbol->primary, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data_buf, length, symbol->primary,
|
||||
escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,9 +254,9 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
/* 64*/ { UNICODE_MODE, -1, -1, -1, { 1, 2, "A" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 549: Structured Append ID not available for MaxiCode", 4, 0, 1, 1, "" },
|
||||
/* 65*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "b..A", -1, "", 0, 30, "(144) 04 3B 02 2E 2E 01 21 21 21 21 11 1C 30 14 2D 3E 16 0E 0C 31 21 21 21 21 21 21 21 21", 4, 0, 1, 1, "" },
|
||||
/* 66*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A123456789b123456789bbbA", -1, "", 0, 30, "(144) 04 01 1F 07 16 3C 34 15 3F 02 10 1B 28 22 20 32 37 0C 0B 2A 1F 07 16 3C 34 15 02 02", 4, 0, 1, 1, "" },
|
||||
/* 67*/ { ESCAPE_MODE, -1, -1, -1, { 0, 0, "" }, "\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192", -1, "", 0, 30, "(144) 04 3C 00 3D 3D 00 00 00 3C 00 34 39 0E 35 1D 25 00 1B 28 03 00 00 00 3C 00 00 00 00", 4, 0, 1, 1, "BWIPP PR #279" },
|
||||
/* 67*/ { ESCAPE_MODE, -1, -1, -1, { 0, 0, "" }, "\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192", -1, "", 0, 30, "(144) 04 3C 00 3D 3D 00 00 00 3C 00 34 39 0E 35 1D 25 00 1B 28 03 00 00 00 3C 00 00 00 00", 4, 0, 1, 899, "BWIPP PR #279" },
|
||||
/* 68*/ { ESCAPE_MODE, -1, 2, -1, { 0, 0, "" }, "1Z34567890\\GUPSN\\G102562\\G034\\G\\G1/1\\G\\GY\\G2201 Second St\\GFt Myers\\GFL\\R\\E", -1, "339010000840001", 0, 30, "(144) 02 34 21 13 03 15 02 12 07 00 0C 03 00 38 24 04 0B 1F 2F 21 31 1A 33 34 35 36 37 38", 2, 0, 1, 1, "" },
|
||||
/* 69*/ { ESCAPE_MODE, -1, -1, -1, { 0, 0, "" }, "ABabcdeAabcdABCabcdABabc\\d192\\d192 \\d192\\d224\\d224\\d028\\d224\\d001\\d001\\d001\\d029\\d00112345678a123456789aABCDa\\d192\\d224\\d001\\d192\\d001\\d224\\d030\\d004", -1, "", 0, 30, "(144) 04 01 02 3F 01 02 03 04 05 3B 25 28 3F 32 0D 10 0D 0F 35 11 01 01 02 03 04 39 01 02", 4, 0, 1, 1, "Exercises all latches & no. of shifts" },
|
||||
/* 69*/ { ESCAPE_MODE, -1, -1, -1, { 0, 0, "" }, "ABabcdeAabcdABCabcdABabc\\d192\\d192 \\d192\\d224\\d224\\d028\\d224\\d001\\d001\\d001\\d029\\d00112345678a123456789aABCDa\\d192\\d224\\d001\\d192\\d001\\d224\\d030\\d004", -1, "", 0, 30, "(144) 04 01 02 3F 01 02 03 04 05 3B 25 28 3F 32 0D 10 0D 0F 35 11 01 01 02 03 04 39 01 02", 4, 0, 1, 899, "Exercises all latches & no. of shifts" },
|
||||
/* 70*/ { UNICODE_MODE, 1023, 3, 96 + 1, { 2, 3, "" }, "A", -1, "P144275001", 0, 30, "(144) 03 08 08 0D 1D 0C 34 04 05 00 13 29 0C 17 0F 15 2E 38 00 0B 21 0A 3B 2A 29 3B 28 1E", 3, 97, 1, 1, "ECI, Structured Append, SCM" },
|
||||
/* 71*/ { UNICODE_MODE, -1, 5, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 05 01 21 21 21 21 21 21 21 21 1F 2E 09 22 19 05 31 13 2B 28 21 21 21 21 21 21 21 21", 5, 0, 1, 1, "" },
|
||||
/* 72*/ { UNICODE_MODE, -1, 6, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 06 01 21 21 21 21 21 21 21 21 26 0D 39 39 11 1E 0E 2C 00 37 21 21 21 21 21 21 21 21", 6, 0, 1, 1, "" },
|
||||
|
@ -263,10 +270,11 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
char cmp_buf[32768] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -277,14 +285,17 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
symbol->debug = ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
|
||||
length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, data[i].input_mode, data[i].eci,
|
||||
data[i].option_1, data[i].option_2, -1 /*option_3*/, -1 /*output_options*/,
|
||||
data[i].data, data[i].length, debug);
|
||||
if (data[i].structapp.count) {
|
||||
symbol->structapp = data[i].structapp;
|
||||
}
|
||||
strcpy(symbol->primary, data[i].primary);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(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);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
printf(" /*%3d*/ { %s, %d, %d, %d, { %d, %d, \"%s\" }, \"%s\", %d, \"%s\", %s, %d, \"%s\", %d, %d, %d, %d, \"%s\" },\n",
|
||||
|
@ -297,9 +308,11 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
data[i].bwipp_cmp, data[i].zxingcpp_cmp, 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_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);
|
||||
assert_equal(symbol->option_1, data[i].expected_option_1, "i:%d symbol->option_1 %d != %d (option_2 %d)\n",
|
||||
i, symbol->option_1, data[i].expected_option_1, symbol->option_2);
|
||||
assert_equal(symbol->option_2, data[i].expected_option_2, "i:%d symbol->option_2 %d != %d\n",
|
||||
|
@ -309,31 +322,45 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
if (ret < ZINT_ERROR) {
|
||||
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) {
|
||||
if (!data[i].bwipp_cmp) {
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) {
|
||||
printf("i:%d %s not BWIPP compatible (%s)\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
}
|
||||
} else {
|
||||
char modules_dump[33 * 33 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, symbol->primary, cmp_buf, sizeof(cmp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length,
|
||||
symbol->primary, cmp_buf, sizeof(cmp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
|
||||
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
|
||||
}
|
||||
}
|
||||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
if (!data[i].zxingcpp_cmp) {
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not ZXing-C++ compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) {
|
||||
printf("i:%d %s not ZXing-C++ compatible (%s)\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
}
|
||||
} else {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[33 * 33 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, data[i].zxingcpp_cmp,
|
||||
cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, symbol->primary, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
symbol->primary, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf,
|
||||
ret_len, escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -361,11 +388,12 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
int expected_rows;
|
||||
int expected_width;
|
||||
int bwipp_cmp;
|
||||
int zxingcpp_cmp;
|
||||
const char *comment;
|
||||
const char *expected;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { -1, -1, -1, { 0, 0, "" }, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", -1, "", 0, 33, 30, 1, "ISO/IEC 16023:2000 Figure 2 (and L1), same",
|
||||
/* 0*/ { -1, -1, -1, { 0, 0, "" }, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", -1, "", 0, 33, 30, 1, 1, "ISO/IEC 16023:2000 Figure 2 (and L1), same",
|
||||
"011111010000001000001000100111"
|
||||
"000100000001000000001010000000"
|
||||
"001011001100100110110010010010"
|
||||
|
@ -400,7 +428,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"001001101111101101101010011100"
|
||||
"001011000000111101100100001000"
|
||||
},
|
||||
/* 1*/ { -1, 4, -1, { 0, 0, "" }, "MaxiCode (19 chars)", -1, "", 0, 33, 30, 1, "ISO/IEC 16023:2000 Figure H1 **NOT SAME** different encodation (figure uses '3 Shift A' among other differences)",
|
||||
/* 1*/ { -1, 4, -1, { 0, 0, "" }, "MaxiCode (19 chars)", -1, "", 0, 33, 30, 1, 1, "ISO/IEC 16023:2000 Figure H1 **NOT SAME** different encodation (figure uses '3 Shift A' among other differences)",
|
||||
"000111011111010000001010110111"
|
||||
"101101010001110001000000110110"
|
||||
"101110001010111100100111111011"
|
||||
|
@ -435,7 +463,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"100000101101100000001000111110"
|
||||
"011101000100000001001111101001"
|
||||
},
|
||||
/* 2*/ { ESCAPE_MODE, 2, 96 + 1, { 0, 0, "" }, "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G634 ALPHA DR\\GPITTSBURGH\\GPA\\R\\E", -1, "152382802840001", 0, 33, 30, 1, "ISO/IEC 16023:2000 Figure B2 **NOT SAME** uses different encodation (figure precedes PAD chars with Latch B)",
|
||||
/* 2*/ { ESCAPE_MODE, 2, 96 + 1, { 0, 0, "" }, "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G634 ALPHA DR\\GPITTSBURGH\\GPA\\R\\E", -1, "152382802840001", 0, 33, 30, 1, 1, "ISO/IEC 16023:2000 Figure B2 **NOT SAME** uses different encodation (figure precedes PAD chars with Latch B)",
|
||||
"110101110110111110111111101111"
|
||||
"010101010111000011011000010010"
|
||||
"110110110001001010100110010001"
|
||||
|
@ -470,7 +498,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"000111101001100001111000010110"
|
||||
"000100101000110000000111110011"
|
||||
},
|
||||
/* 3*/ { ESCAPE_MODE, 2, 96 + 1, { 0, 0, "" }, "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G634 ALPHA DR\\GPITTSBURGH\\GPA\\R\\E", -1, "15238840001", 0, 33, 30, 1, "OkapiBarcode zero-pad postcode lacking +4 (US 840 only), ISO/IEC 16023:2000 Annex B.1.4a",
|
||||
/* 3*/ { ESCAPE_MODE, 2, 96 + 1, { 0, 0, "" }, "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G634 ALPHA DR\\GPITTSBURGH\\GPA\\R\\E", -1, "15238840001", 0, 33, 30, 1, 1, "OkapiBarcode zero-pad postcode lacking +4 (US 840 only), ISO/IEC 16023:2000 Annex B.1.4a",
|
||||
"110101110110111110111111101111"
|
||||
"010101010111000011011000010010"
|
||||
"110110110001001010100110010001"
|
||||
|
@ -505,7 +533,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"000111101001100001111000010110"
|
||||
"000100101000110000000111110011"
|
||||
},
|
||||
/* 4*/ { -1, 3, -1, { 0, 0, "" }, "CEN", -1, "B1050056999", 0, 33, 30, 1, "ISO/IEC 16023:2000 B.1 Example (primary only given, data arbitrary); verified manually against tec-it",
|
||||
/* 4*/ { -1, 3, -1, { 0, 0, "" }, "CEN", -1, "B1050056999", 0, 33, 30, 1, 1, "ISO/IEC 16023:2000 B.1 Example (primary only given, data arbitrary); verified manually against tec-it",
|
||||
"000000010101010101010101010111"
|
||||
"001011000000000000000000000010"
|
||||
"111001101010101010101010101000"
|
||||
|
@ -540,7 +568,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"010010001001110010000101000010"
|
||||
"010001011010000011010010011100"
|
||||
},
|
||||
/* 5*/ { UNICODE_MODE | ESCAPE_MODE, -1, -1, { 0, 0, "" }, "Comité Européen de Normalisation\034rue de Stassart 36\034B-1050 BRUXELLES\034TEL +3225196811", -1, "", 0, 33, 30, 1, "ISO/IEC 16023:2000 Example F.5 **NOT SAME** uses different encodation (2 Shift A among other things)",
|
||||
/* 5*/ { UNICODE_MODE | ESCAPE_MODE, -1, -1, { 0, 0, "" }, "Comité Européen de Normalisation\034rue de Stassart 36\034B-1050 BRUXELLES\034TEL +3225196811", -1, "", 0, 33, 30, 1, 1, "ISO/IEC 16023:2000 Example F.5 **NOT SAME** uses different encodation (2 Shift A among other things)",
|
||||
"110010100010110000000100000111"
|
||||
"011010001100110110111110101100"
|
||||
"111010011100101010011100101101"
|
||||
|
@ -575,7 +603,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"001111010001110000011001100110"
|
||||
"000100001011101000111010000010"
|
||||
},
|
||||
/* 6*/ { -1, -1, -1, { 0, 0, "" }, "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", -1, "", 0, 33, 30, 1, "Numeric compaction, verified manually against TEC-IT",
|
||||
/* 6*/ { -1, -1, -1, { 0, 0, "" }, "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", -1, "", 0, 33, 30, 1, 1, "Numeric compaction, verified manually against TEC-IT",
|
||||
"101101010111101101010111101111"
|
||||
"110110111011110110111011110100"
|
||||
"111101001111111101001111111100"
|
||||
|
@ -610,7 +638,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"101111000100011110110011011100"
|
||||
"011111000110100011001101000000"
|
||||
},
|
||||
/* 7*/ { -1, 5, -1, { 0, 0, "" }, "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\037\237\240\242\243\244\245\246\247\251\255\256\266\225\226\227\230\231\232\233\234\235\236", 51, "", 0, 33, 30, 1, "Mode 5 set E",
|
||||
/* 7*/ { -1, 5, -1, { 0, 0, "" }, "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\037\237\240\242\243\244\245\246\247\251\255\256\266\225\226\227\230\231\232\233\234\235\236", 51, "", 0, 33, 30, 1, 899, "Mode 5 set E",
|
||||
"000000000000000000101010101011"
|
||||
"100101010111111111000000001000"
|
||||
"110010011100100111001001110011"
|
||||
|
@ -645,7 +673,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"011111011011101100100101001010"
|
||||
"000011101111000101100100011101"
|
||||
},
|
||||
/* 8*/ { -1, 6, -1, { 0, 0, "" }, "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\241\250\253\257\260\264\267\270\273\277\212\213\214\215\216\217\220\221\222\223\224", -1, "", 0, 33, 30, 1, "Mode 6 set D",
|
||||
/* 8*/ { -1, 6, -1, { 0, 0, "" }, "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\241\250\253\257\260\264\267\270\273\277\212\213\214\215\216\217\220\221\222\223\224", -1, "", 0, 33, 30, 1, 899, "Mode 6 set D",
|
||||
"000000000000000000101010101011"
|
||||
"100101010111111111000000001010"
|
||||
"110010011100100111001001110001"
|
||||
|
@ -680,7 +708,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"011111001010000101000011000110"
|
||||
"101111010010011100100011110010"
|
||||
},
|
||||
/* 9*/ { -1, 6, -1, { 0, 0, "" }, "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\252\254\261\262\263\265\271\272\274\275\276\200\201\202\203\204\205\206\207\210\211", -1, "", 0, 33, 30, 1, "Mode 6 set C",
|
||||
/* 9*/ { -1, 6, -1, { 0, 0, "" }, "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\252\254\261\262\263\265\271\272\274\275\276\200\201\202\203\204\205\206\207\210\211", -1, "", 0, 33, 30, 1, 899, "Mode 6 set C",
|
||||
"000000000000000000101010101011"
|
||||
"100101010111111111000000001010"
|
||||
"110010011100100111001001110001"
|
||||
|
@ -715,7 +743,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"011111001010000101000011000110"
|
||||
"101111010010011100100011110010"
|
||||
},
|
||||
/* 10*/ { UNICODE_MODE | ESCAPE_MODE, 4, -1, { 0, 0, "" }, "`abcdefghijklmnopqrstuvwxyz\034\\G\\R{}~\177;<=>?[\\\\]^_ ,./:@!|", -1, "", 0, 33, 30, 1, "Mode 4 Set B",
|
||||
/* 10*/ { UNICODE_MODE | ESCAPE_MODE, 4, -1, { 0, 0, "" }, "`abcdefghijklmnopqrstuvwxyz\034\\G\\R{}~\177;<=>?[\\\\]^_ ,./:@!|", -1, "", 0, 33, 30, 1, 1, "Mode 4 Set B",
|
||||
"000000000000000010101010101011"
|
||||
"010101011111111100000000101010"
|
||||
"001001110010011100100111001000"
|
||||
|
@ -750,7 +778,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"100100110011010101001011100100"
|
||||
"001000101111010000111000010101"
|
||||
},
|
||||
/* 11*/ { UNICODE_MODE | ESCAPE_MODE, 4, -1, { 0, 0, "" }, "\\rABCDEFGHIJKLMNOPQRSTUVWXYZ\034\\G\\R \"#$%&'()*+,-./0123456789:", -1, "", 0, 33, 30, 1, "Mode 4 Set A",
|
||||
/* 11*/ { UNICODE_MODE | ESCAPE_MODE, 4, -1, { 0, 0, "" }, "\\rABCDEFGHIJKLMNOPQRSTUVWXYZ\034\\G\\R \"#$%&'()*+,-./0123456789:", -1, "", 0, 33, 30, 1, 1, "Mode 4 Set A",
|
||||
"000000000000001010101010101011"
|
||||
"010101111111110000000010101010"
|
||||
"100111001001110010011100100101"
|
||||
|
@ -785,7 +813,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"010010011001101010010001111100"
|
||||
"100111100111001110011000011011"
|
||||
},
|
||||
/* 12*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ABCDabcdAabcABabcABCabcABCDaABCabABCabcABCéa", -1, "", 0, 33, 30, 1, "Mode 4 LCHB SHA 2SHA 3SHA LCHA SHB LCHB 3SHA 3SHA SHD",
|
||||
/* 12*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ABCDabcdAabcABabcABCabcABCDaABCabABCabcABCéa", -1, "", 0, 33, 30, 1, 1, "Mode 4 LCHB SHA 2SHA 3SHA LCHA SHB LCHB 3SHA 3SHA SHD",
|
||||
"110000000011000000000011000011"
|
||||
"010000000001000000000001000000"
|
||||
"111010011100100110011110100101"
|
||||
|
@ -820,7 +848,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"110001000010011110111101111000"
|
||||
"011010011011111110001000000010"
|
||||
},
|
||||
/* 13*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ÀÁÂÃ1", -1, "", 0, 33, 30, 1, "Mode 4 LCKC LCHA",
|
||||
/* 13*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ÀÁÂÃ1", -1, "", 0, 33, 30, 1, 1, "Mode 4 LCKC LCHA",
|
||||
"010101010101010101010101010111"
|
||||
"000000000000000000000000000000"
|
||||
"101010101010101010101010101010"
|
||||
|
@ -855,7 +883,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"010110101111010110101010111100"
|
||||
"010100000000010110101010010100"
|
||||
},
|
||||
/* 14*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ÀÁÂÃ123456789", -1, "", 0, 33, 30, 1, "Mode 4 LCKC NS",
|
||||
/* 14*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ÀÁÂÃ123456789", -1, "", 0, 33, 30, 1, 1, "Mode 4 LCKC NS",
|
||||
"111110110101010101010101010111"
|
||||
"111010010000000000000000000000"
|
||||
"000010011010101010101010101000"
|
||||
|
@ -890,7 +918,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"000000111100011110100001110000"
|
||||
"101000000010100111001011110101"
|
||||
},
|
||||
/* 15*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "àáâã1", -1, "", 0, 33, 30, 1, "Mode 4 LCKD LCHA",
|
||||
/* 15*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "àáâã1", -1, "", 0, 33, 30, 1, 1, "Mode 4 LCKD LCHA",
|
||||
"010101010101010101010101010111"
|
||||
"000000000000000000000000000000"
|
||||
"101010101010101010101010101010"
|
||||
|
@ -925,7 +953,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"010110101111010110101010111100"
|
||||
"010100000000010110101010010100"
|
||||
},
|
||||
/* 16*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "¢£¤¥1", -1, "", 0, 33, 30, 1, "Mode 4 LCKE LCHA",
|
||||
/* 16*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "¢£¤¥1", -1, "", 0, 33, 30, 1, 1, "Mode 4 LCKE LCHA",
|
||||
"010101010101010101010101010111"
|
||||
"000000000000000000000000000000"
|
||||
"101010101010101010101010101010"
|
||||
|
@ -960,7 +988,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"010110101111010110101010111100"
|
||||
"010100000000010110101010010100"
|
||||
},
|
||||
/* 17*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "¢£¤¥123456789", -1, "", 0, 33, 30, 1, "Mode 4 LCKE NS",
|
||||
/* 17*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "¢£¤¥123456789", -1, "", 0, 33, 30, 1, 1, "Mode 4 LCKE NS",
|
||||
"111110101010101010101010101011"
|
||||
"111010111111111111111111111100"
|
||||
"000010000000000000000000000011"
|
||||
|
@ -995,7 +1023,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"011100101001010011011100111100"
|
||||
"101101110111011101011010011101"
|
||||
},
|
||||
/* 18*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ABCDE12abcde1ÀÁÂ⣤¥1àáâãabcde123A123456789àáâ㢣¤¥abc", -1, "", 0, 33, 30, 1, "Mode 4 mixed sets",
|
||||
/* 18*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ABCDE12abcde1ÀÁÂ⣤¥1àáâãabcde123A123456789àáâ㢣¤¥abc", -1, "", 0, 33, 30, 1, 1, "Mode 4 mixed sets",
|
||||
"000000001111111100000000111111"
|
||||
"000010101100111100000000111100"
|
||||
"011100101110000000100111010111"
|
||||
|
@ -1030,7 +1058,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"100010001001110010101010111000"
|
||||
"111010110110001100101000010001"
|
||||
},
|
||||
/* 19*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789MNO123456789", -1, "", 0, 33, 30, 1, "Mode 4 spaced NSs",
|
||||
/* 19*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789MNO123456789", -1, "", 0, 33, 30, 1, 1, "Mode 4 spaced NSs",
|
||||
"001011111000100010111110001011"
|
||||
"101011101000111010111010101100"
|
||||
"110100001011111101000010001101"
|
||||
|
@ -1065,7 +1093,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"011101000011011001001111111000"
|
||||
"111010010011100000100100111111"
|
||||
},
|
||||
/* 20*/ { UNICODE_MODE, 4, -1, { 3, 7, "" }, "THIS IS A 91 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, APPENDED, MAXICODE SYMBOL...", -1, "", 0, 33, 30, 1, "Mode 4 Structured Append",
|
||||
/* 20*/ { UNICODE_MODE, 4, -1, { 3, 7, "" }, "THIS IS A 91 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, APPENDED, MAXICODE SYMBOL...", -1, "", 0, 33, 30, 1, 1, "Mode 4 Structured Append",
|
||||
"010001111101000000100000100011"
|
||||
"000000010000000100000000101000"
|
||||
"001000101000110010011011001000"
|
||||
|
@ -1100,7 +1128,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"010101011101100110111011100100"
|
||||
"011001000011110011011110111010"
|
||||
},
|
||||
/* 21*/ { UNICODE_MODE, 3, -1, { 1, 8, "" }, "COMMISSION FOR EUROPEAN NORMALIZATION, RUE DE STASSART 36, B-1050 BRUXELLES", -1, "B1050056999", 0, 33, 30, 1, "Mode 3 Structured Append",
|
||||
/* 21*/ { UNICODE_MODE, 3, -1, { 1, 8, "" }, "COMMISSION FOR EUROPEAN NORMALIZATION, RUE DE STASSART 36, B-1050 BRUXELLES", -1, "B1050056999", 0, 33, 30, 1, 1, "Mode 3 Structured Append",
|
||||
"010000000000001010000000010011"
|
||||
"001000111111010000011111001000"
|
||||
"101111111010101111101101000101"
|
||||
|
@ -1135,7 +1163,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
"011111110000111010001010001100"
|
||||
"110010001001001011011111100111"
|
||||
},
|
||||
/* 22*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "am.//ab,\034TA# z\015!", -1, "", 0, 33, 30, 1, "Was test_best_supported_set",
|
||||
/* 22*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "am.//ab,\034TA# z\015!", -1, "", 0, 33, 30, 1, 1, "Was test_best_supported_set",
|
||||
"101110000101101100110101010111"
|
||||
"110110000011010100100000000010"
|
||||
"001000101111011100101010101010"
|
||||
|
@ -1179,10 +1207,11 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
char cmp_buf[8192];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1201,11 +1230,12 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
printf(" /*%3d*/ { %s, %d, %d, { %d, %d, \"%s\" }, \"%s\", %d, \"%s\", %s, %d, %d, %d, \"%s\",\n",
|
||||
printf(" /*%3d*/ { %s, %d, %d, { %d, %d, \"%s\" }, \"%s\", %d, \"%s\", %s, %d, %d, %d, %d, \"%s\",\n",
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2,
|
||||
data[i].structapp.index, data[i].structapp.count, data[i].structapp.id,
|
||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
|
||||
data[i].primary, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
|
||||
data[i].primary, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp,
|
||||
data[i].zxingcpp_cmp, data[i].comment);
|
||||
testUtilModulesPrint(symbol, " ", "\n");
|
||||
printf(" },\n");
|
||||
} else {
|
||||
|
@ -1233,13 +1263,19 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[17984 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
assert_nonzero(data[i].zxingcpp_cmp, "i:%d data[i].zxingcpp_cmp == 0", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, data[i].zxingcpp_cmp,
|
||||
cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, data[i].primary, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
data[i].primary, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1768,10 +1804,11 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
char cmp_buf[8192];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_encode_segs", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1800,52 +1837,69 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
printf(" /*%3d*/ { %s, %d, %d, { %d, %d, \"%s\" }, { { TU(\"%s\"), %d, %d }, { TU(\"%s\"), %d, %d }, { TU(\"%s\"), %d, %d } }, \"%s\", %s, %d, %d, %d, \"%s\",\n",
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2,
|
||||
data[i].structapp.index, data[i].structapp.count, data[i].structapp.id,
|
||||
testUtilEscape((const char *) data[i].segs[0].source, length, escaped, sizeof(escaped)), data[i].segs[0].length, data[i].segs[0].eci,
|
||||
testUtilEscape((const char *) data[i].segs[1].source, length1, escaped1, sizeof(escaped1)), data[i].segs[1].length, data[i].segs[1].eci,
|
||||
testUtilEscape((const char *) data[i].segs[2].source, length2, escaped2, sizeof(escaped2)), data[i].segs[2].length, data[i].segs[2].eci,
|
||||
data[i].primary, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
|
||||
testUtilEscape((const char *) data[i].segs[0].source, length, escaped, sizeof(escaped)),
|
||||
data[i].segs[0].length, data[i].segs[0].eci,
|
||||
testUtilEscape((const char *) data[i].segs[1].source, length1, escaped1, sizeof(escaped1)),
|
||||
data[i].segs[1].length, data[i].segs[1].eci,
|
||||
testUtilEscape((const char *) data[i].segs[2].source, length2, escaped2, sizeof(escaped2)),
|
||||
data[i].segs[2].length, data[i].segs[2].eci,
|
||||
data[i].primary, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp,
|
||||
data[i].comment);
|
||||
testUtilModulesPrint(symbol, " ", "\n");
|
||||
printf(" },\n");
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
int width, row;
|
||||
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\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_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);
|
||||
|
||||
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
|
||||
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d\n", i, ret, width, row);
|
||||
|
||||
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) {
|
||||
if (!data[i].bwipp_cmp) {
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) {
|
||||
printf("i:%d %s not BWIPP compatible (%s)\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
}
|
||||
} else {
|
||||
ret = testUtilBwippSegs(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].segs, seg_count, data[i].primary, cmp_buf, sizeof(cmp_buf));
|
||||
assert_zero(ret, "i:%d %s testUtilBwippSegs ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
ret = testUtilBwippSegs(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].segs,
|
||||
seg_count, data[i].primary, cmp_buf, sizeof(cmp_buf));
|
||||
assert_zero(ret, "i:%d %s testUtilBwippSegs ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected);
|
||||
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf,
|
||||
data[i].expected);
|
||||
}
|
||||
}
|
||||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, (const char *) data[i].segs[0].source, data[i].segs[0].length, debug)) {
|
||||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, (const char *) data[i].segs[0].source,
|
||||
data[i].segs[0].length, debug)) {
|
||||
if (data[i].input_mode == DATA_MODE) {
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) {
|
||||
printf("i:%d multiple segments in DATA_MODE not currently supported for ZXing-C++ testing (%s)\n",
|
||||
printf("i:%d %s multiple segments in DATA_MODE not currently supported for ZXing-C++ testing\n",
|
||||
i, testUtilBarcodeName(symbol->symbology));
|
||||
}
|
||||
} else {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[17984 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, (const char *) data[i].segs[0].source, data[i].segs[0].length,
|
||||
modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, (const char *) data[i].segs[0].source,
|
||||
data[i].segs[0].length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmpSegs(symbol, cmp_msg, cmp_buf, cmp_len, data[i].segs, seg_count,
|
||||
data[i].primary, escaped, &ret_len);
|
||||
data[i].primary, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmpSegs %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf,
|
||||
ret_len, escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1857,6 +1911,178 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int eci;
|
||||
int output_options;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
int expected_eci;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
int expected_raw_eci;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, "é", -1, 0, 0, "", -1, 0 },
|
||||
/* 1*/ { UNICODE_MODE, -1, BARCODE_RAW_TEXT, "é", -1, 0, 0, "\351", -1, 3 },
|
||||
/* 2*/ { UNICODE_MODE, -1, -1, "ก", -1, ZINT_WARN_USES_ECI, 13, "", -1, 0 },
|
||||
/* 3*/ { UNICODE_MODE, -1, BARCODE_RAW_TEXT, "ก", -1, ZINT_WARN_USES_ECI, 13, "\241", -1, 13 },
|
||||
/* 4*/ { DATA_MODE, -1, -1, "\351", -1, 0, 0, "", -1, 0 },
|
||||
/* 5*/ { DATA_MODE, -1, BARCODE_RAW_TEXT, "\351", -1, 0, 0, "\351", -1, 3 },
|
||||
/* 6*/ { UNICODE_MODE, 26, -1, "é", -1, 0, 26, "", -1, 0 },
|
||||
/* 7*/ { UNICODE_MODE, 26, BARCODE_RAW_TEXT, "é", -1, 0, 26, "é", -1, 26 },
|
||||
/* 8*/ { UNICODE_MODE, 899, -1, "é", -1, 0, 899, "", -1, 0 },
|
||||
/* 9*/ { UNICODE_MODE, 899, BARCODE_RAW_TEXT, "é", -1, 0, 899, "é", -1, 899 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, data[i].input_mode, data[i].eci,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n",
|
||||
i, symbol->eci, data[i].expected_eci);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->raw_segs[0].source, symbol->raw_segs[0].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[0].eci, data[i].expected_raw_eci,
|
||||
"i:%d raw_segs[0].eci %d != expected_raw_eci %d\n",
|
||||
i, symbol->raw_segs[0].eci, data[i].expected_raw_eci);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt_segs(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int output_options;
|
||||
struct zint_seg segs[3];
|
||||
int ret;
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
struct zint_seg expected_raw_segs[3];
|
||||
int expected_raw_seg_count;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, {0} }, 0, 33, 30, {{0}}, 0 },
|
||||
/* 1*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 33, 30, { { TU("\266"), 1, 3 }, { TU("\266"), 1, 7 }, {0} }, 2 },
|
||||
/* 2*/ { UNICODE_MODE, -1, { { TU("éé"), -1, 0 }, { TU("กขฯ"), -1, 0 }, { TU("βββ"), -1, 0 } }, ZINT_WARN_USES_ECI, 33, 30, {{0}}, 0 },
|
||||
/* 3*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("éé"), -1, 0 }, { TU("กขฯ"), -1, 0 }, { TU("βββ"), -1, 0 } }, ZINT_WARN_USES_ECI, 33, 30, { { TU("\351\351"), 2, 3 }, { TU("\241\242\317"), 3, 13 }, { TU("\342\342\342"), 3, 9 } }, 3 },
|
||||
/* 4*/ { DATA_MODE, -1, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("\223\137"), -1, 20 } }, 0, 33, 30, {{0}}, 0 },
|
||||
/* 5*/ { DATA_MODE, BARCODE_RAW_TEXT, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("\223\137"), -1, 20 } }, 0, 33, 30, { { TU("¶"), 2, 26 }, { TU("\320\226"), 2, 3 }, { TU("\223\137"), 2, 20 } }, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, j, seg_count, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
testUtilSetSymbol(symbol, BARCODE_MAXICODE, data[i].input_mode, -1 /*eci*/,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
NULL, 0, debug);
|
||||
for (j = 0, seg_count = 0; j < 3 && data[i].segs[j].length; j++, seg_count++);
|
||||
|
||||
ret = ZBarcode_Encode_Segs(symbol, data[i].segs, seg_count);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode_Segs ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (width %d)\n",
|
||||
i, symbol->rows, data[i].expected_rows, symbol->width);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n",
|
||||
i, symbol->width, data[i].expected_width);
|
||||
|
||||
assert_equal(symbol->raw_seg_count, data[i].expected_raw_seg_count, "i:%d symbol->raw_seg_count %d != %d\n",
|
||||
i, symbol->raw_seg_count, data[i].expected_raw_seg_count);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
for (j = 0; j < symbol->raw_seg_count; j++) {
|
||||
assert_nonnull(symbol->raw_segs[j].source, "i:%d raw_segs[%d].source NULL\n", i, j);
|
||||
|
||||
expected_length = data[i].expected_raw_segs[j].length;
|
||||
|
||||
assert_equal(symbol->raw_segs[j].length, expected_length,
|
||||
"i:%d raw_segs[%d].length %d != expected_length %d\n",
|
||||
i, j, symbol->raw_segs[j].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[j].source, data[i].expected_raw_segs[j].source, expected_length),
|
||||
"i:%d raw_segs[%d].source memcmp(%s, %s, %d) != 0\n", i, j,
|
||||
testUtilEscape((const char *) symbol->raw_segs[j].source, expected_length, escaped,
|
||||
sizeof(escaped)),
|
||||
testUtilEscape((const char *) data[i].expected_raw_segs[j].source, expected_length,
|
||||
escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[j].eci, data[i].expected_raw_segs[j].eci,
|
||||
"i:%d raw_segs[%d].eci %d != expected_raw_segs.eci %d\n",
|
||||
i, j, symbol->raw_segs[j].eci, data[i].expected_raw_segs[j].eci);
|
||||
}
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
/* #181 Nico Gunkel OSS-Fuzz */
|
||||
static void test_fuzz(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
@ -1880,7 +2106,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_fuzz", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2009,6 +2235,8 @@ int main(int argc, char *argv[]) {
|
|||
{ "test_input", test_input },
|
||||
{ "test_encode", test_encode },
|
||||
{ "test_encode_segs", test_encode_segs },
|
||||
{ "test_rt", test_rt },
|
||||
{ "test_rt_segs", test_rt_segs },
|
||||
{ "test_fuzz", test_fuzz },
|
||||
{ "test_perf", test_perf },
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[128];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -103,46 +103,47 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
const char *data;
|
||||
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_PHARMA, -1, -1, "123456", "" }, /* None */
|
||||
/* 1*/ { BARCODE_PHARMA, -1, BARCODE_RAW_TEXT, "123456", "123456" },
|
||||
/* 2*/ { BARCODE_PHARMA_TWO, -1, -1, "123456", "" }, /* None */
|
||||
/* 3*/ { BARCODE_PHARMA_TWO, -1, BARCODE_RAW_TEXT, "123456", "123456" },
|
||||
/* 4*/ { BARCODE_CODE32, -1, -1, "123456", "A001234564" },
|
||||
/* 5*/ { BARCODE_CODE32, -1, BARCODE_RAW_TEXT, "123456", "015PN4" }, /* Actual encoded CODE39 value */
|
||||
/* 6*/ { BARCODE_CODE32, -1, -1, "12345678", "A123456788" },
|
||||
/* 7*/ { BARCODE_CODE32, -1, BARCODE_RAW_TEXT, "12345678", "3PRM8N" },
|
||||
/* 8*/ { BARCODE_CODE32, 1, -1, "12345678", "A123456788" }, /* Ignore option_2 re check digits */
|
||||
/* 9*/ { BARCODE_CODE32, 1, BARCODE_RAW_TEXT, "12345678", "3PRM8N" },
|
||||
/* 10*/ { BARCODE_CODE32, 2, -1, "12345678", "A123456788" }, /* Ignore option_2 re check digits */
|
||||
/* 11*/ { BARCODE_CODE32, 2, BARCODE_RAW_TEXT, "12345678", "3PRM8N" },
|
||||
/* 12*/ { BARCODE_PZN, -1, -1, "12345", "PZN - 00123458" }, /* Pads with zeroes if length < 7 */
|
||||
/* 13*/ { BARCODE_PZN, -1, BARCODE_RAW_TEXT, "12345", "-00123458" }, /* Actual encoded CODE39 value */
|
||||
/* 14*/ { BARCODE_PZN, -1, -1, "123456", "PZN - 01234562" },
|
||||
/* 15*/ { BARCODE_PZN, -1, BARCODE_RAW_TEXT, "123456", "-01234562" },
|
||||
/* 16*/ { BARCODE_PZN, -1, -1, "1234567", "PZN - 12345678" },
|
||||
/* 17*/ { BARCODE_PZN, -1, BARCODE_RAW_TEXT, "1234567", "-12345678" },
|
||||
/* 18*/ { BARCODE_PZN, -1, -1, "12345678", "PZN - 12345678" },
|
||||
/* 19*/ { BARCODE_PZN, -1, BARCODE_RAW_TEXT, "12345678", "-12345678" },
|
||||
/* 20*/ { BARCODE_PZN, 1, -1, "1234", "PZN - 0012345" }, /* PZN7, pads with zeroes if length < 6 */
|
||||
/* 21*/ { BARCODE_PZN, 1, BARCODE_RAW_TEXT, "1234", "-0012345" },
|
||||
/* 22*/ { BARCODE_PZN, 1, -1, "12345", "PZN - 0123458" },
|
||||
/* 23*/ { BARCODE_PZN, 1, BARCODE_RAW_TEXT, "12345", "-0123458" },
|
||||
/* 24*/ { BARCODE_PZN, 1, -1, "123456", "PZN - 1234562" },
|
||||
/* 25*/ { BARCODE_PZN, 1, BARCODE_RAW_TEXT, "123456", "-1234562" },
|
||||
/* 26*/ { BARCODE_PZN, 1, -1, "1234562", "PZN - 1234562" },
|
||||
/* 27*/ { BARCODE_PZN, 1, BARCODE_RAW_TEXT, "1234562", "-1234562" },
|
||||
/* 28*/ { BARCODE_PZN, 2, -1, "12345", "PZN - 00123458" }, /* Ignore option_2 re check digits */
|
||||
/* 29*/ { BARCODE_PZN, 2, BARCODE_RAW_TEXT, "12345", "-00123458" },
|
||||
/* 0*/ { BARCODE_PHARMA, -1, -1, "123456", "", "" }, /* None */
|
||||
/* 1*/ { BARCODE_PHARMA, -1, BARCODE_RAW_TEXT, "123456", "", "123456" },
|
||||
/* 2*/ { BARCODE_PHARMA_TWO, -1, -1, "123456", "", "" }, /* None */
|
||||
/* 3*/ { BARCODE_PHARMA_TWO, -1, BARCODE_RAW_TEXT, "123456", "", "123456" },
|
||||
/* 4*/ { BARCODE_CODE32, -1, -1, "123456", "A001234564", "" },
|
||||
/* 5*/ { BARCODE_CODE32, -1, BARCODE_RAW_TEXT, "123456", "A001234564", "015PN4" }, /* Actual encoded CODE39 value */
|
||||
/* 6*/ { BARCODE_CODE32, -1, -1, "12345678", "A123456788", "" },
|
||||
/* 7*/ { BARCODE_CODE32, -1, BARCODE_RAW_TEXT, "12345678", "A123456788", "3PRM8N" },
|
||||
/* 8*/ { BARCODE_CODE32, 1, -1, "12345678", "A123456788", "" }, /* Ignore option_2 re check digits */
|
||||
/* 9*/ { BARCODE_CODE32, 1, BARCODE_RAW_TEXT, "12345678", "A123456788", "3PRM8N" },
|
||||
/* 10*/ { BARCODE_CODE32, 2, -1, "12345678", "A123456788", "" }, /* Ignore option_2 re check digits */
|
||||
/* 11*/ { BARCODE_CODE32, 2, BARCODE_RAW_TEXT, "12345678", "A123456788", "3PRM8N" },
|
||||
/* 12*/ { BARCODE_PZN, -1, -1, "12345", "PZN - 00123458", "" }, /* Pads with zeroes if length < 7 */
|
||||
/* 13*/ { BARCODE_PZN, -1, BARCODE_RAW_TEXT, "12345", "PZN - 00123458", "-00123458" }, /* Actual encoded CODE39 value */
|
||||
/* 14*/ { BARCODE_PZN, -1, -1, "123456", "PZN - 01234562", "" },
|
||||
/* 15*/ { BARCODE_PZN, -1, BARCODE_RAW_TEXT, "123456", "PZN - 01234562", "-01234562" },
|
||||
/* 16*/ { BARCODE_PZN, -1, -1, "1234567", "PZN - 12345678", "" },
|
||||
/* 17*/ { BARCODE_PZN, -1, BARCODE_RAW_TEXT, "1234567", "PZN - 12345678", "-12345678" },
|
||||
/* 18*/ { BARCODE_PZN, -1, -1, "12345678", "PZN - 12345678", "" },
|
||||
/* 19*/ { BARCODE_PZN, -1, BARCODE_RAW_TEXT, "12345678", "PZN - 12345678", "-12345678" },
|
||||
/* 20*/ { BARCODE_PZN, 1, -1, "1234", "PZN - 0012345", "" }, /* PZN7, pads with zeroes if length < 6 */
|
||||
/* 21*/ { BARCODE_PZN, 1, BARCODE_RAW_TEXT, "1234", "PZN - 0012345", "-0012345" },
|
||||
/* 22*/ { BARCODE_PZN, 1, -1, "12345", "PZN - 0123458", "" },
|
||||
/* 23*/ { BARCODE_PZN, 1, BARCODE_RAW_TEXT, "12345", "PZN - 0123458", "-0123458" },
|
||||
/* 24*/ { BARCODE_PZN, 1, -1, "123456", "PZN - 1234562", "" },
|
||||
/* 25*/ { BARCODE_PZN, 1, BARCODE_RAW_TEXT, "123456", "PZN - 1234562", "-1234562" },
|
||||
/* 26*/ { BARCODE_PZN, 1, -1, "1234562", "PZN - 1234562", "" },
|
||||
/* 27*/ { BARCODE_PZN, 1, BARCODE_RAW_TEXT, "1234562", "PZN - 1234562", "-1234562" },
|
||||
/* 28*/ { BARCODE_PZN, 2, -1, "12345", "PZN - 00123458", "" }, /* Ignore option_2 re check digits */
|
||||
/* 29*/ { BARCODE_PZN, 2, BARCODE_RAW_TEXT, "12345", "PZN - 00123458", "-00123458" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -155,6 +156,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, data[i].option_2, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -163,6 +165,18 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length, symbol->text);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -223,7 +237,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -323,10 +337,11 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
char cmp_buf[8192];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -367,13 +382,18 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
|
||||
"i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
|
||||
sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ static void test_check_colour_options(const testCtx *const p_ctx) {
|
|||
int i, ret;
|
||||
struct zint_symbol symbol = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_check_colour_options");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -116,7 +116,7 @@ static void test_colour_get_rgb(const testCtx *const p_ctx) {
|
|||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, ret;
|
||||
|
||||
testStart("test_colour_get_rgb");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
/* Suppress clang-16 run-time exception MemorySanitizer: use-of-uninitialized-value (fixed in clang-17) */
|
||||
|
@ -176,7 +176,7 @@ static void test_colour_get_cmyk(const testCtx *const p_ctx) {
|
|||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, ret;
|
||||
|
||||
testStart("test_colour_get_cmyk");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
/* Suppress clang -fsanitize=memory false positives */
|
||||
|
@ -214,7 +214,7 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
|
|||
int comp_xoffset = 0;
|
||||
float left, right, top, bottom;
|
||||
|
||||
testStart("test_quiet_zones");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 1; i <= BARCODE_LAST; i++) {
|
||||
if (!ZBarcode_ValidID(i)) continue;
|
||||
|
@ -270,7 +270,7 @@ static void test_set_whitespace_offsets(const testCtx *const p_ctx) {
|
|||
float xoffset, yoffset, roffset, boffset, qz_right;
|
||||
int xoffset_si, yoffset_si, roffset_si, boffset_si, qz_right_si;
|
||||
|
||||
testStart("test_set_whitespace_offsets");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
@ -361,7 +361,7 @@ static void test_fopen(const testCtx *const p_ctx) {
|
|||
char subdirname[1024 + 256];
|
||||
int dir_exists, subdir_exists;
|
||||
|
||||
testStart("test_fopen");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
assert_nonnull(getcwd(cwdbuf, sizeof(cwdbuf)), "getcwd NULL (%d, %s)\n", errno, strerror(errno));
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ static void test_print(const testCtx *const p_ctx) {
|
|||
|
||||
const char *const have_identify = testUtilHaveIdentify();
|
||||
|
||||
testStart("test_pcx");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
char data_dir_path[1024];
|
||||
|
@ -171,7 +171,7 @@ static void test_outfile(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_outfile");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol.symbology = BARCODE_CODE128;
|
||||
symbol.bitmap = data;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -73,7 +73,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[4096] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -113,91 +113,93 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
const char *data;
|
||||
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_MSI_PLESSEY, -1, -1, "1234567", "1234567" },
|
||||
/* 1*/ { BARCODE_MSI_PLESSEY, -1, BARCODE_RAW_TEXT, "1234567", "1234567" },
|
||||
/* 2*/ { BARCODE_MSI_PLESSEY, 0, -1, "1234567", "1234567" },
|
||||
/* 3*/ { BARCODE_MSI_PLESSEY, 0, BARCODE_RAW_TEXT, "1234567", "1234567" },
|
||||
/* 4*/ { BARCODE_MSI_PLESSEY, 1, -1, "1234567", "12345674" },
|
||||
/* 5*/ { BARCODE_MSI_PLESSEY, 1, BARCODE_RAW_TEXT, "1234567", "12345674" },
|
||||
/* 6*/ { BARCODE_MSI_PLESSEY, 1 + 10, -1, "1234567", "1234567" },
|
||||
/* 7*/ { BARCODE_MSI_PLESSEY, 1 + 10, BARCODE_RAW_TEXT, "1234567", "12345674" },
|
||||
/* 8*/ { BARCODE_MSI_PLESSEY, 1, -1, "9999999999", "99999999990" },
|
||||
/* 9*/ { BARCODE_MSI_PLESSEY, 1, BARCODE_RAW_TEXT, "9999999999", "99999999990" },
|
||||
/* 10*/ { BARCODE_MSI_PLESSEY, 2, -1, "1234567", "123456741" },
|
||||
/* 11*/ { BARCODE_MSI_PLESSEY, 2, BARCODE_RAW_TEXT, "1234567", "123456741" },
|
||||
/* 12*/ { BARCODE_MSI_PLESSEY, 2 + 10, -1, "1234567", "1234567" },
|
||||
/* 13*/ { BARCODE_MSI_PLESSEY, 2 + 10, BARCODE_RAW_TEXT, "1234567", "123456741" },
|
||||
/* 14*/ { BARCODE_MSI_PLESSEY, 2, -1, "9999999999", "999999999900" },
|
||||
/* 15*/ { BARCODE_MSI_PLESSEY, 2, BARCODE_RAW_TEXT, "9999999999", "999999999900" },
|
||||
/* 16*/ { BARCODE_MSI_PLESSEY, 3, -1, "1234567", "12345674" },
|
||||
/* 17*/ { BARCODE_MSI_PLESSEY, 3, BARCODE_RAW_TEXT, "1234567", "12345674" },
|
||||
/* 18*/ { BARCODE_MSI_PLESSEY, 3 + 10, -1, "1234567", "1234567" },
|
||||
/* 19*/ { BARCODE_MSI_PLESSEY, 3 + 10, BARCODE_RAW_TEXT, "1234567", "12345674" },
|
||||
/* 20*/ { BARCODE_MSI_PLESSEY, 3, -1, "9999999999", "99999999995" },
|
||||
/* 21*/ { BARCODE_MSI_PLESSEY, 3, BARCODE_RAW_TEXT, "9999999999", "99999999995" },
|
||||
/* 22*/ { BARCODE_MSI_PLESSEY, 4, -1, "1234567", "123456741" },
|
||||
/* 23*/ { BARCODE_MSI_PLESSEY, 4, BARCODE_RAW_TEXT, "1234567", "123456741" },
|
||||
/* 24*/ { BARCODE_MSI_PLESSEY, 4 + 10, -1, "1234567", "1234567" },
|
||||
/* 25*/ { BARCODE_MSI_PLESSEY, 4 + 10, BARCODE_RAW_TEXT, "1234567", "123456741" },
|
||||
/* 26*/ { BARCODE_MSI_PLESSEY, 4, -1, "9999999999", "999999999959" },
|
||||
/* 27*/ { BARCODE_MSI_PLESSEY, 4, BARCODE_RAW_TEXT, "9999999999", "999999999959" },
|
||||
/* 28*/ { BARCODE_MSI_PLESSEY, 5, -1, "1234567", "12345679" },
|
||||
/* 29*/ { BARCODE_MSI_PLESSEY, 5, BARCODE_RAW_TEXT, "1234567", "12345679" },
|
||||
/* 30*/ { BARCODE_MSI_PLESSEY, 5 + 10, -1, "1234567", "1234567" },
|
||||
/* 31*/ { BARCODE_MSI_PLESSEY, 5 + 10, BARCODE_RAW_TEXT, "1234567", "12345679" },
|
||||
/* 32*/ { BARCODE_MSI_PLESSEY, 5, -1, "9999999999", "999999999910" },
|
||||
/* 33*/ { BARCODE_MSI_PLESSEY, 5, BARCODE_RAW_TEXT, "9999999999", "999999999910" },
|
||||
/* 34*/ { BARCODE_MSI_PLESSEY, 6, -1, "1234567", "123456790" },
|
||||
/* 35*/ { BARCODE_MSI_PLESSEY, 6, BARCODE_RAW_TEXT, "1234567", "123456790" },
|
||||
/* 36*/ { BARCODE_MSI_PLESSEY, 6 + 10, -1, "1234567", "1234567" },
|
||||
/* 37*/ { BARCODE_MSI_PLESSEY, 6 + 10, BARCODE_RAW_TEXT, "1234567", "123456790" },
|
||||
/* 38*/ { BARCODE_MSI_PLESSEY, 6, -1, "9999999999", "9999999999109" },
|
||||
/* 39*/ { BARCODE_MSI_PLESSEY, 6, BARCODE_RAW_TEXT, "9999999999", "9999999999109" },
|
||||
/* 40*/ { BARCODE_MSI_PLESSEY, 1, -1, "123456", "1234566" },
|
||||
/* 41*/ { BARCODE_MSI_PLESSEY, 1, BARCODE_RAW_TEXT, "123456", "1234566" },
|
||||
/* 42*/ { BARCODE_MSI_PLESSEY, 2, -1, "123456", "12345666" },
|
||||
/* 43*/ { BARCODE_MSI_PLESSEY, 2, BARCODE_RAW_TEXT, "123456", "12345666" },
|
||||
/* 44*/ { BARCODE_MSI_PLESSEY, 3, -1, "123456", "1234560" },
|
||||
/* 45*/ { BARCODE_MSI_PLESSEY, 3, BARCODE_RAW_TEXT, "123456", "1234560" },
|
||||
/* 46*/ { BARCODE_MSI_PLESSEY, 4, -1, "123456", "12345609" },
|
||||
/* 47*/ { BARCODE_MSI_PLESSEY, 4, BARCODE_RAW_TEXT, "123456", "12345609" },
|
||||
/* 48*/ { BARCODE_MSI_PLESSEY, 3, -1, "2211", "221110" }, /* Mod-11 check digit '10' */
|
||||
/* 49*/ { BARCODE_MSI_PLESSEY, 3, BARCODE_RAW_TEXT, "2211", "221110" },
|
||||
/* 50*/ { BARCODE_MSI_PLESSEY, 3 + 10, -1, "2211", "2211" }, /* Mod-11 check digit '10' */
|
||||
/* 51*/ { BARCODE_MSI_PLESSEY, 3 + 10, BARCODE_RAW_TEXT, "2211", "221110" },
|
||||
/* 52*/ { BARCODE_MSI_PLESSEY, 4, -1, "2211", "2211100" },
|
||||
/* 53*/ { BARCODE_MSI_PLESSEY, 4, BARCODE_RAW_TEXT, "2211", "2211100" },
|
||||
/* 54*/ { BARCODE_MSI_PLESSEY, 4 + 10, -1, "2211", "2211" },
|
||||
/* 55*/ { BARCODE_MSI_PLESSEY, 4 + 10, BARCODE_RAW_TEXT, "2211", "2211100" },
|
||||
/* 56*/ { BARCODE_PLESSEY, -1, -1, "0123456789ABCDEF", "0123456789ABCDEF" },
|
||||
/* 57*/ { BARCODE_PLESSEY, -1, BARCODE_RAW_TEXT, "0123456789ABCDEF", "0123456789ABCDEF90" },
|
||||
/* 58*/ { BARCODE_PLESSEY, 1, -1, "0123456789ABCDEF", "0123456789ABCDEF90" },
|
||||
/* 59*/ { BARCODE_PLESSEY, 1, BARCODE_RAW_TEXT, "0123456789ABCDEF", "0123456789ABCDEF90" },
|
||||
/* 60*/ { BARCODE_PLESSEY, -1, -1, "1", "1" },
|
||||
/* 61*/ { BARCODE_PLESSEY, -1, BARCODE_RAW_TEXT, "1", "173" },
|
||||
/* 62*/ { BARCODE_PLESSEY, 1, -1, "1", "173" },
|
||||
/* 63*/ { BARCODE_PLESSEY, 1, BARCODE_RAW_TEXT, "1", "173" },
|
||||
/* 64*/ { BARCODE_PLESSEY, -1, -1, "7", "7" },
|
||||
/* 65*/ { BARCODE_PLESSEY, -1, BARCODE_RAW_TEXT, "7", "758" },
|
||||
/* 66*/ { BARCODE_PLESSEY, 1, -1, "7", "758" },
|
||||
/* 67*/ { BARCODE_PLESSEY, 1, BARCODE_RAW_TEXT, "7", "758" },
|
||||
/* 68*/ { BARCODE_PLESSEY, -1, -1, "75", "75" },
|
||||
/* 69*/ { BARCODE_PLESSEY, -1, BARCODE_RAW_TEXT, "75", "7580" },
|
||||
/* 70*/ { BARCODE_PLESSEY, 1, -1, "75", "7580" },
|
||||
/* 71*/ { BARCODE_PLESSEY, 1, BARCODE_RAW_TEXT, "75", "7580" },
|
||||
/* 72*/ { BARCODE_PLESSEY, -1, -1, "993", "993" },
|
||||
/* 73*/ { BARCODE_PLESSEY, -1, BARCODE_RAW_TEXT, "993", "993AA" },
|
||||
/* 74*/ { BARCODE_PLESSEY, 1, -1, "993", "993AA" },
|
||||
/* 0*/ { BARCODE_MSI_PLESSEY, -1, -1, "1234567", "1234567", "" },
|
||||
/* 1*/ { BARCODE_MSI_PLESSEY, -1, BARCODE_RAW_TEXT, "1234567", "1234567", "1234567" },
|
||||
/* 2*/ { BARCODE_MSI_PLESSEY, 0, -1, "1234567", "1234567", "" },
|
||||
/* 3*/ { BARCODE_MSI_PLESSEY, 0, BARCODE_RAW_TEXT, "1234567", "1234567", "1234567" },
|
||||
/* 4*/ { BARCODE_MSI_PLESSEY, 1, -1, "1234567", "12345674", "" },
|
||||
/* 5*/ { BARCODE_MSI_PLESSEY, 1, BARCODE_RAW_TEXT, "1234567", "12345674", "12345674" },
|
||||
/* 6*/ { BARCODE_MSI_PLESSEY, 1 + 10, -1, "1234567", "1234567", "" },
|
||||
/* 7*/ { BARCODE_MSI_PLESSEY, 1 + 10, BARCODE_RAW_TEXT, "1234567", "1234567", "12345674" },
|
||||
/* 8*/ { BARCODE_MSI_PLESSEY, 1, -1, "9999999999", "99999999990", "" },
|
||||
/* 9*/ { BARCODE_MSI_PLESSEY, 1, BARCODE_RAW_TEXT, "9999999999", "99999999990", "99999999990" },
|
||||
/* 10*/ { BARCODE_MSI_PLESSEY, 2, -1, "1234567", "123456741", "" },
|
||||
/* 11*/ { BARCODE_MSI_PLESSEY, 2, BARCODE_RAW_TEXT, "1234567", "123456741", "123456741" },
|
||||
/* 12*/ { BARCODE_MSI_PLESSEY, 2 + 10, -1, "1234567", "1234567", "" },
|
||||
/* 13*/ { BARCODE_MSI_PLESSEY, 2 + 10, BARCODE_RAW_TEXT, "1234567", "1234567", "123456741" },
|
||||
/* 14*/ { BARCODE_MSI_PLESSEY, 2, -1, "9999999999", "999999999900", "" },
|
||||
/* 15*/ { BARCODE_MSI_PLESSEY, 2, BARCODE_RAW_TEXT, "9999999999", "999999999900", "999999999900" },
|
||||
/* 16*/ { BARCODE_MSI_PLESSEY, 3, -1, "1234567", "12345674", "" },
|
||||
/* 17*/ { BARCODE_MSI_PLESSEY, 3, BARCODE_RAW_TEXT, "1234567", "12345674", "12345674" },
|
||||
/* 18*/ { BARCODE_MSI_PLESSEY, 3 + 10, -1, "1234567", "1234567", "" },
|
||||
/* 19*/ { BARCODE_MSI_PLESSEY, 3 + 10, BARCODE_RAW_TEXT, "1234567", "1234567", "12345674" },
|
||||
/* 20*/ { BARCODE_MSI_PLESSEY, 3, -1, "9999999999", "99999999995", "" },
|
||||
/* 21*/ { BARCODE_MSI_PLESSEY, 3, BARCODE_RAW_TEXT, "9999999999", "99999999995", "99999999995" },
|
||||
/* 22*/ { BARCODE_MSI_PLESSEY, 4, -1, "1234567", "123456741", "" },
|
||||
/* 23*/ { BARCODE_MSI_PLESSEY, 4, BARCODE_RAW_TEXT, "1234567", "123456741", "123456741" },
|
||||
/* 24*/ { BARCODE_MSI_PLESSEY, 4 + 10, -1, "1234567", "1234567", "" },
|
||||
/* 25*/ { BARCODE_MSI_PLESSEY, 4 + 10, BARCODE_RAW_TEXT, "1234567", "1234567", "123456741" },
|
||||
/* 26*/ { BARCODE_MSI_PLESSEY, 4, -1, "9999999999", "999999999959", "" },
|
||||
/* 27*/ { BARCODE_MSI_PLESSEY, 4, BARCODE_RAW_TEXT, "9999999999", "999999999959", "999999999959" },
|
||||
/* 28*/ { BARCODE_MSI_PLESSEY, 5, -1, "1234567", "12345679", "" },
|
||||
/* 29*/ { BARCODE_MSI_PLESSEY, 5, BARCODE_RAW_TEXT, "1234567", "12345679", "12345679" },
|
||||
/* 30*/ { BARCODE_MSI_PLESSEY, 5 + 10, -1, "1234567", "1234567", "" },
|
||||
/* 31*/ { BARCODE_MSI_PLESSEY, 5 + 10, BARCODE_RAW_TEXT, "1234567", "1234567", "12345679" },
|
||||
/* 32*/ { BARCODE_MSI_PLESSEY, 5, -1, "9999999999", "999999999910", "" },
|
||||
/* 33*/ { BARCODE_MSI_PLESSEY, 5, BARCODE_RAW_TEXT, "9999999999", "999999999910", "999999999910" },
|
||||
/* 34*/ { BARCODE_MSI_PLESSEY, 6, -1, "1234567", "123456790", "" },
|
||||
/* 35*/ { BARCODE_MSI_PLESSEY, 6, BARCODE_RAW_TEXT, "1234567", "123456790", "123456790" },
|
||||
/* 36*/ { BARCODE_MSI_PLESSEY, 6 + 10, -1, "1234567", "1234567", "" },
|
||||
/* 37*/ { BARCODE_MSI_PLESSEY, 6 + 10, BARCODE_RAW_TEXT, "1234567", "1234567", "123456790" },
|
||||
/* 38*/ { BARCODE_MSI_PLESSEY, 6, -1, "9999999999", "9999999999109", "" },
|
||||
/* 39*/ { BARCODE_MSI_PLESSEY, 6, BARCODE_RAW_TEXT, "9999999999", "9999999999109", "9999999999109" },
|
||||
/* 40*/ { BARCODE_MSI_PLESSEY, 1, -1, "123456", "1234566", "" },
|
||||
/* 41*/ { BARCODE_MSI_PLESSEY, 1, BARCODE_RAW_TEXT, "123456", "1234566", "1234566" },
|
||||
/* 42*/ { BARCODE_MSI_PLESSEY, 2, -1, "123456", "12345666", "" },
|
||||
/* 43*/ { BARCODE_MSI_PLESSEY, 2, BARCODE_RAW_TEXT, "123456", "12345666", "12345666" },
|
||||
/* 44*/ { BARCODE_MSI_PLESSEY, 3, -1, "123456", "1234560", "" },
|
||||
/* 45*/ { BARCODE_MSI_PLESSEY, 3, BARCODE_RAW_TEXT, "123456", "1234560", "1234560" },
|
||||
/* 46*/ { BARCODE_MSI_PLESSEY, 4, -1, "123456", "12345609", "" },
|
||||
/* 47*/ { BARCODE_MSI_PLESSEY, 4, BARCODE_RAW_TEXT, "123456", "12345609", "12345609" },
|
||||
/* 48*/ { BARCODE_MSI_PLESSEY, 3, -1, "2211", "221110", "" }, /* Mod-11 check digit '10' */
|
||||
/* 49*/ { BARCODE_MSI_PLESSEY, 3, BARCODE_RAW_TEXT, "2211", "221110", "221110" },
|
||||
/* 50*/ { BARCODE_MSI_PLESSEY, 3 + 10, -1, "2211", "2211", "" }, /* Mod-11 check digit '10' */
|
||||
/* 51*/ { BARCODE_MSI_PLESSEY, 3 + 10, BARCODE_RAW_TEXT, "2211", "2211", "221110" },
|
||||
/* 52*/ { BARCODE_MSI_PLESSEY, 4, -1, "2211", "2211100", "" },
|
||||
/* 53*/ { BARCODE_MSI_PLESSEY, 4, BARCODE_RAW_TEXT, "2211", "2211100", "2211100" },
|
||||
/* 54*/ { BARCODE_MSI_PLESSEY, 4 + 10, -1, "2211", "2211", "" },
|
||||
/* 55*/ { BARCODE_MSI_PLESSEY, 4 + 10, BARCODE_RAW_TEXT, "2211", "2211", "2211100" },
|
||||
/* 56*/ { BARCODE_PLESSEY, -1, -1, "0123456789ABCDEF", "0123456789ABCDEF", "" },
|
||||
/* 57*/ { BARCODE_PLESSEY, -1, BARCODE_RAW_TEXT, "0123456789ABCDEF", "0123456789ABCDEF", "0123456789ABCDEF90" },
|
||||
/* 58*/ { BARCODE_PLESSEY, 1, -1, "0123456789ABCDEF", "0123456789ABCDEF90", "" },
|
||||
/* 59*/ { BARCODE_PLESSEY, 1, BARCODE_RAW_TEXT, "0123456789ABCDEF", "0123456789ABCDEF90", "0123456789ABCDEF90" },
|
||||
/* 60*/ { BARCODE_PLESSEY, -1, -1, "1", "1", "" },
|
||||
/* 61*/ { BARCODE_PLESSEY, -1, BARCODE_RAW_TEXT, "1", "1", "173" },
|
||||
/* 62*/ { BARCODE_PLESSEY, 1, -1, "1", "173", "" },
|
||||
/* 63*/ { BARCODE_PLESSEY, 1, BARCODE_RAW_TEXT, "1", "173", "173" },
|
||||
/* 64*/ { BARCODE_PLESSEY, -1, -1, "7", "7", "" },
|
||||
/* 65*/ { BARCODE_PLESSEY, -1, BARCODE_RAW_TEXT, "7", "7", "758" },
|
||||
/* 66*/ { BARCODE_PLESSEY, 1, -1, "7", "758", "" },
|
||||
/* 67*/ { BARCODE_PLESSEY, 1, BARCODE_RAW_TEXT, "7", "758", "758" },
|
||||
/* 68*/ { BARCODE_PLESSEY, -1, -1, "75", "75", "" },
|
||||
/* 69*/ { BARCODE_PLESSEY, -1, BARCODE_RAW_TEXT, "75", "75", "7580" },
|
||||
/* 70*/ { BARCODE_PLESSEY, 1, -1, "75", "7580", "" },
|
||||
/* 71*/ { BARCODE_PLESSEY, 1, BARCODE_RAW_TEXT, "75", "7580", "7580" },
|
||||
/* 72*/ { BARCODE_PLESSEY, -1, -1, "993", "993", "" },
|
||||
/* 73*/ { BARCODE_PLESSEY, -1, BARCODE_RAW_TEXT, "993", "993", "993AA" },
|
||||
/* 74*/ { BARCODE_PLESSEY, 1, -1, "993", "993AA", "" },
|
||||
/* 75*/ { BARCODE_PLESSEY, 1, BARCODE_RAW_TEXT, "993", "993AA", "993AA" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -210,6 +212,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, data[i].option_2, -1, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -218,6 +221,18 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -250,7 +265,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -336,7 +351,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
|
|||
|
||||
const char *const have_identify = testUtilHaveIdentify();
|
||||
|
||||
testStart("test_pixel_plot");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int size;
|
||||
|
@ -253,7 +253,7 @@ static void test_print(const testCtx *const p_ctx) {
|
|||
|
||||
const char *const have_identify = testUtilHaveIdentify();
|
||||
|
||||
testStartSymbol("test_print", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
char data_dir_path[1024];
|
||||
|
@ -375,7 +375,7 @@ static void test_outfile(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_outfile");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol.symbology = BARCODE_CODE128;
|
||||
symbol.bitmap = data;
|
||||
|
@ -428,7 +428,7 @@ static void test_wpng_error_handler(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_wpng_error_handler");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
wpng_error.symbol = &symbol;
|
||||
|
||||
|
@ -476,7 +476,7 @@ static void test_large_compliant_height(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStartSymbol("test_large_compliant_height", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
|
|
@ -84,7 +84,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[4096] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -132,7 +132,7 @@ static void test_koreapost(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_koreapost", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -185,7 +185,7 @@ static void test_japanpost(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_japanpost", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -224,37 +224,38 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
const char *data;
|
||||
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_FLAT, -1, -1, "12345", "" }, /* None */
|
||||
/* 1*/ { BARCODE_FLAT, -1, BARCODE_RAW_TEXT, "12345", "12345" },
|
||||
/* 2*/ { BARCODE_POSTNET, -1, -1, "12345", "" }, /* None */
|
||||
/* 3*/ { BARCODE_POSTNET, -1, BARCODE_RAW_TEXT, "12345", "123455" },
|
||||
/* 4*/ { BARCODE_FIM, -1, -1, "e", "" }, /* None */
|
||||
/* 5*/ { BARCODE_FIM, -1, BARCODE_RAW_TEXT, "e", "E" },
|
||||
/* 6*/ { BARCODE_CEPNET, -1, -1, "12345678", "" }, /* None */
|
||||
/* 7*/ { BARCODE_CEPNET, -1, BARCODE_RAW_TEXT, "12345678", "123456784" },
|
||||
/* 8*/ { BARCODE_RM4SCC, -1, -1, "BX11LT1A", "" }, /* None*/
|
||||
/* 9*/ { BARCODE_RM4SCC, -1, BARCODE_RAW_TEXT, "BX11LT1A", "BX11LT1AI" },
|
||||
/* 10*/ { BARCODE_JAPANPOST, -1, -1, "1234", "" }, /* None*/
|
||||
/* 11*/ { BARCODE_JAPANPOST, -1, BARCODE_RAW_TEXT, "1234", "1234" }, /* Note check char not included */
|
||||
/* 12*/ { BARCODE_JAPANPOST, -1, BARCODE_RAW_TEXT, "123456-AB", "123456-AB" }, /* Ditto */
|
||||
/* 13*/ { BARCODE_KOREAPOST, -1, -1, "123456", "1234569" },
|
||||
/* 14*/ { BARCODE_KOREAPOST, -1, BARCODE_RAW_TEXT, "123456", "1234569" }, /* No difference */
|
||||
/* 15*/ { BARCODE_PLANET, -1, -1, "12345678901", "" }, /* None */
|
||||
/* 16*/ { BARCODE_PLANET, -1, BARCODE_RAW_TEXT, "12345678901", "123456789014" },
|
||||
/* 17*/ { BARCODE_KIX, -1, -1, "0123456789ABCDEFGH", "" }, /* None */
|
||||
/* 18*/ { BARCODE_KIX, -1, BARCODE_RAW_TEXT, "0123456789ABCDEFGH", "0123456789ABCDEFGH" },
|
||||
/* 19*/ { BARCODE_DAFT, -1, -1, "DAFT", "" }, /* None */
|
||||
/* 20*/ { BARCODE_DAFT, -1, BARCODE_RAW_TEXT, "DAFT", "DAFT" },
|
||||
/* 0*/ { BARCODE_FLAT, -1, -1, "12345", "", "" }, /* None */
|
||||
/* 1*/ { BARCODE_FLAT, -1, BARCODE_RAW_TEXT, "12345", "", "12345" },
|
||||
/* 2*/ { BARCODE_POSTNET, -1, -1, "12345", "", "" }, /* None */
|
||||
/* 3*/ { BARCODE_POSTNET, -1, BARCODE_RAW_TEXT, "12345", "", "123455" },
|
||||
/* 4*/ { BARCODE_FIM, -1, -1, "e", "", "" }, /* None */
|
||||
/* 5*/ { BARCODE_FIM, -1, BARCODE_RAW_TEXT, "e", "", "E" },
|
||||
/* 6*/ { BARCODE_CEPNET, -1, -1, "12345678", "", "" }, /* None */
|
||||
/* 7*/ { BARCODE_CEPNET, -1, BARCODE_RAW_TEXT, "12345678", "", "123456784" },
|
||||
/* 8*/ { BARCODE_RM4SCC, -1, -1, "BX11LT1A", "", "" }, /* None*/
|
||||
/* 9*/ { BARCODE_RM4SCC, -1, BARCODE_RAW_TEXT, "BX11LT1A", "", "BX11LT1AI" },
|
||||
/* 10*/ { BARCODE_JAPANPOST, -1, -1, "1234", "", "" }, /* None*/
|
||||
/* 11*/ { BARCODE_JAPANPOST, -1, BARCODE_RAW_TEXT, "1234", "", "1234" }, /* Note check char not included */
|
||||
/* 12*/ { BARCODE_JAPANPOST, -1, BARCODE_RAW_TEXT, "123456-AB", "", "123456-AB" }, /* Ditto */
|
||||
/* 13*/ { BARCODE_KOREAPOST, -1, -1, "123456", "1234569", "" },
|
||||
/* 14*/ { BARCODE_KOREAPOST, -1, BARCODE_RAW_TEXT, "123456", "1234569", "1234569" }, /* No difference */
|
||||
/* 15*/ { BARCODE_PLANET, -1, -1, "12345678901", "", "" }, /* None */
|
||||
/* 16*/ { BARCODE_PLANET, -1, BARCODE_RAW_TEXT, "12345678901", "", "123456789014" },
|
||||
/* 17*/ { BARCODE_KIX, -1, -1, "0123456789ABCDEFGH", "", "" }, /* None */
|
||||
/* 18*/ { BARCODE_KIX, -1, BARCODE_RAW_TEXT, "0123456789ABCDEFGH", "", "0123456789ABCDEFGH" },
|
||||
/* 19*/ { BARCODE_DAFT, -1, -1, "DAFT", "", "" }, /* None */
|
||||
/* 20*/ { BARCODE_DAFT, -1, BARCODE_RAW_TEXT, "DAFT", "", "DAFT" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -267,6 +268,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, data[i].option_2, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -275,6 +277,18 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -357,7 +371,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -555,7 +569,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ static void test_print(const testCtx *const p_ctx) {
|
|||
have_tiffinfo = testUtilHaveTiffInfo();
|
||||
}
|
||||
|
||||
testStartSymbol("test_print", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
assert_nonzero(testUtilDataPath(data_dir, sizeof(data_dir), "/backend/tests/data", NULL), "testUtilDataPath == 0\n");
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ static void test_print(const testCtx *const p_ctx) {
|
|||
|
||||
int have_ghostscript = testUtilHaveGhostscript();
|
||||
|
||||
testStartSymbol("test_print", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
char data_dir_path[1024];
|
||||
|
@ -237,7 +237,7 @@ static void test_ps_convert(const testCtx *const p_ctx) {
|
|||
|
||||
unsigned char converted[256] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_ps_convert");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -260,7 +260,7 @@ static void test_outfile(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_outfile");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol.symbology = BARCODE_CODE128;
|
||||
symbol.vector = &vector;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -72,7 +72,7 @@ static void test_options(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_options", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -393,7 +393,7 @@ static void test_buffer(const testCtx *const p_ctx) {
|
|||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol("test_buffer", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -465,7 +465,7 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
|
|||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_EANX, -1, -1, "123456789012", 0, 50, 1, 95, 226, 116, 102 /*text_row*/, 0, 22, -1, -1, -1 }, /* EAN-13 */
|
||||
/* 1*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456789012", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 95, 226, 116, 102 /*text_row*/, 0, 22, -1, -1, -1 }, /* EAN-13 */
|
||||
/* 1*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456789012", 0, 50, 1, 95, 226, 116, 102 /*text_row*/, 0, 22, -1, -1, -1 }, /* EAN-13 */
|
||||
/* 2*/ { BARCODE_EANX, 0, -1, "123456789012", 0, 50, 1, 95, 226, 110, 102 /*text_row*/, 0, 22, -1, -1, -1 }, /* EAN-13 */
|
||||
/* 3*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456789012", 0, 50, 1, 95, 226, 116, 108 /*text_row*/, 212, 14, -1, -1, -1 }, /* EAN-13 */
|
||||
/* 4*/ { BARCODE_EANX, 0, EANUPC_GUARD_WHITESPACE, "123456789012", 0, 50, 1, 95, 226, 110, 108 /*text_row*/, 212, 14, -1, -1, -1 }, /* EAN-13 */
|
||||
|
@ -473,76 +473,76 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
|
|||
/* 6*/ { BARCODE_EANX_CHK, -1, -1, "1234567890128", 0, 50, 1, 95, 226, 116, 102 /*text_row*/, 0, 22, -1, -1, -1 }, /* EAN-13 */
|
||||
/* 7*/ { BARCODE_EANX_CHK, 0, -1, "1234567890128", 0, 50, 1, 95, 226, 110, 102 /*text_row*/, 0, 22, -1, -1, -1 }, /* EAN-13 */
|
||||
/* 8*/ { BARCODE_EANX_CHK, -1, -1, "1234567890128+12", 0, 50, 1, 122, 276, 116, 102 /*text_row*/, 0, 22, 5, 212, 64 }, /* EAN-13 + EAN-2 */
|
||||
/* 9*/ { BARCODE_EANX_CHK, -1, BARCODE_RAW_TEXT, "1234567890128+12", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 122, 276, 116, 102 /*text_row*/, 0, 22, 5, 212, 64 }, /* EAN-13 + EAN-2 */
|
||||
/* 9*/ { BARCODE_EANX_CHK, -1, BARCODE_RAW_TEXT, "1234567890128+12", 0, 50, 1, 122, 276, 116, 102 /*text_row*/, 0, 22, 5, 212, 64 }, /* EAN-13 + EAN-2 */
|
||||
/* 10*/ { BARCODE_EANX_CHK, 0, -1, "1234567890128+12", 0, 50, 1, 122, 276, 110, 102 /*text_row*/, 0, 22, 5, 212, 64 }, /* EAN-13 + EAN-2 */
|
||||
/* 11*/ { BARCODE_EANX_CHK, -1, EANUPC_GUARD_WHITESPACE, "1234567890128+12", 0, 50, 1, 122, 276, 116, 102 /*text_row*/, 0, 22, 6, 264, 12 }, /* EAN-13 + EAN-2 */
|
||||
/* 12*/ { BARCODE_EANX_CHK, 0, EANUPC_GUARD_WHITESPACE, "1234567890128+12", 0, 50, 1, 122, 276, 110, 102 /*text_row*/, 0, 22, 6, 264, 12 }, /* EAN-13 + EAN-2 */
|
||||
/* 13*/ { BARCODE_EANX_CHK, 1 /*empty*/, -1, "1234567890128+12", 0, 50, 1, 122, 276, 116, 6 /*text_row*/, 264, 12, -1, -1, -1 }, /* EAN-13 + EAN-2 */
|
||||
/* 14*/ { BARCODE_EANX, -1, -1, "1234567890128+12345", 0, 50, 1, 149, 330, 116, 102 /*text_row*/, 0, 22, 5, 212, 118 }, /* EAN-13 + EAN-5 */
|
||||
/* 15*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567890128+12345", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 149, 330, 116, 102 /*text_row*/, 0, 22, 5, 212, 118 }, /* EAN-13 + EAN-5 */
|
||||
/* 15*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567890128+12345", 0, 50, 1, 149, 330, 116, 102 /*text_row*/, 0, 22, 5, 212, 118 }, /* EAN-13 + EAN-5 */
|
||||
/* 16*/ { BARCODE_EANX, 0, -1, "1234567890128+12345", 0, 50, 1, 149, 330, 110, 102 /*text_row*/, 0, 22, 5, 212, 118 }, /* EAN-13 + EAN-5 */
|
||||
/* 17*/ { BARCODE_ISBNX, -1, -1, "9784567890120+12345", 0, 50, 1, 149, 330, 116, 102 /*text_row*/, 0, 22, 5, 212, 118 }, /* ISBNX + EAN-5 */
|
||||
/* 18*/ { BARCODE_ISBNX, -1, BARCODE_RAW_TEXT, "9784567890120+12345", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 149, 330, 116, 102 /*text_row*/, 0, 22, 5, 212, 118 }, /* ISBNX + EAN-5 */
|
||||
/* 18*/ { BARCODE_ISBNX, -1, BARCODE_RAW_TEXT, "9784567890120+12345", 0, 50, 1, 149, 330, 116, 102 /*text_row*/, 0, 22, 5, 212, 118 }, /* ISBNX + EAN-5 */
|
||||
/* 19*/ { BARCODE_ISBNX, 0, -1, "9784567890120+12345", 0, 50, 1, 149, 330, 110, 102 /*text_row*/, 0, 22, 5, 212, 118 }, /* ISBNX + EAN-5 */
|
||||
/* 20*/ { BARCODE_ISBNX, -1, EANUPC_GUARD_WHITESPACE, "9784567890120+12345", 0, 50, 1, 149, 330, 116, 102 /*text_row*/, 0, 22, 6, 304, 26 }, /* ISBNX + EAN-5 */
|
||||
/* 21*/ { BARCODE_ISBNX, 0, EANUPC_GUARD_WHITESPACE, "9784567890120+12345", 0, 50, 1, 149, 330, 110, 102 /*text_row*/, 0, 22, 6, 304, 26 }, /* ISBNX + EAN-5 */
|
||||
/* 22*/ { BARCODE_ISBNX, 1 /*empty*/, -1, "9784567890120+12345", 0, 50, 1, 149, 330, 116, 6 /*text_row*/, 304, 26, -1, -1, -1 }, /* ISBNX + EAN-5 */
|
||||
/* 23*/ { BARCODE_EANX, -1, -1, "123456", 0, 50, 1, 67, 162, 116, 106 /*text_row*/, 20, 58, -1, -1, -1 }, /* EAN-8 */
|
||||
/* 24*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 67, 162, 116, 106 /*text_row*/, 20, 58, -1, -1, -1 }, /* EAN-8 */
|
||||
/* 24*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456", 0, 50, 1, 67, 162, 116, 106 /*text_row*/, 20, 58, -1, -1, -1 }, /* EAN-8 */
|
||||
/* 25*/ { BARCODE_EANX, 0, -1, "123456", 0, 50, 1, 67, 162, 110, 106 /*text_row*/, 20, 58, -1, -1, -1 }, /* EAN-8 */
|
||||
/* 26*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456", 0, 50, 1, 67, 162, 116, 106 /*text_row*/, 0, 14, 106, 148, 14 }, /* EAN-8 */
|
||||
/* 27*/ { BARCODE_EANX, 0, EANUPC_GUARD_WHITESPACE, "123456", 0, 50, 1, 67, 162, 110, 106 /*text_row*/, 0, 14, 106, 148, 14 }, /* EAN-8 */
|
||||
/* 28*/ { BARCODE_EANX, 1 /*empty*/, -1, "123456", 0, 50, 1, 67, 162, 116, 106 /*text_row*/, 0, 14, 106, 148, 14 }, /* EAN-8 */
|
||||
/* 29*/ { BARCODE_EANX, -1, -1, "123456+12", 0, 50, 1, 94, 212, 116, 106 /*text_row*/, 20, 58, 5, 148, 68 }, /* EAN-8 + EAN-2 */
|
||||
/* 30*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456+12", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 94, 212, 116, 106 /*text_row*/, 20, 58, 5, 148, 68 }, /* EAN-8 + EAN-2 */
|
||||
/* 30*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456+12", 0, 50, 1, 94, 212, 116, 106 /*text_row*/, 20, 58, 5, 148, 68 }, /* EAN-8 + EAN-2 */
|
||||
/* 31*/ { BARCODE_EANX, 0, -1, "123456+12", 0, 50, 1, 94, 212, 110, 106 /*text_row*/, 20, 58, 5, 148, 68 }, /* EAN-8 + EAN-2 */
|
||||
/* 32*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456+12", 0, 50, 1, 94, 212, 116, 106 /*text_row*/, 0, 14, 6, 202, 8 }, /* EAN-8 + EAN-2 */
|
||||
/* 33*/ { BARCODE_EANX, 0, EANUPC_GUARD_WHITESPACE, "123456+12", 0, 50, 1, 94, 212, 110, 106 /*text_row*/, 0, 14, 6, 202, 8 }, /* EAN-8 + EAN-2 */
|
||||
/* 34*/ { BARCODE_EANX, 1 /*empty*/, -1, "123456+12", 0, 50, 1, 94, 212, 116, 106 /*text_row*/, 0, 14, 6, 202, 8 }, /* EAN-8 + EAN-2 */
|
||||
/* 35*/ { BARCODE_EANX, -1, -1, "123456+12345", 0, 50, 1, 121, 266, 116, 106 /*text_row*/, 20, 58, 5, 148, 122 }, /* EAN-8 + EAN-5 */
|
||||
/* 36*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456+12345", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 121, 266, 116, 106 /*text_row*/, 20, 58, 5, 148, 122 }, /* EAN-8 + EAN-5 */
|
||||
/* 36*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456+12345", 0, 50, 1, 121, 266, 116, 106 /*text_row*/, 20, 58, 5, 148, 122 }, /* EAN-8 + EAN-5 */
|
||||
/* 37*/ { BARCODE_EANX, 0, -1, "123456+12345", 0, 50, 1, 121, 266, 110, 106 /*text_row*/, 20, 58, 5, 148, 122 }, /* EAN-8 + EAN-5 */
|
||||
/* 38*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456+12345", 0, 50, 1, 121, 266, 116, 106 /*text_row*/, 0, 14, 6, 256, 10 }, /* EAN-8 + EAN-5 */
|
||||
/* 39*/ { BARCODE_EANX, 0, EANUPC_GUARD_WHITESPACE, "123456+12345", 0, 50, 1, 121, 266, 110, 106 /*text_row*/, 0, 14, 6, 256, 10 }, /* EAN-8 + EAN-5 */
|
||||
/* 40*/ { BARCODE_EANX, 1 /*empty*/, -1, "123456+12345", 0, 50, 1, 121, 266, 116, 106 /*text_row*/, 0, 14, 6, 256, 10 }, /* EAN-8 + EAN-5 */
|
||||
/* 41*/ { BARCODE_EANX, -1, -1, "1234", 0, 50, 1, 47, 104, 116, 0 /*text_row*/, 18, 5, -1, -1, -1 }, /* EAN-5 */
|
||||
/* 42*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 47, 104, 116, 0 /*text_row*/, 18, 5, -1, -1, -1 }, /* EAN-5 */
|
||||
/* 42*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234", 0, 50, 1, 47, 104, 116, 0 /*text_row*/, 18, 5, -1, -1, -1 }, /* EAN-5 */
|
||||
/* 43*/ { BARCODE_EANX, 0, -1, "1234", 0, 50, 1, 47, 104, 100, -1 /*text_row*/, -1, -1, -1, -1, -1 }, /* EAN-5 */
|
||||
/* 44*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "1234", 0, 50, 1, 47, 104, 116, 6 /*text_row*/, 94, 10, -1, -1, -1 }, /* EAN-5 */
|
||||
/* 45*/ { BARCODE_EANX, 0, EANUPC_GUARD_WHITESPACE, "1234", 0, 50, 1, 47, 104, 100, -1 /*text_row*/, -1, -1, -1, -1, -1 }, /* EAN-5 */
|
||||
/* 46*/ { BARCODE_EANX, 1 /*empty*/, -1, "1234", 0, 50, 1, 47, 104, 116, 6 /*text_row*/, 94, 10, -1, -1, -1 }, /* EAN-5 */
|
||||
/* 47*/ { BARCODE_EANX, -1, -1, "12", 0, 50, 1, 20, 50, 116, 0 /*text_row*/, 14, 2, -1, -1, -1 }, /* EAN-2 */
|
||||
/* 48*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "12", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 20, 50, 116, 0 /*text_row*/, 14, 2, -1, -1, -1 }, /* EAN-2 */
|
||||
/* 48*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "12", 0, 50, 1, 20, 50, 116, 0 /*text_row*/, 14, 2, -1, -1, -1 }, /* EAN-2 */
|
||||
/* 49*/ { BARCODE_EANX, 0, -1, "12", 0, 50, 1, 20, 50, 100, -1 /*text_row*/, -1, -1, -1, -1, -1 }, /* EAN-2 */
|
||||
/* 50*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "12", 0, 50, 1, 20, 50, 116, 6 /*text_row*/, 40, 10, -1, -1, -1 }, /* EAN-2 */
|
||||
/* 51*/ { BARCODE_EANX, 0, EANUPC_GUARD_WHITESPACE, "12", 0, 50, 1, 20, 50, 100, -1 /*text_row*/, -1, -1, -1, -1, -1 }, /* EAN-2 */
|
||||
/* 52*/ { BARCODE_EANX, 1 /*empty*/, -1, "12", 0, 50, 1, 20, 50, 116, 6 /*text_row*/, 40, 10, -1, -1, -1 }, /* EAN-2 */
|
||||
/* 53*/ { BARCODE_UPCA, -1, -1, "123456789012", 0, 50, 1, 95, 226, 116, 104 /*text_row*/, 0, 18, -1, -1, -1 },
|
||||
/* 54*/ { BARCODE_UPCA, -1, BARCODE_RAW_TEXT, "123456789012", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 95, 226, 116, 104 /*text_row*/, 0, 18, -1, -1, -1 },
|
||||
/* 54*/ { BARCODE_UPCA, -1, BARCODE_RAW_TEXT, "123456789012", 0, 50, 1, 95, 226, 116, 104 /*text_row*/, 0, 18, -1, -1, -1 },
|
||||
/* 55*/ { BARCODE_UPCA, 0, -1, "123456789012", 0, 50, 1, 95, 226, 110, 104 /*text_row*/, 0, 18, -1, -1, -1 },
|
||||
/* 56*/ { BARCODE_UPCA, -1, -1, "123456789012+12", 0, 50, 1, 124, 276, 116, 104 /*text_row*/, 0, 18, 5, 208, 68 },
|
||||
/* 57*/ { BARCODE_UPCA, -1, BARCODE_RAW_TEXT, "123456789012+12", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 124, 276, 116, 104 /*text_row*/, 0, 18, 5, 208, 68 },
|
||||
/* 57*/ { BARCODE_UPCA, -1, BARCODE_RAW_TEXT, "123456789012+12", 0, 50, 1, 124, 276, 116, 104 /*text_row*/, 0, 18, 5, 208, 68 },
|
||||
/* 58*/ { BARCODE_UPCA, 0, -1, "123456789012+12", 0, 50, 1, 124, 276, 110, 104 /*text_row*/, 0, 18, 5, 208, 68 },
|
||||
/* 59*/ { BARCODE_UPCA, -1, EANUPC_GUARD_WHITESPACE, "123456789012+12", 0, 50, 1, 124, 276, 116, 104 /*text_row*/, 0, 18, 5, 266, 10 },
|
||||
/* 60*/ { BARCODE_UPCA, 0, EANUPC_GUARD_WHITESPACE, "123456789012+12", 0, 50, 1, 124, 276, 110, 104 /*text_row*/, 0, 18, 5, 266, 10 },
|
||||
/* 61*/ { BARCODE_UPCA, 1 /*empty*/, -1, "123456789012+12", 0, 50, 1, 124, 276, 116, 5 /*text_row*/, 266, 10, -1, -1, -1 },
|
||||
/* 62*/ { BARCODE_UPCA_CHK, -1, -1, "123456789012+12345", 0, 50, 1, 151, 330, 116, 104 /*text_row*/, 0, 18, 5, 208, 122 },
|
||||
/* 63*/ { BARCODE_UPCA_CHK, -1, BARCODE_RAW_TEXT, "123456789012+12345", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 151, 330, 116, 104 /*text_row*/, 0, 18, 5, 208, 122 },
|
||||
/* 63*/ { BARCODE_UPCA_CHK, -1, BARCODE_RAW_TEXT, "123456789012+12345", 0, 50, 1, 151, 330, 116, 104 /*text_row*/, 0, 18, 5, 208, 122 },
|
||||
/* 64*/ { BARCODE_UPCA_CHK, 0, -1, "123456789012+12345", 0, 50, 1, 151, 330, 110, 104 /*text_row*/, 0, 18, 5, 208, 122 },
|
||||
/* 65*/ { BARCODE_UPCA_CHK, -1, EANUPC_GUARD_WHITESPACE, "123456789012+12345", 0, 50, 1, 151, 330, 116, 104 /*text_row*/, 0, 18, 6, 320, 10 },
|
||||
/* 66*/ { BARCODE_UPCA_CHK, 0, EANUPC_GUARD_WHITESPACE, "123456789012+12345", 0, 50, 1, 151, 330, 110, 104 /*text_row*/, 0, 18, 6, 320, 10 },
|
||||
/* 67*/ { BARCODE_UPCA_CHK, 1 /*empty*/, -1, "123456789012+12345", 0, 50, 1, 151, 330, 116, 6 /*text_row*/, 320, 10, -1, -1, -1 },
|
||||
/* 68*/ { BARCODE_UPCE, -1, -1, "1234567", 0, 50, 1, 51, 134, 116, 104 /*text_row*/, 0, 18, -1, -1, -1 },
|
||||
/* 69*/ { BARCODE_UPCE, -1, BARCODE_RAW_TEXT, "1234567", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 51, 134, 116, 104 /*text_row*/, 0, 18, -1, -1, -1 },
|
||||
/* 69*/ { BARCODE_UPCE, -1, BARCODE_RAW_TEXT, "1234567", 0, 50, 1, 51, 134, 116, 104 /*text_row*/, 0, 18, -1, -1, -1 },
|
||||
/* 70*/ { BARCODE_UPCE, 0, -1, "1234567", 0, 50, 1, 51, 134, 110, 104 /*text_row*/, 0, 18, -1, -1, -1 },
|
||||
/* 71*/ { BARCODE_UPCE_CHK, -1, -1, "12345670+12", 0, 50, 1, 78, 184, 116, 104 /*text_row*/, 0, 18, 5, 120, 64 },
|
||||
/* 72*/ { BARCODE_UPCE_CHK, -1, BARCODE_RAW_TEXT, "12345670+12", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 78, 184, 116, 104 /*text_row*/, 0, 18, 5, 120, 64 },
|
||||
/* 72*/ { BARCODE_UPCE_CHK, -1, BARCODE_RAW_TEXT, "12345670+12", 0, 50, 1, 78, 184, 116, 104 /*text_row*/, 0, 18, 5, 120, 64 },
|
||||
/* 73*/ { BARCODE_UPCE_CHK, 0, -1, "12345670+12", 0, 50, 1, 78, 184, 110, 104 /*text_row*/, 0, 18, 5, 120, 64 },
|
||||
/* 74*/ { BARCODE_UPCE_CHK, -1, EANUPC_GUARD_WHITESPACE, "12345670+12", 0, 50, 1, 78, 184, 116, 104 /*text_row*/, 0, 18, 6, 174, 10 },
|
||||
/* 75*/ { BARCODE_UPCE_CHK, 0, EANUPC_GUARD_WHITESPACE, "12345670+12", 0, 50, 1, 78, 184, 110, 104 /*text_row*/, 0, 18, 6, 174, 10 },
|
||||
/* 76*/ { BARCODE_UPCE_CHK, 1 /*empty*/, -1, "12345670+12", 0, 50, 1, 78, 184, 116, 6 /*text_row*/, 174, 10, -1, -1, -1 },
|
||||
/* 77*/ { BARCODE_UPCE, -1, -1, "1234567+12345", 0, 50, 1, 105, 238, 116, 104 /*text_row*/, 0, 18, 5, 120, 118 },
|
||||
/* 78*/ { BARCODE_UPCE, -1, BARCODE_RAW_TEXT, "1234567+12345", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 105, 238, 116, 104 /*text_row*/, 0, 18, 5, 120, 118 },
|
||||
/* 78*/ { BARCODE_UPCE, -1, BARCODE_RAW_TEXT, "1234567+12345", 0, 50, 1, 105, 238, 116, 104 /*text_row*/, 0, 18, 5, 120, 118 },
|
||||
/* 79*/ { BARCODE_UPCE, 0, -1, "1234567+12345", 0, 50, 1, 105, 238, 110, 104 /*text_row*/, 0, 18, 5, 120, 118 },
|
||||
/* 80*/ { BARCODE_UPCE, -1, EANUPC_GUARD_WHITESPACE, "1234567+12345", 0, 50, 1, 105, 238, 116, 104 /*text_row*/, 0, 18, 6, 228, 10 },
|
||||
/* 81*/ { BARCODE_UPCE, 0, EANUPC_GUARD_WHITESPACE, "1234567+12345", 0, 50, 1, 105, 238, 110, 104 /*text_row*/, 0, 18, 6, 228, 10 },
|
||||
|
@ -552,7 +552,7 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_upcean_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -669,7 +669,7 @@ static void test_row_separator(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_row_separator", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int j, separator_bits_set;
|
||||
|
@ -750,7 +750,7 @@ static void test_stacking(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_stacking", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int length2;
|
||||
|
@ -814,7 +814,7 @@ static void test_stacking_too_many(const testCtx *const p_ctx) {
|
|||
char data[] = "A";
|
||||
char expected_errtxt[] = "Error 770: Too many stacked symbols";
|
||||
|
||||
testStartSymbol("test_stacking_too_many", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
@ -962,7 +962,7 @@ static void test_output_options(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_output_options", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1049,7 +1049,7 @@ static void test_draw_string_wrap(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_draw_string_wrap", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int text_bits_set, row, column;
|
||||
|
@ -1122,7 +1122,7 @@ static void test_code128_utf8(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_code128_utf8", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int text_bits_set, row, column;
|
||||
|
@ -1288,7 +1288,7 @@ static void test_scale(const testCtx *const p_ctx) {
|
|||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol("test_scale", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int row, column;
|
||||
|
@ -1423,7 +1423,7 @@ static void test_guard_descent(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_guard_descent", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int row, column;
|
||||
|
@ -1821,7 +1821,7 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
|
|||
const char *text;
|
||||
static const char composite[] = "[20]12";
|
||||
|
||||
testStartSymbol("test_quiet_zones", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int row, column;
|
||||
|
@ -1991,7 +1991,7 @@ static void test_text_gap(const testCtx *const p_ctx) {
|
|||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol("test_text_gap", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int row, column;
|
||||
|
@ -2185,7 +2185,7 @@ static void test_buffer_plot(const testCtx *const p_ctx) {
|
|||
int row, column;
|
||||
int fg_len, bg_len;
|
||||
|
||||
testStartSymbol("test_buffer_plot", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2899,7 +2899,7 @@ static void test_height(const testCtx *const p_ctx) {
|
|||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol("test_height", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3066,7 +3066,7 @@ static void test_height_per_row(const testCtx *const p_ctx) {
|
|||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol("test_height_per_row", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3138,34 +3138,36 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
|
|||
int expected_bitmap_width;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
const char *expected_raw;
|
||||
int expected_raw_length;
|
||||
const char *expected_errtxt;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_CODE128, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116, 268, "12345 67890", -1, "" },
|
||||
/* 1*/ { BARCODE_CODE128, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, ZINT_WARN_HRT_RAW_TEXT, 116, 268, "12345\00067890", 11, "Warning 665: HRT outputted as raw text" },
|
||||
/* 2*/ { BARCODE_EXCODE39, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116, 362, "12345 67890", -1, "" },
|
||||
/* 3*/ { BARCODE_EXCODE39, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, ZINT_WARN_HRT_RAW_TEXT, 116, 362, "12345\00067890", 11, "Warning 665: HRT outputted as raw text" },
|
||||
/* 4*/ { BARCODE_TELEPEN, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116, 448, "12345 67890", -1, "" },
|
||||
/* 5*/ { BARCODE_TELEPEN, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, ZINT_WARN_HRT_RAW_TEXT, 116, 448, "12345\00067890n", 12, "Warning 665: HRT outputted as raw text" },
|
||||
/* 6*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012", -1, 0, 116, 226, "1234567890128", -1, "" },
|
||||
/* 7*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012", -1, ZINT_WARN_HRT_RAW_TEXT, 116, 226, "1234567890128", -1, "Warning 665: HRT outputted as raw text" }, /* Warn but no difference */
|
||||
/* 8*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012+12", -1, 0, 116, 276, "1234567890128+12", -1, "" },
|
||||
/* 9*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012+12", -1, ZINT_WARN_HRT_RAW_TEXT, 116, 276, "1234567890128+12", -1, "Warning 665: HRT outputted as raw text" },
|
||||
/* 10*/ { BARCODE_CODE39, -1, -1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116, 180, "*ABC14*", -1, "" },
|
||||
/* 11*/ { BARCODE_CODE39, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "ABC14", -1, ZINT_WARN_HRT_RAW_TEXT, 116, 180, "ABC14", -1, "Warning 665: HRT outputted as raw text" },
|
||||
/* 12*/ { BARCODE_CODE39, -1, 1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116, 206, "*ABC14_*", -1, "" }, /* Check digit space rendered as underscore */
|
||||
/* 13*/ { BARCODE_CODE39, -1, 1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "ABC14", -1, ZINT_WARN_HRT_RAW_TEXT, 116, 206, "ABC14 ", -1, "Warning 665: HRT outputted as raw text" },
|
||||
/* 14*/ { BARCODE_POSTNET, -1, -1, BARCODE_MEMORY_FILE, "12345", -1, 0, 24, 126, "", -1, "" },
|
||||
/* 15*/ { BARCODE_POSTNET, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345", -1, ZINT_WARN_HRT_RAW_TEXT, 40, 126, "123455", -1, "Warning 665: HRT outputted as raw text" }, /* HRT printed */
|
||||
/* 16*/ { BARCODE_POSTNET, 0, -1, BARCODE_MEMORY_FILE, "12345", -1, 0, 24, 126, "", -1, "" },
|
||||
/* 17*/ { BARCODE_POSTNET, 0, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345", -1, 0, 24, 126, "123455", -1, "" }, /* HRT not printed, no warning */
|
||||
/* 0*/ { BARCODE_CODE128, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116, 268, "12345 67890", -1, "", -1, "" },
|
||||
/* 1*/ { BARCODE_CODE128, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, 0, 116, 268, "12345 67890", -1, "12345\00067890", 11, "" },
|
||||
/* 2*/ { BARCODE_EXCODE39, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116, 362, "12345 67890", -1, "", -1, "" },
|
||||
/* 3*/ { BARCODE_EXCODE39, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, 0, 116, 362, "12345 67890", -1, "12345\00067890", 11, "" },
|
||||
/* 4*/ { BARCODE_TELEPEN, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116, 448, "12345 67890", -1, "", -1, "" },
|
||||
/* 5*/ { BARCODE_TELEPEN, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, 0, 116, 448, "12345 67890", -1, "12345\00067890n", 12, "" },
|
||||
/* 6*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012", -1, 0, 116, 226, "1234567890128", -1, "", -1, "" },
|
||||
/* 7*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012", -1, 0, 116, 226, "1234567890128", -1, "1234567890128", -1, "" },
|
||||
/* 8*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012+12", -1, 0, 116, 276, "1234567890128+12", -1, "", -1, "" },
|
||||
/* 9*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012+12", -1, 0, 116, 276, "1234567890128+12", -1, "1234567890128+12", -1, "" },
|
||||
/* 10*/ { BARCODE_CODE39, -1, -1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116, 180, "*ABC14*", -1, "", -1, "" },
|
||||
/* 11*/ { BARCODE_CODE39, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "ABC14", -1, 0, 116, 180, "*ABC14*", -1, "ABC14", -1, "" },
|
||||
/* 12*/ { BARCODE_CODE39, -1, 1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116, 206, "*ABC14_*", -1, "", -1, "" }, /* Check digit space rendered as underscore */
|
||||
/* 13*/ { BARCODE_CODE39, -1, 1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "ABC14", -1, 0, 116, 206, "*ABC14_*", -1, "ABC14 ", -1, "" },
|
||||
/* 14*/ { BARCODE_POSTNET, -1, -1, BARCODE_MEMORY_FILE, "12345", -1, 0, 24, 126, "", -1, "", -1, "" },
|
||||
/* 15*/ { BARCODE_POSTNET, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345", -1, 0, 24, 126, "", -1, "123455", -1, "" }, /* HRT not printed */
|
||||
/* 16*/ { BARCODE_POSTNET, 0, -1, BARCODE_MEMORY_FILE, "12345", -1, 0, 24, 126, "", -1, "", -1, "" },
|
||||
/* 17*/ { BARCODE_POSTNET, 0, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345", -1, 0, 24, 126, "", -1, "123455", -1, "" }, /* HRT not printed */
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt_raw_text", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3182,6 +3184,7 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, data[i].option_2, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
expected_raw_length = data[i].expected_raw_length == -1 ? (int) strlen(data[i].expected_raw) : data[i].expected_raw_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n",
|
||||
|
@ -3191,6 +3194,19 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length, symbol->text);
|
||||
assert_zero(memcmp(symbol->text, data[i].expected, expected_length), "i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->text, data[i].expected, expected_length);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%.*s, %.*s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, expected_raw_length,
|
||||
data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ret = ZBarcode_Print(symbol, 0);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Print(%s) ret %d != %d (%s)\n",
|
||||
|
|
|
@ -147,7 +147,7 @@ static void test_encoding(const testCtx *const p_ctx) {
|
|||
int data_size = ARRAY_SIZE(data);
|
||||
int i;
|
||||
|
||||
testStart("test_encoding");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int j;
|
||||
|
@ -210,7 +210,7 @@ static void test_encoding_uint(const testCtx *const p_ctx) {
|
|||
int data_size = ARRAY_SIZE(data);
|
||||
int i;
|
||||
|
||||
testStart("test_encoding_uint");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int j;
|
||||
|
@ -259,7 +259,7 @@ static void test_uint_encoding(const testCtx *const p_ctx) {
|
|||
int data_size = ARRAY_SIZE(data);
|
||||
int i;
|
||||
|
||||
testStart("test_uint_encoding");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int j;
|
||||
|
|
|
@ -127,10 +127,11 @@ static void test_binary_div_modulo_divisor(const testCtx *const p_ctx) {
|
|||
char cmp_buf[1024];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_binary_div_modulo_divisor", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -178,12 +179,14 @@ static void test_binary_div_modulo_divisor(const testCtx *const p_ctx) {
|
|||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/,
|
||||
escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -869,10 +872,11 @@ static void test_examples(const testCtx *const p_ctx) {
|
|||
char cmp_buf[16384];
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_examples", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -918,12 +922,14 @@ static void test_examples(const testCtx *const p_ctx) {
|
|||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/,
|
||||
escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1199,7 +1205,7 @@ static void test_general_field(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_general_field", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1265,7 +1271,7 @@ static void test_binary_buffer_size(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_binary_buffer_size", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1306,34 +1312,35 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
|
||||
int ret;
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_DBAR_OMN, -1, "1234567890123", 0, "(01)12345678901231" },
|
||||
/* 1*/ { BARCODE_DBAR_OMN, BARCODE_RAW_TEXT, "1234567890123", 0, "0112345678901231" },
|
||||
/* 2*/ { BARCODE_DBAR_OMN, -1, "12345678901231", 0, "(01)12345678901231" },
|
||||
/* 3*/ { BARCODE_DBAR_OMN, BARCODE_RAW_TEXT, "12345678901231", 0, "0112345678901231" },
|
||||
/* 4*/ { BARCODE_DBAR_OMN, -1, "1000000000009", 0, "(01)10000000000090" },
|
||||
/* 5*/ { BARCODE_DBAR_OMN, BARCODE_RAW_TEXT, "1000000000009", 0, "0110000000000090" },
|
||||
/* 6*/ { BARCODE_DBAR_LTD, -1, "1341056790138", 0, "(01)13410567901384" },
|
||||
/* 7*/ { BARCODE_DBAR_LTD, BARCODE_RAW_TEXT, "1341056790138", 0, "0113410567901384" },
|
||||
/* 8*/ { BARCODE_DBAR_LTD, -1, "13410567901384", 0, "(01)13410567901384" },
|
||||
/* 9*/ { BARCODE_DBAR_LTD, BARCODE_RAW_TEXT, "13410567901384", 0, "0113410567901384" },
|
||||
/* 10*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", 0, "(01)12345678901231" }, /* See test_hrt() in "test_gs1.c" for full HRT tests */
|
||||
/* 11*/ { BARCODE_DBAR_EXP, BARCODE_RAW_TEXT, "[01]12345678901231", 0, "0112345678901231" },
|
||||
/* 12*/ { BARCODE_DBAR_STK, -1, "12345678901231", 0, "" }, /* No HRT for stacked */
|
||||
/* 13*/ { BARCODE_DBAR_STK, BARCODE_RAW_TEXT, "12345678901231", 0, "0112345678901231" }, /* Unless RAW_TEXT */
|
||||
/* 14*/ { BARCODE_DBAR_OMNSTK, -1, "10000000000090", 0, "" },
|
||||
/* 15*/ { BARCODE_DBAR_OMNSTK, BARCODE_RAW_TEXT, "10000000000090", 0, "0110000000000090" },
|
||||
/* 16*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", 0, "" },
|
||||
/* 17*/ { BARCODE_DBAR_EXPSTK, BARCODE_RAW_TEXT, "[01]12345678901231", 0, "0112345678901231" },
|
||||
/* 0*/ { BARCODE_DBAR_OMN, -1, "1234567890123", 0, "(01)12345678901231", "" },
|
||||
/* 1*/ { BARCODE_DBAR_OMN, BARCODE_RAW_TEXT, "1234567890123", 0, "(01)12345678901231", "12345678901231" }, /* Implicit "01" not included in raw text */
|
||||
/* 2*/ { BARCODE_DBAR_OMN, -1, "12345678901231", 0, "(01)12345678901231", "" },
|
||||
/* 3*/ { BARCODE_DBAR_OMN, BARCODE_RAW_TEXT, "12345678901231", 0, "(01)12345678901231", "12345678901231" },
|
||||
/* 4*/ { BARCODE_DBAR_OMN, -1, "1000000000009", 0, "(01)10000000000090", "" },
|
||||
/* 5*/ { BARCODE_DBAR_OMN, BARCODE_RAW_TEXT, "1000000000009", 0, "(01)10000000000090", "10000000000090" },
|
||||
/* 6*/ { BARCODE_DBAR_LTD, -1, "1341056790138", 0, "(01)13410567901384", "" },
|
||||
/* 7*/ { BARCODE_DBAR_LTD, BARCODE_RAW_TEXT, "1341056790138", 0, "(01)13410567901384", "13410567901384" }, /* Implicit "01" not included in raw text */
|
||||
/* 8*/ { BARCODE_DBAR_LTD, -1, "13410567901384", 0, "(01)13410567901384", "" },
|
||||
/* 9*/ { BARCODE_DBAR_LTD, BARCODE_RAW_TEXT, "13410567901384", 0, "(01)13410567901384", "13410567901384" },
|
||||
/* 10*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", 0, "(01)12345678901231", "" }, /* See test_hrt() in "test_gs1.c" for full HRT tests */
|
||||
/* 11*/ { BARCODE_DBAR_EXP, BARCODE_RAW_TEXT, "[01]12345678901231", 0, "(01)12345678901231", "0112345678901231" },
|
||||
/* 12*/ { BARCODE_DBAR_STK, -1, "12345678901231", 0, "", "" }, /* No HRT for stacked */
|
||||
/* 13*/ { BARCODE_DBAR_STK, BARCODE_RAW_TEXT, "12345678901231", 0, "", "12345678901231" }, /* But have RAW_TEXT */
|
||||
/* 14*/ { BARCODE_DBAR_OMNSTK, -1, "10000000000090", 0, "", "" },
|
||||
/* 15*/ { BARCODE_DBAR_OMNSTK, BARCODE_RAW_TEXT, "10000000000090", 0, "", "10000000000090" },
|
||||
/* 16*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", 0, "", "" },
|
||||
/* 17*/ { BARCODE_DBAR_EXPSTK, BARCODE_RAW_TEXT, "[01]12345678901231", 0, "", "0112345678901231" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1346,6 +1353,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, data[i].ret, ret, symbol->errtxt);
|
||||
|
@ -1354,6 +1362,18 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(strcmp((const char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -1374,126 +1394,128 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int expected_rows;
|
||||
int expected_width;
|
||||
const char *expected_errtxt;
|
||||
int expected_option_2;
|
||||
int expected_option_3;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_DBAR_OMN, -1, -1, -1, "1234567890123", 0, 1, 96, "" },
|
||||
/* 1*/ { BARCODE_DBAR_OMN, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" },
|
||||
/* 2*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" },
|
||||
/* 3*/ { BARCODE_DBAR_OMN, -1, -1, -1, "12345678901234", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '4', expecting '1'" },
|
||||
/* 4*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "12345678901234", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '4', expecting '1'" }, /* Still checked */
|
||||
/* 5*/ { BARCODE_DBAR_OMN, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" },
|
||||
/* 6*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" },
|
||||
/* 7*/ { BARCODE_DBAR_LTD, -1, -1, -1, "1234567890123", 0, 1, 79, "" },
|
||||
/* 8*/ { BARCODE_DBAR_LTD, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character at position 13 in input (digits only)" },
|
||||
/* 9*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character at position 13 in input (digits only)" },
|
||||
/* 10*/ { BARCODE_DBAR_LTD, -1, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '5', expecting '1'" },
|
||||
/* 11*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '5', expecting '1'" }, /* Still checked */
|
||||
/* 12*/ { BARCODE_DBAR_LTD, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 15 too long (maximum 14)" },
|
||||
/* 13*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 15 too long (maximum 14)" },
|
||||
/* 14*/ { BARCODE_DBAR_LTD, -1, -1, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)" },
|
||||
/* 15*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)" },
|
||||
/* 16*/ { BARCODE_DBAR_LTD, -1, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)" },
|
||||
/* 17*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)" },
|
||||
/* 18*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" },
|
||||
/* 19*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 1, 134, "" },
|
||||
/* 20*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231", 0, 1, 134, "" },
|
||||
/* 21*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" },
|
||||
/* 22*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" },
|
||||
/* 23*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01)" },
|
||||
/* 24*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]123456789012315", 0, 1, 151, "" },
|
||||
/* 25*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" },
|
||||
/* 26*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 1, 134, "" },
|
||||
/* 27*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", ZINT_WARN_NONCOMPLIANT, 1, 526, "Warning 261: AI (91) position 21: Invalid CSET 82 character ' '" }, /* ISOIEC punc */
|
||||
/* 28*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", 0, 1, 526, "" },
|
||||
/* 29*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "" }, /* ISOIEC punc less space */
|
||||
/* 30*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "" },
|
||||
/* 31*/ { BARCODE_DBAR_STK, -1, -1, -1, "1234567890123", 0, 3, 50, "" },
|
||||
/* 32*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" },
|
||||
/* 33*/ { BARCODE_DBAR_STK, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" },
|
||||
/* 34*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" },
|
||||
/* 35*/ { BARCODE_DBAR_STK, -1, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '5', expecting '1'" },
|
||||
/* 36*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '5', expecting '1'" }, /* Still checked */
|
||||
/* 37*/ { BARCODE_DBAR_STK, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" },
|
||||
/* 38*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" },
|
||||
/* 39*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "1234567890123", 0, 5, 50, "" },
|
||||
/* 40*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" },
|
||||
/* 41*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" },
|
||||
/* 42*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '6', expecting '1'" },
|
||||
/* 43*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '6', expecting '1'" }, /* Still checked */
|
||||
/* 44*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" },
|
||||
/* 45*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" },
|
||||
/* 46*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 5, 102, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" },
|
||||
/* 47*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 5, 102, "" },
|
||||
/* 48*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901231", 0, 5, 102, "" },
|
||||
/* 49*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" },
|
||||
/* 50*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" },
|
||||
/* 51*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01)" },
|
||||
/* 52*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]123456789012315", 0, 5, 102, "" },
|
||||
/* 53*/ { BARCODE_DBAR_EXPSTK, -1, 12, -1, "[01]12345678901231", 0, 5, 102, "" }, /* Cols > 11 ignored */
|
||||
/* 54*/ { BARCODE_DBAR_EXPSTK, -1, -1, 12, "[01]12345678901231", 0, 5, 102, "" }, /* Rows > 11 ignored */
|
||||
/* 55*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[01]12345678901231", 0, 9, 53, "" },
|
||||
/* 56*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[01]12345678901231", 0, 5, 102, "" },
|
||||
/* 57*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[01]12345678901231", 0, 1, 134, "" },
|
||||
/* 58*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[01]12345678901231", 0, 1, 134, "" },
|
||||
/* 59*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[01]12345678901231", 0, 5, 102, "" },
|
||||
/* 60*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[01]12345678901231", 0, 5, 102, "" },
|
||||
/* 61*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[8110]106141416543213500110000310123196000", 0, 13, 102, "" },
|
||||
/* 62*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[8110]106141416543213500110000310123196000", 0, 25, 53, "" },
|
||||
/* 63*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[8110]106141416543213500110000310123196000", 0, 13, 102, "" },
|
||||
/* 64*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[8110]106141416543213500110000310123196000", 0, 9, 151, "" },
|
||||
/* 65*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[8110]106141416543213500110000310123196000", 0, 5, 200, "" },
|
||||
/* 66*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]106141416543213500110000310123196000", 0, 5, 249, "" },
|
||||
/* 67*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141416543213500110000310123196000", 0, 5, 200, "" },
|
||||
/* 68*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[8110]106141416543213500110000310123196000", 0, 9, 151, "" },
|
||||
/* 69*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[8110]106141416543213500110000310123196000", 0, 13, 102, "" },
|
||||
/* 70*/ { BARCODE_DBAR_EXPSTK, -1, -1, 5, "[8110]106141416543213500110000310123196000", 0, 13, 102, "" },
|
||||
/* 71*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]123456789012345678901", 0, 9, 102, "" },
|
||||
/* 72*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]123456789012345678901", 0, 17, 53, "" },
|
||||
/* 73*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[91]123456789012345678901", 0, 9, 102, "" },
|
||||
/* 74*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[91]123456789012345678901", 0, 5, 151, "" },
|
||||
/* 75*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]123456789012345678901", 0, 5, 200, "" },
|
||||
/* 76*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[91]123456789012345678901", 0, 5, 151, "" },
|
||||
/* 77*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[91]123456789012345678901", 0, 9, 102, "" },
|
||||
/* 78*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[91]123456789012345678901", 0, 9, 102, "" },
|
||||
/* 79*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]123456789012345678901", 0, 9, 102, "" },
|
||||
/* 80*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "" },
|
||||
/* 81*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 33, 53, "" },
|
||||
/* 82*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "" },
|
||||
/* 83*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 151, "" },
|
||||
/* 84*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 200, "" },
|
||||
/* 85*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 200, "" },
|
||||
/* 86*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 249, "" },
|
||||
/* 87*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 298, "" },
|
||||
/* 88*/ { BARCODE_DBAR_EXPSTK, -1, 7, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 347, "" },
|
||||
/* 89*/ { BARCODE_DBAR_EXPSTK, -1, 8, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 396, "" },
|
||||
/* 90*/ { BARCODE_DBAR_EXPSTK, -1, 9, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 1, 428, "" },
|
||||
/* 91*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 249, "" },
|
||||
/* 92*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 151, "" },
|
||||
/* 93*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 151, "" },
|
||||
/* 94*/ { BARCODE_DBAR_EXPSTK, -1, -1, 5, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "" },
|
||||
/* 95*/ { BARCODE_DBAR_EXPSTK, -1, -1, 6, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "" },
|
||||
/* 96*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" },
|
||||
/* 97*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 41, 53, "" },
|
||||
/* 98*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" },
|
||||
/* 99*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 13, 151, "" },
|
||||
/*100*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 9, 200, "" },
|
||||
/*101*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 9, 249, "" },
|
||||
/*102*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 5, 298, "" },
|
||||
/*103*/ { BARCODE_DBAR_EXPSTK, -1, 7, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 5, 347, "" },
|
||||
/*104*/ { BARCODE_DBAR_EXPSTK, -1, -1, 1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" },
|
||||
/*105*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 5, 298, "" },
|
||||
/*106*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 9, 200, "" },
|
||||
/*107*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 13, 151, "" },
|
||||
/*108*/ { BARCODE_DBAR_EXPSTK, -1, -1, 5, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 13, 151, "" },
|
||||
/*109*/ { BARCODE_DBAR_EXPSTK, -1, -1, 6, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" },
|
||||
/*110*/ { BARCODE_DBAR_EXPSTK, -1, -1, 7, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" },
|
||||
/* 0*/ { BARCODE_DBAR_OMN, -1, -1, -1, "1234567890123", 0, 1, 96, "", 0, 0 },
|
||||
/* 1*/ { BARCODE_DBAR_OMN, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)", 0, 0 },
|
||||
/* 2*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)", 0, 0 },
|
||||
/* 3*/ { BARCODE_DBAR_OMN, -1, -1, -1, "12345678901234", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '4', expecting '1'", 0, 0 },
|
||||
/* 4*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "12345678901234", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '4', expecting '1'", 0, 0 }, /* Still checked */
|
||||
/* 5*/ { BARCODE_DBAR_OMN, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)", 0, 0 },
|
||||
/* 6*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)", 0, 0 },
|
||||
/* 7*/ { BARCODE_DBAR_LTD, -1, -1, -1, "1234567890123", 0, 1, 79, "", 0, 0 },
|
||||
/* 8*/ { BARCODE_DBAR_LTD, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character at position 13 in input (digits only)", 0, 0 },
|
||||
/* 9*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character at position 13 in input (digits only)", 0, 0 },
|
||||
/* 10*/ { BARCODE_DBAR_LTD, -1, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '5', expecting '1'", 0, 0 },
|
||||
/* 11*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '5', expecting '1'", 0, 0 }, /* Still checked */
|
||||
/* 12*/ { BARCODE_DBAR_LTD, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 15 too long (maximum 14)", 0, 0 },
|
||||
/* 13*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 15 too long (maximum 14)", 0, 0 },
|
||||
/* 14*/ { BARCODE_DBAR_LTD, -1, -1, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)", 0, 0 },
|
||||
/* 15*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)", 0, 0 },
|
||||
/* 16*/ { BARCODE_DBAR_LTD, -1, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)", 0, 0 },
|
||||
/* 17*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)", 0, 0 },
|
||||
/* 18*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", 0, 0 },
|
||||
/* 19*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 1, 134, "", 0, 0 },
|
||||
/* 20*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231", 0, 1, 134, "", 0, 0 },
|
||||
/* 21*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 },
|
||||
/* 22*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 },
|
||||
/* 23*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01)", 0, 0 },
|
||||
/* 24*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]123456789012315", 0, 1, 151, "", 0, 0 },
|
||||
/* 25*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", 0, 0 },
|
||||
/* 26*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 1, 134, "", 0, 0 },
|
||||
/* 27*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", ZINT_WARN_NONCOMPLIANT, 1, 526, "Warning 261: AI (91) position 21: Invalid CSET 82 character ' '", 0, 0 }, /* ISOIEC punc */
|
||||
/* 28*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", 0, 1, 526, "", 0, 0 },
|
||||
/* 29*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "", 0, 0 }, /* ISOIEC punc less space */
|
||||
/* 30*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "", 0, 0 },
|
||||
/* 31*/ { BARCODE_DBAR_STK, -1, -1, -1, "1234567890123", 0, 3, 50, "", 0, 0 },
|
||||
/* 32*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)", 0, 0 },
|
||||
/* 33*/ { BARCODE_DBAR_STK, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)", 0, 0 },
|
||||
/* 34*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)", 0, 0 },
|
||||
/* 35*/ { BARCODE_DBAR_STK, -1, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '5', expecting '1'", 0, 0 },
|
||||
/* 36*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '5', expecting '1'", 0, 0 }, /* Still checked */
|
||||
/* 37*/ { BARCODE_DBAR_STK, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)", 0, 0 },
|
||||
/* 38*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)", 0, 0 },
|
||||
/* 39*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "1234567890123", 0, 5, 50, "", 0, 0 },
|
||||
/* 40*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)", 0, 0 },
|
||||
/* 41*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)", 0, 0 },
|
||||
/* 42*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '6', expecting '1'", 0, 0 },
|
||||
/* 43*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '6', expecting '1'", 0, 0 }, /* Still checked */
|
||||
/* 44*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)", 0, 0 },
|
||||
/* 45*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)", 0, 0 },
|
||||
/* 46*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 5, 102, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", 2, 0 },
|
||||
/* 47*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 5, 102, "", 2, 0 },
|
||||
/* 48*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901231", 0, 5, 102, "", 2, 0 },
|
||||
/* 49*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 },
|
||||
/* 50*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 },
|
||||
/* 51*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01)", 0, 0 },
|
||||
/* 52*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]123456789012315", 0, 5, 102, "", 2, 0 },
|
||||
/* 53*/ { BARCODE_DBAR_EXPSTK, -1, 12, -1, "[01]12345678901231", 0, 5, 102, "", 2, 0 }, /* Cols > 11 ignored */
|
||||
/* 54*/ { BARCODE_DBAR_EXPSTK, -1, -1, 12, "[01]12345678901231", 0, 5, 102, "", 2, 0 }, /* Rows > 11 ignored */
|
||||
/* 55*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[01]12345678901231", 0, 9, 53, "", 1, 0 },
|
||||
/* 56*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[01]12345678901231", 0, 5, 102, "", 2, 0 },
|
||||
/* 57*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[01]12345678901231", 0, 1, 134, "", 3, 0 },
|
||||
/* 58*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[01]12345678901231", 0, 1, 134, "", 4, 0 },
|
||||
/* 59*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[01]12345678901231", 0, 5, 102, "", 2, 2 },
|
||||
/* 60*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[01]12345678901231", 0, 5, 102, "", 2, 3 },
|
||||
/* 61*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[8110]106141416543213500110000310123196000", 0, 13, 102, "", 2, 0 },
|
||||
/* 62*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[8110]106141416543213500110000310123196000", 0, 25, 53, "", 1, 0 },
|
||||
/* 63*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[8110]106141416543213500110000310123196000", 0, 13, 102, "", 2, 0 },
|
||||
/* 64*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[8110]106141416543213500110000310123196000", 0, 9, 151, "", 3, 0 },
|
||||
/* 65*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[8110]106141416543213500110000310123196000", 0, 5, 200, "", 4, 0 },
|
||||
/* 66*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]106141416543213500110000310123196000", 0, 5, 249, "", 5, 0 },
|
||||
/* 67*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141416543213500110000310123196000", 0, 5, 200, "", 4, 2 },
|
||||
/* 68*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[8110]106141416543213500110000310123196000", 0, 9, 151, "", 3, 3 },
|
||||
/* 69*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[8110]106141416543213500110000310123196000", 0, 13, 102, "", 2, 4 },
|
||||
/* 70*/ { BARCODE_DBAR_EXPSTK, -1, -1, 5, "[8110]106141416543213500110000310123196000", 0, 13, 102, "", 2, 5 },
|
||||
/* 71*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]123456789012345678901", 0, 9, 102, "", 2, 0 },
|
||||
/* 72*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]123456789012345678901", 0, 17, 53, "", 1, 0 },
|
||||
/* 73*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[91]123456789012345678901", 0, 9, 102, "", 2, 0 },
|
||||
/* 74*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[91]123456789012345678901", 0, 5, 151, "", 3, 0 },
|
||||
/* 75*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]123456789012345678901", 0, 5, 200, "", 4, 0 },
|
||||
/* 76*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[91]123456789012345678901", 0, 5, 151, "", 3, 2 },
|
||||
/* 77*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[91]123456789012345678901", 0, 9, 102, "", 2, 3 },
|
||||
/* 78*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[91]123456789012345678901", 0, 9, 102, "", 2, 4 },
|
||||
/* 79*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]123456789012345678901", 0, 9, 102, "", 2, 0 },
|
||||
/* 80*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "", 2, 0 },
|
||||
/* 81*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 33, 53, "", 1, 0 },
|
||||
/* 82*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "", 2, 0 },
|
||||
/* 83*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 151, "", 3, 0 },
|
||||
/* 84*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 200, "", 4, 0 },
|
||||
/* 85*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 200, "", 4, 0 },
|
||||
/* 86*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 249, "", 5, 0 },
|
||||
/* 87*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 298, "", 6, 0 },
|
||||
/* 88*/ { BARCODE_DBAR_EXPSTK, -1, 7, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 347, "", 7, 0 },
|
||||
/* 89*/ { BARCODE_DBAR_EXPSTK, -1, 8, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 396, "", 8, 0 },
|
||||
/* 90*/ { BARCODE_DBAR_EXPSTK, -1, 9, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 1, 428, "", 9, 0 },
|
||||
/* 91*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 249, "", 5, 2 },
|
||||
/* 92*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 151, "", 3, 3 },
|
||||
/* 93*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 151, "", 3, 4 },
|
||||
/* 94*/ { BARCODE_DBAR_EXPSTK, -1, -1, 5, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "", 2, 5 },
|
||||
/* 95*/ { BARCODE_DBAR_EXPSTK, -1, -1, 6, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "", 2, 6 },
|
||||
/* 96*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "", 2, 0 },
|
||||
/* 97*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 41, 53, "", 1, 0 },
|
||||
/* 98*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "", 2, 0 },
|
||||
/* 99*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 13, 151, "", 3, 0 },
|
||||
/*100*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 9, 200, "", 4, 0 },
|
||||
/*101*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 9, 249, "", 5, 0 },
|
||||
/*102*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 5, 298, "", 6, 0 },
|
||||
/*103*/ { BARCODE_DBAR_EXPSTK, -1, 7, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 5, 347, "", 7, 0 },
|
||||
/*104*/ { BARCODE_DBAR_EXPSTK, -1, -1, 1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "", 2, 0 },
|
||||
/*105*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 5, 298, "", 6, 2 },
|
||||
/*106*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 9, 200, "", 4, 3 },
|
||||
/*107*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 13, 151, "", 3, 4 },
|
||||
/*108*/ { BARCODE_DBAR_EXPSTK, -1, -1, 5, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 13, 151, "", 3, 5 },
|
||||
/*109*/ { BARCODE_DBAR_EXPSTK, -1, -1, 6, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "", 2, 6 },
|
||||
/*110*/ { BARCODE_DBAR_EXPSTK, -1, -1, 7, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "", 2, 7 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1502,15 +1524,26 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/,
|
||||
-1 /*option_1*/, data[i].option_2, data[i].option_3, -1 /*output_options*/,
|
||||
data[i].data, -1, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(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);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
|
||||
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->errtxt, data[i].expected_errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (symbol->width %d)\n", i, symbol->rows, data[i].expected_rows, symbol->width);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (symbol->width %d)\n",
|
||||
i, symbol->rows, data[i].expected_rows, symbol->width);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n",
|
||||
i, symbol->width, data[i].expected_width);
|
||||
assert_equal(symbol->option_2, data[i].expected_option_2,
|
||||
"i:%d symbol->option_2 %d != %d (symbol->option_2 %d) (option 3 %d)\n",
|
||||
i, symbol->option_2, data[i].expected_option_2, symbol->option_2, symbol->option_3);
|
||||
assert_equal(symbol->option_3, data[i].expected_option_3,
|
||||
"i:%d symbol->option_3 %d != %d (symbol->option_3 %d)\n",
|
||||
i, symbol->option_3, data[i].expected_option_3, symbol->option_3);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
|
|
|
@ -116,7 +116,7 @@ static void test_u_sjis_int(const testCtx *const p_ctx) {
|
|||
(void)debug;
|
||||
#endif
|
||||
|
||||
testStart("test_u_sjis_int");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
#ifdef TEST_JUST_SAY_GNO
|
||||
if ((debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */
|
||||
|
@ -212,7 +212,7 @@ static void test_sjis_utf8(const testCtx *const p_ctx) {
|
|||
struct zint_symbol symbol = {0};
|
||||
unsigned int jisdata[20] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_sjis_utf8");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_length;
|
||||
|
@ -304,7 +304,7 @@ static void test_sjis_utf8_to_eci(const testCtx *const p_ctx) {
|
|||
|
||||
unsigned int jisdata[20] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_sjis_utf8_to_eci");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_length;
|
||||
|
@ -356,7 +356,7 @@ static void test_sjis_cpy(const testCtx *const p_ctx) {
|
|||
|
||||
unsigned int jisdata[20] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStart("test_sjis_cpy");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int ret_length;
|
||||
|
|
|
@ -155,7 +155,7 @@ static void test_print(const testCtx *const p_ctx) {
|
|||
int have_libreoffice = 0;
|
||||
int have_vnu = 0;
|
||||
|
||||
testStartSymbol("test_print", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
char data_dir_path[1024];
|
||||
|
@ -278,7 +278,7 @@ static void test_outfile(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_outfile");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol.symbology = BARCODE_CODE128;
|
||||
symbol.vector = &vector;
|
||||
|
|
|
@ -56,7 +56,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[256];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -97,34 +97,36 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
const char *expected_raw;
|
||||
int expected_raw_length;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_TELEPEN, -1, "ABC1234.;$", -1, "ABC1234.;$", -1 },
|
||||
/* 1*/ { BARCODE_TELEPEN, BARCODE_RAW_TEXT, "ABC1234.;$", -1, "ABC1234.;$^", -1 },
|
||||
/* 2*/ { BARCODE_TELEPEN, -1, "abc1234.;$", -1, "abc1234.;$", -1 },
|
||||
/* 3*/ { BARCODE_TELEPEN, BARCODE_RAW_TEXT, "abc1234.;$", -1, "abc1234.;$}", -1 },
|
||||
/* 4*/ { BARCODE_TELEPEN, -1, "ABC1234\001", -1, "ABC1234 ", -1 }, /* Note used to put control chars (apart from NUL) in HRT */
|
||||
/* 5*/ { BARCODE_TELEPEN, BARCODE_RAW_TEXT, "ABC1234\001", -1, "ABC1234\001k", -1 },
|
||||
/* 6*/ { BARCODE_TELEPEN, -1, "ABC\0001234", 8, "ABC 1234", -1 },
|
||||
/* 7*/ { BARCODE_TELEPEN, BARCODE_RAW_TEXT, "ABC\0001234", 8, "ABC\0001234l", 9 },
|
||||
/* 8*/ { BARCODE_TELEPEN, -1, "ABK0", -1, "ABK0", -1 },
|
||||
/* 9*/ { BARCODE_TELEPEN, BARCODE_RAW_TEXT, "ABK0", -1, "ABK0\000", 5 },
|
||||
/* 10*/ { BARCODE_TELEPEN_NUM, -1, "1234", -1, "1234", -1 },
|
||||
/* 11*/ { BARCODE_TELEPEN_NUM, BARCODE_RAW_TEXT, "1234", -1, "1234\033", -1 },
|
||||
/* 12*/ { BARCODE_TELEPEN_NUM, -1, "123X", -1, "123X", -1 },
|
||||
/* 13*/ { BARCODE_TELEPEN_NUM, BARCODE_RAW_TEXT, "123X", -1, "123XD", -1 },
|
||||
/* 14*/ { BARCODE_TELEPEN_NUM, -1, "123x", -1, "123X", -1 }, /* Converts to upper */
|
||||
/* 15*/ { BARCODE_TELEPEN_NUM, BARCODE_RAW_TEXT, "123x", -1, "123XD", -1 },
|
||||
/* 16*/ { BARCODE_TELEPEN_NUM, -1, "12345", -1, "012345", -1 }, /* Adds leading zero if odd */
|
||||
/* 17*/ { BARCODE_TELEPEN_NUM, BARCODE_RAW_TEXT, "12345", -1, "012345h", -1 },
|
||||
/* 0*/ { BARCODE_TELEPEN, -1, "ABC1234.;$", -1, "ABC1234.;$", -1, "", -1 },
|
||||
/* 1*/ { BARCODE_TELEPEN, BARCODE_RAW_TEXT, "ABC1234.;$", -1, "ABC1234.;$", -1, "ABC1234.;$^", -1 },
|
||||
/* 2*/ { BARCODE_TELEPEN, -1, "abc1234.;$", -1, "abc1234.;$", -1, "", -1 },
|
||||
/* 3*/ { BARCODE_TELEPEN, BARCODE_RAW_TEXT, "abc1234.;$", -1, "abc1234.;$", -1, "abc1234.;$}", -1 },
|
||||
/* 4*/ { BARCODE_TELEPEN, -1, "ABC1234\001", -1, "ABC1234 ", -1, "", -1 }, /* Note used to put control chars (apart from NUL) in HRT */
|
||||
/* 5*/ { BARCODE_TELEPEN, BARCODE_RAW_TEXT, "ABC1234\001", -1, "ABC1234 ", -1, "ABC1234\001k", -1 },
|
||||
/* 6*/ { BARCODE_TELEPEN, -1, "ABC\0001234", 8, "ABC 1234", -1, "", -1 },
|
||||
/* 7*/ { BARCODE_TELEPEN, BARCODE_RAW_TEXT, "ABC\0001234", 8, "ABC 1234", -1, "ABC\0001234l", 9 },
|
||||
/* 8*/ { BARCODE_TELEPEN, -1, "ABK0", -1, "ABK0", -1, "", -1 },
|
||||
/* 9*/ { BARCODE_TELEPEN, BARCODE_RAW_TEXT, "ABK0", -1, "ABK0", -1, "ABK0\000", 5 },
|
||||
/* 10*/ { BARCODE_TELEPEN_NUM, -1, "1234", -1, "1234", -1, "", -1 },
|
||||
/* 11*/ { BARCODE_TELEPEN_NUM, BARCODE_RAW_TEXT, "1234", -1, "1234", -1, "1234\033", -1 },
|
||||
/* 12*/ { BARCODE_TELEPEN_NUM, -1, "123X", -1, "123X", -1, "", -1 },
|
||||
/* 13*/ { BARCODE_TELEPEN_NUM, BARCODE_RAW_TEXT, "123X", -1, "123X", -1, "123XD", -1 },
|
||||
/* 14*/ { BARCODE_TELEPEN_NUM, -1, "123x", -1, "123X", -1, "", -1 }, /* Converts to upper */
|
||||
/* 15*/ { BARCODE_TELEPEN_NUM, BARCODE_RAW_TEXT, "123x", -1, "123X", -1, "123XD", -1 },
|
||||
/* 16*/ { BARCODE_TELEPEN_NUM, -1, "12345", -1, "012345", -1, "", -1 }, /* Adds leading zero if odd */
|
||||
/* 17*/ { BARCODE_TELEPEN_NUM, BARCODE_RAW_TEXT, "12345", -1, "012345", -1, "012345h", -1 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -137,6 +139,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
expected_raw_length = data[i].expected_raw_length == -1 ? (int) strlen(data[i].expected_raw) : data[i].expected_raw_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
|
@ -145,6 +148,19 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length);
|
||||
assert_zero(memcmp(symbol->text, data[i].expected, expected_length), "i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->text, data[i].expected, expected_length);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%.*s, %.*s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, expected_raw_length,
|
||||
data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
@ -180,7 +196,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -267,7 +283,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -340,7 +356,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_fuzz", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
|
|||
int have_tiffinfo = testUtilHaveTiffInfo();
|
||||
const char *const have_identify = testUtilHaveIdentify();
|
||||
|
||||
testStart("test_pixel_plot");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
@ -221,7 +221,7 @@ static void test_print(const testCtx *const p_ctx) {
|
|||
int have_tiffinfo = testUtilHaveTiffInfo();
|
||||
const char *const have_identify = testUtilHaveIdentify();
|
||||
|
||||
testStartSymbol("test_print", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
if (p_ctx->generate) {
|
||||
char data_dir_path[1024];
|
||||
|
@ -336,7 +336,7 @@ static void test_outfile(const testCtx *const p_ctx) {
|
|||
|
||||
(void)p_ctx;
|
||||
|
||||
testStart("test_outfile");
|
||||
testStart(p_ctx->func_name);
|
||||
|
||||
symbol.symbology = BARCODE_CODE128;
|
||||
symbol.bitmap = data;
|
||||
|
|
|
@ -92,7 +92,7 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
|
||||
char data_buf[ZINT_MAX_DATA_LEN + 1];
|
||||
|
||||
testStartSymbol("test_large", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -149,7 +149,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
|
|||
|
||||
char escaped[1024];
|
||||
|
||||
testStartSymbol("test_reader_init", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -283,7 +283,7 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
char escaped[1024];
|
||||
|
||||
testStartSymbol("test_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -813,7 +813,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1055,7 +1055,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
|
||||
testStartSymbol("test_encode_segs", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1120,6 +1120,180 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int eci;
|
||||
int output_options;
|
||||
const char *data;
|
||||
int length;
|
||||
int ret;
|
||||
int expected_eci;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
int expected_raw_eci;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, "é", -1, 0, 0, "", -1, 0 },
|
||||
/* 1*/ { UNICODE_MODE, -1, BARCODE_RAW_TEXT, "é", -1, 0, 0, "\351", -1, 3 },
|
||||
/* 2*/ { UNICODE_MODE, -1, -1, "ก", -1, ZINT_WARN_USES_ECI, 13, "", -1, 0 },
|
||||
/* 3*/ { UNICODE_MODE, -1, BARCODE_RAW_TEXT, "ก", -1, ZINT_WARN_USES_ECI, 13, "\241", -1, 13 },
|
||||
/* 4*/ { DATA_MODE, -1, -1, "\351", -1, 0, 0, "", -1, 0 },
|
||||
/* 5*/ { DATA_MODE, -1, BARCODE_RAW_TEXT, "\351", -1, 0, 0, "\351", -1, 3 },
|
||||
/* 6*/ { UNICODE_MODE, 26, -1, "é", -1, 0, 26, "", -1, 0 },
|
||||
/* 7*/ { UNICODE_MODE, 26, BARCODE_RAW_TEXT, "é", -1, 0, 26, "é", -1, 26 },
|
||||
/* 8*/ { UNICODE_MODE, 899, -1, "é", -1, 0, 899, "", -1, 0 },
|
||||
/* 9*/ { UNICODE_MODE, 899, BARCODE_RAW_TEXT, "é", -1, 0, 899, "é", -1, 899 },
|
||||
/* 10*/ { GS1_MODE, -1, -1, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "", -1, 0 },
|
||||
/* 11*/ { GS1_MODE, -1, BARCODE_RAW_TEXT, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "01049123451234591597033130128\03510ABC123", -1, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_ULTRA, data[i].input_mode, data[i].eci,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n",
|
||||
i, symbol->eci, data[i].expected_eci);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->raw_segs[0].source, symbol->raw_segs[0].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[0].eci, data[i].expected_raw_eci,
|
||||
"i:%d raw_segs[0].eci %d != expected_raw_eci %d\n",
|
||||
i, symbol->raw_segs[0].eci, data[i].expected_raw_eci);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_rt_segs(const testCtx *const p_ctx) {
|
||||
int debug = p_ctx->debug;
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int output_options;
|
||||
struct zint_seg segs[3];
|
||||
int ret;
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
struct zint_seg expected_raw_segs[3];
|
||||
int expected_raw_seg_count;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, {0} }, 0, 13, 15, {{0}}, 0 },
|
||||
/* 1*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 13, 15, { { TU("\266"), 1, 3 }, { TU("\266"), 1, 7 }, {0} }, 2 },
|
||||
/* 2*/ { UNICODE_MODE, -1, { { TU("éé"), -1, 0 }, { TU("กขฯ"), -1, 0 }, { TU("βββ"), -1, 0 } }, ZINT_WARN_USES_ECI, 13, 20, {{0}}, 0 },
|
||||
/* 3*/ { UNICODE_MODE, BARCODE_RAW_TEXT, { { TU("éé"), -1, 0 }, { TU("กขฯ"), -1, 0 }, { TU("βββ"), -1, 0 } }, ZINT_WARN_USES_ECI, 13, 20, { { TU("\351\351"), 2, 3 }, { TU("\241\242\317"), 3, 13 }, { TU("\342\342\342"), 3, 9 } }, 3 },
|
||||
/* 4*/ { DATA_MODE, -1, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("\223\137"), -1, 20 } }, 0, 13, 19, {{0}}, 0 },
|
||||
/* 5*/ { DATA_MODE, BARCODE_RAW_TEXT, { { TU("¶"), -1, 26 }, { TU("Ж"), -1, 0 }, { TU("\223\137"), -1, 20 } }, 0, 13, 19, { { TU("¶"), 2, 26 }, { TU("\320\226"), 2, 3 }, { TU("\223\137"), 2, 20 } }, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, j, seg_count, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
int expected_length;
|
||||
|
||||
char escaped[4096];
|
||||
char escaped2[4096];
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
testUtilSetSymbol(symbol, BARCODE_ULTRA, data[i].input_mode, -1 /*eci*/,
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
NULL, 0, debug);
|
||||
for (j = 0, seg_count = 0; j < 3 && data[i].segs[j].length; j++, seg_count++);
|
||||
|
||||
ret = ZBarcode_Encode_Segs(symbol, data[i].segs, seg_count);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode_Segs ret %d != %d (%s)\n",
|
||||
i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (width %d)\n",
|
||||
i, symbol->rows, data[i].expected_rows, symbol->width);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n",
|
||||
i, symbol->width, data[i].expected_width);
|
||||
|
||||
assert_equal(symbol->raw_seg_count, data[i].expected_raw_seg_count, "i:%d symbol->raw_seg_count %d != %d\n",
|
||||
i, symbol->raw_seg_count, data[i].expected_raw_seg_count);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
for (j = 0; j < symbol->raw_seg_count; j++) {
|
||||
assert_nonnull(symbol->raw_segs[j].source, "i:%d raw_segs[%d].source NULL\n", i, j);
|
||||
|
||||
expected_length = data[i].expected_raw_segs[j].length;
|
||||
|
||||
assert_equal(symbol->raw_segs[j].length, expected_length,
|
||||
"i:%d raw_segs[%d].length %d != expected_length %d\n",
|
||||
i, j, symbol->raw_segs[j].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[j].source, data[i].expected_raw_segs[j].source, expected_length),
|
||||
"i:%d raw_segs[%d].source memcmp(%s, %s, %d) != 0\n", i, j,
|
||||
testUtilEscape((const char *) symbol->raw_segs[j].source, expected_length, escaped,
|
||||
sizeof(escaped)),
|
||||
testUtilEscape((const char *) data[i].expected_raw_segs[j].source, expected_length,
|
||||
escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[j].eci, data[i].expected_raw_segs[j].eci,
|
||||
"i:%d raw_segs[%d].eci %d != expected_raw_segs.eci %d\n",
|
||||
i, j, symbol->raw_segs[j].eci, data[i].expected_raw_segs[j].eci);
|
||||
}
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
testFunction funcs[] = { /* name, func */
|
||||
|
@ -1128,6 +1302,8 @@ int main(int argc, char *argv[]) {
|
|||
{ "test_input", test_input },
|
||||
{ "test_encode", test_encode },
|
||||
{ "test_encode_segs", test_encode_segs },
|
||||
{ "test_rt", test_rt },
|
||||
{ "test_rt_segs", test_rt_segs },
|
||||
};
|
||||
|
||||
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
|
||||
|
|
|
@ -102,10 +102,11 @@ static void test_upce_input(const testCtx *const p_ctx) {
|
|||
char cmp_buf[4096] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
char cmp_msg[1024] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_upce_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -134,12 +135,14 @@ static void test_upce_input(const testCtx *const p_ctx) {
|
|||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].hrt, (int) strlen(data[i].hrt), NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].hrt, (int) strlen(data[i].hrt),
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +169,7 @@ static void test_upca_print(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_upca_print", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -286,7 +289,7 @@ static void test_upca_input(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_upca_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -458,7 +461,7 @@ static void test_eanx_input(const testCtx *const p_ctx) {
|
|||
|
||||
char errtxt_escaped[256];
|
||||
|
||||
testStartSymbol("test_eanx_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -611,7 +614,7 @@ static void test_isbn_input(const testCtx *const p_ctx) {
|
|||
|
||||
char errtxt_escaped[256];
|
||||
|
||||
testStartSymbol("test_isbn_input", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -755,7 +758,7 @@ static void test_hrt(const testCtx *const p_ctx) {
|
|||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
|
||||
testStartSymbol("test_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -801,7 +804,7 @@ static void test_vector_same(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_vector_same", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
struct zint_vector *vectors[4];
|
||||
|
@ -977,10 +980,11 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
char cmp_buf[4096] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
char cmp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
|
||||
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
|
||||
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1021,12 +1025,14 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
int cmp_len, ret_len;
|
||||
char modules_dump[8192 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
|
||||
NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
|
||||
escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1065,7 +1071,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_fuzz", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
|
@ -500,7 +500,7 @@ static void test_options(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_options", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -691,7 +691,7 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
|
|||
const char *text;
|
||||
char errmsg[128] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStartSymbol("test_buffer_vector", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -860,7 +860,7 @@ static void test_has_hrt(const testCtx *const p_ctx) {
|
|||
const char *text;
|
||||
char errmsg[128] = {0}; /* Suppress clang -fsanitize=memory false positive */
|
||||
|
||||
testStartSymbol("test_has_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -918,78 +918,78 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
|
|||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
struct item data[] = {
|
||||
/* 0*/ { BARCODE_EANX, -1, -1, "123456789012", 0, 50, 1, 95, 226, 118, 12.2, 117.2, -1, -1, 3 }, /* EAN-13 */
|
||||
/* 1*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456789012", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 95, 226, 118, 12.2, 117.2, -1, -1, 3 }, /* EAN-13 */
|
||||
/* 1*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456789012", 0, 50, 1, 95, 226, 118, 12.2, 117.2, -1, -1, 3 }, /* EAN-13 */
|
||||
/* 2*/ { BARCODE_EANX, 0, -1, "123456789012", 0, 50, 1, 95, 226, 110, -1, -1, -1, -1, 0 }, /* EAN-13 */
|
||||
/* 3*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456789012", 0, 50, 1, 95, 226, 118, 12.2, 117.2, 227, 117.2, 4 }, /* EAN-13 */
|
||||
/* 4*/ { BARCODE_EANX_CHK, -1, -1, "1234567890128", 0, 50, 1, 95, 226, 118, 12.2, 117.2, -1, -1, 3 }, /* EAN-13 */
|
||||
/* 5*/ { BARCODE_EANX_CHK, 0, -1, "1234567890128", 0, 50, 1, 95, 226, 110, -1, -1, -1, -1, 0 }, /* EAN-13 */
|
||||
/* 6*/ { BARCODE_EANX_CHK, -1, EANUPC_GUARD_WHITESPACE, "1234567890128", 0, 50, 1, 95, 226, 118, 12.2, 117.2, 227, 117.2, 4 }, /* EAN-13 */
|
||||
/* 7*/ { BARCODE_ISBNX, -1, -1, "9784567890120", 0, 50, 1, 95, 226, 118, 12.2, 117.2, -1, -1, 3 },
|
||||
/* 8*/ { BARCODE_ISBNX, -1, BARCODE_RAW_TEXT, "9784567890120", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 95, 226, 118, 12.2, 117.2, -1, -1, 3 },
|
||||
/* 8*/ { BARCODE_ISBNX, -1, BARCODE_RAW_TEXT, "9784567890120", 0, 50, 1, 95, 226, 118, 12.2, 117.2, -1, -1, 3 },
|
||||
/* 9*/ { BARCODE_ISBNX, 0, -1, "9784567890120", 0, 50, 1, 95, 226, 110, -1, -1, -1, -1, 0 },
|
||||
/* 10*/ { BARCODE_ISBNX, -1, EANUPC_GUARD_WHITESPACE, "9784567890120", 0, 50, 1, 95, 226, 118, 12.2, 117.2, 227, 117.2, 4 },
|
||||
/* 11*/ { BARCODE_EANX, -1, -1, "1234567", 0, 50, 1, 67, 162, 118, 49, 117.2, -1, -1, 2 }, /* EAN-8 */
|
||||
/* 12*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 67, 162, 118, 49, 117.2, -1, -1, 2 }, /* EAN-8 */
|
||||
/* 12*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567", 0, 50, 1, 67, 162, 118, 49, 117.2, -1, -1, 2 }, /* EAN-8 */
|
||||
/* 13*/ { BARCODE_EANX, 0, -1, "1234567", 0, 50, 1, 67, 162, 110, -1, -1, -1, -1, 0 }, /* EAN-8 */
|
||||
/* 14*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "1234567", 0, 50, 1, 67, 162, 118, 49, 117.2, -1, 117.2, 4 }, /* EAN-8 */
|
||||
/* 15*/ { BARCODE_EANX, -1, -1, "1234", 0, 50, 1, 47, 104, 118, 47, 15.6, -1, -1, 1 }, /* EAN-5 */
|
||||
/* 16*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 47, 104, 118, 47, 15.6, -1, -1, 1 }, /* EAN-5 */
|
||||
/* 16*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234", 0, 50, 1, 47, 104, 118, 47, 15.6, -1, -1, 1 }, /* EAN-5 */
|
||||
/* 17*/ { BARCODE_EANX, 0, -1, "1234", 0, 50, 1, 47, 104, 100, -1, -1, -1, -1, 0 }, /* EAN-5 */
|
||||
/* 18*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "1234", 0, 50, 1, 47, 104, 118, 47, 15.6, 105, 15.6, 2 }, /* EAN-5 */
|
||||
/* 19*/ { BARCODE_EANX, -1, -1, "12", 0, 50, 1, 20, 50, 118, 20, 15.6, -1, -1, 1 }, /* EAN-2 */
|
||||
/* 20*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "12", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 20, 50, 118, 20, 15.6, -1, -1, 1 }, /* EAN-2 */
|
||||
/* 20*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "12", 0, 50, 1, 20, 50, 118, 20, 15.6, -1, -1, 1 }, /* EAN-2 */
|
||||
/* 21*/ { BARCODE_EANX, 0, -1, "12", 0, 50, 1, 20, 50, 100, -1, -1, -1, -1, 0 }, /* EAN-2 */
|
||||
/* 22*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "12", 0, 50, 1, 20, 50, 118, 20, 15.6, 51, 15.6, 2 }, /* EAN-2 */
|
||||
/* 23*/ { BARCODE_UPCA, -1, -1, "12345678901", 0, 50, 1, 95, 226, 118, 8.7, 117.2, -1, -1, 4 },
|
||||
/* 24*/ { BARCODE_UPCA, -1, BARCODE_RAW_TEXT, "12345678901", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 95, 226, 118, 8.7, 117.2, -1, -1, 4 },
|
||||
/* 24*/ { BARCODE_UPCA, -1, BARCODE_RAW_TEXT, "12345678901", 0, 50, 1, 95, 226, 118, 8.7, 117.2, -1, -1, 4 },
|
||||
/* 25*/ { BARCODE_UPCA, 0, -1, "12345678901", 0, 50, 1, 95, 226, 110, -1, -1, -1, -1, 0 },
|
||||
/* 26*/ { BARCODE_UPCA, -1, EANUPC_GUARD_WHITESPACE, "12345678901", 0, 50, 1, 95, 226, 118, 8.7, 117.2, -1, -1, 4 },
|
||||
/* 27*/ { BARCODE_UPCA_CHK, -1, -1, "123456789012", 0, 50, 1, 95, 226, 118, 8.7, 117.2, -1, -1, 4 },
|
||||
/* 28*/ { BARCODE_UPCA_CHK, 0, -1, "123456789012", 0, 50, 1, 95, 226, 110, -1, -1, -1, -1, 0 },
|
||||
/* 29*/ { BARCODE_UPCA_CHK, -1, EANUPC_GUARD_WHITESPACE, "123456789012", 0, 50, 1, 95, 226, 118, 8.7, 117.2, -1, -1, 4 },
|
||||
/* 30*/ { BARCODE_UPCE, -1, -1, "1234567", 0, 50, 1, 51, 134, 118, 8.7, 117.2, -1, -1, 3 },
|
||||
/* 31*/ { BARCODE_UPCE, -1, BARCODE_RAW_TEXT, "1234567", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 51, 134, 118, 8.7, 117.2, -1, -1, 3 },
|
||||
/* 31*/ { BARCODE_UPCE, -1, BARCODE_RAW_TEXT, "1234567", 0, 50, 1, 51, 134, 118, 8.7, 117.2, -1, -1, 3 },
|
||||
/* 32*/ { BARCODE_UPCE, 0, -1, "1234567", 0, 50, 1, 51, 134, 110, -1, -1, -1, -1, 0 },
|
||||
/* 33*/ { BARCODE_UPCE, -1, EANUPC_GUARD_WHITESPACE, "1234567", 0, 50, 1, 51, 134, 118, 8.7, 117.2, -1, -1, 3 },
|
||||
/* 34*/ { BARCODE_UPCE_CHK, -1, -1, "12345670", 0, 50, 1, 51, 134, 118, 8.7, 117.2, -1, -1, 3 },
|
||||
/* 35*/ { BARCODE_UPCE_CHK, 0, -1, "12345670", 0, 50, 1, 51, 134, 110, -1, -1, -1, -1, 0 },
|
||||
/* 36*/ { BARCODE_UPCE_CHK, -1, EANUPC_GUARD_WHITESPACE, "12345670", 0, 50, 1, 51, 134, 118, 8.7, 117.2, -1, -1, 3 },
|
||||
/* 37*/ { BARCODE_EANX, -1, -1, "123456789012+12", 0, 50, 1, 122, 276.0, 118, 12.2, 117.2, 246, 15.6, 4 }, /* EAN-13 + EAN-2 */
|
||||
/* 38*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456789012+12", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 122, 276.0, 118, 12.2, 117.2, 246, 15.6, 4 }, /* EAN-13 + EAN-2 */
|
||||
/* 38*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456789012+12", 0, 50, 1, 122, 276.0, 118, 12.2, 117.2, 246, 15.6, 4 }, /* EAN-13 + EAN-2 */
|
||||
/* 39*/ { BARCODE_EANX, 0, -1, "123456789012+12", 0, 50, 1, 122, 276.0, 110, -1, -1, -1, -1, 0 }, /* EAN-13 + EAN-2 */
|
||||
/* 40*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456789012+12", 0, 50, 1, 122, 276.0, 118, 12.2, 117.2, 246, 15.6, 5 }, /* EAN-13 + EAN-2 */
|
||||
/* 41*/ { BARCODE_ISBNX, -1, -1, "9784567890120+12", 0, 50, 1, 122, 276.0, 118, 12.2, 117.2, 246, 15.6, 4 }, /* ISBN + EAN-2 */
|
||||
/* 42*/ { BARCODE_ISBNX, 0, -1, "9784567890120+12", 0, 50, 1, 122, 276.0, 110, -1, -1, -1, -1, 0 }, /* ISBN + EAN-2 */
|
||||
/* 43*/ { BARCODE_ISBNX, -1, EANUPC_GUARD_WHITESPACE, "9784567890120+12", 0, 50, 1, 122, 276.0, 118, 246, 15.6, 277, 15.6, 5 }, /* ISBN + EAN-2 */
|
||||
/* 44*/ { BARCODE_EANX, -1, -1, "123456789012+12345", 0, 50, 1, 149, 330.0, 118, 12.2, 117.2, 274, 15.6, 4 }, /* EAN-13 + EAN-5 */
|
||||
/* 45*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456789012+12345", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 149, 330.0, 118, 12.2, 117.2, 274, 15.6, 4 }, /* EAN-13 + EAN-5 */
|
||||
/* 45*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456789012+12345", 0, 50, 1, 149, 330.0, 118, 12.2, 117.2, 274, 15.6, 4 }, /* EAN-13 + EAN-5 */
|
||||
/* 46*/ { BARCODE_EANX, 0, -1, "123456789012+12345", 0, 50, 1, 149, 330.0, 110, -1, -1, -1, -1, 0 }, /* EAN-13 + EAN-5 */
|
||||
/* 47*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456789012+12345", 0, 50, 1, 149, 330.0, 118, 12.2, 117.2, 274, 15.6, 5 }, /* EAN-13 + EAN-5 */
|
||||
/* 48*/ { BARCODE_ISBNX, -1, -1, "9784567890120+12345", 0, 50, 1, 149, 330.0, 118, 12.2, 117.2, 274, 15.6, 4 }, /* ISBN + EAN-5 */
|
||||
/* 49*/ { BARCODE_ISBNX, 0, -1, "9784567890120+12345", 0, 50, 1, 149, 330.0, 110, -1, -1, -1, -1, 0 }, /* ISBN + EAN-5 */
|
||||
/* 50*/ { BARCODE_ISBNX, -1, EANUPC_GUARD_WHITESPACE, "9784567890120+12345", 0, 50, 1, 149, 330.0, 118, 274, 15.6, 331, 15.6, 5 }, /* ISBN + EAN-5 */
|
||||
/* 51*/ { BARCODE_EANX, -1, -1, "1234567+12", 0, 50, 1, 94, 212, 118, 49, 117.2, 182, 15.6, 3 }, /* EAN-8 + EAN-2 */
|
||||
/* 52*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567+12", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 94, 212, 118, 49, 117.2, 182, 15.6, 3 }, /* EAN-8 + EAN-2 */
|
||||
/* 52*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567+12", 0, 50, 1, 94, 212, 118, 49, 117.2, 182, 15.6, 3 }, /* EAN-8 + EAN-2 */
|
||||
/* 53*/ { BARCODE_EANX, 0, -1, "1234567+12", 0, 50, 1, 94, 212, 110, -1, -1, -1, -1, 0 }, /* EAN-8 + EAN-2 */
|
||||
/* 54*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "1234567+12", 0, 50, 1, 94, 212, 118, 182, 15.6, 213, 15.6, 5 }, /* EAN-8 + EAN-2 */
|
||||
/* 55*/ { BARCODE_EANX, -1, -1, "1234567+12345", 0, 50, 1, 121, 266, 118, 49, 117.2, 210, 15.6, 3 }, /* EAN-8 + EAN-5 */
|
||||
/* 56*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567+12345", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 121, 266, 118, 49, 117.2, 210, 15.6, 3 }, /* EAN-8 + EAN-5 */
|
||||
/* 56*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567+12345", 0, 50, 1, 121, 266, 118, 49, 117.2, 210, 15.6, 3 }, /* EAN-8 + EAN-5 */
|
||||
/* 57*/ { BARCODE_EANX, 0, -1, "1234567+12345", 0, 50, 1, 121, 266, 110, -1, -1, -1, -1, 0 }, /* EAN-8 + EAN-5 */
|
||||
/* 58*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "1234567+12345", 0, 50, 1, 121, 266, 118, 210, 15.6, 210, 15.6, 5 }, /* EAN-8 + EAN-5 */
|
||||
/* 59*/ { BARCODE_UPCA, -1, -1, "12345678901+12", 0, 50, 1, 124, 276, 118, 8.7, 117.2, 246, 15.6, 5 },
|
||||
/* 60*/ { BARCODE_UPCA, -1, BARCODE_RAW_TEXT, "12345678901+12", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 124, 276, 118, 8.7, 117.2, 246, 15.6, 5 },
|
||||
/* 60*/ { BARCODE_UPCA, -1, BARCODE_RAW_TEXT, "12345678901+12", 0, 50, 1, 124, 276, 118, 8.7, 117.2, 246, 15.6, 5 },
|
||||
/* 61*/ { BARCODE_UPCA, 0, -1, "12345678901+12", 0, 50, 1, 124, 276, 110, -1, -1, -1, -1, 0 },
|
||||
/* 62*/ { BARCODE_UPCA, -1, EANUPC_GUARD_WHITESPACE, "12345678901+12", 0, 50, 1, 124, 276, 118, 8.7, 117.2, 277, 15.6, 6 },
|
||||
/* 63*/ { BARCODE_UPCA, -1, -1, "12345678901+12345", 0, 50, 1, 151, 330, 118, 8.7, 117.2, 274, 15.6, 5 },
|
||||
/* 64*/ { BARCODE_UPCA, -1, BARCODE_RAW_TEXT, "12345678901+12345", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 151, 330, 118, 8.7, 117.2, 274, 15.6, 5 },
|
||||
/* 64*/ { BARCODE_UPCA, -1, BARCODE_RAW_TEXT, "12345678901+12345", 0, 50, 1, 151, 330, 118, 8.7, 117.2, 274, 15.6, 5 },
|
||||
/* 65*/ { BARCODE_UPCA, 0, -1, "12345678901+12345", 0, 50, 1, 151, 330, 110, -1, -1, -1, -1, 0 },
|
||||
/* 66*/ { BARCODE_UPCA, -1, EANUPC_GUARD_WHITESPACE, "12345678901+12345", 0, 50, 1, 151, 330, 118, 274, 15.6, 331, 15.6, 6 },
|
||||
/* 67*/ { BARCODE_UPCE, -1, -1, "1234567+12", 0, 50, 1, 78, 184.0, 118, 8.7, 117.2, 154, 15.6, 4 },
|
||||
/* 68*/ { BARCODE_UPCE, -1, BARCODE_RAW_TEXT, "1234567+12", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 78, 184.0, 118, 8.7, 117.2, 154, 15.6, 4 },
|
||||
/* 68*/ { BARCODE_UPCE, -1, BARCODE_RAW_TEXT, "1234567+12", 0, 50, 1, 78, 184.0, 118, 8.7, 117.2, 154, 15.6, 4 },
|
||||
/* 69*/ { BARCODE_UPCE, 0, -1, "1234567+12", 0, 50, 1, 78, 184.0, 110, -1, -1, -1, -1, 0 },
|
||||
/* 70*/ { BARCODE_UPCE, -1, EANUPC_GUARD_WHITESPACE, "1234567+12", 0, 50, 1, 78, 184.0, 118, 8.7, 117.2, 185, 15.6, 5 },
|
||||
/* 71*/ { BARCODE_UPCE, -1, -1, "1234567+12345", 0, 50, 1, 105, 238.0, 118, 8.7, 117.2, 182, 15.6, 4 },
|
||||
/* 72*/ { BARCODE_UPCE, -1, BARCODE_RAW_TEXT, "1234567+12345", ZINT_WARN_HRT_RAW_TEXT, 50, 1, 105, 238.0, 118, 8.7, 117.2, 182, 15.6, 4 },
|
||||
/* 72*/ { BARCODE_UPCE, -1, BARCODE_RAW_TEXT, "1234567+12345", 0, 50, 1, 105, 238.0, 118, 8.7, 117.2, 182, 15.6, 4 },
|
||||
/* 73*/ { BARCODE_UPCE, 0, -1, "1234567+12345", 0, 50, 1, 105, 238.0, 110, -1, -1, -1, -1, 0 },
|
||||
/* 74*/ { BARCODE_UPCE, -1, EANUPC_GUARD_WHITESPACE, "1234567+12345", 0, 50, 1, 105, 238.0, 118, 182, 15.6, 239, 15.6, 5 },
|
||||
};
|
||||
|
@ -999,7 +999,7 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
|
|||
|
||||
struct zint_vector_string *string;
|
||||
|
||||
testStartSymbol("test_upcean_hrt", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int string_cnt;
|
||||
|
@ -1104,7 +1104,7 @@ static void test_row_separator(const testCtx *const p_ctx) {
|
|||
|
||||
struct zint_vector_rect *rect;
|
||||
|
||||
testStartSymbol("test_row_separator", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1170,7 +1170,7 @@ static void test_stacking(const testCtx *const p_ctx) {
|
|||
|
||||
struct zint_vector_rect *rect;
|
||||
|
||||
testStartSymbol("test_stacking", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int length2;
|
||||
|
@ -1306,7 +1306,7 @@ static void test_output_options(const testCtx *const p_ctx) {
|
|||
|
||||
struct zint_vector_rect *rect;
|
||||
|
||||
testStartSymbol("test_output_options", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1385,7 +1385,7 @@ static void test_noncomposite_string_x(const testCtx *const p_ctx) {
|
|||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStartSymbol("test_noncomposite_string_x", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1446,7 +1446,7 @@ static void test_upcean_whitespace_width(const testCtx *const p_ctx) {
|
|||
struct zint_vector_string *string;
|
||||
int string_cnt;
|
||||
|
||||
testStartSymbol("test_upcean_whitespace_width", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1533,7 +1533,7 @@ static void test_scale(const testCtx *const p_ctx) {
|
|||
const char *text;
|
||||
struct zint_vector_rect *rect;
|
||||
|
||||
testStartSymbol("test_scale", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -1659,7 +1659,7 @@ static void test_guard_descent(const testCtx *const p_ctx) {
|
|||
|
||||
struct zint_vector_rect *rect;
|
||||
|
||||
testStartSymbol("test_guard_descent", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2040,7 +2040,7 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
|
|||
struct zint_vector_rect *rect;
|
||||
struct zint_vector_circle *circle;
|
||||
|
||||
testStartSymbol("test_quiet_zones", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2201,7 +2201,7 @@ static void test_text_gap(const testCtx *const p_ctx) {
|
|||
struct zint_vector_string *string;
|
||||
struct zint_vector_rect *rect;
|
||||
|
||||
testStartSymbol("test_text_gap", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -2909,7 +2909,7 @@ static void test_height(const testCtx *const p_ctx) {
|
|||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol("test_height", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3072,7 +3072,7 @@ static void test_height_per_row(const testCtx *const p_ctx) {
|
|||
|
||||
const char *text;
|
||||
|
||||
testStartSymbol("test_height_per_row", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3142,34 +3142,36 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
|
|||
float expected_vector_width;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
const char *expected_raw;
|
||||
int expected_raw_length;
|
||||
const char *expected_errtxt;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { BARCODE_CODE128, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116.279999, 268, "12345 67890", -1, "" },
|
||||
/* 1*/ { BARCODE_CODE128, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, ZINT_WARN_HRT_RAW_TEXT, 116.279999, 268, "12345\00067890", 11, "Warning 698: HRT outputted as raw text" },
|
||||
/* 2*/ { BARCODE_EXCODE39, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116.279999, 362, "12345 67890", -1, "" },
|
||||
/* 3*/ { BARCODE_EXCODE39, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, ZINT_WARN_HRT_RAW_TEXT, 116.279999, 362, "12345\00067890", 11, "Warning 698: HRT outputted as raw text" },
|
||||
/* 4*/ { BARCODE_TELEPEN, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116.279999, 448, "12345 67890", -1, "" },
|
||||
/* 5*/ { BARCODE_TELEPEN, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, ZINT_WARN_HRT_RAW_TEXT, 116.279999, 448, "12345\00067890n", 12, "Warning 698: HRT outputted as raw text" },
|
||||
/* 6*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012", -1, 0, 118, 226, "1234567890128", -1, "" },
|
||||
/* 7*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012", -1, ZINT_WARN_HRT_RAW_TEXT, 118, 226, "1234567890128", -1, "Warning 698: HRT outputted as raw text" }, /* Warn but no difference */
|
||||
/* 8*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012+12", -1, 0, 118, 276, "1234567890128+12", -1, "" },
|
||||
/* 9*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012+12", -1, ZINT_WARN_HRT_RAW_TEXT, 118, 276, "1234567890128+12", -1, "Warning 698: HRT outputted as raw text" },
|
||||
/* 10*/ { BARCODE_CODE39, -1, -1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116.279999, 180, "*ABC14*", -1, "" },
|
||||
/* 11*/ { BARCODE_CODE39, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "ABC14", -1, ZINT_WARN_HRT_RAW_TEXT, 116.279999, 180, "ABC14", -1, "Warning 698: HRT outputted as raw text" },
|
||||
/* 12*/ { BARCODE_CODE39, -1, 1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116.279999, 206, "*ABC14_*", -1, "" }, /* Check digit space rendered as underscore */
|
||||
/* 13*/ { BARCODE_CODE39, -1, 1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "ABC14", -1, ZINT_WARN_HRT_RAW_TEXT, 116.279999, 206, "ABC14 ", -1, "Warning 698: HRT outputted as raw text" },
|
||||
/* 14*/ { BARCODE_POSTNET, -1, -1, BARCODE_MEMORY_FILE, "12345", -1, 0, 24, 126, "", -1, "" },
|
||||
/* 15*/ { BARCODE_POSTNET, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345", -1, ZINT_WARN_HRT_RAW_TEXT, 40.2799988, 126, "123455", -1, "Warning 698: HRT outputted as raw text" }, /* HRT printed */
|
||||
/* 16*/ { BARCODE_POSTNET, 0, -1, BARCODE_MEMORY_FILE, "12345", -1, 0, 24, 126, "", -1, "" },
|
||||
/* 17*/ { BARCODE_POSTNET, 0, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345", -1, 0, 24, 126, "123455", -1, "" }, /* HRT not printed, no warning */
|
||||
/* 0*/ { BARCODE_CODE128, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116.279999, 268, "12345 67890", -1, "", -1, "" },
|
||||
/* 1*/ { BARCODE_CODE128, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, 0, 116.279999, 268, "12345 67890", -1, "12345\00067890", 11, "" },
|
||||
/* 2*/ { BARCODE_EXCODE39, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116.279999, 362, "12345 67890", -1, "", -1, "" },
|
||||
/* 3*/ { BARCODE_EXCODE39, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, 0, 116.279999, 362, "12345 67890", -1, "12345\00067890", 11, "" },
|
||||
/* 4*/ { BARCODE_TELEPEN, -1, -1, BARCODE_MEMORY_FILE, "12345\00067890", 11, 0, 116.279999, 448, "12345 67890", -1, "", -1, "" },
|
||||
/* 5*/ { BARCODE_TELEPEN, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345\00067890", 11, 0, 116.279999, 448, "12345 67890", -1, "12345\00067890n", 12, "" },
|
||||
/* 6*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012", -1, 0, 118, 226, "1234567890128", -1, "", -1, "" },
|
||||
/* 7*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012", -1, 0, 118, 226, "1234567890128", -1, "1234567890128", -1, "" },
|
||||
/* 8*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012+12", -1, 0, 118, 276, "1234567890128+12", -1, "", -1, "" },
|
||||
/* 9*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012+12", -1, 0, 118, 276, "1234567890128+12", -1, "1234567890128+12", -1, "" },
|
||||
/* 10*/ { BARCODE_CODE39, -1, -1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116.279999, 180, "*ABC14*", -1, "", -1, "" },
|
||||
/* 11*/ { BARCODE_CODE39, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "ABC14", -1, 0, 116.279999, 180, "*ABC14*", -1, "ABC14", -1, "" },
|
||||
/* 12*/ { BARCODE_CODE39, -1, 1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116.279999, 206, "*ABC14_*", -1, "", -1, "" }, /* Check digit space rendered as underscore */
|
||||
/* 13*/ { BARCODE_CODE39, -1, 1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "ABC14", -1, 0, 116.279999, 206, "*ABC14_*", -1, "ABC14 ", -1, "" },
|
||||
/* 14*/ { BARCODE_POSTNET, -1, -1, BARCODE_MEMORY_FILE, "12345", -1, 0, 24, 126, "", -1, "", -1, "" },
|
||||
/* 15*/ { BARCODE_POSTNET, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345", -1, 0, 24, 126, "", -1, "123455", -1, "" }, /* HRT not printed */
|
||||
/* 16*/ { BARCODE_POSTNET, 0, -1, BARCODE_MEMORY_FILE, "12345", -1, 0, 24, 126, "", -1, "", -1, "" },
|
||||
/* 17*/ { BARCODE_POSTNET, 0, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "12345", -1, 0, 24, 126, "", -1, "123455", -1, "" }, /* HRT not printed */
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length;
|
||||
int expected_length, expected_raw_length;
|
||||
|
||||
testStartSymbol("test_hrt_raw_text", &symbol);
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -3188,6 +3190,7 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
|
|||
-1 /*option_1*/, data[i].option_2, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, data[i].length, debug);
|
||||
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
|
||||
expected_raw_length = data[i].expected_raw_length == -1 ? (int) strlen(data[i].expected_raw) : data[i].expected_raw_length;
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n",
|
||||
|
@ -3197,6 +3200,19 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
|
|||
i, symbol->text_length, expected_length, symbol->text);
|
||||
assert_zero(memcmp(symbol->text, data[i].expected, expected_length), "i:%d memcmp(%s, %s, %d) != 0\n",
|
||||
i, symbol->text, data[i].expected, expected_length);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
"i:%d memcmp(%.*s, %.*s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, expected_raw_length,
|
||||
data[i].expected_raw, expected_raw_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ret = ZBarcode_Print(symbol, 0);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Print(%s) ret %d != %d (%s)\n",
|
||||
|
|
|
@ -302,7 +302,7 @@ void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size) {
|
|||
for (i = 0; i < ZINT_TEST_CTX_EXC_MAX; i++) {
|
||||
ctx.exclude[i] = ctx.exclude_end[i] = -1;
|
||||
}
|
||||
ctx.generate = ctx.debug = 0;
|
||||
ctx.arg = ctx.generate = ctx.debug = 0;
|
||||
|
||||
if (argc) {
|
||||
const char *filename;
|
||||
|
@ -401,6 +401,18 @@ void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size) {
|
|||
exclude_idx++;
|
||||
}
|
||||
}
|
||||
} else if (strcmp(argv[i], "-a") == 0) {
|
||||
if (i + 1 == argc) {
|
||||
fprintf(stderr, "***testRun: -a argument value missing, ignoring***\n");
|
||||
} else {
|
||||
int a;
|
||||
opt_arg = argv[++i];
|
||||
if (!validate_int(opt_arg, &a)) {
|
||||
fprintf(stderr, "***testRun: -a argument value invalid, ignoring***\n");
|
||||
} else {
|
||||
ctx.arg = a;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "***testRun: unknown arg '%s', ignoring***\n", argv[i]);
|
||||
}
|
||||
|
@ -417,6 +429,7 @@ void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size) {
|
|||
if (func_match && strstr(funcs[i].name, func_match) == NULL) {
|
||||
continue;
|
||||
}
|
||||
ctx.func_name = funcs[i].name;
|
||||
(*funcs[i].func)(&ctx);
|
||||
ran++;
|
||||
}
|
||||
|
@ -508,7 +521,6 @@ const char *testUtilErrorName(int error_number) {
|
|||
int val;
|
||||
};
|
||||
static const struct item data[] = {
|
||||
{ "ZINT_WARN_HRT_RAW_TEXT", ZINT_WARN_HRT_RAW_TEXT, -1 },
|
||||
{ "0", 0, 0 },
|
||||
{ "ZINT_WARN_HRT_TRUNCATED", ZINT_WARN_HRT_TRUNCATED, 1 },
|
||||
{ "ZINT_WARN_INVALID_OPTION", ZINT_WARN_INVALID_OPTION, 2 },
|
||||
|
@ -525,19 +537,18 @@ const char *testUtilErrorName(int error_number) {
|
|||
{ "ZINT_ERROR_USES_ECI", ZINT_ERROR_USES_ECI, 13 },
|
||||
{ "ZINT_ERROR_NONCOMPLIANT", ZINT_ERROR_NONCOMPLIANT, 14 },
|
||||
{ "ZINT_ERROR_HRT_TRUNCATED", ZINT_ERROR_HRT_TRUNCATED, 15 },
|
||||
{ "ZINT_ERROR_HRT_RAW_TEXT", ZINT_ERROR_HRT_RAW_TEXT, 16 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
|
||||
if (error_number + 1 < 0 || error_number + 1 >= data_size) {
|
||||
if (error_number < 0 || error_number >= data_size) {
|
||||
return "";
|
||||
}
|
||||
/* Self-check */
|
||||
if (data[error_number + 1].val != error_number || (data[error_number + 1].define != error_number)) {
|
||||
if (data[error_number].val != error_number || (data[error_number].define != error_number)) {
|
||||
fprintf(stderr, "testUtilErrorName: data table out of sync (%d)\n", error_number);
|
||||
abort();
|
||||
}
|
||||
return data[error_number + 1].name;
|
||||
return data[error_number].name;
|
||||
}
|
||||
|
||||
/* Pretty name for input mode */
|
||||
|
@ -564,10 +575,10 @@ const char *testUtilInputModeName(int input_mode) {
|
|||
return "-1";
|
||||
}
|
||||
*buf = '\0';
|
||||
if ((input_mode & 0x7) & UNICODE_MODE) {
|
||||
if ((input_mode & 0x07) & UNICODE_MODE) {
|
||||
strcpy(buf, "UNICODE_MODE");
|
||||
set = UNICODE_MODE;
|
||||
} else if ((input_mode & 0x7) & GS1_MODE) {
|
||||
} else if ((input_mode & 0x07) & GS1_MODE) {
|
||||
strcpy(buf, "GS1_MODE");
|
||||
set = GS1_MODE;
|
||||
} else {
|
||||
|
@ -760,8 +771,8 @@ int testUtilIsValidUTF8(const unsigned char str[], const int length) {
|
|||
/* Escape data for printing on generate test. Has a number of issues, e.g. need to use octal escapes */
|
||||
char *testUtilEscape(const char *buffer, const int length, char *escaped, const int escaped_size) {
|
||||
int i;
|
||||
unsigned char *b = (unsigned char *) buffer;
|
||||
unsigned char *be = b + length;
|
||||
const unsigned char *b = (const unsigned char *) buffer;
|
||||
const unsigned char *be = b + length;
|
||||
int non_utf8 = !testUtilIsValidUTF8(b, length);
|
||||
int chunk = -1;
|
||||
|
||||
|
@ -776,28 +787,67 @@ char *testUtilEscape(const char *buffer, const int length, char *escaped, const
|
|||
}
|
||||
i += 3;
|
||||
}
|
||||
if (non_utf8 || *b < ' ' || *b == '\177') {
|
||||
if (i + 4 < escaped_size) {
|
||||
sprintf(escaped + i, "\\%.3o", *b);
|
||||
if (non_utf8) {
|
||||
if (!z_isascii(*b) || z_iscntrl(*b)) {
|
||||
if (i + 4 < escaped_size) {
|
||||
sprintf(escaped + i, "\\%.3o", *b);
|
||||
}
|
||||
i += 4;
|
||||
} else {
|
||||
escaped[i++] = *b;
|
||||
}
|
||||
i += 4;
|
||||
} else if (*b == '\\' || *b == '"') {
|
||||
if (i + 2 < escaped_size) {
|
||||
escaped[i] = '\\';
|
||||
escaped[i + 1] = *b;
|
||||
}
|
||||
i += 2;
|
||||
} else if (b + 1 < be && *b == 0xC2 && *(b + 1) < 0xA0) {
|
||||
if (i + 8 < escaped_size) {
|
||||
sprintf(escaped + i, "\\%.3o\\%.3o", *b, *(b + 1));
|
||||
} else if (z_iscntrl(*b)) {
|
||||
if (i + 4 < escaped_size) {
|
||||
sprintf(escaped + i, "\\%.3o", *b);
|
||||
}
|
||||
i += 8;
|
||||
b++;
|
||||
} else {
|
||||
i += 4;
|
||||
} else if (z_isascii(*b)) {
|
||||
escaped[i++] = *b;
|
||||
} else {
|
||||
assert(b + 1 < be);
|
||||
if (*b == 0xC2 && *(b + 1) < 0xA0) {
|
||||
if (i + 8 < escaped_size) {
|
||||
sprintf(escaped + i, "\\%.3o\\%.3o", *b, *(b + 1));
|
||||
}
|
||||
i += 8;
|
||||
b++;
|
||||
} else if (*b < 0xE0) {
|
||||
if (i + 2 < escaped_size) {
|
||||
escaped[i] = *b;
|
||||
escaped[i + 1] = *(b + 1);
|
||||
}
|
||||
i += 2;
|
||||
b++;
|
||||
} else if (*b < 0xF0) {
|
||||
assert(b + 2 < be);
|
||||
if (i + 3 < escaped_size) {
|
||||
escaped[i] = *b;
|
||||
escaped[i + 1] = *(b + 1);
|
||||
escaped[i + 2] = *(b + 2);
|
||||
}
|
||||
i += 3;
|
||||
b += 2;
|
||||
} else {
|
||||
assert(b + 3 < be);
|
||||
if (i + 4 < escaped_size) {
|
||||
escaped[i] = *b;
|
||||
escaped[i + 1] = *(b + 1);
|
||||
escaped[i + 2] = *(b + 2);
|
||||
escaped[i + 3] = *(b + 3);
|
||||
}
|
||||
i += 4;
|
||||
b += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i >= escaped_size) {
|
||||
fprintf(stderr, "testUtilEscape: escape buffer size %d too small\n", escaped_size);
|
||||
return NULL;
|
||||
}
|
||||
escaped[i] = '\0';
|
||||
|
@ -2541,13 +2591,13 @@ static void testUtilBwippCvtGS1Data(char *bwipp_data, const int upcean, const in
|
|||
/* Convert data to Ghostscript format for passing to bwipp_dump.ps */
|
||||
static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const char *data, int length,
|
||||
int zint_escape_mode, int eci, int *parse, int *parsefnc) {
|
||||
const int init_parsefnc = *parsefnc == 1;
|
||||
char *b = bwipp_data;
|
||||
char *be = b + bwipp_data_size;
|
||||
unsigned char *d = (unsigned char *) data;
|
||||
unsigned char *de = (unsigned char *) data + length;
|
||||
int have_done_single_caret = 0; /* Flag to help debug escaping of carets */
|
||||
|
||||
if (eci && !init_parsefnc) {
|
||||
if (eci && !*parsefnc) {
|
||||
sprintf(bwipp_data, "^ECI%06d", eci);
|
||||
*parsefnc = 1;
|
||||
b = bwipp_data + 10;
|
||||
|
@ -2556,15 +2606,30 @@ static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const ch
|
|||
while (b < be && d < de) {
|
||||
/* Have to escape double quote otherwise Ghostscript gives "Unterminated quote in @-file" for some reason */
|
||||
/* Escape single quote also to avoid having to do proper shell escaping TODO: proper shell escaping */
|
||||
if (*d < 0x20 || *d >= 0x7F || (*d == '^' && !init_parsefnc) || *d == '"' || *d == '\''
|
||||
if (*d < 0x20 || *d >= 0x7F || (*d == '^' && !*parsefnc) || *d == '"' || *d == '\''
|
||||
|| *d == '(' || (*d == '\\' && !zint_escape_mode)) {
|
||||
if (b + 4 >= be) {
|
||||
fprintf(stderr, "testUtilBwippEscape: double quote bwipp_data buffer full (%d)\n", bwipp_data_size);
|
||||
return NULL;
|
||||
}
|
||||
have_done_single_caret |= *d == '^'; /* Flag non-doubled caret */
|
||||
sprintf(b, "^%03u", *d++);
|
||||
b += 4;
|
||||
*parse = 1;
|
||||
/* Have to double up carets if `parsefnc` and not ECI/FNC */
|
||||
} else if (*d == '^' && *parsefnc
|
||||
&& (d + 4 >= de || (memcmp(d + 1, "ECI", 3) != 0 && memcmp(d + 1, "FNC", 3) != 0))) {
|
||||
if (b + 2 >= be) {
|
||||
fprintf(stderr, "testUtilBwippEscape: double caret bwipp_data buffer full (%d)\n", bwipp_data_size);
|
||||
return NULL;
|
||||
}
|
||||
strcpy(b, "^^");
|
||||
d++;
|
||||
b += 2;
|
||||
if (have_done_single_caret) {
|
||||
/* `parsefnc` changed while escaping (see FNC1 processing below) - may cause test to fail */
|
||||
fprintf(stderr, "testUtilBwippEscape: WARNING: already escaped caret singularly\n");
|
||||
}
|
||||
} else if (zint_escape_mode && *d == '\\' && d + 1 < de) {
|
||||
int val;
|
||||
switch (*++d) {
|
||||
|
@ -2620,12 +2685,13 @@ static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const ch
|
|||
d++;
|
||||
if (*d == '1') {
|
||||
if (b + 5 >= be) {
|
||||
fprintf(stderr, "testUtilBwippEscape: FNC1 bwipp_data buffer full (%d)\n", bwipp_data_size);
|
||||
fprintf(stderr, "testUtilBwippEscape: FNC1 bwipp_data buffer full (%d)\n",
|
||||
bwipp_data_size);
|
||||
return NULL;
|
||||
}
|
||||
strcpy(b, "^FNC1");
|
||||
b += 5;
|
||||
*parsefnc = 1;
|
||||
*parsefnc = 1; /* See `have_done_single_caret` above for issues this may cause */
|
||||
}
|
||||
} else {
|
||||
if (b + 8 >= be) {
|
||||
|
@ -2680,7 +2746,8 @@ static char *testUtilBwippUtf8Convert(const int index, const int symbology, cons
|
|||
int eci = *p_eci;
|
||||
|
||||
if (eci == 0 && try_sjis
|
||||
&& (symbology == BARCODE_QRCODE || symbology == BARCODE_MICROQR || symbology == BARCODE_RMQR || symbology == BARCODE_UPNQR)) {
|
||||
&& (symbology == BARCODE_QRCODE || symbology == BARCODE_MICROQR || symbology == BARCODE_RMQR
|
||||
|| symbology == BARCODE_UPNQR)) {
|
||||
if (symbology == BARCODE_UPNQR) { /* Note need to add "force binary mode" to BWIPP for this to work */
|
||||
if (utf8_to_eci(4, data, converted, p_data_len) != 0) {
|
||||
fprintf(stderr, "i:%d testUtilBwippUtf8Convert: failed to convert UTF-8 data for %s, ECI 4\n",
|
||||
|
@ -2745,13 +2812,13 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|
|||
static const char cmd_opts_fmt2[] = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%.2040s' -sd2='%s' -so='%s'"
|
||||
" backend/tests/tools/bwipp_dump.ps";
|
||||
/* If data > ~4K and < ~6K */
|
||||
static const char cmd_fmt3[] = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%.2040s' -sd2='%.2040s' -sd3='%s'"
|
||||
" backend/tests/tools/bwipp_dump.ps";
|
||||
static const char cmd_opts_fmt3[] = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%.2040s' -sd2='%.2040s' -sd3='%s'"
|
||||
" -so='%s' backend/tests/tools/bwipp_dump.ps";
|
||||
static const char cmd_fmt3[] = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%.2040s' -sd2='%.2040s'"
|
||||
" -sd3='%s' backend/tests/tools/bwipp_dump.ps";
|
||||
static const char cmd_opts_fmt3[] = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%.2040s' -sd2='%.2040s'"
|
||||
" -sd3='%s' -so='%s' backend/tests/tools/bwipp_dump.ps";
|
||||
/* If data > ~6K and < ~8K */
|
||||
static const char cmd_fmt4[] = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%.2040s' -sd2='%.2040s' -sd3='%.2040s'"
|
||||
" -sd4='%s' backend/tests/tools/bwipp_dump.ps";
|
||||
static const char cmd_fmt4[] = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%.2040s' -sd2='%.2040s'"
|
||||
" -sd3='%.2040s' -sd4='%s' backend/tests/tools/bwipp_dump.ps";
|
||||
static const char cmd_opts_fmt4[] = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%.2040s' -sd2='%.2040s'"
|
||||
" -sd3='%.2040s' -sd4='%s' -so='%s' backend/tests/tools/bwipp_dump.ps";
|
||||
|
||||
|
@ -2895,9 +2962,11 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (symbol->input_mode & GS1NOCHECK_MODE) {
|
||||
/* sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sdontlint", strlen(bwipp_opts_buf) ? " " : ""); */
|
||||
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sdontlint", strlen(bwipp_opts_buf) ? " " : "");
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
const int is_extra_escaped = (symbol->input_mode & EXTRA_ESCAPE_MODE)
|
||||
&& symbol->symbology == BARCODE_CODE128;
|
||||
|
@ -3011,7 +3080,8 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|
|||
|| symbology == BARCODE_USPS_IMAIL || symbology == BARCODE_AUSPOST
|
||||
|| symbology == BARCODE_PHARMA_TWO) {
|
||||
for (r = 0; r < symbol->rows; r++) bwipp_row_height[r] = 1; /* Zap */
|
||||
if (symbology == BARCODE_RM4SCC || symbology == BARCODE_KIX || symbology == BARCODE_JAPANPOST || symbology == BARCODE_DAFT) {
|
||||
if (symbology == BARCODE_RM4SCC || symbology == BARCODE_KIX || symbology == BARCODE_JAPANPOST
|
||||
|| symbology == BARCODE_DAFT) {
|
||||
to_upper((unsigned char *) bwipp_data, (int) strlen(bwipp_data));
|
||||
} else if (symbology == BARCODE_USPS_IMAIL) {
|
||||
char *dash = strchr(bwipp_data, '-');
|
||||
|
@ -3505,7 +3575,8 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|
|||
}
|
||||
cnt = (int) fread(b, 1, symbol->width, fp);
|
||||
if (cnt != symbol->width) {
|
||||
fprintf(stderr, "i:%d testUtilBwipp: failed to read row %d of %d, symbol->width %d bytes, cnt %d (%s)\n",
|
||||
fprintf(stderr,
|
||||
"i:%d testUtilBwipp: failed to read row %d of %d, symbol->width %d bytes, cnt %d (%s)\n",
|
||||
index, r + 1, symbol->rows, symbol->width, cnt, cmd);
|
||||
testutil_pclose(fp);
|
||||
return -1;
|
||||
|
@ -3544,7 +3615,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|
|||
int testUtilBwippSegs(int index, struct zint_symbol *symbol, int option_1, int option_2, int option_3,
|
||||
const struct zint_seg segs[], const int seg_count, const char *primary, char *buffer, int buffer_size) {
|
||||
const int symbology = symbol->symbology;
|
||||
const int unicode_mode = (symbol->input_mode & 0x7) == UNICODE_MODE;
|
||||
const int unicode_mode = (symbol->input_mode & 0x07) == UNICODE_MODE;
|
||||
const int symbol_eci = symbol->eci;
|
||||
struct zint_seg *local_segs = (struct zint_seg *) z_alloca(sizeof(struct zint_seg) * seg_count);
|
||||
int total_len = 0;
|
||||
|
@ -3619,7 +3690,8 @@ int testUtilBwippSegs(int index, struct zint_symbol *symbol, int option_1, int o
|
|||
}
|
||||
symbol->eci = 0;
|
||||
|
||||
ret = testUtilBwipp(index, symbol, option_1, option_2, option_3, data, total_len, primary, buffer, buffer_size, &parsefnc);
|
||||
ret = testUtilBwipp(index, symbol, option_1, option_2, option_3, data, total_len, primary, buffer, buffer_size,
|
||||
&parsefnc);
|
||||
|
||||
if (unicode_mode) {
|
||||
symbol->input_mode = UNICODE_MODE;
|
||||
|
@ -3707,17 +3779,6 @@ int testUtilHaveZXingCPPDecoder(void) {
|
|||
return system("zxingcppdecoder " DEV_NULL_STDERR) == 0;
|
||||
}
|
||||
|
||||
/* Helper to test whether have non-ASCII */
|
||||
static int testUtilHasNonASCII(const char *source, const int length) {
|
||||
int i;
|
||||
for (i = 0; i < length; i++) {
|
||||
if (source[i] & 0x80) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Map Zint symbology to ZXing-C++ format name */
|
||||
static const char *testUtilZXingCPPName(int index, const struct zint_symbol *symbol, const char *source,
|
||||
const int length, const int debug) {
|
||||
|
@ -3896,15 +3957,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (symbology == BARCODE_QRCODE || symbology == BARCODE_HIBC_QR || symbology == BARCODE_MICROQR
|
||||
|| symbology == BARCODE_RMQR) {
|
||||
const int full_multibyte = (symbol->option_3 & 0xFF) == ZINT_FULL_MULTIBYTE;
|
||||
if (full_multibyte && testUtilHasNonASCII(source, length)) { /* TODO: Support in ZXing-C++ */
|
||||
printf("i:%d %s not ZXing-C++ compatible, ZINT_FULL_MULTIBYTE not supported (with non-ASCII data)\n",
|
||||
index, testUtilBarcodeName(symbology));
|
||||
return NULL;
|
||||
}
|
||||
} else if (symbology == BARCODE_CODABLOCKF || symbology == BARCODE_HIBC_BLOCKF) {
|
||||
if (symbology == BARCODE_CODABLOCKF || symbology == BARCODE_HIBC_BLOCKF) {
|
||||
if (symbol->rows == 1) { /* Single row i.e. CODE128 not supported */
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) {
|
||||
printf("i:%d %s not ZXing-C++ compatible, single row not supported\n",
|
||||
|
@ -3937,9 +3990,35 @@ int testUtilCanZXingCPP(int index, const struct zint_symbol *symbol, const char
|
|||
return testUtilZXingCPPName(index, symbol, source, length, debug) != NULL;
|
||||
}
|
||||
|
||||
static const char *testUtilZXingCPPCharSet(int eci) {
|
||||
static const struct { int eci; const char *charset; } charsets[] = {
|
||||
{ 3, "ISO-8859-1" }, { 4, "ISO-8859-2" }, { 5, "ISO-8859-3" }, { 6, "ISO-8859-4" },
|
||||
{ 7, "ISO-8859-5" }, { 8, "ISO-8859-6" }, { 9, "ISO-8859-7" }, { 10, "ISO-8859-8" },
|
||||
{ 11, "ISO-8859-9" }, { 12, "ISO-8859-10" }, { 13, "ISO-8859-11" }, { 15, "ISO-8859-13" },
|
||||
{ 16, "ISO-8859-14" }, { 17, "ISO-8859-15" }, { 18, "ISO-8859-16" }, { 20, "Shift_JIS" },
|
||||
{ 21, "Cp1250" }, { 22, "Cp1251" }, { 23, "Cp1252" }, { 24, "Cp1256" },
|
||||
{ 25, "UTF-16BE" }, { 26, "UTF-8" }, { 27, "ASCII" }, { 28, "Big5" },
|
||||
{ 29, "GB2312" }, { 30, "EUC-CN" }, { 31, "GBK" }, { 32, "GB18030" },
|
||||
{ 33, "UTF-16LE" }, { 34, "UTF-32BE" }, { 35, "UTF-32LE" }, { 170, "ASCII" },
|
||||
{ 899, "BINARY" },
|
||||
};
|
||||
int s = 0, e = ARRAY_SIZE(charsets);
|
||||
while (s < e) {
|
||||
const int m = s + (e - s) / 2;
|
||||
if (charsets[m].eci < eci) {
|
||||
s = m + 1;
|
||||
} else if (charsets[m].eci > eci) {
|
||||
e = m;
|
||||
} else {
|
||||
return charsets[m].charset;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Run "zxingcppdecoder", returning result in `buffer` */
|
||||
int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, const int length, char *bits,
|
||||
char *buffer, const int buffer_size, int *p_cmp_len) {
|
||||
int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, const int length, const char *bits,
|
||||
const int zxingcpp_cmp, char *buffer, const int buffer_size, int *p_cmp_len) {
|
||||
static const char cmd_fmt[] = "zxingcppdecoder -textonly -format %s -width %d -bits '%s'";
|
||||
static const char opts_cmd_fmt[] = "zxingcppdecoder -textonly -format %s -opts '%s' -width %d -bits '%s'";
|
||||
static const char cs_cmd_fmt[] = "zxingcppdecoder -textonly -format %s -charset %s -width %d -bits '%s'";
|
||||
|
@ -3950,7 +4029,7 @@ int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source,
|
|||
char *cmd = (char *) z_alloca(bits_len + 1024);
|
||||
const char *zxingcpp_barcode = NULL;
|
||||
const int data_mode = (symbol->input_mode & 0x07) == DATA_MODE;
|
||||
int set_charset = 0;
|
||||
const char *charset = NULL;
|
||||
const char *opts = NULL;
|
||||
|
||||
FILE *fp = NULL;
|
||||
|
@ -3974,23 +4053,11 @@ int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source,
|
|||
opts = "validateCode39CheckSum";
|
||||
}
|
||||
|
||||
if ((symbol->input_mode & 0x07) == UNICODE_MODE && symbol->eci == 0
|
||||
&& (symbology == BARCODE_QRCODE || symbology == BARCODE_MICROQR || symbology == BARCODE_HANXIN)) {
|
||||
int converted_len = length;
|
||||
unsigned char *converted_buf = (unsigned char *) z_alloca(converted_len + 1);
|
||||
if (symbology == BARCODE_HANXIN) {
|
||||
set_charset = utf8_to_eci(0, (const unsigned char *) source, converted_buf, &converted_len) != 0;
|
||||
} else {
|
||||
set_charset = utf8_to_eci(0, (const unsigned char *) source, converted_buf, &converted_len) == 0;
|
||||
}
|
||||
if (zxingcpp_cmp > 1 && symbol->eci == 0) {
|
||||
charset = testUtilZXingCPPCharSet(zxingcpp_cmp);
|
||||
assert(charset);
|
||||
}
|
||||
if (set_charset) {
|
||||
const char *charset;
|
||||
if (symbology == BARCODE_HANXIN) {
|
||||
charset = "GB18030";
|
||||
} else {
|
||||
charset = "ISO8859_1";
|
||||
}
|
||||
if (charset) {
|
||||
sprintf(cmd, cs_cmd_fmt, zxingcpp_barcode, charset, width, bits);
|
||||
} else if (opts) {
|
||||
sprintf(cmd, opts_cmd_fmt, zxingcpp_barcode, opts, width, bits);
|
||||
|
@ -4024,8 +4091,8 @@ int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source,
|
|||
|
||||
testutil_pclose(fp);
|
||||
|
||||
if ((data_mode && is_eci_convertible(symbol->eci)) || symbol->eci >= 899) {
|
||||
const int eci = symbol->eci >= 899 ? 3 : symbol->eci;
|
||||
if ((data_mode && zxingcpp_cmp > 1 && (zxingcpp_cmp == 899 || is_eci_convertible(zxingcpp_cmp))) || symbol->eci >= 899) {
|
||||
const int eci = symbol->eci > 899 ? 3 : zxingcpp_cmp;
|
||||
int error_number;
|
||||
const int eci_length = get_eci_length(eci, (const unsigned char *) buffer, cnt);
|
||||
unsigned char *preprocessed = (unsigned char *) z_alloca(eci_length + 1);
|
||||
|
@ -4101,8 +4168,8 @@ static int textUtilZXingCPPDX(const char *expected, const int expected_len, cons
|
|||
}
|
||||
|
||||
/* Massage result from "zxingcppdecoder" so as can compare to Zint input */
|
||||
int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, int cmp_len,
|
||||
const char *expected, int expected_len, const char *primary, char *ret_buf, int *p_ret_len) {
|
||||
int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, int cmp_len, const char *expected,
|
||||
int expected_len, const char *primary, char *ret_buf, int *p_ret_len) {
|
||||
const int symbology = symbol->symbology;
|
||||
|
||||
const int is_gs1_128_dbar_exp = symbology == BARCODE_GS1_128 || symbology == BARCODE_DBAR_EXP
|
||||
|
@ -4150,7 +4217,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
|
|||
(unsigned char *) escaped);
|
||||
if (ret != 0) {
|
||||
sprintf(msg, "escape_char_process %d != 0", ret);
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
if (is_extra_escaped) {
|
||||
/* Remove any Code 128 special escapes */
|
||||
|
@ -4193,7 +4260,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
|
|||
&expected_len);
|
||||
if (ret >= ZINT_ERROR) {
|
||||
sprintf(msg, "gs1_verify %d != 0", ret);
|
||||
return 4;
|
||||
return 3;
|
||||
}
|
||||
expected = reduced;
|
||||
if (primary) {
|
||||
|
@ -4207,7 +4274,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
|
|||
to_upper((unsigned char *) (hibc + 1), expected_len);
|
||||
if (not_sane_lookup(TECHNETIUM, sizeof(TECHNETIUM) - 1, (unsigned char *) (hibc + 1), expected_len, posns)) {
|
||||
sprintf(msg, "HIBC not_sane_lookup(TECHNETIUM) failed");
|
||||
return 5;
|
||||
return 4;
|
||||
}
|
||||
counter = 41;
|
||||
for (i = 0; i < expected_len && i < 110; i++) {
|
||||
|
@ -4521,7 +4588,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
|
|||
|
||||
if (cmp_len != expected_len) {
|
||||
sprintf(msg, "cmp_len %d != expected_len %d", cmp_len, expected_len);
|
||||
return 2;
|
||||
return 5;
|
||||
}
|
||||
ret_memcmp = memcmp(cmp_buf, expected, expected_len);
|
||||
if (ret_memcmp != 0) {
|
||||
|
@ -4531,7 +4598,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
|
|||
}
|
||||
}
|
||||
sprintf(msg, "memcmp %d != 0, at %d, len %d", ret_memcmp, i, expected_len);
|
||||
return ret_memcmp;
|
||||
return ret_memcmp + 10;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -47,6 +47,7 @@ extern "C" {
|
|||
#define ZINT_DEBUG_TEST_BWIPP 128
|
||||
#define ZINT_DEBUG_TEST_PERFORMANCE 256
|
||||
#define ZINT_DEBUG_TEST_ZXINGCPP 512
|
||||
#define ZINT_DEBUG_TEST_BWIPP_ZXINGCPP 1024
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
@ -91,10 +92,12 @@ void testReport(void);
|
|||
|
||||
#define ZINT_TEST_CTX_EXC_MAX 32
|
||||
typedef struct s_testCtx {
|
||||
const char *func_name;
|
||||
int index;
|
||||
int index_end;
|
||||
int exclude[ZINT_TEST_CTX_EXC_MAX];
|
||||
int exclude_end[ZINT_TEST_CTX_EXC_MAX];
|
||||
int arg;
|
||||
int generate;
|
||||
int debug;
|
||||
} testCtx;
|
||||
|
@ -208,12 +211,10 @@ int testUtilBwippCmpRow(const struct zint_symbol *symbol, int row, char *msg, co
|
|||
int testUtilHaveZXingCPPDecoder(void);
|
||||
int testUtilCanZXingCPP(int index, const struct zint_symbol *symbol, const char *data, const int length,
|
||||
const int debug);
|
||||
int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, const int length, char *bits,
|
||||
char *buffer, const int buffer_size, int *p_cmp_len);
|
||||
int testUtilZXingCPPSegs(int index, struct zint_symbol *symbol, const struct zint_seg segs[], const int seg_count, char *bits,
|
||||
char *buffer, const int buffer_size, int *p_cmp_len);
|
||||
int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, int cmp_len,
|
||||
const char *expected, int expected_len, const char *primary, char *ret_buf, int *p_ret_len);
|
||||
int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, const int length, const char *bits,
|
||||
const int zxingcpp_cmp, char *buffer, const int buffer_size, int *p_cmp_len);
|
||||
int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, int cmp_len, const char *expected,
|
||||
int expected_len, const char *primary, char *ret_buf, int *p_ret_len);
|
||||
int testUtilZXingCPPCmpSegs(struct zint_symbol *symbol, char *msg, char *cmp_buf, int cmp_len,
|
||||
const struct zint_seg segs[], const int seg_count, const char *primary, char *ret_buf, int *p_ret_len);
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue