1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-06-15 10:03:36 +00:00

RAW_TEXT: expand UPC-A, UPC-E to EAN-13, and EAN-8 if has add-on,

and place any add-on data directly after (no separator)
EAN-8 + add-on: warn as non-compliant (see ZXing-C++ issue #883,
  https://github.com/zxing-cpp/zxing-cpp/issues/883)
test suite: BWIPP: use new EAN-8 + add-on option "permitaddon";
  fix dumps of RAW_TEXT `memcmp()`s fails; various re-formatting
bwipp_dump.ps: update to latest BWIPP
This commit is contained in:
gitlost
2025-04-11 13:02:59 +01:00
parent 182c84fa4d
commit 26805338f8
36 changed files with 1273 additions and 908 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
Version 2.15.0.9 (dev) not released yet (2025-04-09) Version 2.15.0.9 (dev) not released yet (2025-04-11)
==================================================== ====================================================
**Incompatible changes** **Incompatible changes**
@@ -11,6 +11,7 @@ Version 2.15.0.9 (dev) not released yet (2025-04-09)
- New Qt Backend method `isBindable()` for new flag `ZINT_CAP_BINDABLE` - New Qt Backend method `isBindable()` for new flag `ZINT_CAP_BINDABLE`
- GS1 Composites now return warning if CC type upped from requested due to size - GS1 Composites now return warning if CC type upped from requested due to size
of composite data of composite data
- EAN-8 with add-on now returns warning that it's non-standard
Changes Changes
------- -------
@@ -30,6 +31,7 @@ Changes
`ZINT_CAP_STACKABLE`, and new Qt Backend method `isBindable()` `ZINT_CAP_STACKABLE`, and new Qt Backend method `isBindable()`
- DOTCODE: now pads rows if given number of columns instead of failing if rows - DOTCODE: now pads rows if given number of columns instead of failing if rows
below min (5) below min (5)
- EAN-8 + add-on: warn as non-compliant
Bugs Bugs
---- ----
+5
View File
@@ -1456,8 +1456,13 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
} }
} else { } else {
/* If symbol->height given then min row height was returned, else default height */ /* If symbol->height given then min row height was returned, else default height */
if (error_number == 0) { /* Avoid overwriting any previous warning (e.g. EAN-8 with add-on) */
error_number = set_height(symbol, symbol->height ? linear->height : 0.0f, error_number = set_height(symbol, symbol->height ? linear->height : 0.0f,
symbol->height ? 0.0f : linear->height, 0.0f, 0 /*no_errtxt*/); symbol->height ? 0.0f : linear->height, 0.0f, 0 /*no_errtxt*/);
} else {
(void) set_height(symbol, symbol->height ? linear->height : 0.0f,
symbol->height ? 0.0f : linear->height, 0.0f, 1 /*no_errtxt*/);
}
} }
} else { } else {
if (symbol->symbology == BARCODE_DBAR_STK_CC) { if (symbol->symbology == BARCODE_DBAR_STK_CC) {
+3 -2
View File
@@ -213,8 +213,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+3 -2
View File
@@ -167,8 +167,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+3 -2
View File
@@ -125,8 +125,9 @@ static void test_input(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+42 -21
View File
@@ -84,14 +84,16 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
symbol->debug |= debug; symbol->debug |= debug;
size = data[i].width * data[i].height; size = data[i].width * data[i].height;
assert_nonzero(size < (int) sizeof(data_buf), "i:%d bmp_pixel_plot size %d < sizeof(data_buf) %d\n", i, size, (int) sizeof(data_buf)); assert_nonzero(size < (int) sizeof(data_buf), "i:%d bmp_pixel_plot size %d < sizeof(data_buf) %d\n",
i, size, (int) sizeof(data_buf));
if (data[i].repeat) { if (data[i].repeat) {
testUtilStrCpyRepeat(data_buf, data[i].pattern, size); testUtilStrCpyRepeat(data_buf, data[i].pattern, size);
} else { } else {
strcpy(data_buf, data[i].pattern); strcpy(data_buf, data[i].pattern);
} }
assert_equal(size, (int) strlen(data_buf), "i:%d bmp_pixel_plot size %d != strlen(data_buf) %d\n", i, size, (int) strlen(data_buf)); assert_equal(size, (int) strlen(data_buf), "i:%d bmp_pixel_plot size %d != strlen(data_buf) %d\n",
i, size, (int) strlen(data_buf));
if (*data_buf > '9') { if (*data_buf > '9') {
symbol->symbology = BARCODE_ULTRA; symbol->symbology = BARCODE_ULTRA;
@@ -100,7 +102,8 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
symbol->bitmap = (unsigned char *) data_buf; symbol->bitmap = (unsigned char *) data_buf;
ret = bmp_pixel_plot(symbol, TCU(data_buf)); ret = bmp_pixel_plot(symbol, TCU(data_buf));
assert_equal(ret, data[i].ret, "i:%d bmp_pixel_plot ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d bmp_pixel_plot ret %d != %d (%s)\n",
i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
if (have_identify) { if (have_identify) {
@@ -164,7 +167,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) { if (p_ctx->generate) {
char data_dir_path[1024]; char data_dir_path[1024];
assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL), "testUtilDataPath(%s) == 0\n", data_dir); assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL),
"testUtilDataPath(%s) == 0\n", data_dir);
if (!testUtilDirExists(data_dir_path)) { if (!testUtilDirExists(data_dir_path)) {
ret = testUtilMkDir(data_dir_path); ret = testUtilMkDir(data_dir_path);
assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno)); assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno));
@@ -178,7 +182,9 @@ static void test_print(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
data[i].option_1, data[i].option_2, -1 /*option_3*/, data[i].output_options,
data[i].data, -1, debug);
if (data[i].border_width != -1) { if (data[i].border_width != -1) {
symbol->border_width = data[i].border_width; symbol->border_width = data[i].border_width;
} }
@@ -196,35 +202,44 @@ static void test_print(const testCtx *const p_ctx) {
} }
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, bmp); strcpy(symbol->outfile, bmp);
ret = ZBarcode_Print(symbol, 0); ret = ZBarcode_Print(symbol, 0);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file),
"i:%d testUtilDataPath == 0\n", i);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %d, %s, %d, %d, %d, %d, \"%s\", \"%s\", \"%s\", \"%s\"},\n", printf(" /*%3d*/ { %s, %d, %s, %d, %d, %d, %d, \"%s\", \"%s\", \"%s\", \"%s\"},\n",
i, testUtilBarcodeName(data[i].symbology), data[i].border_width, testUtilOutputOptionsName(data[i].output_options), i, testUtilBarcodeName(data[i].symbology), data[i].border_width,
testUtilOutputOptionsName(data[i].output_options),
data[i].whitespace_width, data[i].whitespace_height, data[i].whitespace_width, data[i].whitespace_height,
data[i].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour, data[i].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file); testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file);
ret = testUtilRename(symbol->outfile, expected_file); ret = testUtilRename(symbol->outfile, expected_file);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0 (%d: %s)\n", i, symbol->outfile, expected_file, ret, errno, strerror(errno)); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0 (%d: %s)\n",
i, symbol->outfile, expected_file, ret, errno, strerror(errno));
if (have_identify) { if (have_identify) {
ret = testUtilVerifyIdentify(have_identify, expected_file, debug); ret = testUtilVerifyIdentify(have_identify, expected_file, debug);
assert_zero(ret, "i:%d %s identify %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); assert_zero(ret, "i:%d %s identify %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
} }
} else { } else {
assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile); assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile);
assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file); assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file);
ret = testUtilCmpBins(symbol->outfile, expected_file); ret = testUtilCmpBins(symbol->outfile, expected_file);
assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size); /* For BARCODE_MEMORY_FILE */ /* For BARCODE_MEMORY_FILE */
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size);
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) { if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) {
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile); assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -237,8 +252,8 @@ static void test_print(const testCtx *const p_ctx) {
assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology)); assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology));
assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n", assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size); i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size);
assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size), "i:%d %s memcmp(memfile, filebuf) != 0\n", assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size),
i, testUtilBarcodeName(data[i].symbology)); "i:%d %s memcmp(memfile, filebuf) != 0\n", i, testUtilBarcodeName(data[i].symbology));
} }
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
@@ -266,15 +281,21 @@ static void test_outfile(const testCtx *const p_ctx) {
skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */
#endif #endif
if (!skip_readonly_test) { if (!skip_readonly_test) {
static char expected_errtxt[] = "601: Could not open BMP output file ("; /* Excluding OS-dependent `errno` stuff */ /* Excluding OS-dependent `errno` stuff */
static char expected_errtxt[] = "601: Could not open BMP output file (";
(void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */
assert_nonzero(testUtilCreateROFile(symbol.outfile), "bmp_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); assert_nonzero(testUtilCreateROFile(symbol.outfile),
"bmp_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
ret = bmp_pixel_plot(&symbol, data); ret = bmp_pixel_plot(&symbol, data);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "bmp_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "bmp_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n",
assert_zero(testUtilRmROFile(symbol.outfile), "bmp_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt);
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "bmp_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n",
symbol.errtxt, expected_errtxt);
} }
symbol.output_options |= BARCODE_STDOUT; symbol.output_options |= BARCODE_STDOUT;
+2 -2
View File
@@ -120,8 +120,8 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_length %d\n", "i:%d raw_segs[0].length %d != expected_length %d\n",
i, symbol->raw_segs[0].length, expected_length); i, symbol->raw_segs[0].length, expected_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length), assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
"i:%d memcmp(%s, %s, %d) != 0\n", "i:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected, expected_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected, expected_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+3 -2
View File
@@ -147,8 +147,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+2 -2
View File
@@ -143,8 +143,8 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_length %d\n", "i:%d raw_segs[0].length %d != expected_length %d\n",
i, symbol->raw_segs[0].length, expected_length); i, symbol->raw_segs[0].length, expected_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length), assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
"i:%d memcmp(%s, %s, %d) != 0\n", "i:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected, expected_length); i, expected_length, symbol->raw_segs[0].source, data[i].expected, expected_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+3 -3
View File
@@ -332,9 +332,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, expected_raw_length, i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
data[i].expected_raw, expected_raw_length); expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+27 -26
View File
@@ -53,21 +53,21 @@ static void test_eanx_leading_zeroes(const testCtx *const p_ctx) {
/* 5*/ { BARCODE_EANX_CC, "123456", "[21]A12345678", 0, 8, 72 }, /* 5*/ { BARCODE_EANX_CC, "123456", "[21]A12345678", 0, 8, 72 },
/* 6*/ { BARCODE_EANX_CC, "1234567", "[21]A12345678", 0, 8, 72 }, /* 6*/ { BARCODE_EANX_CC, "1234567", "[21]A12345678", 0, 8, 72 },
/* 7*/ { BARCODE_EANX_CC, "12345678", "[21]A12345678", 0, 7, 99 }, /* EAN-13 */ /* 7*/ { BARCODE_EANX_CC, "12345678", "[21]A12345678", 0, 7, 99 }, /* EAN-13 */
/* 8*/ { BARCODE_EANX_CC, "1+12", "[21]A12345678", 0, 8, 98 }, /* EAN-8 + EAN-2 */ /* 8*/ { BARCODE_EANX_CC, "1+12", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 98 }, /* EAN-8 + EAN-2 */
/* 9*/ { BARCODE_EANX_CC, "12+12", "[21]A12345678", 0, 8, 98 }, /* 9*/ { BARCODE_EANX_CC, "12+12", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 98 },
/*10*/ { BARCODE_EANX_CC, "123+12", "[21]A12345678", 0, 8, 98 }, /*10*/ { BARCODE_EANX_CC, "123+12", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 98 },
/*11*/ { BARCODE_EANX_CC, "1234+12", "[21]A12345678", 0, 8, 98 }, /*11*/ { BARCODE_EANX_CC, "1234+12", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 98 },
/*12*/ { BARCODE_EANX_CC, "12345+12", "[21]A12345678", 0, 8, 98 }, /*12*/ { BARCODE_EANX_CC, "12345+12", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 98 },
/*13*/ { BARCODE_EANX_CC, "123456+12", "[21]A12345678", 0, 8, 98 }, /*13*/ { BARCODE_EANX_CC, "123456+12", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 98 },
/*14*/ { BARCODE_EANX_CC, "1234567+12", "[21]A12345678", 0, 8, 98 }, /*14*/ { BARCODE_EANX_CC, "1234567+12", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 98 },
/*15*/ { BARCODE_EANX_CC, "12345678+12", "[21]A12345678", 0, 7, 125 }, /* EAN-13 + EAN-2 */ /*15*/ { BARCODE_EANX_CC, "12345678+12", "[21]A12345678", 0, 7, 125 }, /* EAN-13 + EAN-2 */
/*16*/ { BARCODE_EANX_CC, "1+123", "[21]A12345678", 0, 8, 125 }, /* EAN-8 + EAN-5 */ /*16*/ { BARCODE_EANX_CC, "1+123", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 125 }, /* EAN-8 + EAN-5 */
/*17*/ { BARCODE_EANX_CC, "12+123", "[21]A12345678", 0, 8, 125 }, /*17*/ { BARCODE_EANX_CC, "12+123", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 125 },
/*18*/ { BARCODE_EANX_CC, "123+123", "[21]A12345678", 0, 8, 125 }, /*18*/ { BARCODE_EANX_CC, "123+123", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 125 },
/*19*/ { BARCODE_EANX_CC, "1234+123", "[21]A12345678", 0, 8, 125 }, /*19*/ { BARCODE_EANX_CC, "1234+123", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 125 },
/*20*/ { BARCODE_EANX_CC, "12345+123", "[21]A12345678", 0, 8, 125 }, /*20*/ { BARCODE_EANX_CC, "12345+123", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 125 },
/*21*/ { BARCODE_EANX_CC, "123456+123", "[21]A12345678", 0, 8, 125 }, /*21*/ { BARCODE_EANX_CC, "123456+123", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 125 },
/*22*/ { BARCODE_EANX_CC, "1234567+123", "[21]A12345678", 0, 8, 125 }, /*22*/ { BARCODE_EANX_CC, "1234567+123", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 125 },
/*23*/ { BARCODE_EANX_CC, "12345678+123", "[21]A12345678", 0, 7, 152 }, /* EAN-13 + EAN-5 */ /*23*/ { BARCODE_EANX_CC, "12345678+123", "[21]A12345678", 0, 7, 152 }, /* EAN-13 + EAN-5 */
/*24*/ { BARCODE_EANX_CC, "1234567890128", "[21]A12345678", 0, 7, 99 }, /* EAN-13 + CHK */ /*24*/ { BARCODE_EANX_CC, "1234567890128", "[21]A12345678", 0, 7, 99 }, /* EAN-13 + CHK */
/*25*/ { BARCODE_EANX_CC, "1234567890128+12", "[21]A12345678", 0, 7, 125 }, /* EAN-13 + CHK + EAN-2 */ /*25*/ { BARCODE_EANX_CC, "1234567890128+12", "[21]A12345678", 0, 7, 125 }, /* EAN-13 + CHK + EAN-2 */
@@ -1493,7 +1493,7 @@ static void test_examples(const testCtx *const p_ctx) {
"000100000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000" "000100000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000"
"000101011011100100010000101011000101000110100001010101000000010110110001010101111010010001010110111010010111" "000101011011100100010000101011000101000110100001010101000000010110110001010101111010010001010110111010010111"
}, },
/* 77*/ { BARCODE_EANX_CC, -1, 1, "9876543+65", "[91]1234567", 0, 8, 98, 1, "Example of EAN-8 with 2-digit addon, CC-A 3 cols, 4 rows", /* 77*/ { BARCODE_EANX_CC, -1, 1, "9876543+65", "[91]1234567", ZINT_WARN_NONCOMPLIANT, 8, 98, 1, "Example of EAN-8 with 2-digit addon, CC-A 3 cols, 4 rows",
"10010001111100110101001100011100010111001100110001011101000001110100110100000000000000000000000000" "10010001111100110101001100011100010111001100110001011101000001110100110100000000000000000000000000"
"11011111100110100101011100011011110010110000111100010011110101110101110100000000000000000000000000" "11011111100110100101011100011011110010110000111100010011110101110101110100000000000000000000000000"
"10000101100000110101011000010101111101111100111010010000111001110101100100000000000000000000000000" "10000101100000110101011000010101111101111100111010010000111001110101100100000000000000000000000000"
@@ -1503,7 +1503,7 @@ static void test_examples(const testCtx *const p_ctx) {
"00001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000" "00001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000"
"00001010001011011011101110110101111010101001110101110010000101110010101000000010110101111010111001" "00001010001011011011101110110101111010101001110101110010000101110010101000000010110101111010111001"
}, },
/* 78*/ { BARCODE_EANX_CC, -1, 2, "9876543+74083", "[91]123456789012345678", 0, 12, 135, 1, "Example of EAN-8 with 5-digit addon, CC-B 3 cols, 8 rows", /* 78*/ { BARCODE_EANX_CC, -1, 2, "9876543+74083", "[91]123456789012345678", ZINT_WARN_NONCOMPLIANT, 12, 135, 1, "Example of EAN-8 with 5-digit addon, CC-B 3 cols, 8 rows",
"110011101011101111101110100100001011010000010000100010111110110100111101100111010100000000000000000000000000000000000000000000000000000" "110011101011101111101110100100001011010000010000100010111110110100111101100111010100000000000000000000000000000000000000000000000000000"
"111011101011001011100001000100001001011100101100100000111000110111010001110111010100000000000000000000000000000000000000000000000000000" "111011101011001011100001000100001001011100101100100000111000110111010001110111010100000000000000000000000000000000000000000000000000000"
"111001101011011111100110100100001101010100010111100000110010011011111101110011010100000000000000000000000000000000000000000000000000000" "111001101011011111100110100100001101010100010111100000110010011011111101110011010100000000000000000000000000000000000000000000000000000"
@@ -3006,7 +3006,7 @@ static void test_addongap(const testCtx *const p_ctx) {
}; };
/* Verified via bwipp_dump.ps against BWIPP */ /* Verified via bwipp_dump.ps against BWIPP */
static const struct item data[] = { static const struct item data[] = {
/* 0*/ { BARCODE_EANX_CC, 1, -1, "1234567+12", 0, 8, 98, "EAN-8 default 7 gap", /* 0*/ { BARCODE_EANX_CC, 1, -1, "1234567+12", ZINT_WARN_NONCOMPLIANT, 8, 98, "EAN-8 default 7 gap",
"10010001111100110101001100011110001011001100110110011110000101110100110100000000000000000000000000" "10010001111100110101001100011110001011001100110110011110000101110100110100000000000000000000000000"
"10000011100101100101011100010111100010001000100000100101111001110101110100000000000000000000000000" "10000011100101100101011100010111100010001000100000100101111001110101110100000000000000000000000000"
"11001101001000000101011000011010011100011110110001100110011001110101100100000000000000000000000000" "11001101001000000101011000011010011100011110110001100110011001110101100100000000000000000000000000"
@@ -3016,7 +3016,7 @@ static void test_addongap(const testCtx *const p_ctx) {
"00001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000" "00001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000"
"00001010011001001001101111010100011010101001110101000010001001110010101000000010110011001010010011" "00001010011001001001101111010100011010101001110101000010001001110010101000000010110011001010010011"
}, },
/* 1*/ { BARCODE_EANX_CC, 1, 8, "1234567+12", 0, 8, 99, "EAN-8 8 gap", /* 1*/ { BARCODE_EANX_CC, 1, 8, "1234567+12", ZINT_WARN_NONCOMPLIANT, 8, 99, "EAN-8 8 gap",
"100100011111001101010011000111100010110011001101100111100001011101001101000000000000000000000000000" "100100011111001101010011000111100010110011001101100111100001011101001101000000000000000000000000000"
"100000111001011001010111000101111000100010001000001001011110011101011101000000000000000000000000000" "100000111001011001010111000101111000100010001000001001011110011101011101000000000000000000000000000"
"110011010010000001010110000110100111000111101100011001100110011101011001000000000000000000000000000" "110011010010000001010110000110100111000111101100011001100110011101011001000000000000000000000000000"
@@ -3242,7 +3242,7 @@ static void test_hrt(const testCtx *const p_ctx) {
/* 9*/ { BARCODE_EANX_CC, -1, -1, "1234567890128", "[20]1A", ZINT_WARN_NONCOMPLIANT, "1234567890128", "" }, /* AI (20) should be 2 nos. */ /* 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", "" }, /* 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", "" }, /* 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" }, /* 12*/ { BARCODE_EANX_CC, -1, BARCODE_RAW_TEXT, "1234567890128+12", "[20]12", 0, "1234567890128+12", "123456789012812|2012" },
/* 13*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]12", 0, "(01)12345678901231", "" }, /* 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", "0112345678901231|2012" }, /* 14*/ { BARCODE_DBAR_OMN_CC, -1, BARCODE_RAW_TEXT, "1234567890123", "[20]12", 0, "(01)12345678901231", "0112345678901231|2012" },
/* 15*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901231", "[20]12", 0, "(01)12345678901231", "" }, /* 15*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901231", "[20]12", 0, "(01)12345678901231", "" },
@@ -3258,16 +3258,16 @@ static void test_hrt(const testCtx *const p_ctx) {
/* 25*/ { BARCODE_DBAR_LTD_CC, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231", "" }, /* AI (20) should be 2 nos. */ /* 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", "" }, /* 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", "" }, /* 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" }, /* 28*/ { BARCODE_UPCA_CC, -1, BARCODE_RAW_TEXT, "12345678901", "[20]12", 0, "123456789012", "0123456789012|2012" },
/* 29*/ { BARCODE_UPCA_CC, -1, -1, "123456789012", "[20]12", 0, "123456789012", "" }, /* 29*/ { BARCODE_UPCA_CC, -1, -1, "123456789012", "[20]12", 0, "123456789012", "" },
/* 30*/ { BARCODE_UPCA_CC, -1, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" }, /* 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 */ /* 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. */ /* 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", "" }, /* 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", "" }, /* 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" }, /* 35*/ { BARCODE_UPCA_CC, -1, BARCODE_RAW_TEXT, "123456789012+123", "[20]12", 0, "123456789012+00123", "012345678901200123|2012" },
/* 36*/ { BARCODE_UPCE_CC, -1, -1, "123456", "[20]12", 0, "01234565", "" }, /* 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" }, /* 37*/ { BARCODE_UPCE_CC, -1, BARCODE_RAW_TEXT, "123456", "[20]12", 0, "01234565", "0012345000065|2012" },
/* 38*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]12", 0, "12345670", "" }, /* 38*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]12", 0, "12345670", "" },
/* 39*/ { BARCODE_UPCE_CC, -1, -1, "12345670", "[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, "", "" }, /* 40*/ { BARCODE_UPCE_CC, -1, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" },
@@ -3276,7 +3276,7 @@ static void test_hrt(const testCtx *const p_ctx) {
/* 43*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]1A", ZINT_WARN_NONCOMPLIANT, "12345670", "" }, /* AI (20) should be 2 nos. */ /* 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", "" }, /* 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", "" }, /* 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" }, /* 46*/ { BARCODE_UPCE_CC, -1, BARCODE_RAW_TEXT, "1234567+2", "[20]12", 0, "12345670+02", "012345600007002|2012" },
/* 47*/ { BARCODE_DBAR_STK_CC, -1, -1, "12345678901231", "[20]12", 0, "", "" }, /* No HRT for stacked symbologies */ /* 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, "", "0112345678901231|2012" }, /* But have RAW_TEXT */ /* 48*/ { BARCODE_DBAR_STK_CC, -1, BARCODE_RAW_TEXT, "12345678901231", "[20]12", 0, "", "0112345678901231|2012" }, /* But have RAW_TEXT */
/* 49*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "12345678901231", "[20]12", 0, "", "" }, /* 49*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "12345678901231", "[20]12", 0, "", "" },
@@ -3321,8 +3321,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
@@ -3538,7 +3539,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
/* 0*/ { BARCODE_EANX_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 18 too long (maximum 5) (linear component)", "" }, /* 0*/ { BARCODE_EANX_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 18 too long (maximum 5) (linear component)", "" },
/* 1*/ { BARCODE_UPCA_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 18 too long (maximum 5) (linear component)", "" }, /* 1*/ { BARCODE_UPCA_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 18 too long (maximum 5) (linear component)", "" },
/* 2*/ { BARCODE_UPCE_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 18 too long (maximum 5) (linear component)", "" }, /* 2*/ { BARCODE_UPCE_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 18 too long (maximum 5) (linear component)", "" },
/* 3*/ { BARCODE_EANX_CC, -1, -1, "+12345", -1, "[21]A12345678", 0 , 0, "", "BWIPP checks for proper EAN data" }, /* 3*/ { BARCODE_EANX_CC, -1, -1, "+12345", -1, "[21]A12345678", ZINT_WARN_NONCOMPLIANT , 0, "Warning 292: EAN-8 with add-on is non-standard (linear component)", "BWIPP checks for proper EAN data" },
/* 4*/ { BARCODE_EANX_CC, -1, -1, "+123456", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 6 too long (maximum 5) (linear component)", "" }, /* 4*/ { BARCODE_EANX_CC, -1, -1, "+123456", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 6 too long (maximum 5) (linear component)", "" },
/* 5*/ { BARCODE_EANX_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "kks", -1, "()111%", ZINT_ERROR_INVALID_DATA, 1, "Error 284: Invalid character at position 1 in input (digits and \"+\" only) (linear component)", "" }, /* #300 (#5), Andre Maute (`dbar_date()` not checking length + other non-checks) */ /* 5*/ { BARCODE_EANX_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "kks", -1, "()111%", ZINT_ERROR_INVALID_DATA, 1, "Error 284: Invalid character at position 1 in input (digits and \"+\" only) (linear component)", "" }, /* #300 (#5), Andre Maute (`dbar_date()` not checking length + other non-checks) */
/* 6*/ { BARCODE_UPCA_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\153\153\153\153\153\153\153\153\163", -1, "()90", ZINT_ERROR_TOO_LONG, 1, "Error 283: Input length 46 too long (maximum 19) (linear component)", "" }, /* #300 (#6), Andre Maute (`dbar_date()` not checking length + other non-checks) */ /* 6*/ { BARCODE_UPCA_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\153\153\153\153\153\153\153\153\163", -1, "()90", ZINT_ERROR_TOO_LONG, 1, "Error 283: Input length 46 too long (maximum 19) (linear component)", "" }, /* #300 (#6), Andre Maute (`dbar_date()` not checking length + other non-checks) */
+3 -2
View File
@@ -92,8 +92,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+42 -21
View File
@@ -116,7 +116,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) { if (p_ctx->generate) {
char data_dir_path[1024]; char data_dir_path[1024];
assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL), "testUtilDataPath(%s) == 0\n", data_dir); assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL),
"testUtilDataPath(%s) == 0\n", data_dir);
if (!testUtilDirExists(data_dir_path)) { if (!testUtilDirExists(data_dir_path)) {
ret = testUtilMkDir(data_dir_path); ret = testUtilMkDir(data_dir_path);
assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno)); assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno));
@@ -130,7 +131,9 @@ static void test_print(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug); 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);
if (data[i].border_width != -1) { if (data[i].border_width != -1) {
symbol->border_width = data[i].border_width; symbol->border_width = data[i].border_width;
} }
@@ -145,7 +148,8 @@ static void test_print(const testCtx *const p_ctx) {
} }
if (data[i].dpmm) { if (data[i].dpmm) {
symbol->dpmm = data[i].dpmm; symbol->dpmm = data[i].dpmm;
symbol->scale = ZBarcode_Scale_From_XdimDp(symbol->symbology, ZBarcode_Default_Xdim(symbol->symbology), symbol->dpmm, "EMF"); symbol->scale = ZBarcode_Scale_From_XdimDp(symbol->symbology, ZBarcode_Default_Xdim(symbol->symbology),
symbol->dpmm, "EMF");
} }
if (*data[i].fgcolour) { if (*data[i].fgcolour) {
strcpy(symbol->fgcolour, data[i].fgcolour); strcpy(symbol->fgcolour, data[i].fgcolour);
@@ -155,24 +159,31 @@ static void test_print(const testCtx *const p_ctx) {
} }
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, emf); strcpy(symbol->outfile, emf);
ret = ZBarcode_Print(symbol, data[i].rotate_angle); ret = ZBarcode_Print(symbol, data[i].rotate_angle);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file),
"i:%d testUtilDataPath == 0\n", i);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %g, \"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\" },\n", printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %g, \"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width, data[i].whitespace_height, data[i].border_width, testUtilOutputOptionsName(data[i].output_options),
data[i].option_1, data[i].option_2, data[i].dpmm, data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle, data[i].whitespace_width, data[i].whitespace_height,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file, data[i].comment); data[i].option_1, data[i].option_2, data[i].dpmm,
data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle,
testUtilEscape(data[i].data, length, escaped, escaped_size),
data[i].expected_file, data[i].comment);
ret = testUtilRename(symbol->outfile, expected_file); ret = testUtilRename(symbol->outfile, expected_file);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
if (have_libreoffice) { if (have_libreoffice) {
/* Note this will fail (on Ubuntu anyway) if LibreOffice Base/Calc/Impress/Writer running (i.e. anything but LibreOffice Draw) /* Note this will fail (on Ubuntu anyway) if LibreOffice Base/Calc/Impress/Writer running
(i.e. anything but LibreOffice Draw)
Doesn't seem to be a way to force Draw invocation through the command line */ Doesn't seem to be a way to force Draw invocation through the command line */
ret = testUtilVerifyLibreOffice(expected_file, debug); ret = testUtilVerifyLibreOffice(expected_file, debug);
assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0 - check that LibreOffice is not running!\n", assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0 - check that LibreOffice is not running!\n",
@@ -183,10 +194,13 @@ static void test_print(const testCtx *const p_ctx) {
assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file); assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file);
ret = testUtilCmpBins(symbol->outfile, expected_file); ret = testUtilCmpBins(symbol->outfile, expected_file);
assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size); /* For BARCODE_MEMORY_FILE */ /* For BARCODE_MEMORY_FILE */
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size);
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) { if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) {
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile); assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -199,7 +213,8 @@ static void test_print(const testCtx *const p_ctx) {
assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology)); assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology));
assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n", assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size); i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size);
assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size), "i:%d %s memcmp(memfile, filebuf) != 0\n", assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size),
"i:%d %s memcmp(memfile, filebuf) != 0\n",
i, testUtilBarcodeName(data[i].symbology)); i, testUtilBarcodeName(data[i].symbology));
} }
@@ -229,15 +244,20 @@ static void test_outfile(const testCtx *const p_ctx) {
skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */
#endif #endif
if (!skip_readonly_test) { if (!skip_readonly_test) {
static char expected_errtxt[] = "640: Could not open EMF output file ("; /* Excluding OS-dependent `errno` stuff */ /* Excluding OS-dependent `errno` stuff */
static char expected_errtxt[] = "640: Could not open EMF output file (";
(void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */
assert_nonzero(testUtilCreateROFile(symbol.outfile), "emf_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); assert_nonzero(testUtilCreateROFile(symbol.outfile), "emf_plot testUtilCreateROFile(%s) fail (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
ret = emf_plot(&symbol, 0); ret = emf_plot(&symbol, 0);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "emf_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "emf_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n",
assert_zero(testUtilRmROFile(symbol.outfile), "emf_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt);
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "emf_plot testUtilRmROFile(%s) != 0 (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n",
symbol.errtxt, expected_errtxt);
} }
symbol.output_options |= BARCODE_STDOUT; symbol.output_options |= BARCODE_STDOUT;
@@ -249,7 +269,8 @@ static void test_outfile(const testCtx *const p_ctx) {
symbol.vector = NULL; symbol.vector = NULL;
ret = emf_plot(&symbol, 0); ret = emf_plot(&symbol, 0);
assert_equal(ret, ZINT_ERROR_INVALID_DATA, "emf_plot ret %d != ZINT_ERROR_INVALID_DATA (%d) (%s)\n", ret, ZINT_ERROR_INVALID_DATA, symbol.errtxt); assert_equal(ret, ZINT_ERROR_INVALID_DATA, "emf_plot ret %d != ZINT_ERROR_INVALID_DATA (%d) (%s)\n",
ret, ZINT_ERROR_INVALID_DATA, symbol.errtxt);
testFinish(); testFinish();
} }
+7 -3
View File
@@ -82,7 +82,9 @@ static void test_svg(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, data[i].output_options, data[i].data, data[i].length, debug); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
data[i].data, data[i].length, debug);
strcpy(symbol->outfile, data[i].outfile); strcpy(symbol->outfile, data[i].outfile);
ret = ZBarcode_Encode_and_Print(symbol, TCU(data[i].data), length, 0); ret = ZBarcode_Encode_and_Print(symbol, TCU(data[i].data), length, 0);
@@ -176,7 +178,8 @@ static void test_putsf(const testCtx *const p_ctx) {
} else { } else {
symbol->output_options |= BARCODE_MEMORY_FILE; symbol->output_options |= BARCODE_MEMORY_FILE;
} }
assert_nonzero(fm_open(fmp, symbol, "w"), "i:%d: fm_open fail (%d, %s)\n", i, fmp->err, strerror(fmp->err)); assert_nonzero(fm_open(fmp, symbol, "w"), "i:%d: fm_open fail (%d, %s)\n",
i, fmp->err, strerror(fmp->err));
if (j == 1) { if (j == 1) {
#ifndef ZINT_TEST_NO_FMEMOPEN #ifndef ZINT_TEST_NO_FMEMOPEN
/* Hack in `fmemopen()` fp */ /* Hack in `fmemopen()` fp */
@@ -212,7 +215,8 @@ static void test_putsf(const testCtx *const p_ctx) {
assert_equal(symbol->memfile_size, expected_size, "i:%d: memfile_size %d != expected_size %d\n", assert_equal(symbol->memfile_size, expected_size, "i:%d: memfile_size %d != expected_size %d\n",
i, symbol->memfile_size, expected_size); i, symbol->memfile_size, expected_size);
assert_nonnull(symbol->memfile, "i:%d memfile NULL\n", i); assert_nonnull(symbol->memfile, "i:%d memfile NULL\n", i);
assert_zero(memcmp(symbol->memfile, data[i].expected, expected_size), "i:%d: memcmp(%.*s, %.*s) != 0\n", assert_zero(memcmp(symbol->memfile, data[i].expected, expected_size),
"i:%d: memcmp(%.*s, %.*s) != 0\n",
i, symbol->memfile_size, symbol->memfile, expected_size, data[i].expected); i, symbol->memfile_size, symbol->memfile, expected_size, data[i].expected);
} }
+44 -21
View File
@@ -93,12 +93,14 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
} else { } else {
strcpy(data_buf, data[i].pattern); strcpy(data_buf, data[i].pattern);
} }
assert_equal(size, (int) strlen(data_buf), "i:%d gif_pixel_plot size %d != strlen(data_buf) %d\n", i, size, (int) strlen(data_buf)); assert_equal(size, (int) strlen(data_buf), "i:%d gif_pixel_plot size %d != strlen(data_buf) %d\n",
i, size, (int) strlen(data_buf));
symbol->bitmap = (unsigned char *) data_buf; symbol->bitmap = (unsigned char *) data_buf;
ret = gif_pixel_plot(symbol, (unsigned char *) data_buf); ret = gif_pixel_plot(symbol, (unsigned char *) data_buf);
assert_equal(ret, data[i].ret, "i:%d gif_pixel_plot ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d gif_pixel_plot ret %d != %d (%s)\n",
i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
if (have_identify) { if (have_identify) {
@@ -200,7 +202,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) { if (p_ctx->generate) {
char data_dir_path[1024]; char data_dir_path[1024];
assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL), "testUtilDataPath(%s) == 0\n", data_dir); assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL),
"testUtilDataPath(%s) == 0\n", data_dir);
if (!testUtilDirExists(data_dir_path)) { if (!testUtilDirExists(data_dir_path)) {
ret = testUtilMkDir(data_dir_path); ret = testUtilMkDir(data_dir_path);
assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno)); assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno));
@@ -214,7 +217,9 @@ static void test_print(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
data[i].option_1, data[i].option_2, -1 /*option_3*/, data[i].output_options,
data[i].data, -1, debug);
if (data[i].border_width != -1) { if (data[i].border_width != -1) {
symbol->border_width = data[i].border_width; symbol->border_width = data[i].border_width;
} }
@@ -244,35 +249,45 @@ static void test_print(const testCtx *const p_ctx) {
} }
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, gif); strcpy(symbol->outfile, gif);
ret = ZBarcode_Print(symbol, 0); ret = ZBarcode_Print(symbol, 0);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file),
"i:%d testUtilDataPath == 0\n", i);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %d, %s, %d, %d, %d, %d, %.5g, %.5g, %.5g, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\" },\n", printf(" /*%3d*/ { %s, %d, %s, %d, %d, %d, %d, %.5g, %.5g, %.5g, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), data[i].border_width, testUtilOutputOptionsName(data[i].output_options), i, testUtilBarcodeName(data[i].symbology), data[i].border_width,
testUtilOutputOptionsName(data[i].output_options),
data[i].whitespace_width, data[i].whitespace_height, data[i].whitespace_width, data[i].whitespace_height,
data[i].option_1, data[i].option_2, data[i].height, data[i].scale, data[i].dot_size, data[i].fgcolour, data[i].bgcolour, data[i].option_1, data[i].option_2, data[i].height, data[i].scale, data[i].dot_size,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file, data[i].comment); data[i].fgcolour, data[i].bgcolour,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file,
data[i].comment);
ret = testUtilRename(symbol->outfile, expected_file); ret = testUtilRename(symbol->outfile, expected_file);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
if (have_identify) { if (have_identify) {
ret = testUtilVerifyIdentify(have_identify, expected_file, debug); ret = testUtilVerifyIdentify(have_identify, expected_file, debug);
assert_zero(ret, "i:%d %s identify %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); assert_zero(ret, "i:%d %s identify %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
} }
} else { } else {
assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile); assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile);
assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file); assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file);
ret = testUtilCmpBins(symbol->outfile, expected_file); ret = testUtilCmpBins(symbol->outfile, expected_file);
assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size); /* For BARCODE_MEMORY_FILE */ /* For BARCODE_MEMORY_FILE */
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size);
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) { if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) {
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile); assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -285,7 +300,8 @@ static void test_print(const testCtx *const p_ctx) {
assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology)); assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology));
assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n", assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size); i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size);
assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size), "i:%d %s memcmp(memfile, filebuf) != 0\n", assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size),
"i:%d %s memcmp(memfile, filebuf) != 0\n",
i, testUtilBarcodeName(data[i].symbology)); i, testUtilBarcodeName(data[i].symbology));
} }
@@ -314,15 +330,21 @@ static void test_outfile(const testCtx *const p_ctx) {
skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */
#endif #endif
if (!skip_readonly_test) { if (!skip_readonly_test) {
static char expected_errtxt[] = "611: Could not open GIF output file ("; /* Excluding OS-dependent `errno` stuff */ /* Excluding OS-dependent `errno` stuff */
static char expected_errtxt[] = "611: Could not open GIF output file (";
(void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */
assert_nonzero(testUtilCreateROFile(symbol.outfile), "gif_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); assert_nonzero(testUtilCreateROFile(symbol.outfile),
"gif_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
ret = gif_pixel_plot(&symbol, data); ret = gif_pixel_plot(&symbol, data);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "gif_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "gif_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n",
assert_zero(testUtilRmROFile(symbol.outfile), "gif_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt);
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "gif_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n",
symbol.errtxt, expected_errtxt);
} }
symbol.output_options |= BARCODE_STDOUT; symbol.output_options |= BARCODE_STDOUT;
@@ -352,7 +374,8 @@ static void test_large_scale(const testCtx *const p_ctx) {
symbol.scale = 12.5f; /* 70.0f would cause paging as LZW > 1MB but very slow */ symbol.scale = 12.5f; /* 70.0f would cause paging as LZW > 1MB but very slow */
ret = ZBarcode_Encode_and_Print(&symbol, (unsigned char *) data, length, 0 /*rotate_angle*/); ret = ZBarcode_Encode_and_Print(&symbol, (unsigned char *) data, length, 0 /*rotate_angle*/);
assert_zero(ret, "%s ZBarcode_Encode_and_Print ret %d != 0 %s\n", testUtilBarcodeName(symbol.symbology), ret, symbol.errtxt); assert_zero(ret, "%s ZBarcode_Encode_and_Print ret %d != 0 %s\n",
testUtilBarcodeName(symbol.symbology), ret, symbol.errtxt);
if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) { /* -d 64 */ if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) { /* -d 64 */
/* 129.1 kB file manually inspected and checked (1.1 MB file for scale 70.0f also checked) */ /* 129.1 kB file manually inspected and checked (1.1 MB file for scale 70.0f also checked) */
+40 -19
View File
@@ -199,7 +199,8 @@ static void test_gs1_reduce(const testCtx *const p_ctx) {
char bwipp_buf[8196]; char bwipp_buf[8196];
char bwipp_msg[1024]; char bwipp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ /* Only do BWIPP test if asked, too slow otherwise */
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
testStartSymbol(p_ctx->func_name, &symbol); testStartSymbol(p_ctx->func_name, &symbol);
@@ -216,35 +217,44 @@ static void test_gs1_reduce(const testCtx *const p_ctx) {
} else { } else {
text = data[i].data; text = data[i].data;
} }
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
text, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, TCU(text), length);
if (p_ctx->generate) { if (p_ctx->generate) {
if (data[i].ret == 0) { if (data[i].ret == 0) {
printf(" /*%2d*/ { %s, %s, \"%s\", \"%s\", %d, \"%s\",\n", printf(" /*%2d*/ { %s, %s, \"%s\", \"%s\", %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].data, data[i].composite, data[i].ret, data[i].comment); i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
data[i].data, data[i].composite, data[i].ret, data[i].comment);
testUtilModulesPrint(symbol, " ", "\n"); testUtilModulesPrint(symbol, " ", "\n");
printf(" },\n"); printf(" },\n");
} else { } else {
printf(" /*%2d*/ { %s, %s, \"%s\", \"%s\", %s, \"%s\", \"\" },\n", printf(" /*%2d*/ { %s, %s, \"%s\", \"%s\", %s, \"%s\", \"\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].data, data[i].composite, testUtilErrorName(data[i].ret), data[i].comment); i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
data[i].data, data[i].composite, testUtilErrorName(data[i].ret), data[i].comment);
} }
} else { } else {
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 (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
int width, row; int width, row;
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n",
i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) { if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, -1, -1, -1, text, length, symbol->primary, bwipp_buf, sizeof(bwipp_buf), NULL); ret = testUtilBwipp(i, symbol, -1, -1, -1, text, length, symbol->primary, bwipp_buf,
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); sizeof(bwipp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n",
i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf,
data[i].expected);
} }
} }
} }
@@ -394,7 +404,8 @@ static void test_hrt(const testCtx *const p_ctx) {
expected_raw_length = (int) strlen(data[i].expected_raw); expected_raw_length = (int) strlen(data[i].expected_raw);
ret = ZBarcode_Encode(symbol, TCU(text), length); 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); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
i, data[i].ret, ret, symbol->errtxt);
assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d\n", assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d\n",
i, symbol->text_length, expected_length); i, symbol->text_length, expected_length);
@@ -403,10 +414,13 @@ static void test_hrt(const testCtx *const p_ctx) {
if (symbol->output_options & BARCODE_RAW_TEXT) { if (symbol->output_options & BARCODE_RAW_TEXT) {
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\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_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", 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); 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", assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
i, 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, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
@@ -2189,16 +2203,19 @@ static void test_gs1_lint(const testCtx *const p_ctx) {
length = (int) strlen(data[i].data); length = (int) strlen(data[i].data);
ret = gs1_verify(symbol, (unsigned char *) data[i].data, length, (unsigned char *) reduced, &reduced_length); ret = gs1_verify(symbol, (unsigned char *) data[i].data, length, (unsigned char *) reduced, &reduced_length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (length %d \"%s\") (%s)\n", i, ret, data[i].ret, length, data[i].data, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (length %d \"%s\") (%s)\n",
i, ret, data[i].ret, length, data[i].data, symbol->errtxt);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
assert_zero(strcmp(reduced, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", assert_zero(strcmp(reduced, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
i, testUtilEscape(reduced, reduced_length, escaped, ARRAY_SIZE(escaped)), i, testUtilEscape(reduced, reduced_length, escaped, ARRAY_SIZE(escaped)),
testUtilEscape(data[i].expected, (int) strlen(data[i].expected), escaped2, ARRAY_SIZE(escaped2))); testUtilEscape(data[i].expected, (int) strlen(data[i].expected), escaped2,
ARRAY_SIZE(escaped2)));
assert_equal(reduced_length, (int) strlen(reduced), "i:%d reduced_length %d != strlen %d\n", assert_equal(reduced_length, (int) strlen(reduced), "i:%d reduced_length %d != strlen %d\n",
i, reduced_length, (int) strlen(reduced)); i, reduced_length, (int) strlen(reduced));
} }
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);
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
} }
@@ -2596,11 +2613,15 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) {
} else { } else {
text = data[i].data; text = data[i].data;
} }
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
text, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, TCU(text), 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",
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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);
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
} }
+3 -2
View File
@@ -211,8 +211,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+71 -42
View File
@@ -230,7 +230,7 @@ static void test_checks(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci,
data[i].option_1, -1, -1, -1 /*output_options*/, data[i].option_1, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, data[i].length, debug); data[i].data, data[i].length, debug);
if (data[i].height) { if (data[i].height) {
symbol->height = data[i].height; symbol->height = data[i].height;
@@ -329,7 +329,7 @@ static void test_checks_segs(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci,
data[i].option_1, -1, -1, -1 /*output_options*/, data[i].option_1, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
NULL, 0, debug); NULL, 0, debug);
if (data[i].warn_level != -1) { if (data[i].warn_level != -1) {
symbol->warn_level = data[i].warn_level; symbol->warn_level = data[i].warn_level;
@@ -394,7 +394,7 @@ static void test_input_data(const testCtx *const p_ctx) {
text = data[i].data; text = data[i].data;
} }
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/,
-1 /*option_1*/, -1, -1, -1 /*output_options*/, -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
text, -1, debug); text, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, TCU(text), length);
@@ -411,7 +411,9 @@ static void test_input_data(const testCtx *const p_ctx) {
if (p_ctx->index == -1 && p_ctx->exclude[0] == -1) { if (p_ctx->index == -1 && p_ctx->exclude[0] == -1) {
char data_buf[ZINT_MAX_DATA_LEN + 10]; char data_buf[ZINT_MAX_DATA_LEN + 10];
int expected_ret = ZINT_ERROR_TOO_LONG; int expected_ret = ZINT_ERROR_TOO_LONG;
const char *expected_errtxt[] = { "Error 797: Input too long", "Error 340: Input length 17399 too long (maximum 256)" }; const char *expected_errtxt[] = {
"Error 797: Input too long", "Error 340: Input length 17399 too long (maximum 256)"
};
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
@@ -603,8 +605,8 @@ static void test_input_mode(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, BARCODE_CODE49 /*Supports GS1*/, data[i].input_mode, length = testUtilSetSymbol(symbol, BARCODE_CODE49 /*Supports GS1*/, data[i].input_mode, -1 /*eci*/,
-1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, -1, debug); data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
@@ -753,7 +755,7 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
debug |= ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */ debug |= ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode | ESCAPE_MODE, data[i].eci, length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode | ESCAPE_MODE, data[i].eci,
-1 /*option_1*/, -1, -1, -1 /*output_options*/, -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
text, -1, debug); text, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, TCU(text), length);
@@ -798,7 +800,7 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
symbol2->debug = ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */ symbol2->debug = ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */
(void) testUtilSetSymbol(symbol2, data[i].symbology, data[i].input_mode | ESCAPE_MODE, data[i].eci, (void) testUtilSetSymbol(symbol2, data[i].symbology, data[i].input_mode | ESCAPE_MODE, data[i].eci,
-1 /*option_1*/, -1, -1, -1 /*output_options*/, -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, -1, debug); data[i].data, -1, debug);
ret = ZBarcode_Encode_File(symbol2, input_filename); ret = ZBarcode_Encode_File(symbol2, input_filename);
@@ -2047,7 +2049,8 @@ static void test_barcode_name(const testCtx *const p_ctx) {
} }
prev_ret = test_prev_ZBarcode_BarcodeName(symbol_id, prev_name); prev_ret = test_prev_ZBarcode_BarcodeName(symbol_id, prev_name);
assert_equal(ret, prev_ret, "ZBarcode_BarcodeName(%d) ret %d != prev_ret %d\n", symbol_id, ret, prev_ret); assert_equal(ret, prev_ret, "ZBarcode_BarcodeName(%d) ret %d != prev_ret %d\n", symbol_id, ret, prev_ret);
assert_zero(strcmp(name, prev_name), "ZBarcode_BarcodeName(%d) strcmp(%s, %s) != 0\n", symbol_id, name, prev_name); assert_zero(strcmp(name, prev_name), "ZBarcode_BarcodeName(%d) strcmp(%s, %s) != 0\n",
symbol_id, name, prev_name);
} }
testFinish(); testFinish();
@@ -2104,13 +2107,15 @@ static void test_error_tag(const testCtx *const p_ctx) {
ret = error_tag_test(data[i].error_number, symbol, -1, data[i].data); ret = error_tag_test(data[i].error_number, symbol, -1, data[i].data);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
i, symbol->errtxt, data[i].expected);
if ((int) strlen(data[i].data) < 100) { if ((int) strlen(data[i].data) < 100) {
strcpy(symbol->errtxt, data[i].data); strcpy(symbol->errtxt, data[i].data);
ret = error_tag_test(data[i].error_number, symbol, -1, NULL); ret = error_tag_test(data[i].error_number, symbol, -1, NULL);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
i, symbol->errtxt, data[i].expected);
} }
} }
@@ -2169,7 +2174,8 @@ static void test_zero_outfile(const testCtx *const p_ctx) {
assert_zero(symbol->outfile[0], "ZBarcode_Encode() outfile non-zero\n"); assert_zero(symbol->outfile[0], "ZBarcode_Encode() outfile non-zero\n");
ret = ZBarcode_Print(symbol, 0); ret = ZBarcode_Print(symbol, 0);
assert_equal(ret, ZINT_ERROR_INVALID_OPTION, "ZBarcode_Print() ret %d != ZINT_ERROR_INVALID_OPTION (%s)\n", ret, symbol->errtxt); assert_equal(ret, ZINT_ERROR_INVALID_OPTION, "ZBarcode_Print() ret %d != ZINT_ERROR_INVALID_OPTION (%s)\n",
ret, symbol->errtxt);
assert_zero(symbol->outfile[0], "ZBarcode_Print() outfile non-zero\n"); assert_zero(symbol->outfile[0], "ZBarcode_Print() outfile non-zero\n");
ret = ZBarcode_Buffer(symbol, 0); ret = ZBarcode_Buffer(symbol, 0);
@@ -2344,10 +2350,13 @@ static void test_reset(const testCtx *const p_ctx) {
assert_nonzero(symbol->symbology == symbol_def->symbology, "ZBarcodeBuffer symbology != symbol_def\n"); assert_nonzero(symbol->symbology == symbol_def->symbology, "ZBarcodeBuffer symbology != symbol_def\n");
assert_nonzero(symbol->height == symbol_def->height, "ZBarcodeBuffer height != symbol_def\n"); assert_nonzero(symbol->height == symbol_def->height, "ZBarcodeBuffer height != symbol_def\n");
assert_nonzero(symbol->scale == symbol_def->scale, "ZBarcodeBuffer scale != symbol_def\n"); assert_nonzero(symbol->scale == symbol_def->scale, "ZBarcodeBuffer scale != symbol_def\n");
assert_nonzero(symbol->whitespace_width == symbol_def->whitespace_width, "ZBarcodeBuffer whitespace_width != symbol_def\n"); assert_nonzero(symbol->whitespace_width == symbol_def->whitespace_width,
assert_nonzero(symbol->whitespace_height == symbol_def->whitespace_height, "ZBarcodeBuffer whitespace_height != symbol_def\n"); "ZBarcodeBuffer whitespace_width != symbol_def\n");
assert_nonzero(symbol->whitespace_height == symbol_def->whitespace_height,
"ZBarcodeBuffer whitespace_height != symbol_def\n");
assert_nonzero(symbol->border_width == symbol_def->border_width, "ZBarcodeBuffer border_width != symbol_def\n"); assert_nonzero(symbol->border_width == symbol_def->border_width, "ZBarcodeBuffer border_width != symbol_def\n");
assert_nonzero(symbol->output_options == symbol_def->output_options, "ZBarcodeBuffer output_options != symbol_def\n"); assert_nonzero(symbol->output_options == symbol_def->output_options,
"ZBarcodeBuffer output_options != symbol_def\n");
assert_zero(strcmp(symbol->fgcolour, symbol_def->fgcolour), "ZBarcodeBuffer fgcolour != symbol_def\n"); assert_zero(strcmp(symbol->fgcolour, symbol_def->fgcolour), "ZBarcodeBuffer fgcolour != symbol_def\n");
assert_zero(strcmp(symbol->bgcolour, symbol_def->bgcolour), "ZBarcodeBuffer bgcolour != symbol_def\n"); assert_zero(strcmp(symbol->bgcolour, symbol_def->bgcolour), "ZBarcodeBuffer bgcolour != symbol_def\n");
assert_zero(strcmp(symbol->fgcolor, symbol_def->fgcolor), "ZBarcodeBuffer fgcolor != symbol_def\n"); assert_zero(strcmp(symbol->fgcolor, symbol_def->fgcolor), "ZBarcodeBuffer fgcolor != symbol_def\n");
@@ -2363,9 +2372,12 @@ static void test_reset(const testCtx *const p_ctx) {
assert_nonzero(symbol->dpmm == symbol_def->dpmm, "ZBarcodeBuffer dpmm != symbol_def\n"); assert_nonzero(symbol->dpmm == symbol_def->dpmm, "ZBarcodeBuffer dpmm != symbol_def\n");
assert_nonzero(symbol->dot_size == symbol_def->dot_size, "ZBarcodeBuffer dot_size != symbol_def\n"); assert_nonzero(symbol->dot_size == symbol_def->dot_size, "ZBarcodeBuffer dot_size != symbol_def\n");
assert_nonzero(symbol->text_gap == symbol_def->text_gap, "ZBarcodeBuffer text_gap != symbol_def\n"); assert_nonzero(symbol->text_gap == symbol_def->text_gap, "ZBarcodeBuffer text_gap != symbol_def\n");
assert_nonzero(symbol->guard_descent == symbol_def->guard_descent, "ZBarcodeBuffer guard_descent != symbol_def\n"); assert_nonzero(symbol->guard_descent == symbol_def->guard_descent,
assert_nonzero(symbol->structapp.index == symbol_def->structapp.index, "ZBarcodeBuffer structapp.index != symbol_def\n"); "ZBarcodeBuffer guard_descent != symbol_def\n");
assert_nonzero(symbol->structapp.count == symbol_def->structapp.count, "ZBarcodeBuffer structapp.count != symbol_def\n"); assert_nonzero(symbol->structapp.index == symbol_def->structapp.index,
"ZBarcodeBuffer structapp.index != symbol_def\n");
assert_nonzero(symbol->structapp.count == symbol_def->structapp.count,
"ZBarcodeBuffer structapp.count != symbol_def\n");
assert_nonzero(symbol->warn_level == symbol_def->warn_level, "ZBarcodeBuffer warn_level != symbol_def\n"); assert_nonzero(symbol->warn_level == symbol_def->warn_level, "ZBarcodeBuffer warn_level != symbol_def\n");
/* Vector */ /* Vector */
@@ -2397,10 +2409,13 @@ static void test_reset(const testCtx *const p_ctx) {
assert_nonzero(symbol->symbology == symbol_def->symbology, "ZBarcodeBuffer symbology != symbol_def\n"); assert_nonzero(symbol->symbology == symbol_def->symbology, "ZBarcodeBuffer symbology != symbol_def\n");
assert_nonzero(symbol->height == symbol_def->height, "ZBarcodeBuffer height != symbol_def\n"); assert_nonzero(symbol->height == symbol_def->height, "ZBarcodeBuffer height != symbol_def\n");
assert_nonzero(symbol->scale == symbol_def->scale, "ZBarcodeBuffer scale != symbol_def\n"); assert_nonzero(symbol->scale == symbol_def->scale, "ZBarcodeBuffer scale != symbol_def\n");
assert_nonzero(symbol->whitespace_width == symbol_def->whitespace_width, "ZBarcodeBuffer whitespace_width != symbol_def\n"); assert_nonzero(symbol->whitespace_width == symbol_def->whitespace_width,
assert_nonzero(symbol->whitespace_height == symbol_def->whitespace_height, "ZBarcodeBuffer whitespace_height != symbol_def\n"); "ZBarcodeBuffer whitespace_width != symbol_def\n");
assert_nonzero(symbol->whitespace_height == symbol_def->whitespace_height,
"ZBarcodeBuffer whitespace_height != symbol_def\n");
assert_nonzero(symbol->border_width == symbol_def->border_width, "ZBarcodeBuffer border_width != symbol_def\n"); assert_nonzero(symbol->border_width == symbol_def->border_width, "ZBarcodeBuffer border_width != symbol_def\n");
assert_nonzero(symbol->output_options == symbol_def->output_options, "ZBarcodeBuffer output_options != symbol_def\n"); assert_nonzero(symbol->output_options == symbol_def->output_options,
"ZBarcodeBuffer output_options != symbol_def\n");
assert_zero(strcmp(symbol->fgcolour, symbol_def->fgcolour), "ZBarcodeBuffer fgcolour != symbol_def\n"); assert_zero(strcmp(symbol->fgcolour, symbol_def->fgcolour), "ZBarcodeBuffer fgcolour != symbol_def\n");
assert_zero(strcmp(symbol->bgcolour, symbol_def->bgcolour), "ZBarcodeBuffer bgcolour != symbol_def\n"); assert_zero(strcmp(symbol->bgcolour, symbol_def->bgcolour), "ZBarcodeBuffer bgcolour != symbol_def\n");
assert_zero(strcmp(symbol->fgcolor, symbol_def->fgcolor), "ZBarcodeBuffer fgcolor != symbol_def\n"); assert_zero(strcmp(symbol->fgcolor, symbol_def->fgcolor), "ZBarcodeBuffer fgcolor != symbol_def\n");
@@ -2416,9 +2431,12 @@ static void test_reset(const testCtx *const p_ctx) {
assert_nonzero(symbol->dpmm == symbol_def->dpmm, "ZBarcodeBuffer dpmm != symbol_def\n"); assert_nonzero(symbol->dpmm == symbol_def->dpmm, "ZBarcodeBuffer dpmm != symbol_def\n");
assert_nonzero(symbol->dot_size == symbol_def->dot_size, "ZBarcodeBuffer dot_size != symbol_def\n"); assert_nonzero(symbol->dot_size == symbol_def->dot_size, "ZBarcodeBuffer dot_size != symbol_def\n");
assert_nonzero(symbol->text_gap == symbol_def->text_gap, "ZBarcodeBuffer text_gap != symbol_def\n"); assert_nonzero(symbol->text_gap == symbol_def->text_gap, "ZBarcodeBuffer text_gap != symbol_def\n");
assert_nonzero(symbol->guard_descent == symbol_def->guard_descent, "ZBarcodeBuffer guard_descent != symbol_def\n"); assert_nonzero(symbol->guard_descent == symbol_def->guard_descent,
assert_nonzero(symbol->structapp.index == symbol_def->structapp.index, "ZBarcodeBuffer structapp.index != symbol_def\n"); "ZBarcodeBuffer guard_descent != symbol_def\n");
assert_nonzero(symbol->structapp.count == symbol_def->structapp.count, "ZBarcodeBuffer structapp.count != symbol_def\n"); assert_nonzero(symbol->structapp.index == symbol_def->structapp.index,
"ZBarcodeBuffer structapp.index != symbol_def\n");
assert_nonzero(symbol->structapp.count == symbol_def->structapp.count,
"ZBarcodeBuffer structapp.count != symbol_def\n");
assert_nonzero(symbol->warn_level == symbol_def->warn_level, "ZBarcodeBuffer warn_level != symbol_def\n"); assert_nonzero(symbol->warn_level == symbol_def->warn_level, "ZBarcodeBuffer warn_level != symbol_def\n");
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
@@ -2538,20 +2556,26 @@ static void test_scale_from_xdimdp(const testCtx *const p_ctx) {
ret = ZBarcode_Scale_From_XdimDp(data[i].symbology, data[i].x_dim, data[i].dpmm, data[i].filetype); ret = ZBarcode_Scale_From_XdimDp(data[i].symbology, data[i].x_dim, data[i].dpmm, data[i].filetype);
assert_equal(ret, data[i].expected, "i:%d ZBarcode_Scale_From_XdimDp(%s, %g, %g, %s) %.8g != %.8g\n", assert_equal(ret, data[i].expected, "i:%d ZBarcode_Scale_From_XdimDp(%s, %g, %g, %s) %.8g != %.8g\n",
i, testUtilBarcodeName(data[i].symbology), data[i].dpmm, data[i].x_dim, data[i].filetype, ret, data[i].expected); i, testUtilBarcodeName(data[i].symbology), data[i].dpmm, data[i].x_dim, data[i].filetype, ret,
data[i].expected);
if (ret) { if (ret) {
dpmm_from_dpi = stripf(roundf(data[i].dpi / 25.4f)); dpmm_from_dpi = stripf(roundf(data[i].dpi / 25.4f));
ret = ZBarcode_Scale_From_XdimDp(data[i].symbology, data[i].x_dim, dpmm_from_dpi, data[i].filetype); ret = ZBarcode_Scale_From_XdimDp(data[i].symbology, data[i].x_dim, dpmm_from_dpi, data[i].filetype);
assert_equal(ret, data[i].expected, "i:%d ZBarcode_Scale_From_XdimDp(%s, %g (dpi %d), %g, %s) %.8g != %.8g\n", assert_equal(ret, data[i].expected,
i, testUtilBarcodeName(data[i].symbology), dpmm_from_dpi, data[i].dpi, data[i].x_dim, data[i].filetype, ret, data[i].expected); "i:%d ZBarcode_Scale_From_XdimDp(%s, %g (dpi %d), %g, %s) %.8g != %.8g\n",
i, testUtilBarcodeName(data[i].symbology), dpmm_from_dpi, data[i].dpi, data[i].x_dim,
data[i].filetype, ret, data[i].expected);
if (data[i].expected > 0.1f && data[i].expected < 200.0f /* Can't round trip scales <= 0.1 or >= 200.0 */ if (data[i].expected > 0.1f && data[i].expected < 200.0f /* Can't round trip scales <= 0.1 or >= 200.0 */
&& (data[i].symbology == BARCODE_MAXICODE || strcmp(data[i].filetype, "gif") != 0)) { /* Non-MAXICODE raster rounds to half-increments */ /* Non-MAXICODE raster rounds to half-increments */
&& (data[i].symbology == BARCODE_MAXICODE || strcmp(data[i].filetype, "gif") != 0)) {
x_dim_from_scale = ZBarcode_XdimDp_From_Scale(data[i].symbology, ret, data[i].dpmm, data[i].filetype); x_dim_from_scale = ZBarcode_XdimDp_From_Scale(data[i].symbology, ret, data[i].dpmm, data[i].filetype);
x_dim_from_scale = stripf(stripf(roundf(x_dim_from_scale * 100.0f)) / 100.0f); x_dim_from_scale = stripf(stripf(roundf(x_dim_from_scale * 100.0f)) / 100.0f);
assert_equal(x_dim_from_scale, data[i].x_dim, "i:%d ZBarcode_XdimDp_From_Scale(%s, %g, %g, %s) %.8g != x_dim %.8g\n", assert_equal(x_dim_from_scale, data[i].x_dim,
i, testUtilBarcodeName(data[i].symbology), ret, data[i].x_dim, data[i].filetype, x_dim_from_scale, data[i].x_dim); "i:%d ZBarcode_XdimDp_From_Scale(%s, %g, %g, %s) %.8g != x_dim %.8g\n",
i, testUtilBarcodeName(data[i].symbology), ret, data[i].x_dim, data[i].filetype,
x_dim_from_scale, data[i].x_dim);
} }
} }
} }
@@ -2612,13 +2636,16 @@ static void test_xdimdp_from_scale(const testCtx *const p_ctx) {
ret = ZBarcode_XdimDp_From_Scale(data[i].symbology, data[i].scale, data[i].dpmm, data[i].filetype); ret = ZBarcode_XdimDp_From_Scale(data[i].symbology, data[i].scale, data[i].dpmm, data[i].filetype);
assert_equal(ret, data[i].expected, "i:%d ZBarcode_XdimDp_From_Scale(%s, %g, %g, %s) %.8g != %.8g\n", assert_equal(ret, data[i].expected, "i:%d ZBarcode_XdimDp_From_Scale(%s, %g, %g, %s) %.8g != %.8g\n",
i, testUtilBarcodeName(data[i].symbology), data[i].dpmm, data[i].scale, data[i].filetype, ret, data[i].expected); i, testUtilBarcodeName(data[i].symbology), data[i].dpmm, data[i].scale, data[i].filetype, ret,
data[i].expected);
if (ret) { if (ret) {
dpmm_from_dpi = stripf(roundf(data[i].dpi / 25.4f)); dpmm_from_dpi = stripf(roundf(data[i].dpi / 25.4f));
ret = ZBarcode_XdimDp_From_Scale(data[i].symbology, data[i].scale, dpmm_from_dpi, data[i].filetype); ret = ZBarcode_XdimDp_From_Scale(data[i].symbology, data[i].scale, dpmm_from_dpi, data[i].filetype);
assert_equal(ret, data[i].expected, "i:%d ZBarcode_XdimDp_From_Scale(%s, %g (dpi %d), %g, %s) %.8g != %.8g\n", assert_equal(ret, data[i].expected,
i, testUtilBarcodeName(data[i].symbology), dpmm_from_dpi, data[i].dpi, data[i].scale, data[i].filetype, ret, data[i].expected); "i:%d ZBarcode_XdimDp_From_Scale(%s, %g (dpi %d), %g, %s) %.8g != %.8g\n",
i, testUtilBarcodeName(data[i].symbology), dpmm_from_dpi, data[i].dpi, data[i].scale,
data[i].filetype, ret, data[i].expected);
} }
} }
@@ -2724,10 +2751,12 @@ static void test_utf8_to_eci(const testCtx *const p_ctx) {
"i:%d ZBarcode_UTF8_To_ECI dest_length %d != expected_length %d\n", "i:%d ZBarcode_UTF8_To_ECI dest_length %d != expected_length %d\n",
i, dest_length, expected_length); i, dest_length, expected_length);
#if 0 #if 0
printf("dest_length %d\n", dest_length); debug_print_escape(TCU(dest), dest_length, NULL); printf("\n"); printf("dest_length %d\n", dest_length); debug_print_escape(TCU(dest), dest_length, NULL);
printf("\n");
#endif #endif
assert_zero(memcmp(dest, data[i].expected, expected_length), "i:%d memcmp(\"%s\", \"%s\", %d) != 0\n", assert_zero(memcmp(dest, data[i].expected, expected_length),
i, dest, data[i].expected, expected_length); "i:%d memcmp(\"%.*s\", \"%s\", %d) != 0\n",
i, dest_length, dest, data[i].expected, expected_length);
} }
} }
} }
@@ -2771,10 +2800,10 @@ static void test_raw_text(const testCtx *const p_ctx) {
/* 22*/ { BARCODE_DBAR_LTD, -1, "1234567890123", "0112345678901231" }, /* 22*/ { BARCODE_DBAR_LTD, -1, "1234567890123", "0112345678901231" },
/* 23*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", "0112345678901231" }, /* 23*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", "0112345678901231" },
/* 24*/ { BARCODE_TELEPEN, -1, "1234567890", "1234567890n" }, /* 24*/ { BARCODE_TELEPEN, -1, "1234567890", "1234567890n" },
/* 25*/ { BARCODE_UPCA, -1, "12345678901", "123456789012" }, /* 25*/ { BARCODE_UPCA, -1, "12345678901", "0123456789012" },
/* 26*/ { BARCODE_UPCA_CHK, -1, "123456789012", "123456789012" }, /* 26*/ { BARCODE_UPCA_CHK, -1, "123456789012", "0123456789012" },
/* 27*/ { BARCODE_UPCE, -1, "1234567", "12345670" }, /* 27*/ { BARCODE_UPCE, -1, "1234567", "0123456000070" },
/* 28*/ { BARCODE_UPCE_CHK, -1, "12345670", "" }, /* 28*/ { BARCODE_UPCE_CHK, -1, "12345670", "0123456000070" },
/* 29*/ { BARCODE_POSTNET, -1, "12345678901", "123456789014" }, /* 29*/ { BARCODE_POSTNET, -1, "12345678901", "123456789014" },
/* 30*/ { BARCODE_MSI_PLESSEY, -1, "1234567890", "" }, /* 30*/ { BARCODE_MSI_PLESSEY, -1, "1234567890", "" },
/* 31*/ { BARCODE_FIM, -1, "A", "" }, /* 31*/ { BARCODE_FIM, -1, "A", "" },
@@ -2840,8 +2869,8 @@ static void test_raw_text(const testCtx *const p_ctx) {
/* 91*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "0112345678901231|2001" }, /* 91*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "0112345678901231|2001" },
/* 92*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "0112345678901231|2001" }, /* 92*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "0112345678901231|2001" },
/* 93*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "0112345678901231|2001" }, /* 93*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "0112345678901231|2001" },
/* 94*/ { BARCODE_UPCA_CC, -1, "12345678901", "123456789012|2001" }, /* 94*/ { BARCODE_UPCA_CC, -1, "12345678901", "0123456789012|2001" },
/* 95*/ { BARCODE_UPCE_CC, -1, "1234567", "12345670|2001" }, /* 95*/ { BARCODE_UPCE_CC, -1, "1234567", "0123456000070|2001" },
/* 96*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "0112345678901231|2001" }, /* 96*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "0112345678901231|2001" },
/* 97*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "0112345678901231|2001" }, /* 97*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "0112345678901231|2001" },
/* 98*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "0112345678901231|2001" }, /* 98*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "0112345678901231|2001" },
+3 -2
View File
@@ -88,8 +88,9 @@ static void test_4s_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+3 -2
View File
@@ -172,8 +172,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+36 -17
View File
@@ -74,7 +74,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) { if (p_ctx->generate) {
char data_dir_path[1024]; char data_dir_path[1024];
assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL), "testUtilDataPath(%s) == 0\n", data_dir); assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL),
"testUtilDataPath(%s) == 0\n", data_dir);
if (!testUtilDirExists(data_dir_path)) { if (!testUtilDirExists(data_dir_path)) {
ret = testUtilMkDir(data_dir_path); ret = testUtilMkDir(data_dir_path);
assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno)); assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno));
@@ -88,7 +89,9 @@ static void test_print(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
data[i].option_1, data[i].option_2, -1 /*option_3*/, data[i].output_options,
data[i].data, -1, debug);
if (data[i].border_width != -1) { if (data[i].border_width != -1) {
symbol->border_width = data[i].border_width; symbol->border_width = data[i].border_width;
} }
@@ -110,35 +113,44 @@ static void test_print(const testCtx *const p_ctx) {
symbol->debug |= debug; symbol->debug |= debug;
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, pcx); strcpy(symbol->outfile, pcx);
ret = ZBarcode_Print(symbol, 0); ret = ZBarcode_Print(symbol, 0);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file),
"i:%d testUtilDataPath == 0\n", i);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %d, %s, %d, %d, %d, %d, \"%s\", \"%s\", %.5g, \"%s\", \"%s\"},\n", printf(" /*%3d*/ { %s, %d, %s, %d, %d, %d, %d, \"%s\", \"%s\", %.5g, \"%s\", \"%s\"},\n",
i, testUtilBarcodeName(data[i].symbology), data[i].border_width, testUtilOutputOptionsName(data[i].output_options), i, testUtilBarcodeName(data[i].symbology), data[i].border_width,
testUtilOutputOptionsName(data[i].output_options),
data[i].whitespace_width, data[i].whitespace_height, data[i].whitespace_width, data[i].whitespace_height,
data[i].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour, data[i].scale, data[i].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour, data[i].scale,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file); testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file);
ret = testUtilRename(symbol->outfile, expected_file); ret = testUtilRename(symbol->outfile, expected_file);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0 (%d: %s)\n", i, symbol->outfile, expected_file, ret, errno, strerror(errno)); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0 (%d: %s)\n",
i, symbol->outfile, expected_file, ret, errno, strerror(errno));
if (have_identify) { if (have_identify) {
ret = testUtilVerifyIdentify(have_identify, expected_file, debug); ret = testUtilVerifyIdentify(have_identify, expected_file, debug);
assert_zero(ret, "i:%d %s identify %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); assert_zero(ret, "i:%d %s identify %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
} }
} else { } else {
assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile); assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile);
assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file); assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file);
ret = testUtilCmpBins(symbol->outfile, expected_file); ret = testUtilCmpBins(symbol->outfile, expected_file);
assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size); /* For BARCODE_MEMORY_FILE */ /* For BARCODE_MEMORY_FILE */
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size);
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) { if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) {
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile); assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -151,7 +163,8 @@ static void test_print(const testCtx *const p_ctx) {
assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology)); assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology));
assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n", assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size); i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size);
assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size), "i:%d %s memcmp(memfile, filebuf) != 0\n", assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size),
"i:%d %s memcmp(memfile, filebuf) != 0\n",
i, testUtilBarcodeName(data[i].symbology)); i, testUtilBarcodeName(data[i].symbology));
} }
@@ -182,15 +195,21 @@ static void test_outfile(const testCtx *const p_ctx) {
skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */
#endif #endif
if (!skip_readonly_test) { if (!skip_readonly_test) {
static char expected_errtxt[] = "621: Could not open PCX output file ("; /* Excluding OS-dependent `errno` stuff */ /* Excluding OS-dependent `errno` stuff */
static char expected_errtxt[] = "621: Could not open PCX output file (";
(void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */
assert_nonzero(testUtilCreateROFile(symbol.outfile), "pcx_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); assert_nonzero(testUtilCreateROFile(symbol.outfile),
"pcx_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
ret = pcx_pixel_plot(&symbol, data); ret = pcx_pixel_plot(&symbol, data);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "pcx_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "pcx_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n",
assert_zero(testUtilRmROFile(symbol.outfile), "pcx_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt);
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "pcx_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n",
symbol.errtxt, expected_errtxt);
} }
symbol.output_options |= BARCODE_STDOUT; symbol.output_options |= BARCODE_STDOUT;
+3 -2
View File
@@ -228,8 +228,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+56 -31
View File
@@ -83,19 +83,22 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
symbol->debug |= debug; symbol->debug |= debug;
size = data[i].width * data[i].height; size = data[i].width * data[i].height;
assert_nonzero(size < (int) sizeof(data_buf), "i:%d png_pixel_plot size %d < sizeof(data_buf) %d\n", i, size, (int) sizeof(data_buf)); assert_nonzero(size < (int) sizeof(data_buf), "i:%d png_pixel_plot size %d < sizeof(data_buf) %d\n",
i, size, (int) sizeof(data_buf));
if (data[i].repeat) { if (data[i].repeat) {
testUtilStrCpyRepeat(data_buf, data[i].pattern, size); testUtilStrCpyRepeat(data_buf, data[i].pattern, size);
} else { } else {
strcpy(data_buf, data[i].pattern); strcpy(data_buf, data[i].pattern);
} }
assert_equal(size, (int) strlen(data_buf), "i:%d png_pixel_plot size %d != strlen(data_buf) %d\n", i, size, (int) strlen(data_buf)); assert_equal(size, (int) strlen(data_buf), "i:%d png_pixel_plot size %d != strlen(data_buf) %d\n",
i, size, (int) strlen(data_buf));
symbol->bitmap = (unsigned char *) data_buf; symbol->bitmap = (unsigned char *) data_buf;
ret = png_pixel_plot(symbol, (unsigned char *) data_buf); ret = png_pixel_plot(symbol, (unsigned char *) data_buf);
assert_equal(ret, data[i].ret, "i:%d png_pixel_plot ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d png_pixel_plot ret %d != %d (%s)\n",
i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
if (have_identify) { if (have_identify) {
@@ -195,14 +198,14 @@ static void test_print(const testCtx *const p_ctx) {
/* 47*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.png", "" }, /* 47*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.png", "" },
/* 48*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567", "", 0, "ean8_gss_5.2.2.2-1.png", "" }, /* 48*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567", "", 0, "ean8_gss_5.2.2.2-1.png", "" },
/* 49*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567", "", 0, "ean8_gss_5.2.2.2-1_gws.png", "" }, /* 49*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567", "", 0, "ean8_gss_5.2.2.2-1_gws.png", "" },
/* 50*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12", "", 0, "ean8_2addon.png", "" }, /* 50*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12", "", ZINT_WARN_NONCOMPLIANT, "ean8_2addon.png", "" },
/* 51*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12", "", 0, "ean8_2addon_gws.png", "" }, /* 51*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12", "", ZINT_WARN_NONCOMPLIANT, "ean8_2addon_gws.png", "" },
/* 52*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12345", "", 0, "ean8_5addon.png", "" }, /* 52*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12345", "", ZINT_WARN_NONCOMPLIANT, "ean8_5addon.png", "" },
/* 53*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12345", "", 0, "ean8_5addon_gws.png", "" }, /* 53*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12345", "", ZINT_WARN_NONCOMPLIANT, "ean8_5addon_gws.png", "" },
/* 54*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.png", "" }, /* 54*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+65", "[91]1234567", ZINT_WARN_NONCOMPLIANT, "ean8_cc_2addon_cca_4x3.png", "" },
/* 55*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3_gws.png", "" }, /* 55*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+65", "[91]1234567", ZINT_WARN_NONCOMPLIANT, "ean8_cc_2addon_cca_4x3_gws.png", "" },
/* 56*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.png", "" }, /* 56*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+74083", "[91]123456789012345678", ZINT_WARN_NONCOMPLIANT, "ean8_cc_5addon_ccb_8x3.png", "" },
/* 57*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3_gws.png", "" }, /* 57*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+74083", "[91]123456789012345678", ZINT_WARN_NONCOMPLIANT, "ean8_cc_5addon_ccb_8x3_gws.png", "" },
/* 58*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345", "", 0, "ean5.png", "" }, /* 58*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345", "", 0, "ean5.png", "" },
/* 59*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345", "", 0, "ean5_gws.png", "" }, /* 59*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345", "", 0, "ean5_gws.png", "" },
/* 60*/ { BARCODE_EANX, -1, 2, BARCODE_BIND, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345", "", 0, "ean5_bind2.png", "" }, /* 60*/ { BARCODE_EANX, -1, 2, BARCODE_BIND, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345", "", 0, "ean5_bind2.png", "" },
@@ -257,7 +260,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) { if (p_ctx->generate) {
char data_dir_path[1024]; char data_dir_path[1024];
assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL), "testUtilDataPath(%s) == 0\n", data_dir); assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL),
"testUtilDataPath(%s) == 0\n", data_dir);
if (!testUtilDirExists(data_dir_path)) { if (!testUtilDirExists(data_dir_path)) {
ret = testUtilMkDir(data_dir_path); ret = testUtilMkDir(data_dir_path);
assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno)); assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno));
@@ -272,7 +276,9 @@ static void test_print(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug); 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);
if (data[i].show_hrt != -1) { if (data[i].show_hrt != -1) {
symbol->show_hrt = data[i].show_hrt; symbol->show_hrt = data[i].show_hrt;
} }
@@ -311,40 +317,51 @@ static void test_print(const testCtx *const p_ctx) {
text_length = (int) strlen(text); text_length = (int) strlen(text);
ret = ZBarcode_Encode(symbol, TCU(text), text_length); ret = ZBarcode_Encode(symbol, TCU(text), text_length);
assert_equal(ret, data[i].ret, "i:%d %s ZBarcode_Encode ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d %s ZBarcode_Encode ret %d != %d (%s)\n",
i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
strcpy(symbol->outfile, png); strcpy(symbol->outfile, png);
ret = ZBarcode_Print(symbol, 0); ret = ZBarcode_Print(symbol, 0);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret, symbol->errtxt); assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0 (%s)\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret, symbol->errtxt);
assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file),
"i:%d testUtilDataPath == 0\n", i);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %.5g, %.5g, { %d, %d, \"%s\" }, \"%s\", \"%s\", %.5g, \"%s\", \"%s\", %s, \"%s\", \"%s\" },\n", printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %.5g, %.5g, { %d, %d, \"%s\" }, \"%s\", \"%s\", %.5g, \"%s\", \"%s\", %s, \"%s\", \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, testUtilOutputOptionsName(data[i].output_options), i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].option_1, data[i].option_2, data[i].height, data[i].scale, data[i].border_width, testUtilOutputOptionsName(data[i].output_options),
data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt,
data[i].option_1, data[i].option_2, data[i].height, data[i].scale,
data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, data[i].structapp.index, data[i].structapp.count, data[i].structapp.id,
data[i].fgcolour, data[i].bgcolour, data[i].text_gap, data[i].fgcolour, data[i].bgcolour, data[i].text_gap,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, testUtilErrorName(data[i].ret), data[i].expected_file, data[i].comment); testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite,
testUtilErrorName(data[i].ret), data[i].expected_file, data[i].comment);
ret = testUtilRename(symbol->outfile, expected_file); ret = testUtilRename(symbol->outfile, expected_file);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
if (have_identify) { if (have_identify) {
ret = testUtilVerifyIdentify(have_identify, expected_file, debug); ret = testUtilVerifyIdentify(have_identify, expected_file, debug);
assert_zero(ret, "i:%d %s identify %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); assert_zero(ret, "i:%d %s identify %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
} }
} else { } else {
assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile); assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile);
assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file); assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file);
ret = testUtilCmpPngs(symbol->outfile, expected_file); ret = testUtilCmpPngs(symbol->outfile, expected_file);
assert_zero(ret, "i:%d %s testUtilCmpPngs(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d %s testUtilCmpPngs(%s, %s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
#ifndef ZLIBNG_VERSION /* zlib-ng (used by e.g. Fedora 40) may produce non-binary compat output */ #ifndef ZLIBNG_VERSION /* zlib-ng (used by e.g. Fedora 40) may produce non-binary compat output */
ret = testUtilCmpBins(symbol->outfile, expected_file); ret = testUtilCmpBins(symbol->outfile, expected_file);
assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
#endif #endif
ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size); /* For BARCODE_MEMORY_FILE */ /* For BARCODE_MEMORY_FILE */
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size);
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) { if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) {
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile); assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -357,7 +374,8 @@ static void test_print(const testCtx *const p_ctx) {
assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology)); assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology));
assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n", assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size); i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size);
assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size), "i:%d %s memcmp(memfile, filebuf) != 0\n", assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size),
"i:%d %s memcmp(memfile, filebuf) != 0\n",
i, testUtilBarcodeName(data[i].symbology)); i, testUtilBarcodeName(data[i].symbology));
} }
@@ -386,15 +404,21 @@ static void test_outfile(const testCtx *const p_ctx) {
skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */
#endif #endif
if (!skip_readonly_test) { if (!skip_readonly_test) {
static char expected_errtxt[] = "632: Could not open PNG output file ("; /* Excluding OS-dependent `errno` stuff */ /* Excluding OS-dependent `errno` stuff */
static char expected_errtxt[] = "632: Could not open PNG output file (";
(void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */
assert_nonzero(testUtilCreateROFile(symbol.outfile), "png_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); assert_nonzero(testUtilCreateROFile(symbol.outfile),
"png_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
ret = png_pixel_plot(&symbol, data); ret = png_pixel_plot(&symbol, data);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "png_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "png_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n",
assert_zero(testUtilRmROFile(symbol.outfile), "png_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt);
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "png_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n",
symbol.errtxt, expected_errtxt);
} }
symbol.output_options |= BARCODE_STDOUT; symbol.output_options |= BARCODE_STDOUT;
@@ -484,7 +508,8 @@ static void test_large_compliant_height(const testCtx *const p_ctx) {
symbol->symbology = BARCODE_CODABLOCKF; symbol->symbology = BARCODE_CODABLOCKF;
symbol->output_options |= COMPLIANT_HEIGHT; symbol->output_options |= COMPLIANT_HEIGHT;
testUtilStrCpyRepeat(data_buf, pattern, codablockf_max); testUtilStrCpyRepeat(data_buf, pattern, codablockf_max);
assert_equal(codablockf_max, (int) strlen(data_buf), "length %d != strlen(data_buf) %d\n", codablockf_max, (int) strlen(data_buf)); assert_equal(codablockf_max, (int) strlen(data_buf), "length %d != strlen(data_buf) %d\n",
codablockf_max, (int) strlen(data_buf));
ret = ZBarcode_Encode_and_Print(symbol, (const unsigned char *) data_buf, codablockf_max, 0); ret = ZBarcode_Encode_and_Print(symbol, (const unsigned char *) data_buf, codablockf_max, 0);
assert_zero(ret, "ZBarcode_Encode_and_Print ret %d != 0 (%s)\n", ret, symbol->errtxt); assert_zero(ret, "ZBarcode_Encode_and_Print ret %d != 0 (%s)\n", ret, symbol->errtxt);
+3 -2
View File
@@ -284,8 +284,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+359 -327
View File
@@ -114,7 +114,7 @@ static void test_buffer(const testCtx *const p_ctx) {
int output_options; int output_options;
const char *data; const char *data;
const char *composite; const char *composite;
int ret;
float expected_height; float expected_height;
int expected_rows; int expected_rows;
int expected_width; int expected_width;
@@ -122,276 +122,277 @@ static void test_buffer(const testCtx *const p_ctx) {
int expected_bitmap_height; int expected_bitmap_height;
}; };
static const struct item data[] = { static const struct item data[] = {
/* 0*/ { BARCODE_CODE11, -1, "1234567890", "", 50, 1, 108, 216, 116 }, /* 0*/ { BARCODE_CODE11, -1, "1234567890", "", 0, 50, 1, 108, 216, 116 },
/* 1*/ { BARCODE_CODE11, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 108, 216, 116 }, /* 1*/ { BARCODE_CODE11, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 108, 216, 116 },
/* 2*/ { BARCODE_C25STANDARD, -1, "1234567890", "", 50, 1, 117, 234, 116 }, /* 2*/ { BARCODE_C25STANDARD, -1, "1234567890", "", 0, 50, 1, 117, 234, 116 },
/* 3*/ { BARCODE_C25STANDARD, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 117, 234, 116 }, /* 3*/ { BARCODE_C25STANDARD, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 117, 234, 116 },
/* 4*/ { BARCODE_C25INTER, -1, "1234567890", "", 50, 1, 99, 198, 116 }, /* 4*/ { BARCODE_C25INTER, -1, "1234567890", "", 0, 50, 1, 99, 198, 116 },
/* 5*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 99, 198, 116 }, /* 5*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 99, 198, 116 },
/* 6*/ { BARCODE_C25IATA, -1, "1234567890", "", 50, 1, 149, 298, 116 }, /* 6*/ { BARCODE_C25IATA, -1, "1234567890", "", 0, 50, 1, 149, 298, 116 },
/* 7*/ { BARCODE_C25IATA, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 149, 298, 116 }, /* 7*/ { BARCODE_C25IATA, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 149, 298, 116 },
/* 8*/ { BARCODE_C25LOGIC, -1, "1234567890", "", 50, 1, 109, 218, 116 }, /* 8*/ { BARCODE_C25LOGIC, -1, "1234567890", "", 0, 50, 1, 109, 218, 116 },
/* 9*/ { BARCODE_C25LOGIC, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 109, 218, 116 }, /* 9*/ { BARCODE_C25LOGIC, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 109, 218, 116 },
/* 10*/ { BARCODE_C25IND, -1, "1234567890", "", 50, 1, 159, 318, 116 }, /* 10*/ { BARCODE_C25IND, -1, "1234567890", "", 0, 50, 1, 159, 318, 116 },
/* 11*/ { BARCODE_C25IND, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 159, 318, 116 }, /* 11*/ { BARCODE_C25IND, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 159, 318, 116 },
/* 12*/ { BARCODE_CODE39, -1, "1234567890", "", 50, 1, 155, 310, 116 }, /* 12*/ { BARCODE_CODE39, -1, "1234567890", "", 0, 50, 1, 155, 310, 116 },
/* 13*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 155, 310, 116 }, /* 13*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 155, 310, 116 },
/* 14*/ { BARCODE_EXCODE39, -1, "1234567890", "", 50, 1, 155, 310, 116 }, /* 14*/ { BARCODE_EXCODE39, -1, "1234567890", "", 0, 50, 1, 155, 310, 116 },
/* 15*/ { BARCODE_EXCODE39, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 155, 310, 116 }, /* 15*/ { BARCODE_EXCODE39, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 155, 310, 116 },
/* 16*/ { BARCODE_EANX, -1, "123456789012", "", 50, 1, 95, 226, 116 }, /* 16*/ { BARCODE_EANX, -1, "123456789012", "", 0, 50, 1, 95, 226, 116 },
/* 17*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012", "", 69, 1, 95, 226, 154 }, /* 17*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012", "", 0, 69, 1, 95, 226, 154 },
/* 18*/ { BARCODE_EANX_CHK, -1, "1234567890128", "", 50, 1, 95, 226, 116 }, /* 18*/ { BARCODE_EANX_CHK, -1, "1234567890128", "", 0, 50, 1, 95, 226, 116 },
/* 19*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128", "", 69, 1, 95, 226, 154 }, /* 19*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128", "", 0, 69, 1, 95, 226, 154 },
/* 20*/ { BARCODE_EANX, -1, "123456789012+12", "", 50, 1, 122, 276, 116 }, /* 20*/ { BARCODE_EANX, -1, "123456789012+12", "", 0, 50, 1, 122, 276, 116 },
/* 21*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012+12", "", 69, 1, 122, 276, 154 }, /* 21*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012+12", "", 0, 69, 1, 122, 276, 154 },
/* 22*/ { BARCODE_EANX_CHK, -1, "1234567890128+12", "", 50, 1, 122, 276, 116 }, /* 22*/ { BARCODE_EANX_CHK, -1, "1234567890128+12", "", 0, 50, 1, 122, 276, 116 },
/* 23*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128+12", "", 69, 1, 122, 276, 154 }, /* 23*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128+12", "", 0, 69, 1, 122, 276, 154 },
/* 24*/ { BARCODE_EANX, -1, "123456789012+12345", "", 50, 1, 149, 330, 116 }, /* 24*/ { BARCODE_EANX, -1, "123456789012+12345", "", 0, 50, 1, 149, 330, 116 },
/* 25*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012+12345", "", 69, 1, 149, 330, 154 }, /* 25*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012+12345", "", 0, 69, 1, 149, 330, 154 },
/* 26*/ { BARCODE_EANX_CHK, -1, "1234567890128+12345", "", 50, 1, 149, 330, 116 }, /* 26*/ { BARCODE_EANX_CHK, -1, "1234567890128+12345", "", 0, 50, 1, 149, 330, 116 },
/* 27*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128+12345", "", 69, 1, 149, 330, 154 }, /* 27*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128+12345", "", 0, 69, 1, 149, 330, 154 },
/* 28*/ { BARCODE_EANX, -1, "1234567", "", 50, 1, 67, 162, 116 }, /* 28*/ { BARCODE_EANX, -1, "1234567", "", 0, 50, 1, 67, 162, 116 },
/* 29*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567", "", 55, 1, 67, 162, 126 }, /* 29*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567", "", 0, 55, 1, 67, 162, 126 },
/* 30*/ { BARCODE_EANX_CHK, -1, "12345670", "", 50, 1, 67, 162, 116 }, /* 30*/ { BARCODE_EANX_CHK, -1, "12345670", "", 0, 50, 1, 67, 162, 116 },
/* 31*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670", "", 55, 1, 67, 162, 126 }, /* 31*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670", "", 0, 55, 1, 67, 162, 126 },
/* 32*/ { BARCODE_EANX, -1, "1234567+12", "", 50, 1, 94, 212, 116 }, /* 32*/ { BARCODE_EANX, -1, "1234567+12", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 94, 212, 116 },
/* 33*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567+12", "", 55, 1, 94, 212, 126 }, /* 33*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567+12", "", ZINT_WARN_NONCOMPLIANT, 55, 1, 94, 212, 126 },
/* 34*/ { BARCODE_EANX_CHK, -1, "12345670+12", "", 50, 1, 94, 212, 116 }, /* 34*/ { BARCODE_EANX_CHK, -1, "12345670+12", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 94, 212, 116 },
/* 35*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670+12", "", 55, 1, 94, 212, 126 }, /* 35*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670+12", "", ZINT_WARN_NONCOMPLIANT, 55, 1, 94, 212, 126 },
/* 36*/ { BARCODE_EANX, -1, "1234567+12345", "", 50, 1, 121, 266, 116 }, /* 36*/ { BARCODE_EANX, -1, "1234567+12345", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 121, 266, 116 },
/* 37*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567+12345", "", 55, 1, 121, 266, 126 }, /* 37*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567+12345", "", ZINT_WARN_NONCOMPLIANT, 55, 1, 121, 266, 126 },
/* 38*/ { BARCODE_EANX_CHK, -1, "12345670+12345", "", 50, 1, 121, 266, 116 }, /* 38*/ { BARCODE_EANX_CHK, -1, "12345670+12345", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 121, 266, 116 },
/* 39*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670+12345", "", 55, 1, 121, 266, 126 }, /* 39*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670+12345", "", ZINT_WARN_NONCOMPLIANT, 55, 1, 121, 266, 126 },
/* 40*/ { BARCODE_EANX, -1, "1234", "", 50, 1, 47, 104, 116 }, /* 40*/ { BARCODE_EANX, -1, "1234", "", 0, 50, 1, 47, 104, 116 },
/* 41*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234", "", 66.5, 1, 47, 104, 149 }, /* 41*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234", "", 0, 66.5, 1, 47, 104, 149 },
/* 42*/ { BARCODE_EANX_CHK, -1, "1234", "", 50, 1, 47, 104, 116 }, /* 42*/ { BARCODE_EANX_CHK, -1, "1234", "", 0, 50, 1, 47, 104, 116 },
/* 43*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234", "", 66.5, 1, 47, 104, 149 }, /* 43*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234", "", 0, 66.5, 1, 47, 104, 149 },
/* 44*/ { BARCODE_EANX, -1, "12", "", 50, 1, 20, 50, 116 }, /* 44*/ { BARCODE_EANX, -1, "12", "", 0, 50, 1, 20, 50, 116 },
/* 45*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "12", "", 66.5, 1, 20, 50, 149 }, /* 45*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "12", "", 0, 66.5, 1, 20, 50, 149 },
/* 46*/ { BARCODE_EANX_CHK, -1, "12", "", 50, 1, 20, 50, 116 }, /* 46*/ { BARCODE_EANX_CHK, -1, "12", "", 0, 50, 1, 20, 50, 116 },
/* 47*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12", "", 66.5, 1, 20, 50, 149 }, /* 47*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12", "", 0, 66.5, 1, 20, 50, 149 },
/* 48*/ { BARCODE_GS1_128, -1, "[01]12345678901231", "", 50, 1, 134, 268, 116 }, /* 48*/ { BARCODE_GS1_128, -1, "[01]12345678901231", "", 0, 50, 1, 134, 268, 116 },
/* 49*/ { BARCODE_GS1_128, COMPLIANT_HEIGHT, "[01]12345678901231", "", 64, 1, 134, 268, 144 }, /* 49*/ { BARCODE_GS1_128, COMPLIANT_HEIGHT, "[01]12345678901231", "", 0, 64, 1, 134, 268, 144 },
/* 50*/ { BARCODE_CODABAR, -1, "A00000000B", "", 50, 1, 102, 204, 116 }, /* 50*/ { BARCODE_CODABAR, -1, "A00000000B", "", 0, 50, 1, 102, 204, 116 },
/* 51*/ { BARCODE_CODABAR, COMPLIANT_HEIGHT, "A00000000B", "", 50, 1, 102, 204, 116 }, /* 51*/ { BARCODE_CODABAR, COMPLIANT_HEIGHT, "A00000000B", "", 0, 50, 1, 102, 204, 116 },
/* 52*/ { BARCODE_CODE128, -1, "1234567890", "", 50, 1, 90, 180, 116 }, /* 52*/ { BARCODE_CODE128, -1, "1234567890", "", 0, 50, 1, 90, 180, 116 },
/* 53*/ { BARCODE_CODE128, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 90, 180, 116 }, /* 53*/ { BARCODE_CODE128, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 90, 180, 116 },
/* 54*/ { BARCODE_DPLEIT, -1, "1234567890123", "", 72, 1, 135, 270, 160 }, /* 54*/ { BARCODE_DPLEIT, -1, "1234567890123", "", 0, 72, 1, 135, 270, 160 },
/* 55*/ { BARCODE_DPLEIT, COMPLIANT_HEIGHT, "1234567890123", "", 72, 1, 135, 270, 160 }, /* 55*/ { BARCODE_DPLEIT, COMPLIANT_HEIGHT, "1234567890123", "", 0, 72, 1, 135, 270, 160 },
/* 56*/ { BARCODE_DPIDENT, -1, "12345678901", "", 72, 1, 117, 234, 160 }, /* 56*/ { BARCODE_DPIDENT, -1, "12345678901", "", 0, 72, 1, 117, 234, 160 },
/* 57*/ { BARCODE_DPIDENT, COMPLIANT_HEIGHT, "12345678901", "", 72, 1, 117, 234, 160 }, /* 57*/ { BARCODE_DPIDENT, COMPLIANT_HEIGHT, "12345678901", "", 0, 72, 1, 117, 234, 160 },
/* 58*/ { BARCODE_CODE16K, -1, "1234567890", "", 20, 2, 70, 162, 44 }, /* 58*/ { BARCODE_CODE16K, -1, "1234567890", "", 0, 20, 2, 70, 162, 44 },
/* 59*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, "1234567890", "", 21, 2, 70, 162, 46 }, /* 59*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, "1234567890", "", 0, 21, 2, 70, 162, 46 },
/* 60*/ { BARCODE_CODE49, -1, "1234567890", "", 20, 2, 70, 162, 44 }, /* 60*/ { BARCODE_CODE49, -1, "1234567890", "", 0, 20, 2, 70, 162, 44 },
/* 61*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, "1234567890", "", 21, 2, 70, 162, 46 }, /* 61*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, "1234567890", "", 0, 21, 2, 70, 162, 46 },
/* 62*/ { BARCODE_CODE93, -1, "1234567890", "", 50, 1, 127, 254, 116 }, /* 62*/ { BARCODE_CODE93, -1, "1234567890", "", 0, 50, 1, 127, 254, 116 },
/* 63*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, "1234567890", "", 40, 1, 127, 254, 96 }, /* 63*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, "1234567890", "", 0, 40, 1, 127, 254, 96 },
/* 64*/ { BARCODE_FLAT, -1, "1234567890", "", 50, 1, 90, 180, 100 }, /* 64*/ { BARCODE_FLAT, -1, "1234567890", "", 0, 50, 1, 90, 180, 100 },
/* 65*/ { BARCODE_FLAT, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 90, 180, 100 }, /* 65*/ { BARCODE_FLAT, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 90, 180, 100 },
/* 66*/ { BARCODE_DBAR_OMN, -1, "1234567890123", "", 50, 1, 96, 192, 116 }, /* 66*/ { BARCODE_DBAR_OMN, -1, "1234567890123", "", 0, 50, 1, 96, 192, 116 },
/* 67*/ { BARCODE_DBAR_OMN, COMPLIANT_HEIGHT, "1234567890123", "", 33, 1, 96, 192, 82 }, /* 67*/ { BARCODE_DBAR_OMN, COMPLIANT_HEIGHT, "1234567890123", "", 0, 33, 1, 96, 192, 82 },
/* 68*/ { BARCODE_DBAR_LTD, -1, "1234567890123", "", 50, 1, 79, 158, 116 }, /* 68*/ { BARCODE_DBAR_LTD, -1, "1234567890123", "", 0, 50, 1, 79, 158, 116 },
/* 69*/ { BARCODE_DBAR_LTD, COMPLIANT_HEIGHT, "1234567890123", "", 10, 1, 79, 158, 36 }, /* 69*/ { BARCODE_DBAR_LTD, COMPLIANT_HEIGHT, "1234567890123", "", 0, 10, 1, 79, 158, 36 },
/* 70*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", "", 34, 1, 134, 268, 84 }, /* 70*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", "", 0, 34, 1, 134, 268, 84 },
/* 71*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, "[01]12345678901231", "", 34, 1, 134, 268, 84 }, /* 71*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, "[01]12345678901231", "", 0, 34, 1, 134, 268, 84 },
/* 72*/ { BARCODE_TELEPEN, -1, "1234567890", "", 50, 1, 208, 416, 116 }, /* 72*/ { BARCODE_TELEPEN, -1, "1234567890", "", 0, 50, 1, 208, 416, 116 },
/* 73*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, "1234567890", "", 32, 1, 208, 416, 80 }, /* 73*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, "1234567890", "", 0, 32, 1, 208, 416, 80 },
/* 74*/ { BARCODE_UPCA, -1, "12345678901", "", 50, 1, 95, 226, 116 }, /* 74*/ { BARCODE_UPCA, -1, "12345678901", "", 0, 50, 1, 95, 226, 116 },
/* 75*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901", "", 69, 1, 95, 226, 154 }, /* 75*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901", "", 0, 69, 1, 95, 226, 154 },
/* 76*/ { BARCODE_UPCA_CHK, -1, "123456789012", "", 50, 1, 95, 226, 116 }, /* 76*/ { BARCODE_UPCA_CHK, -1, "123456789012", "", 0, 50, 1, 95, 226, 116 },
/* 77*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012", "", 69, 1, 95, 226, 154 }, /* 77*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012", "", 0, 69, 1, 95, 226, 154 },
/* 78*/ { BARCODE_UPCA, -1, "12345678901+12", "", 50, 1, 124, 276, 116 }, /* 78*/ { BARCODE_UPCA, -1, "12345678901+12", "", 0, 50, 1, 124, 276, 116 },
/* 79*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901+12", "", 69, 1, 124, 276, 154 }, /* 79*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901+12", "", 0, 69, 1, 124, 276, 154 },
/* 80*/ { BARCODE_UPCA_CHK, -1, "123456789012+12", "", 50, 1, 124, 276, 116 }, /* 80*/ { BARCODE_UPCA_CHK, -1, "123456789012+12", "", 0, 50, 1, 124, 276, 116 },
/* 81*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012+12", "", 69, 1, 124, 276, 154 }, /* 81*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012+12", "", 0, 69, 1, 124, 276, 154 },
/* 82*/ { BARCODE_UPCA, -1, "12345678901+12345", "", 50, 1, 151, 330, 116 }, /* 82*/ { BARCODE_UPCA, -1, "12345678901+12345", "", 0, 50, 1, 151, 330, 116 },
/* 83*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901+12345", "", 69, 1, 151, 330, 154 }, /* 83*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901+12345", "", 0, 69, 1, 151, 330, 154 },
/* 84*/ { BARCODE_UPCA_CHK, -1, "123456789012+12345", "", 50, 1, 151, 330, 116 }, /* 84*/ { BARCODE_UPCA_CHK, -1, "123456789012+12345", "", 0, 50, 1, 151, 330, 116 },
/* 85*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012+12345", "", 69, 1, 151, 330, 154 }, /* 85*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012+12345", "", 0, 69, 1, 151, 330, 154 },
/* 86*/ { BARCODE_UPCE, -1, "1234567", "", 50, 1, 51, 134, 116 }, /* 86*/ { BARCODE_UPCE, -1, "1234567", "", 0, 50, 1, 51, 134, 116 },
/* 87*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567", "", 69, 1, 51, 134, 154 }, /* 87*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567", "", 0, 69, 1, 51, 134, 154 },
/* 88*/ { BARCODE_UPCE_CHK, -1, "12345670", "", 50, 1, 51, 134, 116 }, /* 88*/ { BARCODE_UPCE_CHK, -1, "12345670", "", 0, 50, 1, 51, 134, 116 },
/* 89*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670", "", 69, 1, 51, 134, 154 }, /* 89*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670", "", 0, 69, 1, 51, 134, 154 },
/* 90*/ { BARCODE_UPCE, -1, "1234567+12", "", 50, 1, 78, 184, 116 }, /* 90*/ { BARCODE_UPCE, -1, "1234567+12", "", 0, 50, 1, 78, 184, 116 },
/* 91*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567+12", "", 69, 1, 78, 184, 154 }, /* 91*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567+12", "", 0, 69, 1, 78, 184, 154 },
/* 92*/ { BARCODE_UPCE_CHK, -1, "12345670+12", "", 50, 1, 78, 184, 116 }, /* 92*/ { BARCODE_UPCE_CHK, -1, "12345670+12", "", 0, 50, 1, 78, 184, 116 },
/* 93*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670+12", "", 69, 1, 78, 184, 154 }, /* 93*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670+12", "", 0, 69, 1, 78, 184, 154 },
/* 94*/ { BARCODE_UPCE, -1, "1234567+12345", "", 50, 1, 105, 238, 116 }, /* 94*/ { BARCODE_UPCE, -1, "1234567+12345", "", 0, 50, 1, 105, 238, 116 },
/* 95*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567+12345", "", 69, 1, 105, 238, 154 }, /* 95*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567+12345", "", 0, 69, 1, 105, 238, 154 },
/* 96*/ { BARCODE_UPCE_CHK, -1, "12345670+12345", "", 50, 1, 105, 238, 116 }, /* 96*/ { BARCODE_UPCE_CHK, -1, "12345670+12345", "", 0, 50, 1, 105, 238, 116 },
/* 97*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670+12345", "", 69, 1, 105, 238, 154 }, /* 97*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670+12345", "", 0, 69, 1, 105, 238, 154 },
/* 98*/ { BARCODE_POSTNET, -1, "12345678901", "", 12, 2, 123, 246, 24 }, /* 98*/ { BARCODE_POSTNET, -1, "12345678901", "", 0, 12, 2, 123, 246, 24 },
/* 99*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, "12345678901", "", 5, 2, 123, 246, 10 }, /* 99*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, "12345678901", "", 0, 5, 2, 123, 246, 10 },
/*100*/ { BARCODE_MSI_PLESSEY, -1, "1234567890", "", 50, 1, 127, 254, 116 }, /*100*/ { BARCODE_MSI_PLESSEY, -1, "1234567890", "", 0, 50, 1, 127, 254, 116 },
/*101*/ { BARCODE_MSI_PLESSEY, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 127, 254, 116 }, /*101*/ { BARCODE_MSI_PLESSEY, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 127, 254, 116 },
/*102*/ { BARCODE_FIM, -1, "A", "", 50, 1, 17, 34, 100 }, /*102*/ { BARCODE_FIM, -1, "A", "", 0, 50, 1, 17, 34, 100 },
/*103*/ { BARCODE_FIM, COMPLIANT_HEIGHT, "A", "", 20, 1, 17, 34, 40 }, /*103*/ { BARCODE_FIM, COMPLIANT_HEIGHT, "A", "", 0, 20, 1, 17, 34, 40 },
/*104*/ { BARCODE_LOGMARS, -1, "1234567890", "", 50, 1, 191, 382, 116 }, /*104*/ { BARCODE_LOGMARS, -1, "1234567890", "", 0, 50, 1, 191, 382, 116 },
/*105*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, "1234567890", "", 45.5, 1, 191, 382, 107 }, /*105*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, "1234567890", "", 0, 45.5, 1, 191, 382, 107 },
/*106*/ { BARCODE_PHARMA, -1, "123456", "", 50, 1, 58, 116, 100 }, /*106*/ { BARCODE_PHARMA, -1, "123456", "", 0, 50, 1, 58, 116, 100 },
/*107*/ { BARCODE_PHARMA, COMPLIANT_HEIGHT, "123456", "", 16, 1, 58, 116, 32 }, /*107*/ { BARCODE_PHARMA, COMPLIANT_HEIGHT, "123456", "", 0, 16, 1, 58, 116, 32 },
/*108*/ { BARCODE_PZN, -1, "123456", "", 50, 1, 142, 284, 116 }, /*108*/ { BARCODE_PZN, -1, "123456", "", 0, 50, 1, 142, 284, 116 },
/*109*/ { BARCODE_PZN, COMPLIANT_HEIGHT, "123456", "", 40, 1, 142, 284, 96 }, /*109*/ { BARCODE_PZN, COMPLIANT_HEIGHT, "123456", "", 0, 40, 1, 142, 284, 96 },
/*110*/ { BARCODE_PHARMA_TWO, -1, "12345678", "", 10, 2, 29, 58, 20 }, /*110*/ { BARCODE_PHARMA_TWO, -1, "12345678", "", 0, 10, 2, 29, 58, 20 },
/*111*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, "12345678", "", 8, 2, 29, 58, 16 }, /*111*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, "12345678", "", 0, 8, 2, 29, 58, 16 },
/*112*/ { BARCODE_CEPNET, -1, "12345678", "", 5, 2, 93, 186, 10 }, /*112*/ { BARCODE_CEPNET, -1, "12345678", "", 0, 5, 2, 93, 186, 10 },
/*113*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, "12345678", "", 5, 2, 93, 186, 10 }, /*113*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, "12345678", "", 0, 5, 2, 93, 186, 10 },
/*114*/ { BARCODE_PDF417, -1, "1234567890", "", 21, 7, 103, 206, 42 }, /*114*/ { BARCODE_PDF417, -1, "1234567890", "", 0, 21, 7, 103, 206, 42 },
/*115*/ { BARCODE_PDF417, COMPLIANT_HEIGHT, "1234567890", "", 21, 7, 103, 206, 42 }, /*115*/ { BARCODE_PDF417, COMPLIANT_HEIGHT, "1234567890", "", 0, 21, 7, 103, 206, 42 },
/*116*/ { BARCODE_PDF417COMP, -1, "1234567890", "", 21, 7, 69, 138, 42 }, /*116*/ { BARCODE_PDF417COMP, -1, "1234567890", "", 0, 21, 7, 69, 138, 42 },
/*117*/ { BARCODE_PDF417COMP, COMPLIANT_HEIGHT, "1234567890", "", 21, 7, 69, 138, 42 }, /*117*/ { BARCODE_PDF417COMP, COMPLIANT_HEIGHT, "1234567890", "", 0, 21, 7, 69, 138, 42 },
/*118*/ { BARCODE_MAXICODE, -1, "1234567890", "", 165, 33, 30, 299, 298 }, /*118*/ { BARCODE_MAXICODE, -1, "1234567890", "", 0, 165, 33, 30, 299, 298 },
/*119*/ { BARCODE_MAXICODE, COMPLIANT_HEIGHT, "1234567890", "", 165, 33, 30, 299, 298 }, /*119*/ { BARCODE_MAXICODE, COMPLIANT_HEIGHT, "1234567890", "", 0, 165, 33, 30, 299, 298 },
/*120*/ { BARCODE_QRCODE, -1, "1234567890AB", "", 21, 21, 21, 42, 42 }, /*120*/ { BARCODE_QRCODE, -1, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
/*121*/ { BARCODE_QRCODE, COMPLIANT_HEIGHT, "1234567890AB", "", 21, 21, 21, 42, 42 }, /*121*/ { BARCODE_QRCODE, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
/*122*/ { BARCODE_CODE128AB, -1, "1234567890", "", 50, 1, 145, 290, 116 }, /*122*/ { BARCODE_CODE128AB, -1, "1234567890", "", 0, 50, 1, 145, 290, 116 },
/*123*/ { BARCODE_CODE128AB, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 145, 290, 116 }, /*123*/ { BARCODE_CODE128AB, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 145, 290, 116 },
/*124*/ { BARCODE_AUSPOST, -1, "12345678901234567890123", "", 8, 3, 133, 266, 16 }, /*124*/ { BARCODE_AUSPOST, -1, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16 },
/*125*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, "12345678901234567890123", "", 9.5, 3, 133, 266, 19 }, /*125*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, "12345678901234567890123", "", 0, 9.5, 3, 133, 266, 19 },
/*126*/ { BARCODE_AUSREPLY, -1, "12345678", "", 8, 3, 73, 146, 16 }, /*126*/ { BARCODE_AUSREPLY, -1, "12345678", "", 0, 8, 3, 73, 146, 16 },
/*127*/ { BARCODE_AUSREPLY, COMPLIANT_HEIGHT, "12345678", "", 9.5, 3, 73, 146, 19 }, /*127*/ { BARCODE_AUSREPLY, COMPLIANT_HEIGHT, "12345678", "", 0, 9.5, 3, 73, 146, 19 },
/*128*/ { BARCODE_AUSROUTE, -1, "12345678", "", 8, 3, 73, 146, 16 }, /*128*/ { BARCODE_AUSROUTE, -1, "12345678", "", 0, 8, 3, 73, 146, 16 },
/*129*/ { BARCODE_AUSROUTE, COMPLIANT_HEIGHT, "12345678", "", 9.5, 3, 73, 146, 19 }, /*129*/ { BARCODE_AUSROUTE, COMPLIANT_HEIGHT, "12345678", "", 0, 9.5, 3, 73, 146, 19 },
/*130*/ { BARCODE_AUSREDIRECT, -1, "12345678", "", 8, 3, 73, 146, 16 }, /*130*/ { BARCODE_AUSREDIRECT, -1, "12345678", "", 0, 8, 3, 73, 146, 16 },
/*131*/ { BARCODE_AUSREDIRECT, COMPLIANT_HEIGHT, "12345678", "", 9.5, 3, 73, 146, 19 }, /*131*/ { BARCODE_AUSREDIRECT, COMPLIANT_HEIGHT, "12345678", "", 0, 9.5, 3, 73, 146, 19 },
/*132*/ { BARCODE_ISBNX, -1, "123456789", "", 50, 1, 95, 226, 116 }, /*132*/ { BARCODE_ISBNX, -1, "123456789", "", 0, 50, 1, 95, 226, 116 },
/*133*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789", "", 69, 1, 95, 226, 154 }, /*133*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789", "", 0, 69, 1, 95, 226, 154 },
/*134*/ { BARCODE_ISBNX, -1, "123456789+12", "", 50, 1, 122, 276, 116 }, /*134*/ { BARCODE_ISBNX, -1, "123456789+12", "", 0, 50, 1, 122, 276, 116 },
/*135*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789+12", "", 69, 1, 122, 276, 154 }, /*135*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789+12", "", 0, 69, 1, 122, 276, 154 },
/*136*/ { BARCODE_ISBNX, -1, "123456789+12345", "", 50, 1, 149, 330, 116 }, /*136*/ { BARCODE_ISBNX, -1, "123456789+12345", "", 0, 50, 1, 149, 330, 116 },
/*137*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789+12345", "", 69, 1, 149, 330, 154 }, /*137*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789+12345", "", 0, 69, 1, 149, 330, 154 },
/*138*/ { BARCODE_RM4SCC, -1, "1234567890", "", 8, 3, 91, 182, 16 }, /*138*/ { BARCODE_RM4SCC, -1, "1234567890", "", 0, 8, 3, 91, 182, 16 },
/*139*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, "1234567890", "", 8, 3, 91, 182, 16 }, /*139*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, "1234567890", "", 0, 8, 3, 91, 182, 16 },
/*140*/ { BARCODE_DATAMATRIX, -1, "ABC", "", 10, 10, 10, 20, 20 }, /*140*/ { BARCODE_DATAMATRIX, -1, "ABC", "", 0, 10, 10, 10, 20, 20 },
/*141*/ { BARCODE_DATAMATRIX, COMPLIANT_HEIGHT, "ABC", "", 10, 10, 10, 20, 20 }, /*141*/ { BARCODE_DATAMATRIX, COMPLIANT_HEIGHT, "ABC", "", 0, 10, 10, 10, 20, 20 },
/*142*/ { BARCODE_EAN14, -1, "1234567890123", "", 50, 1, 134, 268, 116 }, /*142*/ { BARCODE_EAN14, -1, "1234567890123", "", 0, 50, 1, 134, 268, 116 },
/*143*/ { BARCODE_EAN14, COMPLIANT_HEIGHT, "1234567890123", "", 64, 1, 134, 268, 144 }, /*143*/ { BARCODE_EAN14, COMPLIANT_HEIGHT, "1234567890123", "", 0, 64, 1, 134, 268, 144 },
/*144*/ { BARCODE_VIN, -1, "12345678701234567", "", 50, 1, 246, 492, 116 }, /*144*/ { BARCODE_VIN, -1, "12345678701234567", "", 0, 50, 1, 246, 492, 116 },
/*145*/ { BARCODE_VIN, COMPLIANT_HEIGHT, "12345678701234567", "", 50, 1, 246, 492, 116 }, /*145*/ { BARCODE_VIN, COMPLIANT_HEIGHT, "12345678701234567", "", 0, 50, 1, 246, 492, 116 },
/*146*/ { BARCODE_CODABLOCKF, -1, "1234567890", "", 20, 2, 101, 242, 44 }, /*146*/ { BARCODE_CODABLOCKF, -1, "1234567890", "", 0, 20, 2, 101, 242, 44 },
/*147*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, "1234567890", "", 20, 2, 101, 242, 44 }, /*147*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, "1234567890", "", 0, 20, 2, 101, 242, 44 },
/*148*/ { BARCODE_NVE18, -1, "12345678901234567", "", 50, 1, 156, 312, 116 }, /*148*/ { BARCODE_NVE18, -1, "12345678901234567", "", 0, 50, 1, 156, 312, 116 },
/*149*/ { BARCODE_NVE18, COMPLIANT_HEIGHT, "12345678901234567", "", 64, 1, 156, 312, 144 }, /*149*/ { BARCODE_NVE18, COMPLIANT_HEIGHT, "12345678901234567", "", 0, 64, 1, 156, 312, 144 },
/*150*/ { BARCODE_JAPANPOST, -1, "1234567890", "", 8, 3, 133, 266, 16 }, /*150*/ { BARCODE_JAPANPOST, -1, "1234567890", "", 0, 8, 3, 133, 266, 16 },
/*151*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, "1234567890", "", 6, 3, 133, 266, 12 }, /*151*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, "1234567890", "", 0, 6, 3, 133, 266, 12 },
/*152*/ { BARCODE_KOREAPOST, -1, "123456", "", 50, 1, 167, 334, 116 }, /*152*/ { BARCODE_KOREAPOST, -1, "123456", "", 0, 50, 1, 167, 334, 116 },
/*153*/ { BARCODE_KOREAPOST, COMPLIANT_HEIGHT, "123456", "", 50, 1, 167, 334, 116 }, /*153*/ { BARCODE_KOREAPOST, COMPLIANT_HEIGHT, "123456", "", 0, 50, 1, 167, 334, 116 },
/*154*/ { BARCODE_DBAR_STK, -1, "1234567890123", "", 13, 3, 50, 100, 26 }, /*154*/ { BARCODE_DBAR_STK, -1, "1234567890123", "", 0, 13, 3, 50, 100, 26 },
/*155*/ { BARCODE_DBAR_STK, COMPLIANT_HEIGHT, "1234567890123", "", 13, 3, 50, 100, 26 }, /*155*/ { BARCODE_DBAR_STK, COMPLIANT_HEIGHT, "1234567890123", "", 0, 13, 3, 50, 100, 26 },
/*156*/ { BARCODE_DBAR_OMNSTK, -1, "1234567890123", "", 69, 5, 50, 100, 138 }, /*156*/ { BARCODE_DBAR_OMNSTK, -1, "1234567890123", "", 0, 69, 5, 50, 100, 138 },
/*157*/ { BARCODE_DBAR_OMNSTK, COMPLIANT_HEIGHT, "1234567890123", "", 69, 5, 50, 100, 138 }, /*157*/ { BARCODE_DBAR_OMNSTK, COMPLIANT_HEIGHT, "1234567890123", "", 0, 69, 5, 50, 100, 138 },
/*158*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", "", 71, 5, 102, 204, 142 }, /*158*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142 },
/*159*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, "[01]12345678901231", "", 71, 5, 102, 204, 142 }, /*159*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142 },
/*160*/ { BARCODE_PLANET, -1, "12345678901", "", 12, 2, 123, 246, 24 }, /*160*/ { BARCODE_PLANET, -1, "12345678901", "", 0, 12, 2, 123, 246, 24 },
/*161*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, "12345678901", "", 5, 2, 123, 246, 10 }, /*161*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, "12345678901", "", 0, 5, 2, 123, 246, 10 },
/*162*/ { BARCODE_MICROPDF417, -1, "1234567890", "", 12, 6, 82, 164, 24 }, /*162*/ { BARCODE_MICROPDF417, -1, "1234567890", "", 0, 12, 6, 82, 164, 24 },
/*163*/ { BARCODE_MICROPDF417, COMPLIANT_HEIGHT, "1234567890", "", 12, 6, 82, 164, 24 }, /*163*/ { BARCODE_MICROPDF417, COMPLIANT_HEIGHT, "1234567890", "", 0, 12, 6, 82, 164, 24 },
/*164*/ { BARCODE_USPS_IMAIL, -1, "12345678901234567890", "", 8, 3, 129, 258, 16 }, /*164*/ { BARCODE_USPS_IMAIL, -1, "12345678901234567890", "", 0, 8, 3, 129, 258, 16 },
/*165*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, "12345678901234567890", "", 6, 3, 129, 258, 12 }, /*165*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, "12345678901234567890", "", 0, 6, 3, 129, 258, 12 },
/*166*/ { BARCODE_PLESSEY, -1, "1234567890", "", 50, 1, 227, 454, 116 }, /*166*/ { BARCODE_PLESSEY, -1, "1234567890", "", 0, 50, 1, 227, 454, 116 },
/*167*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 227, 454, 116 }, /*167*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 227, 454, 116 },
/*168*/ { BARCODE_TELEPEN_NUM, -1, "1234567890", "", 50, 1, 128, 256, 116 }, /*168*/ { BARCODE_TELEPEN_NUM, -1, "1234567890", "", 0, 50, 1, 128, 256, 116 },
/*169*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, "1234567890", "", 32, 1, 128, 256, 80 }, /*169*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, "1234567890", "", 0, 32, 1, 128, 256, 80 },
/*170*/ { BARCODE_ITF14, -1, "1234567890", "", 50, 1, 135, 330, 136 }, /*170*/ { BARCODE_ITF14, -1, "1234567890", "", 0, 50, 1, 135, 330, 136 },
/*171*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, "1234567890", "", 64, 1, 135, 330, 164 }, /*171*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, "1234567890", "", 0, 64, 1, 135, 330, 164 },
/*172*/ { BARCODE_KIX, -1, "123456ABCDE", "", 8, 3, 87, 174, 16 }, /*172*/ { BARCODE_KIX, -1, "123456ABCDE", "", 0, 8, 3, 87, 174, 16 },
/*173*/ { BARCODE_KIX, COMPLIANT_HEIGHT, "123456ABCDE", "", 8, 3, 87, 174, 16 }, /*173*/ { BARCODE_KIX, COMPLIANT_HEIGHT, "123456ABCDE", "", 0, 8, 3, 87, 174, 16 },
/*174*/ { BARCODE_AZTEC, -1, "1234567890AB", "", 15, 15, 15, 30, 30 }, /*174*/ { BARCODE_AZTEC, -1, "1234567890AB", "", 0, 15, 15, 15, 30, 30 },
/*175*/ { BARCODE_AZTEC, COMPLIANT_HEIGHT, "1234567890AB", "", 15, 15, 15, 30, 30 }, /*175*/ { BARCODE_AZTEC, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 15, 15, 15, 30, 30 },
/*176*/ { BARCODE_DAFT, -1, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 }, /*176*/ { BARCODE_DAFT, -1, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16 },
/*177*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 }, /*177*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16 },
/*178*/ { BARCODE_DPD, -1, "0123456789012345678901234567", "", 50, 1, 189, 378, 122 }, /*178*/ { BARCODE_DPD, -1, "0123456789012345678901234567", "", 0, 50, 1, 189, 378, 122 },
/*179*/ { BARCODE_DPD, COMPLIANT_HEIGHT, "0123456789012345678901234567", "", 66.5, 1, 189, 378, 155 }, /*179*/ { BARCODE_DPD, COMPLIANT_HEIGHT, "0123456789012345678901234567", "", 0, 66.5, 1, 189, 378, 155 },
/*180*/ { BARCODE_MICROQR, -1, "12345", "", 11, 11, 11, 22, 22 }, /*180*/ { BARCODE_MICROQR, -1, "12345", "", 0, 11, 11, 11, 22, 22 },
/*181*/ { BARCODE_MICROQR, COMPLIANT_HEIGHT, "12345", "", 11, 11, 11, 22, 22 }, /*181*/ { BARCODE_MICROQR, COMPLIANT_HEIGHT, "12345", "", 0, 11, 11, 11, 22, 22 },
/*182*/ { BARCODE_HIBC_128, -1, "1234567890", "", 50, 1, 123, 246, 116 }, /*182*/ { BARCODE_HIBC_128, -1, "1234567890", "", 0, 50, 1, 123, 246, 116 },
/*183*/ { BARCODE_HIBC_128, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 123, 246, 116 }, /*183*/ { BARCODE_HIBC_128, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 123, 246, 116 },
/*184*/ { BARCODE_HIBC_39, -1, "1234567890", "", 50, 1, 223, 446, 116 }, /*184*/ { BARCODE_HIBC_39, -1, "1234567890", "", 0, 50, 1, 223, 446, 116 },
/*185*/ { BARCODE_HIBC_39, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 223, 446, 116 }, /*185*/ { BARCODE_HIBC_39, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 223, 446, 116 },
/*186*/ { BARCODE_HIBC_DM, -1, "ABC", "", 12, 12, 12, 24, 24 }, /*186*/ { BARCODE_HIBC_DM, -1, "ABC", "", 0, 12, 12, 12, 24, 24 },
/*187*/ { BARCODE_HIBC_DM, COMPLIANT_HEIGHT, "ABC", "", 12, 12, 12, 24, 24 }, /*187*/ { BARCODE_HIBC_DM, COMPLIANT_HEIGHT, "ABC", "", 0, 12, 12, 12, 24, 24 },
/*188*/ { BARCODE_HIBC_QR, -1, "1234567890AB", "", 21, 21, 21, 42, 42 }, /*188*/ { BARCODE_HIBC_QR, -1, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
/*189*/ { BARCODE_HIBC_QR, COMPLIANT_HEIGHT, "1234567890AB", "", 21, 21, 21, 42, 42 }, /*189*/ { BARCODE_HIBC_QR, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
/*190*/ { BARCODE_HIBC_PDF, -1, "1234567890", "", 24, 8, 103, 206, 48 }, /*190*/ { BARCODE_HIBC_PDF, -1, "1234567890", "", 0, 24, 8, 103, 206, 48 },
/*191*/ { BARCODE_HIBC_PDF, COMPLIANT_HEIGHT, "1234567890", "", 24, 8, 103, 206, 48 }, /*191*/ { BARCODE_HIBC_PDF, COMPLIANT_HEIGHT, "1234567890", "", 0, 24, 8, 103, 206, 48 },
/*192*/ { BARCODE_HIBC_MICPDF, -1, "1234567890", "", 28, 14, 38, 76, 56 }, /*192*/ { BARCODE_HIBC_MICPDF, -1, "1234567890", "", 0, 28, 14, 38, 76, 56 },
/*193*/ { BARCODE_HIBC_MICPDF, COMPLIANT_HEIGHT, "1234567890", "", 28, 14, 38, 76, 56 }, /*193*/ { BARCODE_HIBC_MICPDF, COMPLIANT_HEIGHT, "1234567890", "", 0, 28, 14, 38, 76, 56 },
/*194*/ { BARCODE_HIBC_BLOCKF, -1, "1234567890", "", 30, 3, 101, 242, 64 }, /*194*/ { BARCODE_HIBC_BLOCKF, -1, "1234567890", "", 0, 30, 3, 101, 242, 64 },
/*195*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, "1234567890", "", 30, 3, 101, 242, 64 }, /*195*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, "1234567890", "", 0, 30, 3, 101, 242, 64 },
/*196*/ { BARCODE_HIBC_AZTEC, -1, "1234567890AB", "", 19, 19, 19, 38, 38 }, /*196*/ { BARCODE_HIBC_AZTEC, -1, "1234567890AB", "", 0, 19, 19, 19, 38, 38 },
/*197*/ { BARCODE_HIBC_AZTEC, COMPLIANT_HEIGHT, "1234567890AB", "", 19, 19, 19, 38, 38 }, /*197*/ { BARCODE_HIBC_AZTEC, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 19, 19, 19, 38, 38 },
/*198*/ { BARCODE_DOTCODE, -1, "ABC", "", 11, 11, 16, 33, 23 }, /*198*/ { BARCODE_DOTCODE, -1, "ABC", "", 0, 11, 11, 16, 33, 23 },
/*199*/ { BARCODE_DOTCODE, COMPLIANT_HEIGHT, "ABC", "", 11, 11, 16, 33, 23 }, /*199*/ { BARCODE_DOTCODE, COMPLIANT_HEIGHT, "ABC", "", 0, 11, 11, 16, 33, 23 },
/*200*/ { BARCODE_HANXIN, -1, "1234567890AB", "", 23, 23, 23, 46, 46 }, /*200*/ { BARCODE_HANXIN, -1, "1234567890AB", "", 0, 23, 23, 23, 46, 46 },
/*201*/ { BARCODE_HANXIN, COMPLIANT_HEIGHT, "1234567890AB", "", 23, 23, 23, 46, 46 }, /*201*/ { BARCODE_HANXIN, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 23, 23, 23, 46, 46 },
/*202*/ { BARCODE_MAILMARK_2D, -1, "012100123412345678AB19XY1A 0", "", 24, 24, 24, 48, 48 }, /*202*/ { BARCODE_MAILMARK_2D, -1, "012100123412345678AB19XY1A 0", "", 0, 24, 24, 24, 48, 48 },
/*203*/ { BARCODE_MAILMARK_2D, COMPLIANT_HEIGHT, "012100123412345678AB19XY1A 0", "", 24, 24, 24, 48, 48 }, /*203*/ { BARCODE_MAILMARK_2D, COMPLIANT_HEIGHT, "012100123412345678AB19XY1A 0", "", 0, 24, 24, 24, 48, 48 },
/*204*/ { BARCODE_UPU_S10, -1, "EE876543216CA", "", 50, 1, 156, 312, 116 }, /*204*/ { BARCODE_UPU_S10, -1, "EE876543216CA", "", 0, 50, 1, 156, 312, 116 },
/*205*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, "EE876543216CA", "", 50, 1, 156, 312, 116 }, /*205*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, "EE876543216CA", "", 0, 50, 1, 156, 312, 116 },
/*206*/ { BARCODE_MAILMARK_4S, -1, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 }, /*206*/ { BARCODE_MAILMARK_4S, -1, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20 },
/*207*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, "01000000000000000AA00AA0A", "", 8, 3, 155, 310, 16 }, /*207*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, "01000000000000000AA00AA0A", "", 0, 8, 3, 155, 310, 16 },
/*208*/ { BARCODE_AZRUNE, -1, "255", "", 11, 11, 11, 22, 22 }, /*208*/ { BARCODE_AZRUNE, -1, "255", "", 0, 11, 11, 11, 22, 22 },
/*209*/ { BARCODE_AZRUNE, COMPLIANT_HEIGHT, "255", "", 11, 11, 11, 22, 22 }, /*209*/ { BARCODE_AZRUNE, COMPLIANT_HEIGHT, "255", "", 0, 11, 11, 11, 22, 22 },
/*210*/ { BARCODE_CODE32, -1, "12345678", "", 50, 1, 103, 206, 116 }, /*210*/ { BARCODE_CODE32, -1, "12345678", "", 0, 50, 1, 103, 206, 116 },
/*211*/ { BARCODE_CODE32, COMPLIANT_HEIGHT, "12345678", "", 20, 1, 103, 206, 56 }, /*211*/ { BARCODE_CODE32, COMPLIANT_HEIGHT, "12345678", "", 0, 20, 1, 103, 206, 56 },
/*212*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01", 50, 7, 99, 226, 116 }, /*212*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01", 0, 50, 7, 99, 226, 116 },
/*213*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "123456789012", "[20]01", 81, 7, 99, 226, 178 }, /*213*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "123456789012", "[20]01", 0, 81, 7, 99, 226, 178 },
/*214*/ { BARCODE_EANX_CC, -1, "123456789012+12", "[20]01", 50, 7, 125, 276, 116 }, /*214*/ { BARCODE_EANX_CC, -1, "123456789012+12", "[20]01", 0, 50, 7, 125, 276, 116 },
/*215*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "123456789012+12", "[20]01", 81, 7, 125, 276, 178 }, /*215*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "123456789012+12", "[20]01", 0, 81, 7, 125, 276, 178 },
/*216*/ { BARCODE_EANX_CC, -1, "123456789012+12345", "[20]01", 50, 7, 152, 330, 116 }, /*216*/ { BARCODE_EANX_CC, -1, "123456789012+12345", "[20]01", 0, 50, 7, 152, 330, 116 },
/*217*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "123456789012+12345", "[20]01", 81, 7, 152, 330, 178 }, /*217*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "123456789012+12345", "[20]01", 0, 81, 7, 152, 330, 178 },
/*218*/ { BARCODE_EANX_CC, -1, "1234567", "[20]01", 50, 8, 72, 162, 116 }, /*218*/ { BARCODE_EANX_CC, -1, "1234567", "[20]01", 0, 50, 8, 72, 162, 116 },
/*219*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "1234567", "[20]01", 69, 8, 72, 162, 154 }, /*219*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "1234567", "[20]01", 0, 69, 8, 72, 162, 154 },
/*220*/ { BARCODE_EANX_CC, -1, "1234567+12", "[20]01", 50, 8, 98, 212, 116 }, /*220*/ { BARCODE_EANX_CC, -1, "1234567+12", "[20]01", ZINT_WARN_NONCOMPLIANT, 50, 8, 98, 212, 116 },
/*221*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "1234567+12", "[20]01", 69, 8, 98, 212, 154 }, /*221*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "1234567+12", "[20]01", ZINT_WARN_NONCOMPLIANT, 69, 8, 98, 212, 154 },
/*222*/ { BARCODE_EANX_CC, -1, "1234567+12345", "[20]01", 50, 8, 125, 266, 116 }, /*222*/ { BARCODE_EANX_CC, -1, "1234567+12345", "[20]01", ZINT_WARN_NONCOMPLIANT, 50, 8, 125, 266, 116 },
/*223*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "1234567+12345", "[20]01", 69, 8, 125, 266, 154 }, /*223*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "1234567+12345", "[20]01", ZINT_WARN_NONCOMPLIANT, 69, 8, 125, 266, 154 },
/*224*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01", 50, 5, 145, 290, 116 }, /*224*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01", 0, 50, 5, 145, 290, 116 },
/*225*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, "[01]12345678901231", "[20]01", 71, 5, 145, 290, 158 }, /*225*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, "[01]12345678901231", "[20]01", 0, 71, 5, 145, 290, 158 },
/*226*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "[20]01", 21, 5, 100, 200, 58 }, /*226*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "[20]01", 0, 21, 5, 100, 200, 58 },
/*227*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 40, 5, 100, 200, 96 }, /*227*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 0, 40, 5, 100, 200, 96 },
/*228*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "[20]01", 19, 6, 79, 158, 54 }, /*228*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 54 },
/*229*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 19, 6, 79, 158, 54 }, /*229*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 54 },
/*230*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "[20]01", 41, 5, 134, 268, 98 }, /*230*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 98 },
/*231*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, "[01]12345678901231", "[20]01", 41, 5, 134, 268, 98 }, /*231*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 98 },
/*232*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01", 50, 7, 99, 226, 116 }, /*232*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01", 0, 50, 7, 99, 226, 116 },
/*233*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, "12345678901", "[20]01", 81, 7, 99, 226, 178 }, /*233*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, "12345678901", "[20]01", 0, 81, 7, 99, 226, 178 },
/*234*/ { BARCODE_UPCA_CC, -1, "12345678901+12", "[20]01", 50, 7, 127, 276, 116 }, /*234*/ { BARCODE_UPCA_CC, -1, "12345678901+12", "[20]01", 0, 50, 7, 127, 276, 116 },
/*235*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, "12345678901+12", "[20]01", 81, 7, 127, 276, 178 }, /*235*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, "12345678901+12", "[20]01", 0, 81, 7, 127, 276, 178 },
/*236*/ { BARCODE_UPCA_CC, -1, "12345678901+12345", "[20]01", 50, 7, 154, 330, 116 }, /*236*/ { BARCODE_UPCA_CC, -1, "12345678901+12345", "[20]01", 0, 50, 7, 154, 330, 116 },
/*237*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, "12345678901+12345", "[20]01", 81, 7, 154, 330, 178 }, /*237*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, "12345678901+12345", "[20]01", 0, 81, 7, 154, 330, 178 },
/*238*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01", 50, 9, 55, 134, 116 }, /*238*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01", 0, 50, 9, 55, 134, 116 },
/*239*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, "1234567", "[20]01", 85, 9, 55, 134, 186 }, /*239*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, "1234567", "[20]01", 0, 85, 9, 55, 134, 186 },
/*240*/ { BARCODE_UPCE_CC, -1, "1234567+12", "[20]01", 50, 9, 81, 184, 116 }, /*240*/ { BARCODE_UPCE_CC, -1, "1234567+12", "[20]01", 0, 50, 9, 81, 184, 116 },
/*241*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, "1234567+12", "[20]01", 85, 9, 81, 184, 186 }, /*241*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, "1234567+12", "[20]01", 0, 85, 9, 81, 184, 186 },
/*242*/ { BARCODE_UPCE_CC, -1, "1234567+12345", "[20]01", 50, 9, 108, 238, 116 }, /*242*/ { BARCODE_UPCE_CC, -1, "1234567+12345", "[20]01", 0, 50, 9, 108, 238, 116 },
/*243*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, "1234567+12345", "[20]01", 85, 9, 108, 238, 186 }, /*243*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, "1234567+12345", "[20]01", 0, 85, 9, 108, 238, 186 },
/*244*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "[20]01", 24, 9, 56, 112, 48 }, /*244*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48 },
/*245*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 24, 9, 56, 112, 48 }, /*245*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48 },
/*246*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "[20]01", 80, 11, 56, 112, 160 }, /*246*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "[20]01", 0, 80, 11, 56, 112, 160 },
/*247*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 80, 11, 56, 112, 160 }, /*247*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 0, 80, 11, 56, 112, 160 },
/*248*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 }, /*248*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156 },
/*249*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 }, /*249*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156 },
/*250*/ { BARCODE_CHANNEL, -1, "01", "", 50, 1, 19, 38, 116 }, /*250*/ { BARCODE_CHANNEL, -1, "01", "", 0, 50, 1, 19, 38, 116 },
/*251*/ { BARCODE_CHANNEL, COMPLIANT_HEIGHT, "01", "", 20, 1, 19, 38, 56 }, /*251*/ { BARCODE_CHANNEL, COMPLIANT_HEIGHT, "01", "", 0, 20, 1, 19, 38, 56 },
/*252*/ { BARCODE_CODEONE, -1, "12345678901234567890", "", 16, 16, 18, 36, 32 }, /*252*/ { BARCODE_CODEONE, -1, "12345678901234567890", "", 0, 16, 16, 18, 36, 32 },
/*253*/ { BARCODE_CODEONE, COMPLIANT_HEIGHT, "12345678901234567890", "", 16, 16, 18, 36, 32 }, /*253*/ { BARCODE_CODEONE, COMPLIANT_HEIGHT, "12345678901234567890", "", 0, 16, 16, 18, 36, 32 },
/*254*/ { BARCODE_GRIDMATRIX, -1, "ABC", "", 18, 18, 18, 36, 36 }, /*254*/ { BARCODE_GRIDMATRIX, -1, "ABC", "", 0, 18, 18, 18, 36, 36 },
/*255*/ { BARCODE_GRIDMATRIX, COMPLIANT_HEIGHT, "ABC", "", 18, 18, 18, 36, 36 }, /*255*/ { BARCODE_GRIDMATRIX, COMPLIANT_HEIGHT, "ABC", "", 0, 18, 18, 18, 36, 36 },
/*256*/ { BARCODE_UPNQR, -1, "1234567890AB", "", 77, 77, 77, 154, 154 }, /*256*/ { BARCODE_UPNQR, -1, "1234567890AB", "", 0, 77, 77, 77, 154, 154 },
/*257*/ { BARCODE_UPNQR, COMPLIANT_HEIGHT, "1234567890AB", "", 77, 77, 77, 154, 154 }, /*257*/ { BARCODE_UPNQR, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 77, 77, 77, 154, 154 },
/*258*/ { BARCODE_ULTRA, -1, "1234567890", "", 13, 13, 18, 36, 26 }, /*258*/ { BARCODE_ULTRA, -1, "1234567890", "", 0, 13, 13, 18, 36, 26 },
/*259*/ { BARCODE_ULTRA, COMPLIANT_HEIGHT, "1234567890", "", 13, 13, 18, 36, 26 }, /*259*/ { BARCODE_ULTRA, COMPLIANT_HEIGHT, "1234567890", "", 0, 13, 13, 18, 36, 26 },
/*260*/ { BARCODE_RMQR, -1, "12345", "", 11, 11, 27, 54, 22 }, /*260*/ { BARCODE_RMQR, -1, "12345", "", 0, 11, 11, 27, 54, 22 },
/*261*/ { BARCODE_RMQR, COMPLIANT_HEIGHT, "12345", "", 11, 11, 27, 54, 22 }, /*261*/ { BARCODE_RMQR, COMPLIANT_HEIGHT, "12345", "", 0, 11, 11, 27, 54, 22 },
/*262*/ { BARCODE_BC412, -1, "1234567", "", 16.5, 1, 102, 204, 49 }, /*262*/ { BARCODE_BC412, -1, "1234567", "", 0, 16.5, 1, 102, 204, 49 },
/*263*/ { BARCODE_BC412, COMPLIANT_HEIGHT, "1234567", "", 16.5, 1, 102, 204, 49 }, /*263*/ { BARCODE_BC412, COMPLIANT_HEIGHT, "1234567", "", 0, 16.5, 1, 102, 204, 49 },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
const char *text; const char *text;
int ret_buf;
testStartSymbol(p_ctx->func_name, &symbol); testStartSymbol(p_ctx->func_name, &symbol);
@@ -408,30 +409,44 @@ static void test_buffer(const testCtx *const p_ctx) {
} else { } else {
text = data[i].data; text = data[i].data;
} }
length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, data[i].output_options, text, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
text, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%s) ret %d != %d (%s)\n",
i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, 0); ret_buf = ZBarcode_Buffer(symbol, 0);
assert_zero(ret, "i:%d ZBarcode_Buffer(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); assert_zero(ret_buf, "i:%d ZBarcode_Buffer(%s) ret_buf %d != 0 (%s)\n",
assert_nonnull(symbol->bitmap, "i:%d ZBarcode_Buffer(%s) bitmap NULL\n", i, testUtilBarcodeName(data[i].symbology)); i, testUtilBarcodeName(data[i].symbology), ret_buf, symbol->errtxt);
assert_nonnull(symbol->bitmap, "i:%d ZBarcode_Buffer(%s) bitmap NULL\n",
i, testUtilBarcodeName(data[i].symbology));
if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); /* ZINT_DEBUG_TEST_PRINT 16 */ if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) { /* ZINT_DEBUG_TEST_PRINT 16 */
testUtilBitmapPrint(symbol, NULL, NULL);
}
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %s, \"%s\", \"%s\", %.8g, %d, %d, %d, %d },\n", printf(" /*%3d*/ { %s, %s, \"%s\", \"%s\", %s, %.8g, %d, %d, %d, %d },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilOutputOptionsName(data[i].output_options), i, testUtilBarcodeName(data[i].symbology), testUtilOutputOptionsName(data[i].output_options),
data[i].data, data[i].composite, data[i].data, data[i].composite, testUtilErrorName(ret),
symbol->height, symbol->rows, symbol->width, symbol->bitmap_width, symbol->bitmap_height); symbol->height, symbol->rows, symbol->width, symbol->bitmap_width, symbol->bitmap_height);
} else { } else {
assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.8g != %.8g\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height); assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.8g != %.8g\n",
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows); i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width); assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n",
assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%s) symbol->bitmap_width %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows);
i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_width, data[i].expected_bitmap_width); assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n",
assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%s) symbol->bitmap_height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width);
i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_height, data[i].expected_bitmap_height); assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width,
"i:%d (%s) symbol->bitmap_width %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_width,
data[i].expected_bitmap_width);
assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height,
"i:%d (%s) symbol->bitmap_height %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_height,
data[i].expected_bitmap_height);
} }
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
@@ -493,18 +508,18 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
/* 26*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456", 0, 50, 1, 67, 162, 116, 106 /*text_row*/, 0, 14, 106, 148, 14 }, /* 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 */ /* 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 */ /* 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 */ /* 29*/ { BARCODE_EANX, -1, -1, "123456+12", ZINT_WARN_NONCOMPLIANT, 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 */ /* 30*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456+12", ZINT_WARN_NONCOMPLIANT, 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 */ /* 31*/ { BARCODE_EANX, 0, -1, "123456+12", ZINT_WARN_NONCOMPLIANT, 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 */ /* 32*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456+12", ZINT_WARN_NONCOMPLIANT, 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 */ /* 33*/ { BARCODE_EANX, 0, EANUPC_GUARD_WHITESPACE, "123456+12", ZINT_WARN_NONCOMPLIANT, 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 */ /* 34*/ { BARCODE_EANX, 1 /*empty*/, -1, "123456+12", ZINT_WARN_NONCOMPLIANT, 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 */ /* 35*/ { BARCODE_EANX, -1, -1, "123456+12345", ZINT_WARN_NONCOMPLIANT, 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 */ /* 36*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456+12345", ZINT_WARN_NONCOMPLIANT, 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 */ /* 37*/ { BARCODE_EANX, 0, -1, "123456+12345", ZINT_WARN_NONCOMPLIANT, 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 */ /* 38*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456+12345", ZINT_WARN_NONCOMPLIANT, 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 */ /* 39*/ { BARCODE_EANX, 0, EANUPC_GUARD_WHITESPACE, "123456+12345", ZINT_WARN_NONCOMPLIANT, 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 */ /* 40*/ { BARCODE_EANX, 1 /*empty*/, -1, "123456+12345", ZINT_WARN_NONCOMPLIANT, 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 */ /* 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", 0, 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 */ /* 43*/ { BARCODE_EANX, 0, -1, "1234", 0, 50, 1, 47, 104, 100, -1 /*text_row*/, -1, -1, -1, -1, -1 }, /* EAN-5 */
@@ -573,40 +588,54 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
length = (int) strlen(data[i].data); length = (int) strlen(data[i].data);
ret = ZBarcode_Encode_and_Buffer(symbol, (unsigned char *) data[i].data, length, 0); ret = ZBarcode_Encode_and_Buffer(symbol, (unsigned char *) data[i].data, length, 0);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, data[i].symbology); assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, data[i].symbology);
if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); /* ZINT_DEBUG_TEST_PRINT 16 */ if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) { /* ZINT_DEBUG_TEST_PRINT 16 */
testUtilBitmapPrint(symbol, NULL, NULL);
}
assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.8g != %.8g\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height); assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.8g != %.8g\n",
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows); i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width); assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width);
assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%s) symbol->bitmap_width %d != %d\n", assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%s) symbol->bitmap_width %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_width, data[i].expected_bitmap_width); i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_width, data[i].expected_bitmap_width);
assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%s) symbol->bitmap_height %d != %d\n", assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height,
"i:%d (%s) symbol->bitmap_height %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_height, data[i].expected_bitmap_height); i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_height, data[i].expected_bitmap_height);
assert_nonzero(symbol->bitmap_height > data[i].expected_text_row, "i:%d symbol->bitmap_height %d <= data[i].expected_text_row %d\n", i, symbol->bitmap_height, data[i].expected_text_row); assert_nonzero(symbol->bitmap_height > data[i].expected_text_row,
"i:%d symbol->bitmap_height %d <= data[i].expected_text_row %d\n",
i, symbol->bitmap_height, data[i].expected_text_row);
if (data[i].expected_text_row == -1) { /* EAN-2/5 just truncates bitmap if no text */ if (data[i].expected_text_row == -1) { /* EAN-2/5 just truncates bitmap if no text */
assert_zero(data[i].show_hrt, "i:%d Expected text row -1 but show_hrt set\n", i); assert_zero(data[i].show_hrt, "i:%d Expected text row -1 but show_hrt set\n", i);
if (i && data[i - 1].symbology == symbol->symbology && data[i - 1].show_hrt && data[i - 1].expected_text_row != -1) { if (i && data[i - 1].symbology == symbol->symbology && data[i - 1].show_hrt
assert_nonzero(data[i].expected_bitmap_height > data[i - 1].expected_text_row, "i:%d (%s) expected_bitmap_height %d <= previous expected_text_row %d\n", && data[i - 1].expected_text_row != -1) {
i, testUtilBarcodeName(data[i].symbology), data[i].expected_bitmap_height, data[i - 1].expected_text_row); assert_nonzero(data[i].expected_bitmap_height > data[i - 1].expected_text_row,
"i:%d (%s) expected_bitmap_height %d <= previous expected_text_row %d\n",
i, testUtilBarcodeName(data[i].symbology), data[i].expected_bitmap_height,
data[i - 1].expected_text_row);
} }
} else { } else {
int text_bits_set = 0; int text_bits_set = 0;
int row = data[i].expected_text_row; int row = data[i].expected_text_row;
int column; int column;
for (column = data[i].expected_text_col; column < data[i].expected_text_col + data[i].expected_text_len; column++) { for (column = data[i].expected_text_col;
column < data[i].expected_text_col + data[i].expected_text_len; column++) {
if (is_row_column_black(symbol, row, column)) { if (is_row_column_black(symbol, row, column)) {
text_bits_set = 1; text_bits_set = 1;
break; break;
} }
} }
if (data[i].show_hrt == -1) { /* Using -1 in data as show_hrt, 1 in data as show_hrt but empty space */ if (data[i].show_hrt == -1) { /* Using -1 in data as show_hrt, 1 in data as show_hrt but empty space */
assert_nonzero(text_bits_set, "i:%d (%s) text_bits_set zero\n", i, testUtilBarcodeName(data[i].symbology)); assert_nonzero(text_bits_set, "i:%d (%s) text_bits_set zero\n",
i, testUtilBarcodeName(data[i].symbology));
} else { } else {
assert_zero(text_bits_set, "i:%d (%s) text_bits_set non-zero\n", i, testUtilBarcodeName(data[i].symbology)); assert_zero(text_bits_set, "i:%d (%s) text_bits_set non-zero\n",
i, testUtilBarcodeName(data[i].symbology));
} }
} }
@@ -614,16 +643,19 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
int text2_bits_set = 0; int text2_bits_set = 0;
int row = data[i].expected_text2_row; int row = data[i].expected_text2_row;
int column; int column;
for (column = data[i].expected_text2_col; column < data[i].expected_text2_col + data[i].expected_text2_len; column++) { for (column = data[i].expected_text2_col;
column < data[i].expected_text2_col + data[i].expected_text2_len; column++) {
if (is_row_column_black(symbol, row, column)) { if (is_row_column_black(symbol, row, column)) {
text2_bits_set = 1; text2_bits_set = 1;
break; break;
} }
} }
if (data[i].show_hrt == -1) { /* Using -1 in data as show_hrt, 1 in data as show_hrt but empty space */ if (data[i].show_hrt == -1) { /* Using -1 in data as show_hrt, 1 in data as show_hrt but empty space */
assert_nonzero(text2_bits_set, "i:%d (%s) text2_bits_set zero\n", i, testUtilBarcodeName(data[i].symbology)); assert_nonzero(text2_bits_set, "i:%d (%s) text2_bits_set zero\n",
i, testUtilBarcodeName(data[i].symbology));
} else { } else {
assert_zero(text2_bits_set, "i:%d (%s) text2_bits_set non-zero\n", i, testUtilBarcodeName(data[i].symbology)); assert_zero(text2_bits_set, "i:%d (%s) text2_bits_set non-zero\n",
i, testUtilBarcodeName(data[i].symbology));
} }
} }
@@ -3152,7 +3184,7 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
/* 6*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012", -1, 0, 116, 226, "1234567890128", -1, "", -1, "" }, /* 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, "" }, /* 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, "" }, /* 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, "" }, /* 9*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012+12", -1, 0, 116, 276, "1234567890128+12", -1, "123456789012812", -1, "" },
/* 10*/ { BARCODE_CODE39, -1, -1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116, 180, "*ABC14*", -1, "", -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, "" }, /* 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 */ /* 12*/ { BARCODE_CODE39, -1, 1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116, 206, "*ABC14_*", -1, "", -1, "" }, /* Check digit space rendered as underscore */
@@ -3347,24 +3379,24 @@ static void test_perf_scale(const testCtx *const p_ctx) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func */ testFunction funcs[] = { /* name, func */
{ "test_options", test_options, }, { "test_options", test_options },
{ "test_buffer", test_buffer, }, { "test_buffer", test_buffer },
{ "test_upcean_hrt", test_upcean_hrt, }, { "test_upcean_hrt", test_upcean_hrt },
{ "test_row_separator", test_row_separator, }, { "test_row_separator", test_row_separator },
{ "test_stacking", test_stacking, }, { "test_stacking", test_stacking },
{ "test_stacking_too_many", test_stacking_too_many, }, { "test_stacking_too_many", test_stacking_too_many },
{ "test_output_options", test_output_options, }, { "test_output_options", test_output_options },
{ "test_draw_string_wrap", test_draw_string_wrap, }, { "test_draw_string_wrap", test_draw_string_wrap },
{ "test_code128_utf8", test_code128_utf8, }, { "test_code128_utf8", test_code128_utf8 },
{ "test_scale", test_scale, }, { "test_scale", test_scale },
{ "test_guard_descent", test_guard_descent, }, { "test_guard_descent", test_guard_descent },
{ "test_quiet_zones", test_quiet_zones, }, { "test_quiet_zones", test_quiet_zones },
{ "test_text_gap", test_text_gap, }, { "test_text_gap", test_text_gap },
{ "test_buffer_plot", test_buffer_plot, }, { "test_buffer_plot", test_buffer_plot },
{ "test_height", test_height, }, { "test_height", test_height },
{ "test_height_per_row", test_height_per_row, }, { "test_height_per_row", test_height_per_row },
{ "test_hrt_raw_text", test_hrt_raw_text, }, { "test_hrt_raw_text", test_hrt_raw_text },
{ "test_perf_scale", test_perf_scale, }, { "test_perf_scale", test_perf_scale },
}; };
testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
+3 -2
View File
@@ -1369,8 +1369,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
+44 -26
View File
@@ -109,14 +109,14 @@ static void test_print(const testCtx *const p_ctx) {
/* 49*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, -1, 0, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.svg", "" }, /* 49*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, -1, 0, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.svg", "" },
/* 50*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9501234", "", 0, "ean8_gss_5.2.2.2-1.svg", "" }, /* 50*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9501234", "", 0, "ean8_gss_5.2.2.2-1.svg", "" },
/* 51*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9501234", "", 0, "ean8_gss_5.2.2.2-1_gws.svg", "" }, /* 51*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9501234", "", 0, "ean8_gss_5.2.2.2-1_gws.svg", "" },
/* 52*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", 0, "ean8_2addon.svg", "" }, /* 52*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", ZINT_WARN_NONCOMPLIANT, "ean8_2addon.svg", "" },
/* 53*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", 0, "ean8_2addon_gws.svg", "" }, /* 53*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", ZINT_WARN_NONCOMPLIANT, "ean8_2addon_gws.svg", "" },
/* 54*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "ean8_5addon.svg", "" }, /* 54*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", ZINT_WARN_NONCOMPLIANT, "ean8_5addon.svg", "" },
/* 55*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "ean8_5addon_gws.svg", "" }, /* 55*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", ZINT_WARN_NONCOMPLIANT, "ean8_5addon_gws.svg", "" },
/* 56*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.svg", "" }, /* 56*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "9876543+65", "[91]1234567", ZINT_WARN_NONCOMPLIANT, "ean8_cc_2addon_cca_4x3.svg", "" },
/* 57*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3_gws.svg", "" }, /* 57*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "9876543+65", "[91]1234567", ZINT_WARN_NONCOMPLIANT, "ean8_cc_2addon_cca_4x3_gws.svg", "" },
/* 58*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.svg", "" }, /* 58*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "9876543+74083", "[91]123456789012345678", ZINT_WARN_NONCOMPLIANT, "ean8_cc_5addon_ccb_8x3.svg", "" },
/* 59*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3_gws.svg", "" }, /* 59*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "9876543+74083", "[91]123456789012345678", ZINT_WARN_NONCOMPLIANT, "ean8_cc_5addon_ccb_8x3_gws.svg", "" },
/* 60*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5.svg", "" }, /* 60*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5.svg", "" },
/* 61*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5_gws.svg", "" }, /* 61*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5_gws.svg", "" },
/* 62*/ { BARCODE_EANX, -1, 2, BARCODE_BIND, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5_bind2.svg", "" }, /* 62*/ { BARCODE_EANX, -1, 2, BARCODE_BIND, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5_bind2.svg", "" },
@@ -163,7 +163,8 @@ static void test_print(const testCtx *const p_ctx) {
have_libreoffice = testUtilHaveLibreOffice(); have_libreoffice = testUtilHaveLibreOffice();
have_vnu = testUtilHaveVnu(); have_vnu = testUtilHaveVnu();
assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL), "testUtilDataPath(%s) == 0\n", data_dir); assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL),
"testUtilDataPath(%s) == 0\n", data_dir);
if (!testUtilDirExists(data_dir_path)) { if (!testUtilDirExists(data_dir_path)) {
ret = testUtilMkDir(data_dir_path); ret = testUtilMkDir(data_dir_path);
assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno)); assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno));
@@ -178,7 +179,9 @@ static void test_print(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, data[i].output_options, data[i].data, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/,
data[i].option_1, data[i].option_2, data[i].option_3, data[i].output_options,
data[i].data, -1, debug);
if (data[i].show_hrt != -1) { if (data[i].show_hrt != -1) {
symbol->show_hrt = data[i].show_hrt; symbol->show_hrt = data[i].show_hrt;
} }
@@ -210,44 +213,53 @@ static void test_print(const testCtx *const p_ctx) {
text_length = (int) strlen(text); text_length = (int) strlen(text);
ret = ZBarcode_Encode(symbol, TCU(text), text_length); ret = ZBarcode_Encode(symbol, TCU(text), text_length);
assert_equal(ret, data[i].ret, "i:%d %s ZBarcode_Encode ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d %s ZBarcode_Encode ret %d != %d (%s)\n",
i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
strcpy(symbol->outfile, svg); strcpy(symbol->outfile, svg);
ret = ZBarcode_Print(symbol, data[i].rotate_angle); ret = ZBarcode_Print(symbol, data[i].rotate_angle);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file),
"i:%d testUtilDataPath == 0\n", i);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %d, %.8g, \"%s\", \"%s\", %d, \"%s\", \"%s\", %s, \"%s\", \"%s\" },\n", printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %d, %.8g, \"%s\", \"%s\", %d, \"%s\", \"%s\", %s, \"%s\", \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].border_width, testUtilOutputOptionsName(data[i].output_options),
data[i].option_1, data[i].option_2, data[i].option_3, data[i].height, data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle, data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt,
data[i].option_1, data[i].option_2, data[i].option_3, data[i].height,
data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite,
testUtilErrorName(data[i].ret), data[i].expected_file, data[i].comment); testUtilErrorName(data[i].ret), data[i].expected_file, data[i].comment);
ret = testUtilRename(symbol->outfile, expected_file); ret = testUtilRename(symbol->outfile, expected_file);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
if (have_libreoffice) { if (have_libreoffice) {
ret = testUtilVerifyLibreOffice(expected_file, debug); ret = testUtilVerifyLibreOffice(expected_file, debug);
assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
} }
if (have_vnu) { if (have_vnu) {
ret = testUtilVerifyVnu(expected_file, debug); /* Very slow */ ret = testUtilVerifyVnu(expected_file, debug); /* Very slow */
assert_zero(ret, "i:%d %s vnu libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); assert_zero(ret, "i:%d %s vnu libreoffice %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
} }
} else { } else {
assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile); assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile);
assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file); assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file);
ret = testUtilCmpSvgs(symbol->outfile, expected_file); ret = testUtilCmpSvgs(symbol->outfile, expected_file);
assert_zero(ret, "i:%d %s testUtilCmpSvgs(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d %s testUtilCmpSvgs(%s, %s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
symbol->output_options |= BARCODE_MEMORY_FILE; symbol->output_options |= BARCODE_MEMORY_FILE;
ret = ZBarcode_Print(symbol, data[i].rotate_angle); ret = ZBarcode_Print(symbol, data[i].rotate_angle);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0 (%s)\n", assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0 (%s)\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret, symbol->errtxt); i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret, symbol->errtxt);
assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology)); assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology));
assert_nonzero(symbol->memfile_size, "i:%d %s memfile_size 0\n", i, testUtilBarcodeName(data[i].symbology)); assert_nonzero(symbol->memfile_size, "i:%d %s memfile_size 0\n",
i, testUtilBarcodeName(data[i].symbology));
ret = testUtilWriteFile(memfile, symbol->memfile, symbol->memfile_size, "wb"); ret = testUtilWriteFile(memfile, symbol->memfile, symbol->memfile_size, "wb");
assert_zero(ret, "%d: testUtilWriteFile(%s) fail ret %d != 0\n", i, memfile, ret); assert_zero(ret, "%d: testUtilWriteFile(%s) fail ret %d != 0\n", i, memfile, ret);
@@ -288,15 +300,20 @@ static void test_outfile(const testCtx *const p_ctx) {
skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */
#endif #endif
if (!skip_readonly_test) { if (!skip_readonly_test) {
static char expected_errtxt[] = "680: Could not open SVG output file ("; /* Excluding OS-dependent `errno` stuff */ /* Excluding OS-dependent `errno` stuff */
static char expected_errtxt[] = "680: Could not open SVG output file (";
(void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */
assert_nonzero(testUtilCreateROFile(symbol.outfile), "svg_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); assert_nonzero(testUtilCreateROFile(symbol.outfile), "svg_plot testUtilCreateROFile(%s) fail (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
ret = svg_plot(&symbol, 0); ret = svg_plot(&symbol, 0);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "svg_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "svg_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n",
assert_zero(testUtilRmROFile(symbol.outfile), "svg_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt);
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "svg_plot testUtilRmROFile(%s) != 0 (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n",
symbol.errtxt, expected_errtxt);
} }
symbol.output_options |= BARCODE_STDOUT; symbol.output_options |= BARCODE_STDOUT;
@@ -308,7 +325,8 @@ static void test_outfile(const testCtx *const p_ctx) {
symbol.vector = NULL; symbol.vector = NULL;
ret = svg_plot(&symbol, 0); ret = svg_plot(&symbol, 0);
assert_equal(ret, ZINT_ERROR_INVALID_DATA, "svg_plot ret %d != ZINT_ERROR_INVALID_DATA (%d) (%s)\n", ret, ZINT_ERROR_INVALID_DATA, symbol.errtxt); assert_equal(ret, ZINT_ERROR_INVALID_DATA, "svg_plot ret %d != ZINT_ERROR_INVALID_DATA (%d) (%s)\n",
ret, ZINT_ERROR_INVALID_DATA, symbol.errtxt);
testFinish(); testFinish();
} }
+46 -22
View File
@@ -117,19 +117,22 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
symbol->debug |= debug; symbol->debug |= debug;
size = data[i].width * data[i].height; size = data[i].width * data[i].height;
assert_nonzero(size < (int) sizeof(data_buf), "i:%d tif_pixel_plot size %d >= sizeof(data_buf) %d\n", i, size, (int) sizeof(data_buf)); assert_nonzero(size < (int) sizeof(data_buf), "i:%d tif_pixel_plot size %d >= sizeof(data_buf) %d\n",
i, size, (int) sizeof(data_buf));
if (data[i].repeat) { if (data[i].repeat) {
testUtilStrCpyRepeat(data_buf, data[i].pattern, size); testUtilStrCpyRepeat(data_buf, data[i].pattern, size);
} else { } else {
strcpy(data_buf, data[i].pattern); strcpy(data_buf, data[i].pattern);
} }
assert_equal(size, (int) strlen(data_buf), "i:%d tif_pixel_plot size %d != strlen(data_buf) %d\n", i, size, (int) strlen(data_buf)); assert_equal(size, (int) strlen(data_buf), "i:%d tif_pixel_plot size %d != strlen(data_buf) %d\n",
i, size, (int) strlen(data_buf));
symbol->bitmap = (unsigned char *) data_buf; symbol->bitmap = (unsigned char *) data_buf;
ret = tif_pixel_plot(symbol, (unsigned char *) data_buf); ret = tif_pixel_plot(symbol, (unsigned char *) data_buf);
assert_equal(ret, data[i].ret, "i:%d tif_pixel_plot ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d tif_pixel_plot ret %d != %d (%s)\n",
i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
if (have_tiffinfo) { if (have_tiffinfo) {
@@ -225,7 +228,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) { if (p_ctx->generate) {
char data_dir_path[1024]; char data_dir_path[1024];
assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL), "testUtilDataPath(%s) == 0\n", data_dir); assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL),
"testUtilDataPath(%s) == 0\n", data_dir);
if (!testUtilDirExists(data_dir_path)) { if (!testUtilDirExists(data_dir_path)) {
ret = testUtilMkDir(data_dir_path); ret = testUtilMkDir(data_dir_path);
assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno)); assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno));
@@ -240,7 +244,9 @@ static void test_print(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug); 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);
if (data[i].show_hrt != -1) { if (data[i].show_hrt != -1) {
symbol->show_hrt = data[i].show_hrt; symbol->show_hrt = data[i].show_hrt;
} }
@@ -274,38 +280,49 @@ static void test_print(const testCtx *const p_ctx) {
text_length = (int) strlen(text); text_length = (int) strlen(text);
ret = ZBarcode_Encode(symbol, TCU(text), text_length); ret = ZBarcode_Encode(symbol, TCU(text), text_length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, tif); strcpy(symbol->outfile, tif);
ret = ZBarcode_Print(symbol, 0); ret = ZBarcode_Print(symbol, 0);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file),
"i:%d testUtilDataPath == 0\n", i);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %d, %.5g, \"%s\",\"%s\", \"%s\", \"%s\", \"%s\", \"%s\" },\n", printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %d, %.5g, \"%s\",\"%s\", \"%s\", \"%s\", \"%s\", \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, testUtilOutputOptionsName(data[i].output_options), i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].option_1, data[i].option_2, data[i].border_width, testUtilOutputOptionsName(data[i].output_options),
data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt,
data[i].option_1, data[i].option_2,
data[i].height, data[i].scale, data[i].fgcolour, data[i].bgcolour, data[i].height, data[i].scale, data[i].fgcolour, data[i].bgcolour,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].expected_file, data[i].comment); testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite,
data[i].expected_file, data[i].comment);
ret = testUtilRename(symbol->outfile, expected_file); ret = testUtilRename(symbol->outfile, expected_file);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
if (have_tiffinfo) { if (have_tiffinfo) {
ret = testUtilVerifyTiffInfo(expected_file, debug); ret = testUtilVerifyTiffInfo(expected_file, debug);
assert_zero(ret, "i:%d %s tiffinfo %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); assert_zero(ret, "i:%d %s tiffinfo %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
} else if (have_identify) { } else if (have_identify) {
ret = testUtilVerifyIdentify(have_identify, expected_file, debug); ret = testUtilVerifyIdentify(have_identify, expected_file, debug);
assert_zero(ret, "i:%d %s identify %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); assert_zero(ret, "i:%d %s identify %s ret %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
} }
} else { } else {
assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile); assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile);
assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file); assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file);
ret = testUtilCmpBins(symbol->outfile, expected_file); ret = testUtilCmpBins(symbol->outfile, expected_file);
assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size); /* For BARCODE_MEMORY_FILE */ /* For BARCODE_MEMORY_FILE */
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size);
assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) { if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) {
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile); assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -318,7 +335,8 @@ static void test_print(const testCtx *const p_ctx) {
assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology)); assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology));
assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n", assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size); i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size);
assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size), "i:%d %s memcmp(memfile, filebuf) != 0\n", assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size),
"i:%d %s memcmp(memfile, filebuf) != 0\n",
i, testUtilBarcodeName(data[i].symbology)); i, testUtilBarcodeName(data[i].symbology));
} }
@@ -347,15 +365,21 @@ static void test_outfile(const testCtx *const p_ctx) {
skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */
#endif #endif
if (!skip_readonly_test) { if (!skip_readonly_test) {
static char expected_errtxt[] = "672: Could not open TIF output file ("; /* Excluding OS-dependent `errno` stuff */ /* Excluding OS-dependent `errno` stuff */
static char expected_errtxt[] = "672: Could not open TIF output file (";
(void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */
assert_nonzero(testUtilCreateROFile(symbol.outfile), "tif_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); assert_nonzero(testUtilCreateROFile(symbol.outfile),
"tif_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
ret = tif_pixel_plot(&symbol, data); ret = tif_pixel_plot(&symbol, data);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "tif_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "tif_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n",
assert_zero(testUtilRmROFile(symbol.outfile), "tif_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt);
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "tif_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n",
symbol.outfile, errno, strerror(errno));
assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n",
symbol.errtxt, expected_errtxt);
} }
symbol.output_options |= BARCODE_STDOUT; symbol.output_options |= BARCODE_STDOUT;
+127 -85
View File
@@ -115,7 +115,9 @@ static void test_upce_input(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
@@ -123,9 +125,12 @@ static void test_upce_input(const testCtx *const p_ctx) {
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) { if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
char modules_dump[8192 + 1]; char modules_dump[8192 + 1];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].hrt, (int) strlen(data[i].hrt), NULL, cmp_buf, sizeof(cmp_buf), NULL); "i:%d testUtilModulesDump == -1\n", i);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].hrt, (int) strlen(data[i].hrt), 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, modules_dump); 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", assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
@@ -134,9 +139,12 @@ static void test_upce_input(const testCtx *const p_ctx) {
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) { if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len; int cmp_len, ret_len;
char modules_dump[8192 + 1]; char modules_dump[8192 + 1];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf, sizeof(cmp_buf), &cmp_len); "i:%d testUtilModulesDump == -1\n", i);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); 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), ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].hrt, (int) strlen(data[i].hrt),
NULL /*primary*/, escaped, &ret_len); NULL /*primary*/, escaped, &ret_len);
@@ -178,14 +186,17 @@ static void test_upca_print(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
strcpy(symbol->outfile, "out.gif"); strcpy(symbol->outfile, "out.gif");
ret = ZBarcode_Print(symbol, 0); ret = ZBarcode_Print(symbol, 0);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret, symbol->errtxt); assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0 (%s)\n",
i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret, symbol->errtxt);
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile); assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -298,11 +309,14 @@ static void test_upca_input(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d 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);
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
} }
@@ -368,9 +382,9 @@ static void test_eanx_input(const testCtx *const p_ctx) {
/* 43*/ { BARCODE_EANX, "12+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, /* 43*/ { BARCODE_EANX, "12+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" },
/* 44*/ { BARCODE_EANX, "1+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, /* 44*/ { BARCODE_EANX, "1+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" },
/* 45*/ { BARCODE_EANX, "1+12345678901234", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 14 too long (maximum 5)", "" }, /* 45*/ { BARCODE_EANX, "1+12345678901234", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 14 too long (maximum 5)", "" },
/* 46*/ { BARCODE_EANX, "1+12345", 0, "", "" }, /* 46*/ { BARCODE_EANX, "1+12345", ZINT_WARN_NONCOMPLIANT, "Warning 292: EAN-8 with add-on is non-standard", "" },
/* 47*/ { BARCODE_EANX, "1+", 0, "", "EAN-2" }, /* 47*/ { BARCODE_EANX, "1+", 0, "", "EAN-2" },
/* 48*/ { BARCODE_EANX, "+1", 0, "", "EAN-8" }, /* 48*/ { BARCODE_EANX, "+1", ZINT_WARN_NONCOMPLIANT, "Warning 292: EAN-8 with add-on is non-standard", "EAN-8" },
/* 49*/ { BARCODE_EANX, "+", 0, "", "EAN-2" }, /* 49*/ { BARCODE_EANX, "+", 0, "", "EAN-2" },
/* 50*/ { BARCODE_EANX, "1", 0, "", "EAN-2" }, /* 50*/ { BARCODE_EANX, "1", 0, "", "EAN-2" },
/* 51*/ { BARCODE_EANX, "12", 0, "", "EAN-2" }, /* 51*/ { BARCODE_EANX, "12", 0, "", "EAN-2" },
@@ -426,26 +440,26 @@ static void test_eanx_input(const testCtx *const p_ctx) {
/*101*/ { BARCODE_EANX_CHK, "1234567890+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, /*101*/ { BARCODE_EANX_CHK, "1234567890+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" },
/*102*/ { BARCODE_EANX_CHK, "123456789+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '9', expecting '4'", "" }, /*102*/ { BARCODE_EANX_CHK, "123456789+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '9', expecting '4'", "" },
/*103*/ { BARCODE_EANX_CHK, "12345678+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '8', expecting '0'", "EAN-8" }, /*103*/ { BARCODE_EANX_CHK, "12345678+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '8', expecting '0'", "EAN-8" },
/*104*/ { BARCODE_EANX_CHK, "12345670+12345", 0, "", "" }, /*104*/ { BARCODE_EANX_CHK, "12345670+12345", ZINT_WARN_NONCOMPLIANT, "Warning 292: EAN-8 with add-on is non-standard", "" },
/*105*/ { BARCODE_EANX_CHK, "1234567+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '7', expecting '5'", "" }, /*105*/ { BARCODE_EANX_CHK, "1234567+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '7', expecting '5'", "" },
/*106*/ { BARCODE_EANX_CHK, "1234565+12345", 0, "", "" }, /*106*/ { BARCODE_EANX_CHK, "1234565+12345", ZINT_WARN_NONCOMPLIANT, "Warning 292: EAN-8 with add-on is non-standard", "" },
/*107*/ { BARCODE_EANX_CHK, "123456+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '6', expecting '7'", "" }, /*107*/ { BARCODE_EANX_CHK, "123456+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '6', expecting '7'", "" },
/*108*/ { BARCODE_EANX_CHK, "123457+12345", 0, "", "" }, /*108*/ { BARCODE_EANX_CHK, "123457+12345", ZINT_WARN_NONCOMPLIANT, "Warning 292: EAN-8 with add-on is non-standard", "" },
/*109*/ { BARCODE_EANX_CHK, "12345+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '5', expecting '8'", "" }, /*109*/ { BARCODE_EANX_CHK, "12345+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '5', expecting '8'", "" },
/*110*/ { BARCODE_EANX_CHK, "12348+12345", 0, "", "" }, /*110*/ { BARCODE_EANX_CHK, "12348+12345", ZINT_WARN_NONCOMPLIANT, "Warning 292: EAN-8 with add-on is non-standard", "" },
/*111*/ { BARCODE_EANX_CHK, "1234+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '4', expecting '6'", "" }, /*111*/ { BARCODE_EANX_CHK, "1234+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '4', expecting '6'", "" },
/*112*/ { BARCODE_EANX_CHK, "1236+12345", 0, "", "" }, /*112*/ { BARCODE_EANX_CHK, "1236+12345", ZINT_WARN_NONCOMPLIANT, "Warning 292: EAN-8 with add-on is non-standard", "" },
/*113*/ { BARCODE_EANX_CHK, "123+12345", 0, "", "3 happens to be correct check digit" }, /*113*/ { BARCODE_EANX_CHK, "123+12345", ZINT_WARN_NONCOMPLIANT, "Warning 292: EAN-8 with add-on is non-standard", "3 happens to be correct check digit" },
/*114*/ { BARCODE_EANX_CHK, "124+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '4', expecting '3'", "" }, /*114*/ { BARCODE_EANX_CHK, "124+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '4', expecting '3'", "" },
/*115*/ { BARCODE_EANX_CHK, "12+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '2', expecting '7'", "" }, /*115*/ { BARCODE_EANX_CHK, "12+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '2', expecting '7'", "" },
/*116*/ { BARCODE_EANX_CHK, "17+12345", 0, "", "" }, /*116*/ { BARCODE_EANX_CHK, "17+12345", ZINT_WARN_NONCOMPLIANT, "Warning 292: EAN-8 with add-on is non-standard", "" },
/*117*/ { BARCODE_EANX_CHK, "1+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '1', expecting '0'", "" }, /*117*/ { BARCODE_EANX_CHK, "1+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '1', expecting '0'", "" },
/*118*/ { BARCODE_EANX_CHK, "0+12345", 0, "", "" }, /*118*/ { BARCODE_EANX_CHK, "0+12345", ZINT_WARN_NONCOMPLIANT, "Warning 292: EAN-8 with add-on is non-standard", "" },
/*119*/ { BARCODE_EANX_CHK, "0+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, /*119*/ { BARCODE_EANX_CHK, "0+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" },
/*120*/ { BARCODE_EANX_CHK, "1+12345678901234", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 14 too long (maximum 5)", "" }, /*120*/ { BARCODE_EANX_CHK, "1+12345678901234", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 14 too long (maximum 5)", "" },
/*121*/ { BARCODE_EANX_CHK, "0+12345678901234", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 14 too long (maximum 5)", "" }, /*121*/ { BARCODE_EANX_CHK, "0+12345678901234", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 14 too long (maximum 5)", "" },
/*122*/ { BARCODE_EANX_CHK, "1+", 0, "", "EAN-2" }, /*122*/ { BARCODE_EANX_CHK, "1+", 0, "", "EAN-2" },
/*123*/ { BARCODE_EANX_CHK, "+1", 0, "", "EAN-8" }, /*123*/ { BARCODE_EANX_CHK, "+1", ZINT_WARN_NONCOMPLIANT, "Warning 292: EAN-8 with add-on is non-standard", "EAN-8" },
/*124*/ { BARCODE_EANX_CHK, "+", 0, "", "EAN-2" }, /*124*/ { BARCODE_EANX_CHK, "+", 0, "", "EAN-2" },
/*125*/ { BARCODE_EANX_CHK, "12345678901234", ZINT_ERROR_TOO_LONG, "Error 294: Input length 14 too long (maximum 13)", "" }, /*125*/ { BARCODE_EANX_CHK, "12345678901234", ZINT_ERROR_TOO_LONG, "Error 294: Input length 14 too long (maximum 13)", "" },
/*126*/ { BARCODE_EANX_CHK, "1234567890123A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 14 in input (digits and \"+\" only)", "" }, /*126*/ { BARCODE_EANX_CHK, "1234567890123A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 14 in input (digits and \"+\" only)", "" },
@@ -470,18 +484,21 @@ static void test_eanx_input(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, \"%s\", %s, \"%s\", \"%s\" },\n", printf(" /*%3d*/ { %s, \"%s\", %s, \"%s\", \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), data[i].data, testUtilErrorName(data[i].ret), i, testUtilBarcodeName(data[i].symbology), data[i].data, testUtilErrorName(ret),
testUtilEscape(symbol->errtxt, (int) strlen(symbol->errtxt), errtxt_escaped, sizeof(errtxt_escaped)), testUtilEscape(symbol->errtxt, (int) strlen(symbol->errtxt), errtxt_escaped, sizeof(errtxt_escaped)),
data[i].comment); data[i].comment);
} else { } else {
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].ret_errtxt), "i:%d errtxt %s != %s\n", i, symbol->errtxt, data[i].ret_errtxt); assert_zero(strcmp(symbol->errtxt, data[i].ret_errtxt), "i:%d errtxt %s != %s\n",
i, symbol->errtxt, data[i].ret_errtxt);
} }
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
@@ -623,7 +640,9 @@ static void test_isbn_input(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, BARCODE_ISBNX, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); length = testUtilSetSymbol(symbol, BARCODE_ISBNX, -1 /*input_mode*/, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
@@ -633,12 +652,15 @@ static void test_isbn_input(const testCtx *const p_ctx) {
testUtilEscape(symbol->errtxt, (int) strlen(symbol->errtxt), errtxt_escaped, sizeof(errtxt_escaped)), testUtilEscape(symbol->errtxt, (int) strlen(symbol->errtxt), errtxt_escaped, sizeof(errtxt_escaped)),
data[i].comment); data[i].comment);
} else { } else {
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
assert_zero(strcmp(symbol->errtxt, data[i].ret_errtxt), "i:%d errtxt %s != %s\n", i, symbol->errtxt, data[i].ret_errtxt); i, ret, data[i].ret_encode, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].ret_errtxt), "i:%d errtxt %s != %s\n",
i, symbol->errtxt, data[i].ret_errtxt);
if (data[i].ret_vector != -1) { if (data[i].ret_vector != -1) {
ret = ZBarcode_Buffer_Vector(symbol, 0); ret = ZBarcode_Buffer_Vector(symbol, 0);
assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d (%s)\n", i, ret, data[i].ret_vector, symbol->errtxt); assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d (%s)\n",
i, ret, data[i].ret_vector, symbol->errtxt);
} }
} }
@@ -670,9 +692,9 @@ static void test_hrt(const testCtx *const p_ctx) {
/* 6*/ { BARCODE_EANX_CHK, BARCODE_RAW_TEXT, "1234567890128", 0, "1234567890128", "1234567890128" }, /* 6*/ { BARCODE_EANX_CHK, BARCODE_RAW_TEXT, "1234567890128", 0, "1234567890128", "1234567890128" },
/* 7*/ { BARCODE_EANX_CHK, -1, "123456789012", 0, "0123456789012", "0123456789012" }, /* '2' happens to be correct check digit for "012345678901" */ /* 7*/ { BARCODE_EANX_CHK, -1, "123456789012", 0, "0123456789012", "0123456789012" }, /* '2' happens to be correct check digit for "012345678901" */
/* 8*/ { BARCODE_EANX, -1, "1234567890128+1", 0, "1234567890128+01", "" }, /* 8*/ { BARCODE_EANX, -1, "1234567890128+1", 0, "1234567890128+01", "" },
/* 9*/ { BARCODE_EANX, BARCODE_RAW_TEXT, "1234567890128+1", 0, "1234567890128+01", "1234567890128+01" }, /* 9*/ { BARCODE_EANX, BARCODE_RAW_TEXT, "1234567890128+1", 0, "1234567890128+01", "123456789012801" },
/* 10*/ { BARCODE_EANX_CHK, -1, "1234567890128+1", 0, "1234567890128+01", "" }, /* 10*/ { BARCODE_EANX_CHK, -1, "1234567890128+1", 0, "1234567890128+01", "" },
/* 11*/ { BARCODE_EANX_CHK, BARCODE_RAW_TEXT, "1234567890128+1", 0, "1234567890128+01", "1234567890128+01" }, /* 11*/ { BARCODE_EANX_CHK, BARCODE_RAW_TEXT, "1234567890128+1", 0, "1234567890128+01", "123456789012801" },
/* 12*/ { BARCODE_EANX, -1, "12345678", 0, "0000123456784", "" }, /* 12*/ { BARCODE_EANX, -1, "12345678", 0, "0000123456784", "" },
/* 13*/ { BARCODE_EANX, BARCODE_RAW_TEXT, "12345678", 0, "0000123456784", "0000123456784" }, /* 13*/ { BARCODE_EANX, BARCODE_RAW_TEXT, "12345678", 0, "0000123456784", "0000123456784" },
/* 14*/ { BARCODE_EANX, -1, "1234567", 0, "12345670", "" }, /* EAN-8 */ /* 14*/ { BARCODE_EANX, -1, "1234567", 0, "12345670", "" }, /* EAN-8 */
@@ -700,73 +722,73 @@ static void test_hrt(const testCtx *const p_ctx) {
/* 36*/ { BARCODE_ISBNX, -1, "9781234567897", 0, "9781234567897", "" }, /* 36*/ { BARCODE_ISBNX, -1, "9781234567897", 0, "9781234567897", "" },
/* 37*/ { BARCODE_ISBNX, BARCODE_RAW_TEXT, "9781234567897", 0, "9781234567897", "9781234567897" }, /* 37*/ { BARCODE_ISBNX, BARCODE_RAW_TEXT, "9781234567897", 0, "9781234567897", "9781234567897" },
/* 38*/ { BARCODE_ISBNX, -1, "9791234567896+12", 0, "9791234567896+12", "" }, /* 38*/ { BARCODE_ISBNX, -1, "9791234567896+12", 0, "9791234567896+12", "" },
/* 39*/ { BARCODE_ISBNX, BARCODE_RAW_TEXT, "9791234567896+12", 0, "9791234567896+12", "9791234567896+12" }, /* 39*/ { BARCODE_ISBNX, BARCODE_RAW_TEXT, "9791234567896+12", 0, "9791234567896+12", "979123456789612" },
/* 40*/ { BARCODE_UPCA, -1, "12345678901", 0, "123456789012", "" }, /* 40*/ { BARCODE_UPCA, -1, "12345678901", 0, "123456789012", "" },
/* 41*/ { BARCODE_UPCA, BARCODE_RAW_TEXT, "12345678901", 0, "123456789012", "123456789012" }, /* 41*/ { BARCODE_UPCA, BARCODE_RAW_TEXT, "12345678901", 0, "123456789012", "0123456789012" },
/* 42*/ { BARCODE_UPCA, -1, "123456789012", 0, "123456789012", "" }, /* 42*/ { BARCODE_UPCA, -1, "123456789012", 0, "123456789012", "" },
/* 43*/ { BARCODE_UPCA, BARCODE_RAW_TEXT, "123456789012", 0, "123456789012", "123456789012" }, /* 43*/ { BARCODE_UPCA, BARCODE_RAW_TEXT, "123456789012", 0, "123456789012", "0123456789012" },
/* 44*/ { BARCODE_UPCA_CHK, -1, "123456789012", 0, "123456789012", "" }, /* 44*/ { BARCODE_UPCA_CHK, -1, "123456789012", 0, "123456789012", "" },
/* 45*/ { BARCODE_UPCA_CHK, BARCODE_RAW_TEXT, "123456789012", 0, "123456789012", "123456789012" }, /* 45*/ { BARCODE_UPCA_CHK, BARCODE_RAW_TEXT, "123456789012", 0, "123456789012", "0123456789012" },
/* 46*/ { BARCODE_UPCA, -1, "12345678905+1", 0, "123456789050+01", "" }, /* 46*/ { BARCODE_UPCA, -1, "12345678905+1", 0, "123456789050+01", "" },
/* 47*/ { BARCODE_UPCA, BARCODE_RAW_TEXT, "12345678905+1", 0, "123456789050+01", "123456789050+01" }, /* 47*/ { BARCODE_UPCA, BARCODE_RAW_TEXT, "12345678905+1", 0, "123456789050+01", "012345678905001" },
/* 48*/ { BARCODE_UPCA_CHK, -1, "123456789050+1", 0, "123456789050+01", "" }, /* 48*/ { BARCODE_UPCA_CHK, -1, "123456789050+1", 0, "123456789050+01", "" },
/* 49*/ { BARCODE_UPCA_CHK, BARCODE_RAW_TEXT, "123456789050+1", 0, "123456789050+01", "123456789050+01" }, /* 49*/ { BARCODE_UPCA_CHK, BARCODE_RAW_TEXT, "123456789050+1", 0, "123456789050+01", "012345678905001" },
/* 50*/ { BARCODE_UPCA, -1, "123456789050+123", 0, "123456789050+00123", "" }, /* 50*/ { BARCODE_UPCA, -1, "123456789050+123", 0, "123456789050+00123", "" },
/* 51*/ { BARCODE_UPCA, BARCODE_RAW_TEXT, "123456789050+123", 0, "123456789050+00123", "123456789050+00123" }, /* 51*/ { BARCODE_UPCA, BARCODE_RAW_TEXT, "123456789050+123", 0, "123456789050+00123", "012345678905000123" },
/* 52*/ { BARCODE_UPCA_CHK, -1, "123456789050+123", 0, "123456789050+00123", "" }, /* 52*/ { BARCODE_UPCA_CHK, -1, "123456789050+123", 0, "123456789050+00123", "" },
/* 53*/ { BARCODE_UPCA_CHK, BARCODE_RAW_TEXT, "123456789050+123", 0, "123456789050+00123", "123456789050+00123" }, /* 53*/ { BARCODE_UPCA_CHK, BARCODE_RAW_TEXT, "123456789050+123", 0, "123456789050+00123", "012345678905000123" },
/* 54*/ { BARCODE_UPCE, -1, "12345", 0, "00123457", "" }, /* equivalent: 00123400005, hrt: 00123457, Check digit: 7 */ /* 54*/ { BARCODE_UPCE, -1, "12345", 0, "00123457", "" }, /* equivalent: 00123400005, hrt: 00123457, Check digit: 7 */
/* 55*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "12345", 0, "00123457", "00123457" }, /* 55*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "12345", 0, "00123457", "0001234000057" },
/* 56*/ { BARCODE_UPCE_CHK, -1, "12344", 0, "00012344", "" }, /* equivalent: 00012000003, hrt: 00012344, Check digit: 4 */ /* 56*/ { BARCODE_UPCE_CHK, -1, "12344", 0, "00012344", "" }, /* equivalent: 00012000003, hrt: 00012344, Check digit: 4 */
/* 57*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "12344", 0, "00012344", "00012344" }, /* 57*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "12344", 0, "00012344", "0000120000034" },
/* 58*/ { BARCODE_UPCE, -1, "123456", 0, "01234565", "" }, /* equivalent: 01234500006, hrt: 01234565, Check digit: 5 */ /* 58*/ { BARCODE_UPCE, -1, "123456", 0, "01234565", "" }, /* equivalent: 01234500006, hrt: 01234565, Check digit: 5 */
/* 59*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "123456", 0, "01234565", "01234565" }, /* 59*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "123456", 0, "01234565", "0012345000065" },
/* 60*/ { BARCODE_UPCE_CHK, -1, "123457", 0, "00123457", "" }, /* equivalent: 00123400005, hrt: 00123457, Check digit: 7 */ /* 60*/ { BARCODE_UPCE_CHK, -1, "123457", 0, "00123457", "" }, /* equivalent: 00123400005, hrt: 00123457, Check digit: 7 */
/* 61*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "123457", 0, "00123457", "00123457" }, /* 61*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "123457", 0, "00123457", "0001234000057" },
/* 62*/ { BARCODE_UPCE, -1, "1234567", 0, "12345670", "" }, /* equivalent: 12345600007, hrt: 12345670, Check digit: 0 */ /* 62*/ { BARCODE_UPCE, -1, "1234567", 0, "12345670", "" }, /* equivalent: 12345600007, hrt: 12345670, Check digit: 0 */
/* 63*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "1234567", 0, "12345670", "12345670" }, /* 63*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "1234567", 0, "12345670", "0123456000070" },
/* 64*/ { BARCODE_UPCE_CHK, -1, "1234565", 0, "01234565", "" }, /* equivalent: 01234500006, hrt: 01234565, Check digit: 5 */ /* 64*/ { BARCODE_UPCE_CHK, -1, "1234565", 0, "01234565", "" }, /* equivalent: 01234500006, hrt: 01234565, Check digit: 5 */
/* 65*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "1234565", 0, "01234565", "01234565" }, /* 65*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "1234565", 0, "01234565", "0012345000065" },
/* 66*/ { BARCODE_UPCE_CHK, -1, "12345670", 0, "12345670", "" }, /* equivalent: 12345600007, hrt: 12345670, Check digit: 0 */ /* 66*/ { BARCODE_UPCE_CHK, -1, "12345670", 0, "12345670", "" }, /* equivalent: 12345600007, hrt: 12345670, Check digit: 0 */
/* 67*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "12345670", 0, "12345670", "12345670" }, /* 67*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "12345670", 0, "12345670", "0123456000070" },
/* 68*/ { BARCODE_UPCE, -1, "2345678", 0, "03456781", "" }, /* 2 ignored, equivalent: 03456700008, hrt: 03456781, Check digit: 1 */ /* 68*/ { BARCODE_UPCE, -1, "2345678", 0, "03456781", "" }, /* 2 ignored, equivalent: 03456700008, hrt: 03456781, Check digit: 1 */
/* 69*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "2345678", 0, "03456781", "03456781" }, /* 69*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "2345678", 0, "03456781", "0034567000081" },
/* 70*/ { BARCODE_UPCE_CHK, -1, "23456781", 0, "03456781", "" }, /* 2 ignored, equivalent: 03456700008, hrt: 03456781, Check digit: 1 */ /* 70*/ { BARCODE_UPCE_CHK, -1, "23456781", 0, "03456781", "" }, /* 2 ignored, equivalent: 03456700008, hrt: 03456781, Check digit: 1 */
/* 71*/ { BARCODE_UPCE, -1, "123455", 0, "01234558", "" }, /* equivalent: 01234500005, hrt: 01234558, Check digit: 8 (BS 797 Rule 3 (a)) */ /* 71*/ { BARCODE_UPCE, -1, "123455", 0, "01234558", "" }, /* equivalent: 01234500005, hrt: 01234558, Check digit: 8 (BS 797 Rule 3 (a)) */
/* 72*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "123455", 0, "01234558", "01234558" }, /* 72*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "123455", 0, "01234558", "0012345000058" },
/* 73*/ { BARCODE_UPCE_CHK, -1, "1234558", 0, "01234558", "" }, /* equivalent: 01234500005, hrt: 01234558, Check digit: 8 (BS 797 Rule 3 (a)) */ /* 73*/ { BARCODE_UPCE_CHK, -1, "1234558", 0, "01234558", "" }, /* equivalent: 01234500005, hrt: 01234558, Check digit: 8 (BS 797 Rule 3 (a)) */
/* 74*/ { BARCODE_UPCE, -1, "456784", 0, "04567840", "" }, /* equivalent: 04567000008, hrt: 04567840, Check digit: 0 (BS 797 Rule 3 (b)) */ /* 74*/ { BARCODE_UPCE, -1, "456784", 0, "04567840", "" }, /* equivalent: 04567000008, hrt: 04567840, Check digit: 0 (BS 797 Rule 3 (b)) */
/* 75*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "456784", 0, "04567840", "04567840" }, /* 75*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "456784", 0, "04567840", "0045670000080" },
/* 76*/ { BARCODE_UPCE_CHK, -1, "4567840", 0, "04567840", "" }, /* equivalent: 04567000008, hrt: 04567840, Check digit: 0 (BS 797 Rule 3 (b)) */ /* 76*/ { BARCODE_UPCE_CHK, -1, "4567840", 0, "04567840", "" }, /* equivalent: 04567000008, hrt: 04567840, Check digit: 0 (BS 797 Rule 3 (b)) */
/* 77*/ { BARCODE_UPCE, -1, "345670", 0, "03456703", "" }, /* equivalent: 03400000567, hrt: 03456703, Check digit: 3 (BS 797 Rule 3 (c)) */ /* 77*/ { BARCODE_UPCE, -1, "345670", 0, "03456703", "" }, /* equivalent: 03400000567, hrt: 03456703, Check digit: 3 (BS 797 Rule 3 (c)) */
/* 78*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "345670", 0, "03456703", "03456703" }, /* 78*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "345670", 0, "03456703", "0034000005673" },
/* 79*/ { BARCODE_UPCE_CHK, -1, "3456703", 0, "03456703", "" }, /* equivalent: 03400000567, hrt: 03456703, Check digit: 3 (BS 797 Rule 3 (c)) */ /* 79*/ { BARCODE_UPCE_CHK, -1, "3456703", 0, "03456703", "" }, /* equivalent: 03400000567, hrt: 03456703, Check digit: 3 (BS 797 Rule 3 (c)) */
/* 80*/ { BARCODE_UPCE, -1, "984753", 0, "09847531", "" }, /* equivalent: 09840000075, hrt: 09847531, Check digit: 1 (BS 797 Rule 3 (d)) */ /* 80*/ { BARCODE_UPCE, -1, "984753", 0, "09847531", "" }, /* equivalent: 09840000075, hrt: 09847531, Check digit: 1 (BS 797 Rule 3 (d)) */
/* 81*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "984753", 0, "09847531", "09847531" }, /* 81*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "984753", 0, "09847531", "0098400000751" },
/* 82*/ { BARCODE_UPCE_CHK, -1, "9847531", 0, "09847531", "" }, /* equivalent: 09840000075, hrt: 09847531, Check digit: 1 (BS 797 Rule 3 (d)) */ /* 82*/ { BARCODE_UPCE_CHK, -1, "9847531", 0, "09847531", "" }, /* equivalent: 09840000075, hrt: 09847531, Check digit: 1 (BS 797 Rule 3 (d)) */
/* 83*/ { BARCODE_UPCE, -1, "123453", 0, "01234531", "" }, /* 83*/ { BARCODE_UPCE, -1, "123453", 0, "01234531", "" },
/* 84*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "123453", 0, "01234531", "01234531" }, /* 84*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "123453", 0, "01234531", "0012300000451" },
/* 85*/ { BARCODE_UPCE, -1, "000000", 0, "00000000", "" }, /* 85*/ { BARCODE_UPCE, -1, "000000", 0, "00000000", "" },
/* 86*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "000000", 0, "00000000", "00000000" }, /* 86*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "000000", 0, "00000000", "0000000000000" },
/* 87*/ { BARCODE_UPCE, -1, "0000000", 0, "00000000", "" }, /* 87*/ { BARCODE_UPCE, -1, "0000000", 0, "00000000", "" },
/* 88*/ { BARCODE_UPCE, -1, "1000000", 0, "10000007", "" }, /* 88*/ { BARCODE_UPCE, -1, "1000000", 0, "10000007", "" },
/* 89*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "1000000", 0, "10000007", "10000007" }, /* 89*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "1000000", 0, "10000007", "0100000000007" },
/* 90*/ { BARCODE_UPCE, -1, "2000000", 0, "00000000", "" }, /* First char 2-9 ignored, replaced with 0 */ /* 90*/ { BARCODE_UPCE, -1, "2000000", 0, "00000000", "" }, /* First char 2-9 ignored, replaced with 0 */
/* 91*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "2000000", 0, "00000000", "00000000" }, /* 91*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "2000000", 0, "00000000", "0000000000000" },
/* 92*/ { BARCODE_UPCE, -1, "3000000", 0, "00000000", "" }, /* 92*/ { BARCODE_UPCE, -1, "3000000", 0, "00000000", "" },
/* 93*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "3000000", 0, "00000000", "00000000" }, /* 93*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "3000000", 0, "00000000", "0000000000000" },
/* 94*/ { BARCODE_UPCE, -1, "8000000", 0, "00000000", "" }, /* 94*/ { BARCODE_UPCE, -1, "8000000", 0, "00000000", "" },
/* 95*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "8000000", 0, "00000000", "00000000" }, /* 95*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "8000000", 0, "00000000", "0000000000000" },
/* 96*/ { BARCODE_UPCE, -1, "9000000", 0, "00000000", "" }, /* 96*/ { BARCODE_UPCE, -1, "9000000", 0, "00000000", "" },
/* 97*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "9000000", 0, "00000000", "00000000" }, /* 97*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "9000000", 0, "00000000", "0000000000000" },
/* 98*/ { BARCODE_UPCE, -1, "1234567+1", 0, "12345670+01", "" }, /* 98*/ { BARCODE_UPCE, -1, "1234567+1", 0, "12345670+01", "" },
/* 99*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "1234567+1", 0, "12345670+01", "12345670+01" }, /* 99*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "1234567+1", 0, "12345670+01", "012345600007001" },
/*100*/ { BARCODE_UPCE, -1, "12345670+1", 0, "12345670+01", "" }, /*100*/ { BARCODE_UPCE, -1, "12345670+1", 0, "12345670+01", "" },
/*101*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "12345670+1", 0, "12345670+01", "12345670+01" }, /*101*/ { BARCODE_UPCE, BARCODE_RAW_TEXT, "12345670+1", 0, "12345670+01", "012345600007001" },
/*102*/ { BARCODE_UPCE_CHK, -1, "12345670+1", 0, "12345670+01", "" }, /*102*/ { BARCODE_UPCE_CHK, -1, "12345670+1", 0, "12345670+01", "" },
/*103*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "12345670+1", 0, "12345670+01", "12345670+01" }, /*103*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "12345670+1", 0, "12345670+01", "012345600007001" },
/*104*/ { BARCODE_UPCE_CHK, -1, "1234565+1", 0, "01234565+01", "" }, /*104*/ { BARCODE_UPCE_CHK, -1, "1234565+1", 0, "01234565+01", "" },
/*105*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "1234565+1", 0, "01234565+01", "01234565+01" }, /*105*/ { BARCODE_UPCE_CHK, BARCODE_RAW_TEXT, "1234565+1", 0, "01234565+01", "001234500006501" },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
@@ -802,8 +824,9 @@ static void test_hrt(const testCtx *const p_ctx) {
"i:%d raw_segs[0].length %d != expected_raw_length %d\n", "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length); i, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, 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:%d memcmp(%.*s, %s, %d) != 0\n",
i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length); i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
expected_raw_length);
} else { } else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i); assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
} }
@@ -845,13 +868,17 @@ static void test_vector_same(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
i, ret, data[i].ret_encode, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0); ret = ZBarcode_Buffer_Vector(symbol, 0);
assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d (%s)\n", i, ret, data[i].ret_vector, symbol->errtxt); assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d (%s)\n",
i, ret, data[i].ret_vector, symbol->errtxt);
assert_nonnull(symbol->vector, "i:%d symbol->vector NULL\n", i); assert_nonnull(symbol->vector, "i:%d symbol->vector NULL\n", i);
vectors[j] = testUtilVectorCpy(symbol->vector); vectors[j] = testUtilVectorCpy(symbol->vector);
@@ -954,10 +981,10 @@ static void test_encode(const testCtx *const p_ctx) {
/* 20*/ { BARCODE_UPCE_CHK, -1, "12345670+12345", 0, 1, 105, "Example of UPC-E with 5-digit add-on", /* 20*/ { BARCODE_UPCE_CHK, -1, "12345670+12345", 0, 1, 105, "Example of UPC-E with 5-digit add-on",
"101001001101111010100011011100100001010010001010101000000010110110011010010011010100001010100011010110001" "101001001101111010100011011100100001010010001010101000000010110110011010010011010100001010100011010110001"
}, },
/* 21*/ { BARCODE_EANX, -1, "1234567+12", 0, 1, 94, "Example of EAN-8 with 2-digit add-on", /* 21*/ { BARCODE_EANX, -1, "1234567+12", ZINT_WARN_NONCOMPLIANT, 1, 94, "Example of EAN-8 with 2-digit add-on",
"1010011001001001101111010100011010101001110101000010001001110010101000000010110011001010010011" "1010011001001001101111010100011010101001110101000010001001110010101000000010110011001010010011"
}, },
/* 22*/ { BARCODE_EANX_CHK, -1, "12345670+12345", 0, 1, 121, "Example of EAN-8 with 5-digit add-on", /* 22*/ { BARCODE_EANX_CHK, -1, "12345670+12345", ZINT_WARN_NONCOMPLIANT, 1, 121, "Example of EAN-8 with 5-digit add-on",
"1010011001001001101111010100011010101001110101000010001001110010101000000010110110011010010011010100001010100011010110001" "1010011001001001101111010100011010101001110101000010001001110010101000000010110110011010010011010100001010100011010110001"
}, },
/* 23*/ { BARCODE_EANX, -1, "54321", 0, 1, 47, "Example of EAN-5", /* 23*/ { BARCODE_EANX, -1, "54321", 0, 1, 47, "Example of EAN-5",
@@ -966,10 +993,10 @@ static void test_encode(const testCtx *const p_ctx) {
/* 24*/ { BARCODE_EANX, -1, "21", 0, 1, 20, "Example of EAN-2", /* 24*/ { BARCODE_EANX, -1, "21", 0, 1, 20, "Example of EAN-2",
"10110010011010110011" "10110010011010110011"
}, },
/* 25*/ { BARCODE_EANX_CHK, 9, "76543210+21", 0, 1, 96, "Example of EAN-8 barcode with two-digit add-on, addon_gap 9", /* 25*/ { BARCODE_EANX_CHK, 9, "76543210+21", ZINT_WARN_NONCOMPLIANT, 1, 96, "Example of EAN-8 barcode with two-digit add-on, addon_gap 9",
"101011101101011110110001010001101010100001011011001100110111001010100000000010110010011010110011" "101011101101011110110001010001101010100001011011001100110111001010100000000010110010011010110011"
}, },
/* 26*/ { BARCODE_EANX, 12, "7654321+54321", 0, 1, 126, "Example of EAN-8 barcode with five-digit add-on, addon_gap 12", /* 26*/ { BARCODE_EANX, 12, "7654321+54321", ZINT_WARN_NONCOMPLIANT, 1, 126, "Example of EAN-8 barcode with five-digit add-on, addon_gap 12",
"101011101101011110110001010001101010100001011011001100110111001010100000000000010110111001010100011010100001010010011010011001" "101011101101011110110001010001101010100001011011001100110111001010100000000000010110111001010100011010100001010010011010011001"
}, },
/* 27*/ { BARCODE_UPCA_CHK, 10, "210987654329+21", 0, 1, 125, "Example of UPC-A with 2-digit add-on, addon_gap 10", /* 27*/ { BARCODE_UPCA_CHK, 10, "210987654329+21", 0, 1, 125, "Example of UPC-A with 2-digit add-on, addon_gap 10",
@@ -1021,40 +1048,53 @@ static void test_encode(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); 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); 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) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n", printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), data[i].option_2, data[i].data, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment); i, testUtilBarcodeName(data[i].symbology), data[i].option_2, data[i].data,
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
testUtilModulesPrint(symbol, " ", "\n"); testUtilModulesPrint(symbol, " ", "\n");
printf(" },\n"); printf(" },\n");
} else { } else {
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
int width, row; 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->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n",
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); 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); 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)) { 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); ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf,
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); 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); 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", 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)) { if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len; int cmp_len, ret_len;
char modules_dump[8192 + 1]; char modules_dump[8192 + 1];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf, sizeof(cmp_buf), &cmp_len); "i:%d testUtilModulesDump == -1\n", i);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); 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, ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
NULL /*primary*/, escaped, &ret_len); NULL /*primary*/, escaped, &ret_len);
@@ -1091,7 +1131,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
/* 5*/ { BARCODE_UPCE, "+123456789012345678", -1, ZINT_ERROR_TOO_LONG }, /* 5*/ { BARCODE_UPCE, "+123456789012345678", -1, ZINT_ERROR_TOO_LONG },
/* 6*/ { BARCODE_UPCE_CHK, "+123456789012345678", -1, ZINT_ERROR_TOO_LONG }, /* 6*/ { BARCODE_UPCE_CHK, "+123456789012345678", -1, ZINT_ERROR_TOO_LONG },
/* 7*/ { BARCODE_ISBNX, "+123456789012345678", -1, ZINT_ERROR_TOO_LONG }, /* 7*/ { BARCODE_ISBNX, "+123456789012345678", -1, ZINT_ERROR_TOO_LONG },
/* 8*/ { BARCODE_EANX, "+12345", -1, 0 }, /* 8*/ { BARCODE_EANX, "+12345", -1, ZINT_WARN_NONCOMPLIANT },
/* 9*/ { BARCODE_EANX, "+123456", -1, ZINT_ERROR_TOO_LONG }, /* 9*/ { BARCODE_EANX, "+123456", -1, ZINT_ERROR_TOO_LONG },
/*10*/ { BARCODE_EANX, "000002000000200+203", -1, ZINT_ERROR_TOO_LONG }, /* #218 Jan Schrewe CI-Fuzz */ /*10*/ { BARCODE_EANX, "000002000000200+203", -1, ZINT_ERROR_TOO_LONG }, /* #218 Jan Schrewe CI-Fuzz */
}; };
@@ -1108,7 +1148,9 @@ static void test_fuzz(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
+187 -166
View File
@@ -543,7 +543,7 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
int symbology; int symbology;
const char *data; const char *data;
const char *composite; const char *composite;
int ret;
float expected_height; float expected_height;
int expected_rows; int expected_rows;
int expected_width; int expected_width;
@@ -551,144 +551,145 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
float expected_vector_height; float expected_vector_height;
}; };
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_CODE11, "1234567890", "", 50, 1, 108, 216, 116.28 }, /* 0*/ { BARCODE_CODE11, "1234567890", "", 0, 50, 1, 108, 216, 116.28 },
/* 1*/ { BARCODE_C25STANDARD, "1234567890", "", 50, 1, 117, 234, 116.28 }, /* 1*/ { BARCODE_C25STANDARD, "1234567890", "", 0, 50, 1, 117, 234, 116.28 },
/* 2*/ { BARCODE_C25INTER, "1234567890", "", 50, 1, 99, 198, 116.28 }, /* 2*/ { BARCODE_C25INTER, "1234567890", "", 0, 50, 1, 99, 198, 116.28 },
/* 3*/ { BARCODE_C25IATA, "1234567890", "", 50, 1, 149, 298, 116.28 }, /* 3*/ { BARCODE_C25IATA, "1234567890", "", 0, 50, 1, 149, 298, 116.28 },
/* 4*/ { BARCODE_C25LOGIC, "1234567890", "", 50, 1, 109, 218, 116.28 }, /* 4*/ { BARCODE_C25LOGIC, "1234567890", "", 0, 50, 1, 109, 218, 116.28 },
/* 5*/ { BARCODE_C25IND, "1234567890", "", 50, 1, 159, 318, 116.28 }, /* 5*/ { BARCODE_C25IND, "1234567890", "", 0, 50, 1, 159, 318, 116.28 },
/* 6*/ { BARCODE_CODE39, "1234567890", "", 50, 1, 155, 310, 116.28 }, /* 6*/ { BARCODE_CODE39, "1234567890", "", 0, 50, 1, 155, 310, 116.28 },
/* 7*/ { BARCODE_EXCODE39, "1234567890", "", 50, 1, 155, 310, 116.28 }, /* 7*/ { BARCODE_EXCODE39, "1234567890", "", 0, 50, 1, 155, 310, 116.28 },
/* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 226, 118 }, /* 8*/ { BARCODE_EANX, "123456789012", "", 0, 50, 1, 95, 226, 118 },
/* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 226, 118 }, /* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 0, 50, 1, 95, 226, 118 },
/* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 122, 276, 118 }, /* 10*/ { BARCODE_EANX, "123456789012+12", "", 0, 50, 1, 122, 276, 118 },
/* 11*/ { BARCODE_EANX_CHK, "1234567890128+12", "", 50, 1, 122, 276, 118 }, /* 11*/ { BARCODE_EANX_CHK, "1234567890128+12", "", 0, 50, 1, 122, 276, 118 },
/* 12*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 149, 330, 118 }, /* 12*/ { BARCODE_EANX, "123456789012+12345", "", 0, 50, 1, 149, 330, 118 },
/* 13*/ { BARCODE_EANX_CHK, "1234567890128+12345", "", 50, 1, 149, 330, 118 }, /* 13*/ { BARCODE_EANX_CHK, "1234567890128+12345", "", 0, 50, 1, 149, 330, 118 },
/* 14*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 162, 118 }, /* 14*/ { BARCODE_EANX, "1234567", "", 0, 50, 1, 67, 162, 118 },
/* 15*/ { BARCODE_EANX_CHK, "12345670", "", 50, 1, 67, 162, 118 }, /* 15*/ { BARCODE_EANX_CHK, "12345670", "", 0, 50, 1, 67, 162, 118 },
/* 16*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 94, 212, 118 }, /* 16*/ { BARCODE_EANX, "1234567+12", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 94, 212, 118 },
/* 17*/ { BARCODE_EANX_CHK, "12345670+12", "", 50, 1, 94, 212, 118 }, /* 17*/ { BARCODE_EANX_CHK, "12345670+12", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 94, 212, 118 },
/* 18*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 121, 266, 118 }, /* 18*/ { BARCODE_EANX, "1234567+12345", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 121, 266, 118 },
/* 19*/ { BARCODE_EANX_CHK, "12345670+12345", "", 50, 1, 121, 266, 118 }, /* 19*/ { BARCODE_EANX_CHK, "12345670+12345", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 121, 266, 118 },
/* 20*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 104, 118 }, /* 20*/ { BARCODE_EANX, "1234", "", 0, 50, 1, 47, 104, 118 },
/* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 104, 118 }, /* 21*/ { BARCODE_EANX_CHK, "1234", "", 0, 50, 1, 47, 104, 118 },
/* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 50, 118 }, /* 22*/ { BARCODE_EANX, "12", "", 0, 50, 1, 20, 50, 118 },
/* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 50, 118 }, /* 23*/ { BARCODE_EANX_CHK, "12", "", 0, 50, 1, 20, 50, 118 },
/* 24*/ { BARCODE_GS1_128, "[01]12345678901231", "", 50, 1, 134, 268, 116.28 }, /* 24*/ { BARCODE_GS1_128, "[01]12345678901231", "", 0, 50, 1, 134, 268, 116.28 },
/* 25*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 116.28 }, /* 25*/ { BARCODE_CODABAR, "A00000000B", "", 0, 50, 1, 102, 204, 116.28 },
/* 26*/ { BARCODE_CODE128, "1234567890", "", 50, 1, 90, 180, 116.28 }, /* 26*/ { BARCODE_CODE128, "1234567890", "", 0, 50, 1, 90, 180, 116.28 },
/* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 72, 1, 135, 270, 160.28 }, /* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 0, 72, 1, 135, 270, 160.28 },
/* 28*/ { BARCODE_DPIDENT, "12345678901", "", 72, 1, 117, 234, 160.28 }, /* 28*/ { BARCODE_DPIDENT, "12345678901", "", 0, 72, 1, 117, 234, 160.28 },
/* 29*/ { BARCODE_CODE16K, "1234567890", "", 20, 2, 70, 162, 44 }, /* 29*/ { BARCODE_CODE16K, "1234567890", "", 0, 20, 2, 70, 162, 44 },
/* 30*/ { BARCODE_CODE49, "1234567890", "", 20, 2, 70, 162, 44 }, /* 30*/ { BARCODE_CODE49, "1234567890", "", 0, 20, 2, 70, 162, 44 },
/* 31*/ { BARCODE_CODE93, "1234567890", "", 50, 1, 127, 254, 116.28 }, /* 31*/ { BARCODE_CODE93, "1234567890", "", 0, 50, 1, 127, 254, 116.28 },
/* 32*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 }, /* 32*/ { BARCODE_FLAT, "1234567890", "", 0, 50, 1, 90, 180, 100 },
/* 33*/ { BARCODE_DBAR_OMN, "1234567890123", "", 50, 1, 96, 192, 116.28 }, /* 33*/ { BARCODE_DBAR_OMN, "1234567890123", "", 0, 50, 1, 96, 192, 116.28 },
/* 34*/ { BARCODE_DBAR_LTD, "1234567890123", "", 50, 1, 79, 158, 116.28 }, /* 34*/ { BARCODE_DBAR_LTD, "1234567890123", "", 0, 50, 1, 79, 158, 116.28 },
/* 35*/ { BARCODE_DBAR_EXP, "[01]12345678901231", "", 34, 1, 134, 268, 84.279999 }, /* 35*/ { BARCODE_DBAR_EXP, "[01]12345678901231", "", 0, 34, 1, 134, 268, 84.279999 },
/* 36*/ { BARCODE_TELEPEN, "1234567890", "", 50, 1, 208, 416, 116.28 }, /* 36*/ { BARCODE_TELEPEN, "1234567890", "", 0, 50, 1, 208, 416, 116.28 },
/* 37*/ { BARCODE_UPCA, "12345678901", "", 50, 1, 95, 226, 118 }, /* 37*/ { BARCODE_UPCA, "12345678901", "", 0, 50, 1, 95, 226, 118 },
/* 38*/ { BARCODE_UPCA_CHK, "123456789012", "", 50, 1, 95, 226, 118 }, /* 38*/ { BARCODE_UPCA_CHK, "123456789012", "", 0, 50, 1, 95, 226, 118 },
/* 39*/ { BARCODE_UPCA, "12345678901+12", "", 50, 1, 124, 276, 118 }, /* 39*/ { BARCODE_UPCA, "12345678901+12", "", 0, 50, 1, 124, 276, 118 },
/* 40*/ { BARCODE_UPCA_CHK, "123456789012+12", "", 50, 1, 124, 276, 118 }, /* 40*/ { BARCODE_UPCA_CHK, "123456789012+12", "", 0, 50, 1, 124, 276, 118 },
/* 41*/ { BARCODE_UPCA, "12345678901+12345", "", 50, 1, 151, 330, 118 }, /* 41*/ { BARCODE_UPCA, "12345678901+12345", "", 0, 50, 1, 151, 330, 118 },
/* 42*/ { BARCODE_UPCA_CHK, "123456789012+12345", "", 50, 1, 151, 330, 118 }, /* 42*/ { BARCODE_UPCA_CHK, "123456789012+12345", "", 0, 50, 1, 151, 330, 118 },
/* 43*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 134, 118 }, /* 43*/ { BARCODE_UPCE, "1234567", "", 0, 50, 1, 51, 134, 118 },
/* 44*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 134, 118 }, /* 44*/ { BARCODE_UPCE_CHK, "12345670", "", 0, 50, 1, 51, 134, 118 },
/* 45*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 78, 184, 118 }, /* 45*/ { BARCODE_UPCE, "1234567+12", "", 0, 50, 1, 78, 184, 118 },
/* 46*/ { BARCODE_UPCE_CHK, "12345670+12", "", 50, 1, 78, 184, 118 }, /* 46*/ { BARCODE_UPCE_CHK, "12345670+12", "", 0, 50, 1, 78, 184, 118 },
/* 47*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 105, 238, 118 }, /* 47*/ { BARCODE_UPCE, "1234567+12345", "", 0, 50, 1, 105, 238, 118 },
/* 48*/ { BARCODE_UPCE_CHK, "12345670+12345", "", 50, 1, 105, 238, 118 }, /* 48*/ { BARCODE_UPCE_CHK, "12345670+12345", "", 0, 50, 1, 105, 238, 118 },
/* 49*/ { BARCODE_POSTNET, "12345678901", "", 12, 2, 123, 246, 24 }, /* 49*/ { BARCODE_POSTNET, "12345678901", "", 0, 12, 2, 123, 246, 24 },
/* 50*/ { BARCODE_MSI_PLESSEY, "1234567890", "", 50, 1, 127, 254, 116.28 }, /* 50*/ { BARCODE_MSI_PLESSEY, "1234567890", "", 0, 50, 1, 127, 254, 116.28 },
/* 51*/ { BARCODE_FIM, "A", "", 50, 1, 17, 34, 100 }, /* 51*/ { BARCODE_FIM, "A", "", 0, 50, 1, 17, 34, 100 },
/* 52*/ { BARCODE_LOGMARS, "1234567890", "", 50, 1, 191, 382, 116.28 }, /* 52*/ { BARCODE_LOGMARS, "1234567890", "", 0, 50, 1, 191, 382, 116.28 },
/* 53*/ { BARCODE_PHARMA, "123456", "", 50, 1, 58, 116, 100 }, /* 53*/ { BARCODE_PHARMA, "123456", "", 0, 50, 1, 58, 116, 100 },
/* 54*/ { BARCODE_PZN, "123456", "", 50, 1, 142, 284, 116.28 }, /* 54*/ { BARCODE_PZN, "123456", "", 0, 50, 1, 142, 284, 116.28 },
/* 55*/ { BARCODE_PHARMA_TWO, "12345678", "", 10, 2, 29, 58, 20 }, /* 55*/ { BARCODE_PHARMA_TWO, "12345678", "", 0, 10, 2, 29, 58, 20 },
/* 56*/ { BARCODE_CEPNET, "12345678", "", 5.375, 2, 93, 186, 10.75 }, /* 56*/ { BARCODE_CEPNET, "12345678", "", 0, 5.375, 2, 93, 186, 10.75 },
/* 57*/ { BARCODE_PDF417, "1234567890", "", 21, 7, 103, 206, 42 }, /* 57*/ { BARCODE_PDF417, "1234567890", "", 0, 21, 7, 103, 206, 42 },
/* 58*/ { BARCODE_PDF417COMP, "1234567890", "", 21, 7, 69, 138, 42 }, /* 58*/ { BARCODE_PDF417COMP, "1234567890", "", 0, 21, 7, 69, 138, 42 },
/* 59*/ { BARCODE_MAXICODE, "1234567890", "", 165, 33, 30, 60, 57.7333984 }, /* 59*/ { BARCODE_MAXICODE, "1234567890", "", 0, 165, 33, 30, 60, 57.7333984 },
/* 60*/ { BARCODE_QRCODE, "1234567890AB", "", 21, 21, 21, 42, 42 }, /* 60*/ { BARCODE_QRCODE, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
/* 61*/ { BARCODE_CODE128AB, "1234567890", "", 50, 1, 145, 290, 116.28 }, /* 61*/ { BARCODE_CODE128AB, "1234567890", "", 0, 50, 1, 145, 290, 116.28 },
/* 62*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 8, 3, 133, 266, 16 }, /* 62*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16 },
/* 63*/ { BARCODE_AUSREPLY, "12345678", "", 8, 3, 73, 146, 16 }, /* 63*/ { BARCODE_AUSREPLY, "12345678", "", 0, 8, 3, 73, 146, 16 },
/* 64*/ { BARCODE_AUSROUTE, "12345678", "", 8, 3, 73, 146, 16 }, /* 64*/ { BARCODE_AUSROUTE, "12345678", "", 0, 8, 3, 73, 146, 16 },
/* 65*/ { BARCODE_AUSREDIRECT, "12345678", "", 8, 3, 73, 146, 16 }, /* 65*/ { BARCODE_AUSREDIRECT, "12345678", "", 0, 8, 3, 73, 146, 16 },
/* 66*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 226, 118 }, /* 66*/ { BARCODE_ISBNX, "123456789", "", 0, 50, 1, 95, 226, 118 },
/* 67*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 122, 276, 118 }, /* 67*/ { BARCODE_ISBNX, "123456789+12", "", 0, 50, 1, 122, 276, 118 },
/* 68*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 149, 330, 118 }, /* 68*/ { BARCODE_ISBNX, "123456789+12345", "", 0, 50, 1, 149, 330, 118 },
/* 69*/ { BARCODE_RM4SCC, "1234567890", "", 8, 3, 91, 182, 16 }, /* 69*/ { BARCODE_RM4SCC, "1234567890", "", 0, 8, 3, 91, 182, 16 },
/* 70*/ { BARCODE_DATAMATRIX, "ABC", "", 10, 10, 10, 20, 20 }, /* 70*/ { BARCODE_DATAMATRIX, "ABC", "", 0, 10, 10, 10, 20, 20 },
/* 71*/ { BARCODE_EAN14, "1234567890123", "", 50, 1, 134, 268, 116.28 }, /* 71*/ { BARCODE_EAN14, "1234567890123", "", 0, 50, 1, 134, 268, 116.28 },
/* 72*/ { BARCODE_VIN, "12345678701234567", "", 50, 1, 246, 492, 116.28 }, /* 72*/ { BARCODE_VIN, "12345678701234567", "", 0, 50, 1, 246, 492, 116.28 },
/* 73*/ { BARCODE_CODABLOCKF, "1234567890", "", 20, 2, 101, 242, 44 }, /* 73*/ { BARCODE_CODABLOCKF, "1234567890", "", 0, 20, 2, 101, 242, 44 },
/* 74*/ { BARCODE_NVE18, "12345678901234567", "", 50, 1, 156, 312, 116.28 }, /* 74*/ { BARCODE_NVE18, "12345678901234567", "", 0, 50, 1, 156, 312, 116.28 },
/* 75*/ { BARCODE_JAPANPOST, "1234567890", "", 8, 3, 133, 266, 16 }, /* 75*/ { BARCODE_JAPANPOST, "1234567890", "", 0, 8, 3, 133, 266, 16 },
/* 76*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 116.28 }, /* 76*/ { BARCODE_KOREAPOST, "123456", "", 0, 50, 1, 167, 334, 116.28 },
/* 77*/ { BARCODE_DBAR_STK, "1234567890123", "", 13, 3, 50, 100, 26 }, /* 77*/ { BARCODE_DBAR_STK, "1234567890123", "", 0, 13, 3, 50, 100, 26 },
/* 78*/ { BARCODE_DBAR_OMNSTK, "1234567890123", "", 69, 5, 50, 100, 138 }, /* 78*/ { BARCODE_DBAR_OMNSTK, "1234567890123", "", 0, 69, 5, 50, 100, 138 },
/* 79*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901231", "", 71, 5, 102, 204, 142 }, /* 79*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142 },
/* 80*/ { BARCODE_PLANET, "12345678901", "", 12, 2, 123, 246, 24 }, /* 80*/ { BARCODE_PLANET, "12345678901", "", 0, 12, 2, 123, 246, 24 },
/* 81*/ { BARCODE_MICROPDF417, "1234567890", "", 12, 6, 82, 164, 24 }, /* 81*/ { BARCODE_MICROPDF417, "1234567890", "", 0, 12, 6, 82, 164, 24 },
/* 82*/ { BARCODE_USPS_IMAIL, "12345678901234567890", "", 8, 3, 129, 258, 16 }, /* 82*/ { BARCODE_USPS_IMAIL, "12345678901234567890", "", 0, 8, 3, 129, 258, 16 },
/* 83*/ { BARCODE_PLESSEY, "1234567890", "", 50, 1, 227, 454, 116.28 }, /* 83*/ { BARCODE_PLESSEY, "1234567890", "", 0, 50, 1, 227, 454, 116.28 },
/* 84*/ { BARCODE_TELEPEN_NUM, "1234567890", "", 50, 1, 128, 256, 116.28 }, /* 84*/ { BARCODE_TELEPEN_NUM, "1234567890", "", 0, 50, 1, 128, 256, 116.28 },
/* 85*/ { BARCODE_ITF14, "1234567890", "", 50, 1, 135, 330, 136.28 }, /* 85*/ { BARCODE_ITF14, "1234567890", "", 0, 50, 1, 135, 330, 136.28 },
/* 86*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174, 16 }, /* 86*/ { BARCODE_KIX, "123456ABCDE", "", 0, 8, 3, 87, 174, 16 },
/* 87*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30, 30 }, /* 87*/ { BARCODE_AZTEC, "1234567890AB", "", 0, 15, 15, 15, 30, 30 },
/* 88*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 }, /* 88*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16 },
/* 89*/ { BARCODE_DPD, "0123456789012345678901234567", "", 50, 1, 189, 378, 122.28 }, /* 89*/ { BARCODE_DPD, "0123456789012345678901234567", "", 0, 50, 1, 189, 378, 122.28 },
/* 90*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 }, /* 90*/ { BARCODE_MICROQR, "12345", "", 0, 11, 11, 11, 22, 22 },
/* 91*/ { BARCODE_HIBC_128, "1234567890", "", 50, 1, 123, 246, 116.28 }, /* 91*/ { BARCODE_HIBC_128, "1234567890", "", 0, 50, 1, 123, 246, 116.28 },
/* 92*/ { BARCODE_HIBC_39, "1234567890", "", 50, 1, 223, 446, 116.28 }, /* 92*/ { BARCODE_HIBC_39, "1234567890", "", 0, 50, 1, 223, 446, 116.28 },
/* 93*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24, 24 }, /* 93*/ { BARCODE_HIBC_DM, "ABC", "", 0, 12, 12, 12, 24, 24 },
/* 94*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42, 42 }, /* 94*/ { BARCODE_HIBC_QR, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
/* 95*/ { BARCODE_HIBC_PDF, "1234567890", "", 24, 8, 103, 206, 48 }, /* 95*/ { BARCODE_HIBC_PDF, "1234567890", "", 0, 24, 8, 103, 206, 48 },
/* 96*/ { BARCODE_HIBC_MICPDF, "1234567890", "", 28, 14, 38, 76, 56 }, /* 96*/ { BARCODE_HIBC_MICPDF, "1234567890", "", 0, 28, 14, 38, 76, 56 },
/* 97*/ { BARCODE_HIBC_BLOCKF, "1234567890", "", 30, 3, 101, 242, 64 }, /* 97*/ { BARCODE_HIBC_BLOCKF, "1234567890", "", 0, 30, 3, 101, 242, 64 },
/* 98*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38, 38 }, /* 98*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 0, 19, 19, 19, 38, 38 },
/* 99*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 32, 22 }, /* 99*/ { BARCODE_DOTCODE, "ABC", "", 0, 11, 11, 16, 32, 22 },
/*100*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46, 46 }, /*100*/ { BARCODE_HANXIN, "1234567890AB", "", 0, 23, 23, 23, 46, 46 },
/*101*/ { BARCODE_MAILMARK_2D, "012100123412345678AB19XY1A 0", "", 24, 24, 24, 48, 48 }, /*101*/ { BARCODE_MAILMARK_2D, "012100123412345678AB19XY1A 0", "", 0, 24, 24, 24, 48, 48 },
/*102*/ { BARCODE_UPU_S10, "EE876543216CA", "", 50, 1, 156, 312, 116.28 }, /*102*/ { BARCODE_UPU_S10, "EE876543216CA", "", 0, 50, 1, 156, 312, 116.28 },
/*103*/ { BARCODE_MAILMARK_4S, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 }, /*103*/ { BARCODE_MAILMARK_4S, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20 },
/*104*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 }, /*104*/ { BARCODE_AZRUNE, "255", "", 0, 11, 11, 11, 22, 22 },
/*105*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206, 116.28 }, /*105*/ { BARCODE_CODE32, "12345678", "", 0, 50, 1, 103, 206, 116.28 },
/*106*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 226, 118 }, /*106*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 0, 50, 7, 99, 226, 118 },
/*107*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 125, 276, 118 }, /*107*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 0, 50, 7, 125, 276, 118 },
/*108*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 152, 330, 118 }, /*108*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 0, 50, 7, 152, 330, 118 },
/*109*/ { BARCODE_EANX_CC, "1234567", "[20]01", 50, 8, 72, 162, 118 }, /*109*/ { BARCODE_EANX_CC, "1234567", "[20]01", 0, 50, 8, 72, 162, 118 },
/*110*/ { BARCODE_EANX_CC, "1234567+12", "[20]01", 50, 8, 98, 212, 118 }, /*110*/ { BARCODE_EANX_CC, "1234567+12", "[20]01", ZINT_WARN_NONCOMPLIANT, 50, 8, 98, 212, 118 },
/*111*/ { BARCODE_EANX_CC, "1234567+12345", "[20]01", 50, 8, 125, 266, 118 }, /*111*/ { BARCODE_EANX_CC, "1234567+12345", "[20]01", ZINT_WARN_NONCOMPLIANT, 50, 8, 125, 266, 118 },
/*112*/ { BARCODE_GS1_128_CC, "[01]12345678901231", "[20]01", 50, 5, 145, 290, 116.28 }, /*112*/ { BARCODE_GS1_128_CC, "[01]12345678901231", "[20]01", 0, 50, 5, 145, 290, 116.28 },
/*113*/ { BARCODE_DBAR_OMN_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 58.279999 }, /*113*/ { BARCODE_DBAR_OMN_CC, "1234567890123", "[20]01", 0, 21, 5, 100, 200, 58.279999 },
/*114*/ { BARCODE_DBAR_LTD_CC, "1234567890123", "[20]01", 19, 6, 79, 158, 54.279999 }, /*114*/ { BARCODE_DBAR_LTD_CC, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 54.279999 },
/*115*/ { BARCODE_DBAR_EXP_CC, "[01]12345678901231", "[20]01", 41, 5, 134, 268, 98.279999 }, /*115*/ { BARCODE_DBAR_EXP_CC, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 98.279999 },
/*116*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 226, 118 }, /*116*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 0, 50, 7, 99, 226, 118 },
/*117*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 127, 276, 118 }, /*117*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 0, 50, 7, 127, 276, 118 },
/*118*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 154, 330, 118 }, /*118*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 0, 50, 7, 154, 330, 118 },
/*119*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 134, 118 }, /*119*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 0, 50, 9, 55, 134, 118 },
/*120*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 81, 184, 118 }, /*120*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 0, 50, 9, 81, 184, 118 },
/*121*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 108, 238, 118 }, /*121*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 0, 50, 9, 108, 238, 118 },
/*122*/ { BARCODE_DBAR_STK_CC, "1234567890123", "[20]01", 24, 9, 56, 112, 48 }, /*122*/ { BARCODE_DBAR_STK_CC, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48 },
/*123*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 80, 11, 56, 112, 160 }, /*123*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 0, 80, 11, 56, 112, 160 },
/*124*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 }, /*124*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156 },
/*125*/ { BARCODE_CHANNEL, "01", "", 50, 1, 19, 38, 116.28 }, /*125*/ { BARCODE_CHANNEL, "01", "", 0, 50, 1, 19, 38, 116.28 },
/*126*/ { BARCODE_CODEONE, "12345678901234567890", "", 16, 16, 18, 36, 32 }, /*126*/ { BARCODE_CODEONE, "12345678901234567890", "", 0, 16, 16, 18, 36, 32 },
/*127*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 }, /*127*/ { BARCODE_GRIDMATRIX, "ABC", "", 0, 18, 18, 18, 36, 36 },
/*128*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 }, /*128*/ { BARCODE_UPNQR, "1234567890AB", "", 0, 77, 77, 77, 154, 154 },
/*129*/ { BARCODE_ULTRA, "1234567890", "", 13, 13, 18, 36, 26 }, /*129*/ { BARCODE_ULTRA, "1234567890", "", 0, 13, 13, 18, 36, 26 },
/*130*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54, 22 }, /*130*/ { BARCODE_RMQR, "12345", "", 0, 11, 11, 27, 54, 22 },
/*131*/ { BARCODE_BC412, "1234567", "", 16.666666, 1, 102, 204, 49.613335 }, /*131*/ { BARCODE_BC412, "1234567", "", 0, 16.666666, 1, 102, 204, 49.613335 },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
const char *text; const char *text;
int ret_buf;
char errmsg[128] = {0}; /* Suppress clang -fsanitize=memory false positive */ char errmsg[128] = {0}; /* Suppress clang -fsanitize=memory false positive */
testStartSymbol(p_ctx->func_name, &symbol); testStartSymbol(p_ctx->func_name, &symbol);
@@ -713,15 +714,17 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
length = (int) strlen(text); length = (int) strlen(text);
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%s) ret %d != %d (%s)\n",
i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0); ret_buf = ZBarcode_Buffer_Vector(symbol, 0);
assert_zero(ret, "i:%d ZBarcode_Buffer_Vector(%d) ret %d != 0\n", i, data[i].symbology, ret); assert_zero(ret_buf, "i:%d ZBarcode_Buffer_Vector(%d) ret_buf %d != 0\n", i, data[i].symbology, ret_buf);
assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology); assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, \"%s\", \"%s\", %.9g, %d, %d, %.9g, %.9g },\n", printf(" /*%3d*/ { %s, \"%s\", \"%s\", %s, %.9g, %d, %d, %.9g, %.9g },\n",
i, testUtilBarcodeName(data[i].symbology), data[i].data, data[i].composite, i, testUtilBarcodeName(data[i].symbology), data[i].data, data[i].composite,
testUtilErrorName(ret),
symbol->height, symbol->rows, symbol->width, symbol->vector->width, symbol->vector->height); symbol->height, symbol->rows, symbol->width, symbol->vector->width, symbol->vector->height);
} else { } else {
assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.9g != %.9g\n", assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.9g != %.9g\n",
@@ -730,10 +733,14 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows); i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width); i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width);
assert_equal(symbol->vector->width, data[i].expected_vector_width, "i:%d (%s) symbol->vector->width %.9g != %.9g\n", assert_equal(symbol->vector->width, data[i].expected_vector_width,
i, testUtilBarcodeName(data[i].symbology), symbol->vector->width, data[i].expected_vector_width); "i:%d (%s) symbol->vector->width %.9g != %.9g\n",
assert_equal(symbol->vector->height, data[i].expected_vector_height, "i:%d (%s) symbol->vector->height %.9g != %.9g\n", i, testUtilBarcodeName(data[i].symbology), symbol->vector->width,
i, testUtilBarcodeName(data[i].symbology), symbol->vector->height, data[i].expected_vector_height); data[i].expected_vector_width);
assert_equal(symbol->vector->height, data[i].expected_vector_height,
"i:%d (%s) symbol->vector->height %.9g != %.9g\n",
i, testUtilBarcodeName(data[i].symbology), symbol->vector->height,
data[i].expected_vector_height);
assert_nonzero(check_vectors(symbol, errmsg), "i:%d (%s) %s\n", assert_nonzero(check_vectors(symbol, errmsg), "i:%d (%s) %s\n",
i, testUtilBarcodeName(data[i].symbology), errmsg); i, testUtilBarcodeName(data[i].symbology), errmsg);
@@ -968,14 +975,14 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
/* 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 */ /* 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 */ /* 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 */ /* 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 */ /* 51*/ { BARCODE_EANX, -1, -1, "1234567+12", ZINT_WARN_NONCOMPLIANT, 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 */ /* 52*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567+12", ZINT_WARN_NONCOMPLIANT, 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 */ /* 53*/ { BARCODE_EANX, 0, -1, "1234567+12", ZINT_WARN_NONCOMPLIANT, 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 */ /* 54*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "1234567+12", ZINT_WARN_NONCOMPLIANT, 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 */ /* 55*/ { BARCODE_EANX, -1, -1, "1234567+12345", ZINT_WARN_NONCOMPLIANT, 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 */ /* 56*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567+12345", ZINT_WARN_NONCOMPLIANT, 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 */ /* 57*/ { BARCODE_EANX, 0, -1, "1234567+12345", ZINT_WARN_NONCOMPLIANT, 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 */ /* 58*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "1234567+12345", ZINT_WARN_NONCOMPLIANT, 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 }, /* 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", 0, 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 }, /* 61*/ { BARCODE_UPCA, 0, -1, "12345678901+12", 0, 50, 1, 124, 276, 110, -1, -1, -1, -1, 0 },
@@ -1021,20 +1028,28 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
length = (int) strlen(data[i].data); length = (int) strlen(data[i].data);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%d) ret %d != %d (%s)\n",
i, data[i].symbology, ret, data[i].ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0); ret = ZBarcode_Buffer_Vector(symbol, 0);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Buffer_Vector(%d) ret %d != %d\n", i, data[i].symbology, ret, data[i].ret); assert_zero(ret, "i:%d ZBarcode_Buffer_Vector(%d) ret %d != 0 (%s)\n",
i, data[i].symbology, ret, symbol->errtxt);
assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology); assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology);
assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.9g != %.9g\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height); assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.9g != %.9g\n",
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows); i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width); assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width);
assert_equal(symbol->vector->width, data[i].expected_vector_width, "i:%d (%s) symbol->vector->width %.9g != %.9g\n", assert_equal(symbol->vector->width, data[i].expected_vector_width,
"i:%d (%s) symbol->vector->width %.9g != %.9g\n",
i, testUtilBarcodeName(data[i].symbology), symbol->vector->width, data[i].expected_vector_width); i, testUtilBarcodeName(data[i].symbology), symbol->vector->width, data[i].expected_vector_width);
assert_equal(symbol->vector->height, data[i].expected_vector_height, "i:%d (%s) symbol->vector->height %.9g != %.9g\n", assert_equal(symbol->vector->height, data[i].expected_vector_height,
i, testUtilBarcodeName(data[i].symbology), symbol->vector->height, data[i].expected_vector_height); "i:%d (%s) symbol->vector->height %.9g != %.9g\n",
i, testUtilBarcodeName(data[i].symbology), symbol->vector->height,
data[i].expected_vector_height);
if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) { if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) {
testUtilVectorPrint(symbol); testUtilVectorPrint(symbol);
@@ -1045,14 +1060,16 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
i, testUtilBarcodeName(data[i].symbology)); i, testUtilBarcodeName(data[i].symbology));
string = find_string(symbol, data[i].expected_string_x, data[i].expected_string_y); string = find_string(symbol, data[i].expected_string_x, data[i].expected_string_y);
assert_nonnull(string, "i:%d (%s) find_string(%.9g, %.9g) NULL\n", assert_nonnull(string, "i:%d (%s) find_string(%.9g, %.9g) NULL\n",
i, testUtilBarcodeName(data[i].symbology), data[i].expected_string_x, data[i].expected_string_y); i, testUtilBarcodeName(data[i].symbology), data[i].expected_string_x,
data[i].expected_string_y);
if (data[i].expected_string2_x != -1) { if (data[i].expected_string2_x != -1) {
assert_nonnull(symbol->vector->strings->next, "i:%d (%s) vector->strings->next NULL\n", assert_nonnull(symbol->vector->strings->next, "i:%d (%s) vector->strings->next NULL\n",
i, testUtilBarcodeName(data[i].symbology)); i, testUtilBarcodeName(data[i].symbology));
string = find_string(symbol, data[i].expected_string2_x, data[i].expected_string2_y); string = find_string(symbol, data[i].expected_string2_x, data[i].expected_string2_y);
assert_nonnull(string, "i:%d (%s) find_string(%.9g, %.9g) NULL\n", assert_nonnull(string, "i:%d (%s) find_string(%.9g, %.9g) NULL\n",
i, testUtilBarcodeName(data[i].symbology), data[i].expected_string2_x, data[i].expected_string2_y); i, testUtilBarcodeName(data[i].symbology), data[i].expected_string2_x,
data[i].expected_string2_y);
} }
} else { } else {
assert_null(symbol->vector->strings, "i:%d (%s) vector->strings NULL\n", assert_null(symbol->vector->strings, "i:%d (%s) vector->strings NULL\n",
@@ -3156,7 +3173,7 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
/* 6*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012", -1, 0, 118, 226, "1234567890128", -1, "", -1, "" }, /* 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, "" }, /* 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, "" }, /* 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, "" }, /* 9*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012+12", -1, 0, 118, 276, "1234567890128+12", -1, "123456789012812", -1, "" },
/* 10*/ { BARCODE_CODE39, -1, -1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116.279999, 180, "*ABC14*", -1, "", -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, "" }, /* 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 */ /* 12*/ { BARCODE_CODE39, -1, 1, BARCODE_MEMORY_FILE, "ABC14", -1, 0, 116.279999, 206, "*ABC14_*", -1, "", -1, "" }, /* Check digit space rendered as underscore */
@@ -3190,7 +3207,8 @@ 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, -1 /*option_1*/, data[i].option_2, -1 /*option_3*/, data[i].output_options,
data[i].data, data[i].length, debug); data[i].data, data[i].length, debug);
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length; 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; 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); ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n",
@@ -3221,9 +3239,12 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
i, symbol->errtxt, data[i].expected_errtxt); i, symbol->errtxt, data[i].expected_errtxt);
assert_nonnull(symbol->vector, "i:%d ZBarcode_Print(%s) vector NULL\n", assert_nonnull(symbol->vector, "i:%d ZBarcode_Print(%s) vector NULL\n",
i, testUtilBarcodeName(data[i].symbology)); i, testUtilBarcodeName(data[i].symbology));
assert_equal(symbol->vector->height, data[i].expected_vector_height, "i:%d (%s) symbol->vector->height %.9g != %.9g\n", assert_equal(symbol->vector->height, data[i].expected_vector_height,
i, testUtilBarcodeName(data[i].symbology), symbol->vector->height, data[i].expected_vector_height); "i:%d (%s) symbol->vector->height %.9g != %.9g\n",
assert_equal(symbol->vector->width, data[i].expected_vector_width, "i:%d (%s) symbol->vector->width %.9g != %.9g\n", i, testUtilBarcodeName(data[i].symbology), symbol->vector->height,
data[i].expected_vector_height);
assert_equal(symbol->vector->width, data[i].expected_vector_width,
"i:%d (%s) symbol->vector->width %.9g != %.9g\n",
i, testUtilBarcodeName(data[i].symbology), symbol->vector->width, data[i].expected_vector_width); i, testUtilBarcodeName(data[i].symbology), symbol->vector->width, data[i].expected_vector_width);
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
@@ -3247,10 +3268,10 @@ int main(int argc, char *argv[]) {
{ "test_scale", test_scale }, { "test_scale", test_scale },
{ "test_guard_descent", test_guard_descent }, { "test_guard_descent", test_guard_descent },
{ "test_quiet_zones", test_quiet_zones }, { "test_quiet_zones", test_quiet_zones },
{ "test_text_gap", test_text_gap, }, { "test_text_gap", test_text_gap },
{ "test_height", test_height }, { "test_height", test_height },
{ "test_height_per_row", test_height_per_row }, { "test_height_per_row", test_height_per_row },
{ "test_hrt_raw_text", test_hrt_raw_text, }, { "test_hrt_raw_text", test_hrt_raw_text },
}; };
testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
+8
View File
@@ -2915,6 +2915,10 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
if (upcean) { if (upcean) {
if (symbology == BARCODE_EANX_CC && (primary_len <= 8 || (addon_posn && addon_posn <= 8))) { if (symbology == BARCODE_EANX_CC && (primary_len <= 8 || (addon_posn && addon_posn <= 8))) {
bwipp_barcode = "ean8composite"; bwipp_barcode = "ean8composite";
if (addon_posn) {
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%spermitaddon",
strlen(bwipp_opts_buf) ? " " : "");
}
} }
if (addon_posn) { if (addon_posn) {
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%saddongap=%d", sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%saddongap=%d",
@@ -2951,6 +2955,10 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
if ((symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK) if ((symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK)
&& (data_len <= 8 || (addon_posn && addon_posn <= 8))) { && (data_len <= 8 || (addon_posn && addon_posn <= 8))) {
bwipp_barcode = data_len <= 3 ? "ean2" : data_len <= 5 ? "ean5" : "ean8"; bwipp_barcode = data_len <= 3 ? "ean2" : data_len <= 5 ? "ean5" : "ean8";
if (addon_posn) {
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%spermitaddon",
strlen(bwipp_opts_buf) ? " " : "");
}
} }
if (symbology == BARCODE_ISBNX) { if (symbology == BARCODE_ISBNX) {
testUtilISBNHyphenate(bwipp_data, addon_posn); testUtilISBNHyphenate(bwipp_data, addon_posn);
Binary file not shown.
+41 -8
View File
@@ -84,7 +84,7 @@ static const char EANsetB[10][4] = {
{'1','3','2','1'}, {'4','1','1','1'}, {'2','1','3','1'}, {'3','1','2','1'}, {'2','1','1','3'} {'1','3','2','1'}, {'4','1','1','1'}, {'2','1','3','1'}, {'3','1','2','1'}, {'2','1','1','3'}
}; };
/* UPC A is usually used for 12 digit numbers, but this function takes a source of any length */ /* Write UPC-A or EAN-8 encodation to destination `d` */
static void upca_set_dest(const unsigned char source[], const int length, char *d) { static void upca_set_dest(const unsigned char source[], const int length, char *d) {
int i, half_way; int i, half_way;
@@ -156,12 +156,12 @@ static int upca(struct zint_symbol *symbol, const unsigned char source[], int le
} }
/* UPC-E, allowing for composite if `cc_rows` set */ /* UPC-E, allowing for composite if `cc_rows` set */
static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int length, char *d, int cc_rows) { static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int length, char *d, int cc_rows,
unsigned char equivalent[12]) {
int i, num_system; int i, num_system;
char emode, check_digit; char emode, check_digit;
const char *parity; const char *parity;
char src_check_digit = '\0'; char src_check_digit = '\0';
unsigned char equivalent[12];
const unsigned char *hrt = symbol->text; const unsigned char *hrt = symbol->text;
int error_number = 0; int error_number = 0;
@@ -266,6 +266,7 @@ static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int lengt
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 274, "Invalid check digit '%1$c', expecting '%2$c'", return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 274, "Invalid check digit '%1$c', expecting '%2$c'",
src_check_digit, check_digit); src_check_digit, check_digit);
} }
equivalent[11] = check_digit;
/* Use the number system and check digit information to choose a parity scheme */ /* Use the number system and check digit information to choose a parity scheme */
if (num_system == 1) { if (num_system == 1) {
@@ -322,8 +323,9 @@ static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int lengt
} }
/* UPC-E is a zero-compressed version of UPC-A */ /* UPC-E is a zero-compressed version of UPC-A */
static int upce(struct zint_symbol *symbol, unsigned char source[], int length, char dest[]) { static int upce(struct zint_symbol *symbol, unsigned char source[], int length, char dest[],
return upce_cc(symbol, source, length, dest, 0 /*cc_rows*/); unsigned char equivalent[12]) {
return upce_cc(symbol, source, length, dest, 0 /*cc_rows*/, equivalent);
} }
/* EAN-2 and EAN-5 add-on codes */ /* EAN-2 and EAN-5 add-on codes */
@@ -753,6 +755,7 @@ INTERNAL int ean_leading_zeroes(struct zint_symbol *symbol, const unsigned char
INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int length, int cc_rows) { INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int length, int cc_rows) {
unsigned char first_part[14], second_part[6]; unsigned char first_part[14], second_part[6];
unsigned char local_source[20]; /* Allow 13 + "+" + 5 + 1 */ unsigned char local_source[20]; /* Allow 13 + "+" + 5 + 1 */
unsigned char equivalent[12] = {0}; /* For UPC-E - GTIN-12 equivalent */
char dest[1000] = {0}; char dest[1000] = {0};
int with_addon; int with_addon;
int error_number = 0, i, plus_count; int error_number = 0, i, plus_count;
@@ -899,7 +902,7 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int len
case BARCODE_UPCE: case BARCODE_UPCE:
case BARCODE_UPCE_CHK: case BARCODE_UPCE_CHK:
if ((first_part_len >= 6) && (first_part_len <= 8)) { if ((first_part_len >= 6) && (first_part_len <= 8)) {
error_number = upce(symbol, first_part, first_part_len, dest); error_number = upce(symbol, first_part, first_part_len, dest, equivalent);
} else { } else {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 290, return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 290,
"Input length %d wrong (6, 7 or 8 characters required)", first_part_len); "Input length %d wrong (6, 7 or 8 characters required)", first_part_len);
@@ -917,7 +920,7 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int len
symbol->row_height[symbol->rows + 1] = 2; symbol->row_height[symbol->rows + 1] = 2;
symbol->row_height[symbol->rows + 2] = 2; symbol->row_height[symbol->rows + 2] = 2;
symbol->rows += 3; symbol->rows += 3;
error_number = upce_cc(symbol, first_part, first_part_len, dest, cc_rows); error_number = upce_cc(symbol, first_part, first_part_len, dest, cc_rows, equivalent);
} else { } else {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 291, return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 291,
"Input length %d wrong (6, 7 or 8 characters required)", first_part_len); "Input length %d wrong (6, 7 or 8 characters required)", first_part_len);
@@ -944,11 +947,41 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int len
ean_add_on(second_part, second_part_len, dest, addon_gap); ean_add_on(second_part, second_part_len, dest, addon_gap);
hrt_cat_chr_nochk(symbol, '+'); hrt_cat_chr_nochk(symbol, '+');
hrt_cat_nochk(symbol, second_part, second_part_len); hrt_cat_nochk(symbol, second_part, second_part_len);
if (first_part_len <= 8 && (symbol->symbology == BARCODE_EANX || symbol->symbology == BARCODE_EANX_CHK
|| symbol->symbology == BARCODE_EANX_CC)) {
error_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 292, "EAN-8 with add-on is non-standard");
}
} }
if (raw_text && rt_cpy(symbol, symbol->text, symbol->text_length)) { /* Just use the HRT */ if (raw_text) {
const int is_ean = symbol->symbology == BARCODE_EANX || symbol->symbology == BARCODE_EANX_CHK
|| symbol->symbology == BARCODE_EANX_CC || symbol->symbology == BARCODE_ISBNX;
/* EAN-8 with no add-on, EAN-2, EAN-5 */
if (is_ean && symbol->text_length <= 8 && !second_part_len) {
if (rt_cpy(symbol, symbol->text, symbol->text_length)) { /* Just use the HRT */
return ZINT_ERROR_MEMORY; /* `rt_cpy()` only fails with OOM */ return ZINT_ERROR_MEMORY; /* `rt_cpy()` only fails with OOM */
} }
} else { /* Expand to GTIN-13 (UPC-A, UPC-E, EAN-8 with add-on) */
unsigned char gtin13[13];
/* EAN-13, ISBNX */
if (is_ean && symbol->text_length >= 13) {
memcpy(gtin13, symbol->text, 13);
/* UPC-E */
} else if (*equivalent) {
gtin13[0] = '0';
memcpy(gtin13 + 1, equivalent, 12);
/* UPC-A, EAN-8 */
} else {
const int zeroes = 13 - (symbol->text_length - (second_part_len ? second_part_len + 1 : 0));
assert(zeroes > 0);
memset(gtin13, '0', zeroes);
memcpy(gtin13 + zeroes, symbol->text, 13 - zeroes);
}
if (rt_cpy_cat(symbol, gtin13, 13, '\xFF' /*none*/, second_part, second_part_len)) {
return ZINT_ERROR_MEMORY; /* `rt_cpy_cat()` only fails with OOM */
}
}
}
expand(symbol, dest, (int) strlen(dest)); expand(symbol, dest, (int) strlen(dest));
+6 -4
View File
@@ -4343,10 +4343,12 @@ character set the data is in (UTF-8 data will be converted) in
href="#fn16" class="footnote-ref" id="fnref16" href="#fn16" class="footnote-ref" id="fnref16"
role="doc-noteref"><sup>16</sup></a> and for GS1 data any role="doc-noteref"><sup>16</sup></a> and for GS1 data any
<code>FNC1</code> separators will be represented as <code>GS</code> <code>FNC1</code> separators will be represented as <code>GS</code>
characters. For EAN/UPC data, add-ons will be separated from the main (ASCII 29) characters. UPC-A and UPC-E data will be expanded to EAN-13,
data with a plus (<code>+</code>) sign. GS1 Composite data if any will as will EAN-8 but only if it has an add-on (otherwise it will remain at
be separated from the primary data (including any EAN/UPC add-ons) by a 8 digits), and any add-ons will follow the 13 digits directly (no
pipe (<code>|</code>) character.</p> separator). GS1 Composite data if any will be separated from the primary
data (including any EAN/UPC add-ons) by a pipe (<code>|</code>)
character.</p>
<h2 id="utf-8-to-eci-convenience-functions">5.17 UTF-8 to ECI <h2 id="utf-8-to-eci-convenience-functions">5.17 UTF-8 to ECI
convenience functions</h2> convenience functions</h2>
<p>As a convenience the conversion done by Zint from UTF-8 to ECIs is <p>As a convenience the conversion done by Zint from UTF-8 to ECIs is
+5 -4
View File
@@ -2691,10 +2691,11 @@ The `source`, `length` and `eci` members of `zint_seg` will be set accordingly -
the data in `source`, the data length in `length`, and the character set the the data in `source`, the data length in `length`, and the character set the
data is in (UTF-8 data will be converted) in `eci`. Any check characters encoded data is in (UTF-8 data will be converted) in `eci`. Any check characters encoded
will be included,[^16] and for GS1 data any `FNC1` separators will be will be included,[^16] and for GS1 data any `FNC1` separators will be
represented as `GS` characters. For EAN/UPC data, add-ons will be separated from represented as `GS` (ASCII 29) characters. UPC-A and UPC-E data will be expanded
the main data with a plus (`+`) sign. GS1 Composite data if any will be to EAN-13, as will EAN-8 but only if it has an add-on (otherwise it will remain
separated from the primary data (including any EAN/UPC add-ons) by a pipe (`|`) at 8 digits), and any add-ons will follow the 13 digits directly (no separator).
character. GS1 Composite data if any will be separated from the primary data (including any
EAN/UPC add-ons) by a pipe (`|`) character.
[^15]: DotCode, Han Xin, Micro QR Code, QR Code and UPNQR have variable masks. [^15]: DotCode, Han Xin, Micro QR Code, QR Code and UPNQR have variable masks.
Rectangular Micro QR Code has a fixed mask (4). Rectangular Micro QR Code has a fixed mask (4).
+5 -3
View File
@@ -2632,9 +2632,11 @@ The source, length and eci members of zint_seg will be set accordingly - the
data in source, the data length in length, and the character set the data is in data in source, the data length in length, and the character set the data is in
(UTF-8 data will be converted) in eci. Any check characters encoded will be (UTF-8 data will be converted) in eci. Any check characters encoded will be
included,[16] and for GS1 data any FNC1 separators will be represented as GS included,[16] and for GS1 data any FNC1 separators will be represented as GS
characters. For EAN/UPC data, add-ons will be separated from the main data with (ASCII 29) characters. UPC-A and UPC-E data will be expanded to EAN-13, as will
a plus (+) sign. GS1 Composite data if any will be separated from the primary EAN-8 but only if it has an add-on (otherwise it will remain at 8 digits), and
data (including any EAN/UPC add-ons) by a pipe (|) character. any add-ons will follow the 13 digits directly (no separator). GS1 Composite
data if any will be separated from the primary data (including any EAN/UPC
add-ons) by a pipe (|) character.
5.17 UTF-8 to ECI convenience functions 5.17 UTF-8 to ECI convenience functions