diff --git a/ChangeLog b/ChangeLog
index e50d38da..15c088f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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**
@@ -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`
- GS1 Composites now return warning if CC type upped from requested due to size
of composite data
+- EAN-8 with add-on now returns warning that it's non-standard
Changes
-------
@@ -30,6 +31,7 @@ Changes
`ZINT_CAP_STACKABLE`, and new Qt Backend method `isBindable()`
- DOTCODE: now pads rows if given number of columns instead of failing if rows
below min (5)
+- EAN-8 + add-on: warn as non-compliant
Bugs
----
diff --git a/backend/composite.c b/backend/composite.c
index cd231207..1d33ac50 100644
--- a/backend/composite.c
+++ b/backend/composite.c
@@ -1456,8 +1456,13 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
}
} else {
/* If symbol->height given then min row height was returned, else default height */
- error_number = set_height(symbol, symbol->height ? linear->height : 0.0f,
- symbol->height ? 0.0f : linear->height, 0.0f, 0 /*no_errtxt*/);
+ 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,
+ 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 {
if (symbol->symbology == BARCODE_DBAR_STK_CC) {
diff --git a/backend/tests/test_2of5.c b/backend/tests/test_2of5.c
index e451007f..8d3445a1 100644
--- a/backend/tests/test_2of5.c
+++ b/backend/tests/test_2of5.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_auspost.c b/backend/tests/test_auspost.c
index a5b5e7ad..e02e9fb6 100644
--- a/backend/tests/test_auspost.c
+++ b/backend/tests/test_auspost.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_bc412.c b/backend/tests/test_bc412.c
index 26b6627c..02f244c3 100644
--- a/backend/tests/test_bc412.c
+++ b/backend/tests/test_bc412.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_bmp.c b/backend/tests/test_bmp.c
index 394a5d4b..914c2df5 100644
--- a/backend/tests/test_bmp.c
+++ b/backend/tests/test_bmp.c
@@ -84,14 +84,16 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
symbol->debug |= debug;
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) {
testUtilStrCpyRepeat(data_buf, data[i].pattern, size);
} else {
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') {
symbol->symbology = BARCODE_ULTRA;
@@ -100,7 +102,8 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
symbol->bitmap = (unsigned char *) 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 (have_identify) {
@@ -164,7 +167,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) {
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)) {
ret = testUtilMkDir(data_dir_path);
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();
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) {
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);
- 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);
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) {
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].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].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) {
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 {
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);
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 */
- assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
+ /* For BARCODE_MEMORY_FILE */
+ 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)) {
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_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
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",
- i, testUtilBarcodeName(data[i].symbology));
+ assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size),
+ "i:%d %s memcmp(memfile, filebuf) != 0\n", i, testUtilBarcodeName(data[i].symbology));
}
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 */
#endif
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 */
- 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);
- 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_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);
+ 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_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;
diff --git a/backend/tests/test_channel.c b/backend/tests/test_channel.c
index bca18493..3bcff2f3 100644
--- a/backend/tests/test_channel.c
+++ b/backend/tests/test_channel.c
@@ -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, symbol->raw_segs[0].length, expected_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected, expected_length);
+ "i:%d memcmp(%.*s, %s, %d) != 0\n",
+ i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected, expected_length);
} else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_codabar.c b/backend/tests/test_codabar.c
index 0575afd4..a0122d6f 100644
--- a/backend/tests/test_codabar.c
+++ b/backend/tests/test_codabar.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_code11.c b/backend/tests/test_code11.c
index da6c3733..1ba0c474 100644
--- a/backend/tests/test_code11.c
+++ b/backend/tests/test_code11.c
@@ -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, symbol->raw_segs[0].length, expected_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected, expected_length);
+ "i:%d memcmp(%.*s, %s, %d) != 0\n",
+ i, expected_length, symbol->raw_segs[0].source, data[i].expected, expected_length);
} else {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_code128.c b/backend/tests/test_code128.c
index 275e3d72..a6b0c03a 100644
--- a/backend/tests/test_code128.c
+++ b/backend/tests/test_code128.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%.*s, %.*s, %d) != 0\n",
- i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, expected_raw_length,
- data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_composite.c b/backend/tests/test_composite.c
index deb3b491..9dd2f24c 100644
--- a/backend/tests/test_composite.c
+++ b/backend/tests/test_composite.c
@@ -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 },
/* 6*/ { BARCODE_EANX_CC, "1234567", "[21]A12345678", 0, 8, 72 },
/* 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 */
- /* 9*/ { BARCODE_EANX_CC, "12+12", "[21]A12345678", 0, 8, 98 },
- /*10*/ { BARCODE_EANX_CC, "123+12", "[21]A12345678", 0, 8, 98 },
- /*11*/ { BARCODE_EANX_CC, "1234+12", "[21]A12345678", 0, 8, 98 },
- /*12*/ { BARCODE_EANX_CC, "12345+12", "[21]A12345678", 0, 8, 98 },
- /*13*/ { BARCODE_EANX_CC, "123456+12", "[21]A12345678", 0, 8, 98 },
- /*14*/ { BARCODE_EANX_CC, "1234567+12", "[21]A12345678", 0, 8, 98 },
+ /* 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", ZINT_WARN_NONCOMPLIANT, 8, 98 },
+ /*10*/ { BARCODE_EANX_CC, "123+12", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 98 },
+ /*11*/ { BARCODE_EANX_CC, "1234+12", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 98 },
+ /*12*/ { BARCODE_EANX_CC, "12345+12", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 98 },
+ /*13*/ { BARCODE_EANX_CC, "123456+12", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 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 */
- /*16*/ { BARCODE_EANX_CC, "1+123", "[21]A12345678", 0, 8, 125 }, /* EAN-8 + EAN-5 */
- /*17*/ { BARCODE_EANX_CC, "12+123", "[21]A12345678", 0, 8, 125 },
- /*18*/ { BARCODE_EANX_CC, "123+123", "[21]A12345678", 0, 8, 125 },
- /*19*/ { BARCODE_EANX_CC, "1234+123", "[21]A12345678", 0, 8, 125 },
- /*20*/ { BARCODE_EANX_CC, "12345+123", "[21]A12345678", 0, 8, 125 },
- /*21*/ { BARCODE_EANX_CC, "123456+123", "[21]A12345678", 0, 8, 125 },
- /*22*/ { BARCODE_EANX_CC, "1234567+123", "[21]A12345678", 0, 8, 125 },
+ /*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", ZINT_WARN_NONCOMPLIANT, 8, 125 },
+ /*18*/ { BARCODE_EANX_CC, "123+123", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 125 },
+ /*19*/ { BARCODE_EANX_CC, "1234+123", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 125 },
+ /*20*/ { BARCODE_EANX_CC, "12345+123", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 8, 125 },
+ /*21*/ { BARCODE_EANX_CC, "123456+123", "[21]A12345678", ZINT_WARN_NONCOMPLIANT, 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 */
/*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 */
@@ -1493,7 +1493,7 @@ static void test_examples(const testCtx *const p_ctx) {
"000100000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000"
"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"
"11011111100110100101011100011011110010110000111100010011110101110101110100000000000000000000000000"
"10000101100000110101011000010101111101111100111010010000111001110101100100000000000000000000000000"
@@ -1503,7 +1503,7 @@ static void test_examples(const testCtx *const p_ctx) {
"00001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000"
"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"
"111011101011001011100001000100001001011100101100100000111000110111010001110111010100000000000000000000000000000000000000000000000000000"
"111001101011011111100110100100001101010100010111100000110010011011111101110011010100000000000000000000000000000000000000000000000000000"
@@ -3006,7 +3006,7 @@ static void test_addongap(const testCtx *const p_ctx) {
};
/* Verified via bwipp_dump.ps against BWIPP */
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"
"10000011100101100101011100010111100010001000100000100101111001110101110100000000000000000000000000"
"11001101001000000101011000011010011100011110110001100110011001110101100100000000000000000000000000"
@@ -3016,7 +3016,7 @@ static void test_addongap(const testCtx *const p_ctx) {
"00001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000"
"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"
"100000111001011001010111000101111000100010001000001001011110011101011101000000000000000000000000000"
"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. */
/* 10*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "1234567890128", "[20]1A", 0, "1234567890128", "" },
/* 11*/ { BARCODE_EANX_CC, -1, -1, "1234567890128+12", "[20]12", 0, "1234567890128+12", "" },
- /* 12*/ { BARCODE_EANX_CC, -1, BARCODE_RAW_TEXT, "1234567890128+12", "[20]12", 0, "1234567890128+12", "1234567890128+12|2012" },
+ /* 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", "" },
/* 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", "" },
@@ -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. */
/* 26*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[20]1A", 0, "(01)12345678901231", "" },
/* 27*/ { BARCODE_UPCA_CC, -1, -1, "12345678901", "[20]12", 0, "123456789012", "" },
- /* 28*/ { BARCODE_UPCA_CC, -1, BARCODE_RAW_TEXT, "12345678901", "[20]12", 0, "123456789012", "123456789012|2012" },
+ /* 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", "" },
/* 30*/ { BARCODE_UPCA_CC, -1, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" },
/* 31*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, "", "" }, /* Still checked */
/* 32*/ { BARCODE_UPCA_CC, -1, -1, "123456789012", "[20]1A", ZINT_WARN_NONCOMPLIANT, "123456789012", "" }, /* AI (20) should be 2 nos. */
/* 33*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, "123456789012", "[20]1A", 0, "123456789012", "" },
/* 34*/ { BARCODE_UPCA_CC, -1, -1, "123456789012+123", "[20]12", 0, "123456789012+00123", "" },
- /* 35*/ { BARCODE_UPCA_CC, -1, BARCODE_RAW_TEXT, "123456789012+123", "[20]12", 0, "123456789012+00123", "123456789012+00123|2012" },
+ /* 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", "" },
- /* 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", "" },
/* 39*/ { BARCODE_UPCE_CC, -1, -1, "12345670", "[20]12", 0, "12345670", "" },
/* 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. */
/* 44*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, "1234567", "[20]1A", 0, "12345670", "" },
/* 45*/ { BARCODE_UPCE_CC, -1, -1, "1234567+2", "[20]12", 0, "12345670+02", "" },
- /* 46*/ { BARCODE_UPCE_CC, -1, BARCODE_RAW_TEXT, "1234567+2", "[20]12", 0, "12345670+02", "12345670+02|2012" },
+ /* 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 */
/* 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, "", "" },
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
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)", "" },
/* 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)", "" },
- /* 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)", "" },
/* 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) */
diff --git a/backend/tests/test_dxfilmedge.c b/backend/tests/test_dxfilmedge.c
index 933442f4..4a08cd4a 100644
--- a/backend/tests/test_dxfilmedge.c
+++ b/backend/tests/test_dxfilmedge.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_emf.c b/backend/tests/test_emf.c
index e12815d6..6cd6cfce 100644
--- a/backend/tests/test_emf.c
+++ b/backend/tests/test_emf.c
@@ -116,7 +116,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) {
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)) {
ret = testUtilMkDir(data_dir_path);
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();
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) {
symbol->border_width = data[i].border_width;
}
@@ -145,7 +148,8 @@ static void test_print(const testCtx *const p_ctx) {
}
if (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) {
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);
- 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);
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) {
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,
- testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width, data[i].whitespace_height,
- 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);
+ i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
+ data[i].border_width, testUtilOutputOptionsName(data[i].output_options),
+ data[i].whitespace_width, data[i].whitespace_height,
+ 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);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
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 */
ret = testUtilVerifyLibreOffice(expected_file, debug);
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);
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 */
- assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
+ /* For BARCODE_MEMORY_FILE */
+ 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)) {
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -195,12 +209,13 @@ static void test_print(const testCtx *const p_ctx) {
symbol->output_options |= BARCODE_MEMORY_FILE;
ret = ZBarcode_Print(symbol, data[i].rotate_angle);
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_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
- 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",
- i, testUtilBarcodeName(data[i].symbology));
+ 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",
+ i, testUtilBarcodeName(data[i].symbology));
}
ZBarcode_Delete(symbol);
@@ -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 */
#endif
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 */
- 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);
- 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_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);
+ 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_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;
@@ -249,7 +269,8 @@ static void test_outfile(const testCtx *const p_ctx) {
symbol.vector = NULL;
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();
}
diff --git a/backend/tests/test_filemem.c b/backend/tests/test_filemem.c
index 1cbdddbe..42882d6e 100644
--- a/backend/tests/test_filemem.c
+++ b/backend/tests/test_filemem.c
@@ -82,7 +82,9 @@ static void test_svg(const testCtx *const p_ctx) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
- length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -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);
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 {
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) {
#ifndef ZINT_TEST_NO_FMEMOPEN
/* 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",
i, symbol->memfile_size, expected_size);
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);
}
diff --git a/backend/tests/test_gif.c b/backend/tests/test_gif.c
index 207d305d..a56ce67f 100644
--- a/backend/tests/test_gif.c
+++ b/backend/tests/test_gif.c
@@ -93,12 +93,14 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
} else {
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;
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 (have_identify) {
@@ -200,7 +202,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) {
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)) {
ret = testUtilMkDir(data_dir_path);
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();
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) {
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);
- 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);
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) {
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].option_1, data[i].option_2, data[i].height, data[i].scale, data[i].dot_size, data[i].fgcolour, data[i].bgcolour,
- 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].height, data[i].scale, data[i].dot_size,
+ 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);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
if (have_identify) {
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 {
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);
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 */
- assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
+ /* For BARCODE_MEMORY_FILE */
+ 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)) {
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -281,12 +296,13 @@ static void test_print(const testCtx *const p_ctx) {
symbol->output_options |= BARCODE_MEMORY_FILE;
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);
+ 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_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
- 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",
- i, testUtilBarcodeName(data[i].symbology));
+ 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",
+ i, testUtilBarcodeName(data[i].symbology));
}
ZBarcode_Delete(symbol);
@@ -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 */
#endif
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 */
- 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);
- 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_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);
+ 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_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;
@@ -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 */
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 */
/* 129.1 kB file manually inspected and checked (1.1 MB file for scale 70.0f also checked) */
diff --git a/backend/tests/test_gs1.c b/backend/tests/test_gs1.c
index cd131580..feb82e8e 100644
--- a/backend/tests/test_gs1.c
+++ b/backend/tests/test_gs1.c
@@ -199,7 +199,8 @@ static void test_gs1_reduce(const testCtx *const p_ctx) {
char bwipp_buf[8196];
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);
@@ -216,35 +217,44 @@ static void test_gs1_reduce(const testCtx *const p_ctx) {
} else {
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);
if (p_ctx->generate) {
if (data[i].ret == 0) {
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");
printf(" },\n");
} else {
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 {
- 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) {
int 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)) {
- ret = testUtilBwipp(i, symbol, -1, -1, -1, text, length, symbol->primary, bwipp_buf, sizeof(bwipp_buf), NULL);
- assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
+ ret = testUtilBwipp(i, symbol, -1, -1, -1, text, length, symbol->primary, bwipp_buf,
+ 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);
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);
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",
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) {
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
- assert_equal(symbol->raw_segs[0].length, expected_raw_length, "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
+ assert_equal(symbol->raw_segs[0].length, expected_raw_length,
+ "i:%d raw_segs[0].length %d != expected_raw_length %d\n",
i, symbol->raw_segs[0].length, expected_raw_length);
- assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length), "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
+ "i:%d memcmp(%.*s, %s, %d) != 0\n",
+ i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
+ expected_raw_length);
} else {
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);
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) {
assert_zero(strcmp(reduced, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
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",
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);
}
@@ -2596,11 +2613,15 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) {
} else {
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);
- assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
- assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
+ assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
+ i, ret, data[i].ret, symbol->errtxt);
+ assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n",
+ i, symbol->errtxt, data[i].expected_errtxt);
ZBarcode_Delete(symbol);
}
diff --git a/backend/tests/test_imail.c b/backend/tests/test_imail.c
index 20887866..38a4a79a 100644
--- a/backend/tests/test_imail.c
+++ b/backend/tests/test_imail.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c
index b306ebe1..65b5f678 100644
--- a/backend/tests/test_library.c
+++ b/backend/tests/test_library.c
@@ -230,7 +230,7 @@ static void test_checks(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n");
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);
if (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");
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);
if (data[i].warn_level != -1) {
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;
}
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);
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) {
char data_buf[ZINT_MAX_DATA_LEN + 10];
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();
assert_nonnull(symbol, "Symbol not created\n");
@@ -603,8 +605,8 @@ static void test_input_mode(const testCtx *const p_ctx) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
- length = testUtilSetSymbol(symbol, BARCODE_CODE49 /*Supports GS1*/, data[i].input_mode,
- -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/,
+ length = testUtilSetSymbol(symbol, BARCODE_CODE49 /*Supports GS1*/, data[i].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);
@@ -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 */
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);
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 */
(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);
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);
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();
@@ -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);
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) {
strcpy(symbol->errtxt, data[i].data);
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_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");
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");
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->height == symbol_def->height, "ZBarcodeBuffer height != 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_height == symbol_def->whitespace_height, "ZBarcodeBuffer whitespace_height != symbol_def\n");
+ assert_nonzero(symbol->whitespace_width == symbol_def->whitespace_width,
+ "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->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->bgcolour, symbol_def->bgcolour), "ZBarcodeBuffer bgcolour != 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->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->guard_descent == symbol_def->guard_descent, "ZBarcodeBuffer guard_descent != 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->guard_descent == symbol_def->guard_descent,
+ "ZBarcodeBuffer guard_descent != 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");
/* 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->height == symbol_def->height, "ZBarcodeBuffer height != 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_height == symbol_def->whitespace_height, "ZBarcodeBuffer whitespace_height != symbol_def\n");
+ assert_nonzero(symbol->whitespace_width == symbol_def->whitespace_width,
+ "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->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->bgcolour, symbol_def->bgcolour), "ZBarcodeBuffer bgcolour != 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->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->guard_descent == symbol_def->guard_descent, "ZBarcodeBuffer guard_descent != 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->guard_descent == symbol_def->guard_descent,
+ "ZBarcodeBuffer guard_descent != 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");
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);
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) {
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);
- assert_equal(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);
+ assert_equal(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 */
- && (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 = 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",
- i, testUtilBarcodeName(data[i].symbology), ret, data[i].x_dim, data[i].filetype, x_dim_from_scale, data[i].x_dim);
+ 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",
+ 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);
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) {
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);
- assert_equal(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);
+ assert_equal(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, dest_length, expected_length);
#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
- assert_zero(memcmp(dest, data[i].expected, expected_length), "i:%d memcmp(\"%s\", \"%s\", %d) != 0\n",
- i, dest, data[i].expected, expected_length);
+ assert_zero(memcmp(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" },
/* 23*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", "0112345678901231" },
/* 24*/ { BARCODE_TELEPEN, -1, "1234567890", "1234567890n" },
- /* 25*/ { BARCODE_UPCA, -1, "12345678901", "123456789012" },
- /* 26*/ { BARCODE_UPCA_CHK, -1, "123456789012", "123456789012" },
- /* 27*/ { BARCODE_UPCE, -1, "1234567", "12345670" },
- /* 28*/ { BARCODE_UPCE_CHK, -1, "12345670", "" },
+ /* 25*/ { BARCODE_UPCA, -1, "12345678901", "0123456789012" },
+ /* 26*/ { BARCODE_UPCA_CHK, -1, "123456789012", "0123456789012" },
+ /* 27*/ { BARCODE_UPCE, -1, "1234567", "0123456000070" },
+ /* 28*/ { BARCODE_UPCE_CHK, -1, "12345670", "0123456000070" },
/* 29*/ { BARCODE_POSTNET, -1, "12345678901", "123456789014" },
/* 30*/ { BARCODE_MSI_PLESSEY, -1, "1234567890", "" },
/* 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" },
/* 92*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "0112345678901231|2001" },
/* 93*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "0112345678901231|2001" },
- /* 94*/ { BARCODE_UPCA_CC, -1, "12345678901", "123456789012|2001" },
- /* 95*/ { BARCODE_UPCE_CC, -1, "1234567", "12345670|2001" },
+ /* 94*/ { BARCODE_UPCA_CC, -1, "12345678901", "0123456789012|2001" },
+ /* 95*/ { BARCODE_UPCE_CC, -1, "1234567", "0123456000070|2001" },
/* 96*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "0112345678901231|2001" },
/* 97*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "0112345678901231|2001" },
/* 98*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "0112345678901231|2001" },
@@ -2882,8 +2911,8 @@ static void test_raw_text(const testCtx *const p_ctx) {
text = data[i].data;
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/,
- -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, BARCODE_RAW_TEXT,
- text, -1, debug);
+ -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, BARCODE_RAW_TEXT,
+ text, -1, debug);
expected = data[i].expected[0] ? data[i].expected : data[i].data;
expected_length = (int) strlen(expected);
diff --git a/backend/tests/test_mailmark.c b/backend/tests/test_mailmark.c
index 84716196..7bb83a3b 100644
--- a/backend/tests/test_mailmark.c
+++ b/backend/tests/test_mailmark.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_medical.c b/backend/tests/test_medical.c
index 485467ff..107ef843 100644
--- a/backend/tests/test_medical.c
+++ b/backend/tests/test_medical.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_pcx.c b/backend/tests/test_pcx.c
index c01a2743..ed889c79 100644
--- a/backend/tests/test_pcx.c
+++ b/backend/tests/test_pcx.c
@@ -74,7 +74,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) {
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)) {
ret = testUtilMkDir(data_dir_path);
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();
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) {
symbol->border_width = data[i].border_width;
}
@@ -110,35 +113,44 @@ static void test_print(const testCtx *const p_ctx) {
symbol->debug |= debug;
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);
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) {
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].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);
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) {
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 {
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);
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 */
- assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
+ /* For BARCODE_MEMORY_FILE */
+ 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)) {
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -147,12 +159,13 @@ static void test_print(const testCtx *const p_ctx) {
symbol->output_options |= BARCODE_MEMORY_FILE;
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);
+ 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_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
- 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",
- i, testUtilBarcodeName(data[i].symbology));
+ 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",
+ i, testUtilBarcodeName(data[i].symbology));
}
ZBarcode_Delete(symbol);
@@ -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 */
#endif
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 */
- 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);
- 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_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);
+ 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_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;
diff --git a/backend/tests/test_plessey.c b/backend/tests/test_plessey.c
index 723beb03..ab75857d 100644
--- a/backend/tests/test_plessey.c
+++ b/backend/tests/test_plessey.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_png.c b/backend/tests/test_png.c
index 1187820e..3d5c776f 100644
--- a/backend/tests/test_png.c
+++ b/backend/tests/test_png.c
@@ -83,19 +83,22 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
symbol->debug |= debug;
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) {
testUtilStrCpyRepeat(data_buf, data[i].pattern, size);
} else {
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;
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 (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", "" },
/* 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", "" },
- /* 50*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12", "", 0, "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", "" },
- /* 52*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12345", "", 0, "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", "" },
- /* 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", "" },
- /* 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", "" },
- /* 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", "" },
- /* 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", "" },
+ /* 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", "", 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", "", 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", "", 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", 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", 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", 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", 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", "" },
/* 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", "" },
@@ -257,7 +260,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) {
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)) {
ret = testUtilMkDir(data_dir_path);
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();
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) {
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);
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);
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) {
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),
- 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,
+ i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
+ 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].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);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
if (have_identify) {
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 {
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);
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 */
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
- ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size); /* For BARCODE_MEMORY_FILE */
- assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
+ /* For BARCODE_MEMORY_FILE */
+ 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)) {
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -353,12 +370,13 @@ static void test_print(const testCtx *const p_ctx) {
symbol->output_options |= BARCODE_MEMORY_FILE;
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);
+ 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_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
- 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",
- i, testUtilBarcodeName(data[i].symbology));
+ 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",
+ i, testUtilBarcodeName(data[i].symbology));
}
ZBarcode_Delete(symbol);
@@ -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 */
#endif
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 */
- 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);
- 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_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);
+ 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_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;
@@ -484,7 +508,8 @@ static void test_large_compliant_height(const testCtx *const p_ctx) {
symbol->symbology = BARCODE_CODABLOCKF;
symbol->output_options |= COMPLIANT_HEIGHT;
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);
assert_zero(ret, "ZBarcode_Encode_and_Print ret %d != 0 (%s)\n", ret, symbol->errtxt);
diff --git a/backend/tests/test_postal.c b/backend/tests/test_postal.c
index 5b8d4f24..e625d423 100644
--- a/backend/tests/test_postal.c
+++ b/backend/tests/test_postal.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_raster.c b/backend/tests/test_raster.c
index 5eb4f8bf..7009bf49 100644
--- a/backend/tests/test_raster.c
+++ b/backend/tests/test_raster.c
@@ -114,7 +114,7 @@ static void test_buffer(const testCtx *const p_ctx) {
int output_options;
const char *data;
const char *composite;
-
+ int ret;
float expected_height;
int expected_rows;
int expected_width;
@@ -122,276 +122,277 @@ static void test_buffer(const testCtx *const p_ctx) {
int expected_bitmap_height;
};
static const struct item data[] = {
- /* 0*/ { BARCODE_CODE11, -1, "1234567890", "", 50, 1, 108, 216, 116 },
- /* 1*/ { BARCODE_CODE11, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 108, 216, 116 },
- /* 2*/ { BARCODE_C25STANDARD, -1, "1234567890", "", 50, 1, 117, 234, 116 },
- /* 3*/ { BARCODE_C25STANDARD, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 117, 234, 116 },
- /* 4*/ { BARCODE_C25INTER, -1, "1234567890", "", 50, 1, 99, 198, 116 },
- /* 5*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 99, 198, 116 },
- /* 6*/ { BARCODE_C25IATA, -1, "1234567890", "", 50, 1, 149, 298, 116 },
- /* 7*/ { BARCODE_C25IATA, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 149, 298, 116 },
- /* 8*/ { BARCODE_C25LOGIC, -1, "1234567890", "", 50, 1, 109, 218, 116 },
- /* 9*/ { BARCODE_C25LOGIC, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 109, 218, 116 },
- /* 10*/ { BARCODE_C25IND, -1, "1234567890", "", 50, 1, 159, 318, 116 },
- /* 11*/ { BARCODE_C25IND, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 159, 318, 116 },
- /* 12*/ { BARCODE_CODE39, -1, "1234567890", "", 50, 1, 155, 310, 116 },
- /* 13*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 155, 310, 116 },
- /* 14*/ { BARCODE_EXCODE39, -1, "1234567890", "", 50, 1, 155, 310, 116 },
- /* 15*/ { BARCODE_EXCODE39, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 155, 310, 116 },
- /* 16*/ { BARCODE_EANX, -1, "123456789012", "", 50, 1, 95, 226, 116 },
- /* 17*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012", "", 69, 1, 95, 226, 154 },
- /* 18*/ { BARCODE_EANX_CHK, -1, "1234567890128", "", 50, 1, 95, 226, 116 },
- /* 19*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128", "", 69, 1, 95, 226, 154 },
- /* 20*/ { BARCODE_EANX, -1, "123456789012+12", "", 50, 1, 122, 276, 116 },
- /* 21*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012+12", "", 69, 1, 122, 276, 154 },
- /* 22*/ { BARCODE_EANX_CHK, -1, "1234567890128+12", "", 50, 1, 122, 276, 116 },
- /* 23*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128+12", "", 69, 1, 122, 276, 154 },
- /* 24*/ { BARCODE_EANX, -1, "123456789012+12345", "", 50, 1, 149, 330, 116 },
- /* 25*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012+12345", "", 69, 1, 149, 330, 154 },
- /* 26*/ { BARCODE_EANX_CHK, -1, "1234567890128+12345", "", 50, 1, 149, 330, 116 },
- /* 27*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128+12345", "", 69, 1, 149, 330, 154 },
- /* 28*/ { BARCODE_EANX, -1, "1234567", "", 50, 1, 67, 162, 116 },
- /* 29*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567", "", 55, 1, 67, 162, 126 },
- /* 30*/ { BARCODE_EANX_CHK, -1, "12345670", "", 50, 1, 67, 162, 116 },
- /* 31*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670", "", 55, 1, 67, 162, 126 },
- /* 32*/ { BARCODE_EANX, -1, "1234567+12", "", 50, 1, 94, 212, 116 },
- /* 33*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567+12", "", 55, 1, 94, 212, 126 },
- /* 34*/ { BARCODE_EANX_CHK, -1, "12345670+12", "", 50, 1, 94, 212, 116 },
- /* 35*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670+12", "", 55, 1, 94, 212, 126 },
- /* 36*/ { BARCODE_EANX, -1, "1234567+12345", "", 50, 1, 121, 266, 116 },
- /* 37*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567+12345", "", 55, 1, 121, 266, 126 },
- /* 38*/ { BARCODE_EANX_CHK, -1, "12345670+12345", "", 50, 1, 121, 266, 116 },
- /* 39*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670+12345", "", 55, 1, 121, 266, 126 },
- /* 40*/ { BARCODE_EANX, -1, "1234", "", 50, 1, 47, 104, 116 },
- /* 41*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234", "", 66.5, 1, 47, 104, 149 },
- /* 42*/ { BARCODE_EANX_CHK, -1, "1234", "", 50, 1, 47, 104, 116 },
- /* 43*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234", "", 66.5, 1, 47, 104, 149 },
- /* 44*/ { BARCODE_EANX, -1, "12", "", 50, 1, 20, 50, 116 },
- /* 45*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "12", "", 66.5, 1, 20, 50, 149 },
- /* 46*/ { BARCODE_EANX_CHK, -1, "12", "", 50, 1, 20, 50, 116 },
- /* 47*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12", "", 66.5, 1, 20, 50, 149 },
- /* 48*/ { BARCODE_GS1_128, -1, "[01]12345678901231", "", 50, 1, 134, 268, 116 },
- /* 49*/ { BARCODE_GS1_128, COMPLIANT_HEIGHT, "[01]12345678901231", "", 64, 1, 134, 268, 144 },
- /* 50*/ { BARCODE_CODABAR, -1, "A00000000B", "", 50, 1, 102, 204, 116 },
- /* 51*/ { BARCODE_CODABAR, COMPLIANT_HEIGHT, "A00000000B", "", 50, 1, 102, 204, 116 },
- /* 52*/ { BARCODE_CODE128, -1, "1234567890", "", 50, 1, 90, 180, 116 },
- /* 53*/ { BARCODE_CODE128, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 90, 180, 116 },
- /* 54*/ { BARCODE_DPLEIT, -1, "1234567890123", "", 72, 1, 135, 270, 160 },
- /* 55*/ { BARCODE_DPLEIT, COMPLIANT_HEIGHT, "1234567890123", "", 72, 1, 135, 270, 160 },
- /* 56*/ { BARCODE_DPIDENT, -1, "12345678901", "", 72, 1, 117, 234, 160 },
- /* 57*/ { BARCODE_DPIDENT, COMPLIANT_HEIGHT, "12345678901", "", 72, 1, 117, 234, 160 },
- /* 58*/ { BARCODE_CODE16K, -1, "1234567890", "", 20, 2, 70, 162, 44 },
- /* 59*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, "1234567890", "", 21, 2, 70, 162, 46 },
- /* 60*/ { BARCODE_CODE49, -1, "1234567890", "", 20, 2, 70, 162, 44 },
- /* 61*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, "1234567890", "", 21, 2, 70, 162, 46 },
- /* 62*/ { BARCODE_CODE93, -1, "1234567890", "", 50, 1, 127, 254, 116 },
- /* 63*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, "1234567890", "", 40, 1, 127, 254, 96 },
- /* 64*/ { BARCODE_FLAT, -1, "1234567890", "", 50, 1, 90, 180, 100 },
- /* 65*/ { BARCODE_FLAT, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 90, 180, 100 },
- /* 66*/ { BARCODE_DBAR_OMN, -1, "1234567890123", "", 50, 1, 96, 192, 116 },
- /* 67*/ { BARCODE_DBAR_OMN, COMPLIANT_HEIGHT, "1234567890123", "", 33, 1, 96, 192, 82 },
- /* 68*/ { BARCODE_DBAR_LTD, -1, "1234567890123", "", 50, 1, 79, 158, 116 },
- /* 69*/ { BARCODE_DBAR_LTD, COMPLIANT_HEIGHT, "1234567890123", "", 10, 1, 79, 158, 36 },
- /* 70*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", "", 34, 1, 134, 268, 84 },
- /* 71*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, "[01]12345678901231", "", 34, 1, 134, 268, 84 },
- /* 72*/ { BARCODE_TELEPEN, -1, "1234567890", "", 50, 1, 208, 416, 116 },
- /* 73*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, "1234567890", "", 32, 1, 208, 416, 80 },
- /* 74*/ { BARCODE_UPCA, -1, "12345678901", "", 50, 1, 95, 226, 116 },
- /* 75*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901", "", 69, 1, 95, 226, 154 },
- /* 76*/ { BARCODE_UPCA_CHK, -1, "123456789012", "", 50, 1, 95, 226, 116 },
- /* 77*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012", "", 69, 1, 95, 226, 154 },
- /* 78*/ { BARCODE_UPCA, -1, "12345678901+12", "", 50, 1, 124, 276, 116 },
- /* 79*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901+12", "", 69, 1, 124, 276, 154 },
- /* 80*/ { BARCODE_UPCA_CHK, -1, "123456789012+12", "", 50, 1, 124, 276, 116 },
- /* 81*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012+12", "", 69, 1, 124, 276, 154 },
- /* 82*/ { BARCODE_UPCA, -1, "12345678901+12345", "", 50, 1, 151, 330, 116 },
- /* 83*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901+12345", "", 69, 1, 151, 330, 154 },
- /* 84*/ { BARCODE_UPCA_CHK, -1, "123456789012+12345", "", 50, 1, 151, 330, 116 },
- /* 85*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012+12345", "", 69, 1, 151, 330, 154 },
- /* 86*/ { BARCODE_UPCE, -1, "1234567", "", 50, 1, 51, 134, 116 },
- /* 87*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567", "", 69, 1, 51, 134, 154 },
- /* 88*/ { BARCODE_UPCE_CHK, -1, "12345670", "", 50, 1, 51, 134, 116 },
- /* 89*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670", "", 69, 1, 51, 134, 154 },
- /* 90*/ { BARCODE_UPCE, -1, "1234567+12", "", 50, 1, 78, 184, 116 },
- /* 91*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567+12", "", 69, 1, 78, 184, 154 },
- /* 92*/ { BARCODE_UPCE_CHK, -1, "12345670+12", "", 50, 1, 78, 184, 116 },
- /* 93*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670+12", "", 69, 1, 78, 184, 154 },
- /* 94*/ { BARCODE_UPCE, -1, "1234567+12345", "", 50, 1, 105, 238, 116 },
- /* 95*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567+12345", "", 69, 1, 105, 238, 154 },
- /* 96*/ { BARCODE_UPCE_CHK, -1, "12345670+12345", "", 50, 1, 105, 238, 116 },
- /* 97*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670+12345", "", 69, 1, 105, 238, 154 },
- /* 98*/ { BARCODE_POSTNET, -1, "12345678901", "", 12, 2, 123, 246, 24 },
- /* 99*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, "12345678901", "", 5, 2, 123, 246, 10 },
- /*100*/ { BARCODE_MSI_PLESSEY, -1, "1234567890", "", 50, 1, 127, 254, 116 },
- /*101*/ { BARCODE_MSI_PLESSEY, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 127, 254, 116 },
- /*102*/ { BARCODE_FIM, -1, "A", "", 50, 1, 17, 34, 100 },
- /*103*/ { BARCODE_FIM, COMPLIANT_HEIGHT, "A", "", 20, 1, 17, 34, 40 },
- /*104*/ { BARCODE_LOGMARS, -1, "1234567890", "", 50, 1, 191, 382, 116 },
- /*105*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, "1234567890", "", 45.5, 1, 191, 382, 107 },
- /*106*/ { BARCODE_PHARMA, -1, "123456", "", 50, 1, 58, 116, 100 },
- /*107*/ { BARCODE_PHARMA, COMPLIANT_HEIGHT, "123456", "", 16, 1, 58, 116, 32 },
- /*108*/ { BARCODE_PZN, -1, "123456", "", 50, 1, 142, 284, 116 },
- /*109*/ { BARCODE_PZN, COMPLIANT_HEIGHT, "123456", "", 40, 1, 142, 284, 96 },
- /*110*/ { BARCODE_PHARMA_TWO, -1, "12345678", "", 10, 2, 29, 58, 20 },
- /*111*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, "12345678", "", 8, 2, 29, 58, 16 },
- /*112*/ { BARCODE_CEPNET, -1, "12345678", "", 5, 2, 93, 186, 10 },
- /*113*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, "12345678", "", 5, 2, 93, 186, 10 },
- /*114*/ { BARCODE_PDF417, -1, "1234567890", "", 21, 7, 103, 206, 42 },
- /*115*/ { BARCODE_PDF417, COMPLIANT_HEIGHT, "1234567890", "", 21, 7, 103, 206, 42 },
- /*116*/ { BARCODE_PDF417COMP, -1, "1234567890", "", 21, 7, 69, 138, 42 },
- /*117*/ { BARCODE_PDF417COMP, COMPLIANT_HEIGHT, "1234567890", "", 21, 7, 69, 138, 42 },
- /*118*/ { BARCODE_MAXICODE, -1, "1234567890", "", 165, 33, 30, 299, 298 },
- /*119*/ { BARCODE_MAXICODE, COMPLIANT_HEIGHT, "1234567890", "", 165, 33, 30, 299, 298 },
- /*120*/ { BARCODE_QRCODE, -1, "1234567890AB", "", 21, 21, 21, 42, 42 },
- /*121*/ { BARCODE_QRCODE, COMPLIANT_HEIGHT, "1234567890AB", "", 21, 21, 21, 42, 42 },
- /*122*/ { BARCODE_CODE128AB, -1, "1234567890", "", 50, 1, 145, 290, 116 },
- /*123*/ { BARCODE_CODE128AB, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 145, 290, 116 },
- /*124*/ { BARCODE_AUSPOST, -1, "12345678901234567890123", "", 8, 3, 133, 266, 16 },
- /*125*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, "12345678901234567890123", "", 9.5, 3, 133, 266, 19 },
- /*126*/ { BARCODE_AUSREPLY, -1, "12345678", "", 8, 3, 73, 146, 16 },
- /*127*/ { BARCODE_AUSREPLY, COMPLIANT_HEIGHT, "12345678", "", 9.5, 3, 73, 146, 19 },
- /*128*/ { BARCODE_AUSROUTE, -1, "12345678", "", 8, 3, 73, 146, 16 },
- /*129*/ { BARCODE_AUSROUTE, COMPLIANT_HEIGHT, "12345678", "", 9.5, 3, 73, 146, 19 },
- /*130*/ { BARCODE_AUSREDIRECT, -1, "12345678", "", 8, 3, 73, 146, 16 },
- /*131*/ { BARCODE_AUSREDIRECT, COMPLIANT_HEIGHT, "12345678", "", 9.5, 3, 73, 146, 19 },
- /*132*/ { BARCODE_ISBNX, -1, "123456789", "", 50, 1, 95, 226, 116 },
- /*133*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789", "", 69, 1, 95, 226, 154 },
- /*134*/ { BARCODE_ISBNX, -1, "123456789+12", "", 50, 1, 122, 276, 116 },
- /*135*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789+12", "", 69, 1, 122, 276, 154 },
- /*136*/ { BARCODE_ISBNX, -1, "123456789+12345", "", 50, 1, 149, 330, 116 },
- /*137*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789+12345", "", 69, 1, 149, 330, 154 },
- /*138*/ { BARCODE_RM4SCC, -1, "1234567890", "", 8, 3, 91, 182, 16 },
- /*139*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, "1234567890", "", 8, 3, 91, 182, 16 },
- /*140*/ { BARCODE_DATAMATRIX, -1, "ABC", "", 10, 10, 10, 20, 20 },
- /*141*/ { BARCODE_DATAMATRIX, COMPLIANT_HEIGHT, "ABC", "", 10, 10, 10, 20, 20 },
- /*142*/ { BARCODE_EAN14, -1, "1234567890123", "", 50, 1, 134, 268, 116 },
- /*143*/ { BARCODE_EAN14, COMPLIANT_HEIGHT, "1234567890123", "", 64, 1, 134, 268, 144 },
- /*144*/ { BARCODE_VIN, -1, "12345678701234567", "", 50, 1, 246, 492, 116 },
- /*145*/ { BARCODE_VIN, COMPLIANT_HEIGHT, "12345678701234567", "", 50, 1, 246, 492, 116 },
- /*146*/ { BARCODE_CODABLOCKF, -1, "1234567890", "", 20, 2, 101, 242, 44 },
- /*147*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, "1234567890", "", 20, 2, 101, 242, 44 },
- /*148*/ { BARCODE_NVE18, -1, "12345678901234567", "", 50, 1, 156, 312, 116 },
- /*149*/ { BARCODE_NVE18, COMPLIANT_HEIGHT, "12345678901234567", "", 64, 1, 156, 312, 144 },
- /*150*/ { BARCODE_JAPANPOST, -1, "1234567890", "", 8, 3, 133, 266, 16 },
- /*151*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, "1234567890", "", 6, 3, 133, 266, 12 },
- /*152*/ { BARCODE_KOREAPOST, -1, "123456", "", 50, 1, 167, 334, 116 },
- /*153*/ { BARCODE_KOREAPOST, COMPLIANT_HEIGHT, "123456", "", 50, 1, 167, 334, 116 },
- /*154*/ { BARCODE_DBAR_STK, -1, "1234567890123", "", 13, 3, 50, 100, 26 },
- /*155*/ { BARCODE_DBAR_STK, COMPLIANT_HEIGHT, "1234567890123", "", 13, 3, 50, 100, 26 },
- /*156*/ { BARCODE_DBAR_OMNSTK, -1, "1234567890123", "", 69, 5, 50, 100, 138 },
- /*157*/ { BARCODE_DBAR_OMNSTK, COMPLIANT_HEIGHT, "1234567890123", "", 69, 5, 50, 100, 138 },
- /*158*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", "", 71, 5, 102, 204, 142 },
- /*159*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, "[01]12345678901231", "", 71, 5, 102, 204, 142 },
- /*160*/ { BARCODE_PLANET, -1, "12345678901", "", 12, 2, 123, 246, 24 },
- /*161*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, "12345678901", "", 5, 2, 123, 246, 10 },
- /*162*/ { BARCODE_MICROPDF417, -1, "1234567890", "", 12, 6, 82, 164, 24 },
- /*163*/ { BARCODE_MICROPDF417, COMPLIANT_HEIGHT, "1234567890", "", 12, 6, 82, 164, 24 },
- /*164*/ { BARCODE_USPS_IMAIL, -1, "12345678901234567890", "", 8, 3, 129, 258, 16 },
- /*165*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, "12345678901234567890", "", 6, 3, 129, 258, 12 },
- /*166*/ { BARCODE_PLESSEY, -1, "1234567890", "", 50, 1, 227, 454, 116 },
- /*167*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 227, 454, 116 },
- /*168*/ { BARCODE_TELEPEN_NUM, -1, "1234567890", "", 50, 1, 128, 256, 116 },
- /*169*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, "1234567890", "", 32, 1, 128, 256, 80 },
- /*170*/ { BARCODE_ITF14, -1, "1234567890", "", 50, 1, 135, 330, 136 },
- /*171*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, "1234567890", "", 64, 1, 135, 330, 164 },
- /*172*/ { BARCODE_KIX, -1, "123456ABCDE", "", 8, 3, 87, 174, 16 },
- /*173*/ { BARCODE_KIX, COMPLIANT_HEIGHT, "123456ABCDE", "", 8, 3, 87, 174, 16 },
- /*174*/ { BARCODE_AZTEC, -1, "1234567890AB", "", 15, 15, 15, 30, 30 },
- /*175*/ { BARCODE_AZTEC, COMPLIANT_HEIGHT, "1234567890AB", "", 15, 15, 15, 30, 30 },
- /*176*/ { BARCODE_DAFT, -1, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
- /*177*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
- /*178*/ { BARCODE_DPD, -1, "0123456789012345678901234567", "", 50, 1, 189, 378, 122 },
- /*179*/ { BARCODE_DPD, COMPLIANT_HEIGHT, "0123456789012345678901234567", "", 66.5, 1, 189, 378, 155 },
- /*180*/ { BARCODE_MICROQR, -1, "12345", "", 11, 11, 11, 22, 22 },
- /*181*/ { BARCODE_MICROQR, COMPLIANT_HEIGHT, "12345", "", 11, 11, 11, 22, 22 },
- /*182*/ { BARCODE_HIBC_128, -1, "1234567890", "", 50, 1, 123, 246, 116 },
- /*183*/ { BARCODE_HIBC_128, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 123, 246, 116 },
- /*184*/ { BARCODE_HIBC_39, -1, "1234567890", "", 50, 1, 223, 446, 116 },
- /*185*/ { BARCODE_HIBC_39, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 223, 446, 116 },
- /*186*/ { BARCODE_HIBC_DM, -1, "ABC", "", 12, 12, 12, 24, 24 },
- /*187*/ { BARCODE_HIBC_DM, COMPLIANT_HEIGHT, "ABC", "", 12, 12, 12, 24, 24 },
- /*188*/ { BARCODE_HIBC_QR, -1, "1234567890AB", "", 21, 21, 21, 42, 42 },
- /*189*/ { BARCODE_HIBC_QR, COMPLIANT_HEIGHT, "1234567890AB", "", 21, 21, 21, 42, 42 },
- /*190*/ { BARCODE_HIBC_PDF, -1, "1234567890", "", 24, 8, 103, 206, 48 },
- /*191*/ { BARCODE_HIBC_PDF, COMPLIANT_HEIGHT, "1234567890", "", 24, 8, 103, 206, 48 },
- /*192*/ { BARCODE_HIBC_MICPDF, -1, "1234567890", "", 28, 14, 38, 76, 56 },
- /*193*/ { BARCODE_HIBC_MICPDF, COMPLIANT_HEIGHT, "1234567890", "", 28, 14, 38, 76, 56 },
- /*194*/ { BARCODE_HIBC_BLOCKF, -1, "1234567890", "", 30, 3, 101, 242, 64 },
- /*195*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, "1234567890", "", 30, 3, 101, 242, 64 },
- /*196*/ { BARCODE_HIBC_AZTEC, -1, "1234567890AB", "", 19, 19, 19, 38, 38 },
- /*197*/ { BARCODE_HIBC_AZTEC, COMPLIANT_HEIGHT, "1234567890AB", "", 19, 19, 19, 38, 38 },
- /*198*/ { BARCODE_DOTCODE, -1, "ABC", "", 11, 11, 16, 33, 23 },
- /*199*/ { BARCODE_DOTCODE, COMPLIANT_HEIGHT, "ABC", "", 11, 11, 16, 33, 23 },
- /*200*/ { BARCODE_HANXIN, -1, "1234567890AB", "", 23, 23, 23, 46, 46 },
- /*201*/ { BARCODE_HANXIN, COMPLIANT_HEIGHT, "1234567890AB", "", 23, 23, 23, 46, 46 },
- /*202*/ { BARCODE_MAILMARK_2D, -1, "012100123412345678AB19XY1A 0", "", 24, 24, 24, 48, 48 },
- /*203*/ { BARCODE_MAILMARK_2D, COMPLIANT_HEIGHT, "012100123412345678AB19XY1A 0", "", 24, 24, 24, 48, 48 },
- /*204*/ { BARCODE_UPU_S10, -1, "EE876543216CA", "", 50, 1, 156, 312, 116 },
- /*205*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, "EE876543216CA", "", 50, 1, 156, 312, 116 },
- /*206*/ { BARCODE_MAILMARK_4S, -1, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 },
- /*207*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, "01000000000000000AA00AA0A", "", 8, 3, 155, 310, 16 },
- /*208*/ { BARCODE_AZRUNE, -1, "255", "", 11, 11, 11, 22, 22 },
- /*209*/ { BARCODE_AZRUNE, COMPLIANT_HEIGHT, "255", "", 11, 11, 11, 22, 22 },
- /*210*/ { BARCODE_CODE32, -1, "12345678", "", 50, 1, 103, 206, 116 },
- /*211*/ { BARCODE_CODE32, COMPLIANT_HEIGHT, "12345678", "", 20, 1, 103, 206, 56 },
- /*212*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01", 50, 7, 99, 226, 116 },
- /*213*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "123456789012", "[20]01", 81, 7, 99, 226, 178 },
- /*214*/ { BARCODE_EANX_CC, -1, "123456789012+12", "[20]01", 50, 7, 125, 276, 116 },
- /*215*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "123456789012+12", "[20]01", 81, 7, 125, 276, 178 },
- /*216*/ { BARCODE_EANX_CC, -1, "123456789012+12345", "[20]01", 50, 7, 152, 330, 116 },
- /*217*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "123456789012+12345", "[20]01", 81, 7, 152, 330, 178 },
- /*218*/ { BARCODE_EANX_CC, -1, "1234567", "[20]01", 50, 8, 72, 162, 116 },
- /*219*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "1234567", "[20]01", 69, 8, 72, 162, 154 },
- /*220*/ { BARCODE_EANX_CC, -1, "1234567+12", "[20]01", 50, 8, 98, 212, 116 },
- /*221*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "1234567+12", "[20]01", 69, 8, 98, 212, 154 },
- /*222*/ { BARCODE_EANX_CC, -1, "1234567+12345", "[20]01", 50, 8, 125, 266, 116 },
- /*223*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "1234567+12345", "[20]01", 69, 8, 125, 266, 154 },
- /*224*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01", 50, 5, 145, 290, 116 },
- /*225*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, "[01]12345678901231", "[20]01", 71, 5, 145, 290, 158 },
- /*226*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "[20]01", 21, 5, 100, 200, 58 },
- /*227*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 40, 5, 100, 200, 96 },
- /*228*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "[20]01", 19, 6, 79, 158, 54 },
- /*229*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 19, 6, 79, 158, 54 },
- /*230*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "[20]01", 41, 5, 134, 268, 98 },
- /*231*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, "[01]12345678901231", "[20]01", 41, 5, 134, 268, 98 },
- /*232*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01", 50, 7, 99, 226, 116 },
- /*233*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, "12345678901", "[20]01", 81, 7, 99, 226, 178 },
- /*234*/ { BARCODE_UPCA_CC, -1, "12345678901+12", "[20]01", 50, 7, 127, 276, 116 },
- /*235*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, "12345678901+12", "[20]01", 81, 7, 127, 276, 178 },
- /*236*/ { BARCODE_UPCA_CC, -1, "12345678901+12345", "[20]01", 50, 7, 154, 330, 116 },
- /*237*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, "12345678901+12345", "[20]01", 81, 7, 154, 330, 178 },
- /*238*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01", 50, 9, 55, 134, 116 },
- /*239*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, "1234567", "[20]01", 85, 9, 55, 134, 186 },
- /*240*/ { BARCODE_UPCE_CC, -1, "1234567+12", "[20]01", 50, 9, 81, 184, 116 },
- /*241*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, "1234567+12", "[20]01", 85, 9, 81, 184, 186 },
- /*242*/ { BARCODE_UPCE_CC, -1, "1234567+12345", "[20]01", 50, 9, 108, 238, 116 },
- /*243*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, "1234567+12345", "[20]01", 85, 9, 108, 238, 186 },
- /*244*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "[20]01", 24, 9, 56, 112, 48 },
- /*245*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 24, 9, 56, 112, 48 },
- /*246*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "[20]01", 80, 11, 56, 112, 160 },
- /*247*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, "1234567890123", "[20]01", 80, 11, 56, 112, 160 },
- /*248*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 },
- /*249*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 },
- /*250*/ { BARCODE_CHANNEL, -1, "01", "", 50, 1, 19, 38, 116 },
- /*251*/ { BARCODE_CHANNEL, COMPLIANT_HEIGHT, "01", "", 20, 1, 19, 38, 56 },
- /*252*/ { BARCODE_CODEONE, -1, "12345678901234567890", "", 16, 16, 18, 36, 32 },
- /*253*/ { BARCODE_CODEONE, COMPLIANT_HEIGHT, "12345678901234567890", "", 16, 16, 18, 36, 32 },
- /*254*/ { BARCODE_GRIDMATRIX, -1, "ABC", "", 18, 18, 18, 36, 36 },
- /*255*/ { BARCODE_GRIDMATRIX, COMPLIANT_HEIGHT, "ABC", "", 18, 18, 18, 36, 36 },
- /*256*/ { BARCODE_UPNQR, -1, "1234567890AB", "", 77, 77, 77, 154, 154 },
- /*257*/ { BARCODE_UPNQR, COMPLIANT_HEIGHT, "1234567890AB", "", 77, 77, 77, 154, 154 },
- /*258*/ { BARCODE_ULTRA, -1, "1234567890", "", 13, 13, 18, 36, 26 },
- /*259*/ { BARCODE_ULTRA, COMPLIANT_HEIGHT, "1234567890", "", 13, 13, 18, 36, 26 },
- /*260*/ { BARCODE_RMQR, -1, "12345", "", 11, 11, 27, 54, 22 },
- /*261*/ { BARCODE_RMQR, COMPLIANT_HEIGHT, "12345", "", 11, 11, 27, 54, 22 },
- /*262*/ { BARCODE_BC412, -1, "1234567", "", 16.5, 1, 102, 204, 49 },
- /*263*/ { BARCODE_BC412, COMPLIANT_HEIGHT, "1234567", "", 16.5, 1, 102, 204, 49 },
+ /* 0*/ { BARCODE_CODE11, -1, "1234567890", "", 0, 50, 1, 108, 216, 116 },
+ /* 1*/ { BARCODE_CODE11, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 108, 216, 116 },
+ /* 2*/ { BARCODE_C25STANDARD, -1, "1234567890", "", 0, 50, 1, 117, 234, 116 },
+ /* 3*/ { BARCODE_C25STANDARD, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 117, 234, 116 },
+ /* 4*/ { BARCODE_C25INTER, -1, "1234567890", "", 0, 50, 1, 99, 198, 116 },
+ /* 5*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 99, 198, 116 },
+ /* 6*/ { BARCODE_C25IATA, -1, "1234567890", "", 0, 50, 1, 149, 298, 116 },
+ /* 7*/ { BARCODE_C25IATA, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 149, 298, 116 },
+ /* 8*/ { BARCODE_C25LOGIC, -1, "1234567890", "", 0, 50, 1, 109, 218, 116 },
+ /* 9*/ { BARCODE_C25LOGIC, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 109, 218, 116 },
+ /* 10*/ { BARCODE_C25IND, -1, "1234567890", "", 0, 50, 1, 159, 318, 116 },
+ /* 11*/ { BARCODE_C25IND, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 159, 318, 116 },
+ /* 12*/ { BARCODE_CODE39, -1, "1234567890", "", 0, 50, 1, 155, 310, 116 },
+ /* 13*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 155, 310, 116 },
+ /* 14*/ { BARCODE_EXCODE39, -1, "1234567890", "", 0, 50, 1, 155, 310, 116 },
+ /* 15*/ { BARCODE_EXCODE39, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 155, 310, 116 },
+ /* 16*/ { BARCODE_EANX, -1, "123456789012", "", 0, 50, 1, 95, 226, 116 },
+ /* 17*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012", "", 0, 69, 1, 95, 226, 154 },
+ /* 18*/ { BARCODE_EANX_CHK, -1, "1234567890128", "", 0, 50, 1, 95, 226, 116 },
+ /* 19*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128", "", 0, 69, 1, 95, 226, 154 },
+ /* 20*/ { BARCODE_EANX, -1, "123456789012+12", "", 0, 50, 1, 122, 276, 116 },
+ /* 21*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012+12", "", 0, 69, 1, 122, 276, 154 },
+ /* 22*/ { BARCODE_EANX_CHK, -1, "1234567890128+12", "", 0, 50, 1, 122, 276, 116 },
+ /* 23*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128+12", "", 0, 69, 1, 122, 276, 154 },
+ /* 24*/ { BARCODE_EANX, -1, "123456789012+12345", "", 0, 50, 1, 149, 330, 116 },
+ /* 25*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "123456789012+12345", "", 0, 69, 1, 149, 330, 154 },
+ /* 26*/ { BARCODE_EANX_CHK, -1, "1234567890128+12345", "", 0, 50, 1, 149, 330, 116 },
+ /* 27*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234567890128+12345", "", 0, 69, 1, 149, 330, 154 },
+ /* 28*/ { BARCODE_EANX, -1, "1234567", "", 0, 50, 1, 67, 162, 116 },
+ /* 29*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567", "", 0, 55, 1, 67, 162, 126 },
+ /* 30*/ { BARCODE_EANX_CHK, -1, "12345670", "", 0, 50, 1, 67, 162, 116 },
+ /* 31*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670", "", 0, 55, 1, 67, 162, 126 },
+ /* 32*/ { BARCODE_EANX, -1, "1234567+12", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 94, 212, 116 },
+ /* 33*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567+12", "", ZINT_WARN_NONCOMPLIANT, 55, 1, 94, 212, 126 },
+ /* 34*/ { BARCODE_EANX_CHK, -1, "12345670+12", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 94, 212, 116 },
+ /* 35*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670+12", "", ZINT_WARN_NONCOMPLIANT, 55, 1, 94, 212, 126 },
+ /* 36*/ { BARCODE_EANX, -1, "1234567+12345", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 121, 266, 116 },
+ /* 37*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234567+12345", "", ZINT_WARN_NONCOMPLIANT, 55, 1, 121, 266, 126 },
+ /* 38*/ { BARCODE_EANX_CHK, -1, "12345670+12345", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 121, 266, 116 },
+ /* 39*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12345670+12345", "", ZINT_WARN_NONCOMPLIANT, 55, 1, 121, 266, 126 },
+ /* 40*/ { BARCODE_EANX, -1, "1234", "", 0, 50, 1, 47, 104, 116 },
+ /* 41*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "1234", "", 0, 66.5, 1, 47, 104, 149 },
+ /* 42*/ { BARCODE_EANX_CHK, -1, "1234", "", 0, 50, 1, 47, 104, 116 },
+ /* 43*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "1234", "", 0, 66.5, 1, 47, 104, 149 },
+ /* 44*/ { BARCODE_EANX, -1, "12", "", 0, 50, 1, 20, 50, 116 },
+ /* 45*/ { BARCODE_EANX, COMPLIANT_HEIGHT, "12", "", 0, 66.5, 1, 20, 50, 149 },
+ /* 46*/ { BARCODE_EANX_CHK, -1, "12", "", 0, 50, 1, 20, 50, 116 },
+ /* 47*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, "12", "", 0, 66.5, 1, 20, 50, 149 },
+ /* 48*/ { BARCODE_GS1_128, -1, "[01]12345678901231", "", 0, 50, 1, 134, 268, 116 },
+ /* 49*/ { BARCODE_GS1_128, COMPLIANT_HEIGHT, "[01]12345678901231", "", 0, 64, 1, 134, 268, 144 },
+ /* 50*/ { BARCODE_CODABAR, -1, "A00000000B", "", 0, 50, 1, 102, 204, 116 },
+ /* 51*/ { BARCODE_CODABAR, COMPLIANT_HEIGHT, "A00000000B", "", 0, 50, 1, 102, 204, 116 },
+ /* 52*/ { BARCODE_CODE128, -1, "1234567890", "", 0, 50, 1, 90, 180, 116 },
+ /* 53*/ { BARCODE_CODE128, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 90, 180, 116 },
+ /* 54*/ { BARCODE_DPLEIT, -1, "1234567890123", "", 0, 72, 1, 135, 270, 160 },
+ /* 55*/ { BARCODE_DPLEIT, COMPLIANT_HEIGHT, "1234567890123", "", 0, 72, 1, 135, 270, 160 },
+ /* 56*/ { BARCODE_DPIDENT, -1, "12345678901", "", 0, 72, 1, 117, 234, 160 },
+ /* 57*/ { BARCODE_DPIDENT, COMPLIANT_HEIGHT, "12345678901", "", 0, 72, 1, 117, 234, 160 },
+ /* 58*/ { BARCODE_CODE16K, -1, "1234567890", "", 0, 20, 2, 70, 162, 44 },
+ /* 59*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, "1234567890", "", 0, 21, 2, 70, 162, 46 },
+ /* 60*/ { BARCODE_CODE49, -1, "1234567890", "", 0, 20, 2, 70, 162, 44 },
+ /* 61*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, "1234567890", "", 0, 21, 2, 70, 162, 46 },
+ /* 62*/ { BARCODE_CODE93, -1, "1234567890", "", 0, 50, 1, 127, 254, 116 },
+ /* 63*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, "1234567890", "", 0, 40, 1, 127, 254, 96 },
+ /* 64*/ { BARCODE_FLAT, -1, "1234567890", "", 0, 50, 1, 90, 180, 100 },
+ /* 65*/ { BARCODE_FLAT, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 90, 180, 100 },
+ /* 66*/ { BARCODE_DBAR_OMN, -1, "1234567890123", "", 0, 50, 1, 96, 192, 116 },
+ /* 67*/ { BARCODE_DBAR_OMN, COMPLIANT_HEIGHT, "1234567890123", "", 0, 33, 1, 96, 192, 82 },
+ /* 68*/ { BARCODE_DBAR_LTD, -1, "1234567890123", "", 0, 50, 1, 79, 158, 116 },
+ /* 69*/ { BARCODE_DBAR_LTD, COMPLIANT_HEIGHT, "1234567890123", "", 0, 10, 1, 79, 158, 36 },
+ /* 70*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", "", 0, 34, 1, 134, 268, 84 },
+ /* 71*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, "[01]12345678901231", "", 0, 34, 1, 134, 268, 84 },
+ /* 72*/ { BARCODE_TELEPEN, -1, "1234567890", "", 0, 50, 1, 208, 416, 116 },
+ /* 73*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, "1234567890", "", 0, 32, 1, 208, 416, 80 },
+ /* 74*/ { BARCODE_UPCA, -1, "12345678901", "", 0, 50, 1, 95, 226, 116 },
+ /* 75*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901", "", 0, 69, 1, 95, 226, 154 },
+ /* 76*/ { BARCODE_UPCA_CHK, -1, "123456789012", "", 0, 50, 1, 95, 226, 116 },
+ /* 77*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012", "", 0, 69, 1, 95, 226, 154 },
+ /* 78*/ { BARCODE_UPCA, -1, "12345678901+12", "", 0, 50, 1, 124, 276, 116 },
+ /* 79*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901+12", "", 0, 69, 1, 124, 276, 154 },
+ /* 80*/ { BARCODE_UPCA_CHK, -1, "123456789012+12", "", 0, 50, 1, 124, 276, 116 },
+ /* 81*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012+12", "", 0, 69, 1, 124, 276, 154 },
+ /* 82*/ { BARCODE_UPCA, -1, "12345678901+12345", "", 0, 50, 1, 151, 330, 116 },
+ /* 83*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, "12345678901+12345", "", 0, 69, 1, 151, 330, 154 },
+ /* 84*/ { BARCODE_UPCA_CHK, -1, "123456789012+12345", "", 0, 50, 1, 151, 330, 116 },
+ /* 85*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, "123456789012+12345", "", 0, 69, 1, 151, 330, 154 },
+ /* 86*/ { BARCODE_UPCE, -1, "1234567", "", 0, 50, 1, 51, 134, 116 },
+ /* 87*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567", "", 0, 69, 1, 51, 134, 154 },
+ /* 88*/ { BARCODE_UPCE_CHK, -1, "12345670", "", 0, 50, 1, 51, 134, 116 },
+ /* 89*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670", "", 0, 69, 1, 51, 134, 154 },
+ /* 90*/ { BARCODE_UPCE, -1, "1234567+12", "", 0, 50, 1, 78, 184, 116 },
+ /* 91*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567+12", "", 0, 69, 1, 78, 184, 154 },
+ /* 92*/ { BARCODE_UPCE_CHK, -1, "12345670+12", "", 0, 50, 1, 78, 184, 116 },
+ /* 93*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670+12", "", 0, 69, 1, 78, 184, 154 },
+ /* 94*/ { BARCODE_UPCE, -1, "1234567+12345", "", 0, 50, 1, 105, 238, 116 },
+ /* 95*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, "1234567+12345", "", 0, 69, 1, 105, 238, 154 },
+ /* 96*/ { BARCODE_UPCE_CHK, -1, "12345670+12345", "", 0, 50, 1, 105, 238, 116 },
+ /* 97*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, "12345670+12345", "", 0, 69, 1, 105, 238, 154 },
+ /* 98*/ { BARCODE_POSTNET, -1, "12345678901", "", 0, 12, 2, 123, 246, 24 },
+ /* 99*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, "12345678901", "", 0, 5, 2, 123, 246, 10 },
+ /*100*/ { BARCODE_MSI_PLESSEY, -1, "1234567890", "", 0, 50, 1, 127, 254, 116 },
+ /*101*/ { BARCODE_MSI_PLESSEY, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 127, 254, 116 },
+ /*102*/ { BARCODE_FIM, -1, "A", "", 0, 50, 1, 17, 34, 100 },
+ /*103*/ { BARCODE_FIM, COMPLIANT_HEIGHT, "A", "", 0, 20, 1, 17, 34, 40 },
+ /*104*/ { BARCODE_LOGMARS, -1, "1234567890", "", 0, 50, 1, 191, 382, 116 },
+ /*105*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, "1234567890", "", 0, 45.5, 1, 191, 382, 107 },
+ /*106*/ { BARCODE_PHARMA, -1, "123456", "", 0, 50, 1, 58, 116, 100 },
+ /*107*/ { BARCODE_PHARMA, COMPLIANT_HEIGHT, "123456", "", 0, 16, 1, 58, 116, 32 },
+ /*108*/ { BARCODE_PZN, -1, "123456", "", 0, 50, 1, 142, 284, 116 },
+ /*109*/ { BARCODE_PZN, COMPLIANT_HEIGHT, "123456", "", 0, 40, 1, 142, 284, 96 },
+ /*110*/ { BARCODE_PHARMA_TWO, -1, "12345678", "", 0, 10, 2, 29, 58, 20 },
+ /*111*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, "12345678", "", 0, 8, 2, 29, 58, 16 },
+ /*112*/ { BARCODE_CEPNET, -1, "12345678", "", 0, 5, 2, 93, 186, 10 },
+ /*113*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, "12345678", "", 0, 5, 2, 93, 186, 10 },
+ /*114*/ { BARCODE_PDF417, -1, "1234567890", "", 0, 21, 7, 103, 206, 42 },
+ /*115*/ { BARCODE_PDF417, COMPLIANT_HEIGHT, "1234567890", "", 0, 21, 7, 103, 206, 42 },
+ /*116*/ { BARCODE_PDF417COMP, -1, "1234567890", "", 0, 21, 7, 69, 138, 42 },
+ /*117*/ { BARCODE_PDF417COMP, COMPLIANT_HEIGHT, "1234567890", "", 0, 21, 7, 69, 138, 42 },
+ /*118*/ { BARCODE_MAXICODE, -1, "1234567890", "", 0, 165, 33, 30, 299, 298 },
+ /*119*/ { BARCODE_MAXICODE, COMPLIANT_HEIGHT, "1234567890", "", 0, 165, 33, 30, 299, 298 },
+ /*120*/ { BARCODE_QRCODE, -1, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
+ /*121*/ { BARCODE_QRCODE, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
+ /*122*/ { BARCODE_CODE128AB, -1, "1234567890", "", 0, 50, 1, 145, 290, 116 },
+ /*123*/ { BARCODE_CODE128AB, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 145, 290, 116 },
+ /*124*/ { BARCODE_AUSPOST, -1, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16 },
+ /*125*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, "12345678901234567890123", "", 0, 9.5, 3, 133, 266, 19 },
+ /*126*/ { BARCODE_AUSREPLY, -1, "12345678", "", 0, 8, 3, 73, 146, 16 },
+ /*127*/ { BARCODE_AUSREPLY, COMPLIANT_HEIGHT, "12345678", "", 0, 9.5, 3, 73, 146, 19 },
+ /*128*/ { BARCODE_AUSROUTE, -1, "12345678", "", 0, 8, 3, 73, 146, 16 },
+ /*129*/ { BARCODE_AUSROUTE, COMPLIANT_HEIGHT, "12345678", "", 0, 9.5, 3, 73, 146, 19 },
+ /*130*/ { BARCODE_AUSREDIRECT, -1, "12345678", "", 0, 8, 3, 73, 146, 16 },
+ /*131*/ { BARCODE_AUSREDIRECT, COMPLIANT_HEIGHT, "12345678", "", 0, 9.5, 3, 73, 146, 19 },
+ /*132*/ { BARCODE_ISBNX, -1, "123456789", "", 0, 50, 1, 95, 226, 116 },
+ /*133*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789", "", 0, 69, 1, 95, 226, 154 },
+ /*134*/ { BARCODE_ISBNX, -1, "123456789+12", "", 0, 50, 1, 122, 276, 116 },
+ /*135*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789+12", "", 0, 69, 1, 122, 276, 154 },
+ /*136*/ { BARCODE_ISBNX, -1, "123456789+12345", "", 0, 50, 1, 149, 330, 116 },
+ /*137*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, "123456789+12345", "", 0, 69, 1, 149, 330, 154 },
+ /*138*/ { BARCODE_RM4SCC, -1, "1234567890", "", 0, 8, 3, 91, 182, 16 },
+ /*139*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, "1234567890", "", 0, 8, 3, 91, 182, 16 },
+ /*140*/ { BARCODE_DATAMATRIX, -1, "ABC", "", 0, 10, 10, 10, 20, 20 },
+ /*141*/ { BARCODE_DATAMATRIX, COMPLIANT_HEIGHT, "ABC", "", 0, 10, 10, 10, 20, 20 },
+ /*142*/ { BARCODE_EAN14, -1, "1234567890123", "", 0, 50, 1, 134, 268, 116 },
+ /*143*/ { BARCODE_EAN14, COMPLIANT_HEIGHT, "1234567890123", "", 0, 64, 1, 134, 268, 144 },
+ /*144*/ { BARCODE_VIN, -1, "12345678701234567", "", 0, 50, 1, 246, 492, 116 },
+ /*145*/ { BARCODE_VIN, COMPLIANT_HEIGHT, "12345678701234567", "", 0, 50, 1, 246, 492, 116 },
+ /*146*/ { BARCODE_CODABLOCKF, -1, "1234567890", "", 0, 20, 2, 101, 242, 44 },
+ /*147*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, "1234567890", "", 0, 20, 2, 101, 242, 44 },
+ /*148*/ { BARCODE_NVE18, -1, "12345678901234567", "", 0, 50, 1, 156, 312, 116 },
+ /*149*/ { BARCODE_NVE18, COMPLIANT_HEIGHT, "12345678901234567", "", 0, 64, 1, 156, 312, 144 },
+ /*150*/ { BARCODE_JAPANPOST, -1, "1234567890", "", 0, 8, 3, 133, 266, 16 },
+ /*151*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, "1234567890", "", 0, 6, 3, 133, 266, 12 },
+ /*152*/ { BARCODE_KOREAPOST, -1, "123456", "", 0, 50, 1, 167, 334, 116 },
+ /*153*/ { BARCODE_KOREAPOST, COMPLIANT_HEIGHT, "123456", "", 0, 50, 1, 167, 334, 116 },
+ /*154*/ { BARCODE_DBAR_STK, -1, "1234567890123", "", 0, 13, 3, 50, 100, 26 },
+ /*155*/ { BARCODE_DBAR_STK, COMPLIANT_HEIGHT, "1234567890123", "", 0, 13, 3, 50, 100, 26 },
+ /*156*/ { BARCODE_DBAR_OMNSTK, -1, "1234567890123", "", 0, 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", "", 0, 71, 5, 102, 204, 142 },
+ /*159*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142 },
+ /*160*/ { BARCODE_PLANET, -1, "12345678901", "", 0, 12, 2, 123, 246, 24 },
+ /*161*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, "12345678901", "", 0, 5, 2, 123, 246, 10 },
+ /*162*/ { BARCODE_MICROPDF417, -1, "1234567890", "", 0, 12, 6, 82, 164, 24 },
+ /*163*/ { BARCODE_MICROPDF417, COMPLIANT_HEIGHT, "1234567890", "", 0, 12, 6, 82, 164, 24 },
+ /*164*/ { BARCODE_USPS_IMAIL, -1, "12345678901234567890", "", 0, 8, 3, 129, 258, 16 },
+ /*165*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, "12345678901234567890", "", 0, 6, 3, 129, 258, 12 },
+ /*166*/ { BARCODE_PLESSEY, -1, "1234567890", "", 0, 50, 1, 227, 454, 116 },
+ /*167*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 227, 454, 116 },
+ /*168*/ { BARCODE_TELEPEN_NUM, -1, "1234567890", "", 0, 50, 1, 128, 256, 116 },
+ /*169*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, "1234567890", "", 0, 32, 1, 128, 256, 80 },
+ /*170*/ { BARCODE_ITF14, -1, "1234567890", "", 0, 50, 1, 135, 330, 136 },
+ /*171*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, "1234567890", "", 0, 64, 1, 135, 330, 164 },
+ /*172*/ { BARCODE_KIX, -1, "123456ABCDE", "", 0, 8, 3, 87, 174, 16 },
+ /*173*/ { BARCODE_KIX, COMPLIANT_HEIGHT, "123456ABCDE", "", 0, 8, 3, 87, 174, 16 },
+ /*174*/ { BARCODE_AZTEC, -1, "1234567890AB", "", 0, 15, 15, 15, 30, 30 },
+ /*175*/ { BARCODE_AZTEC, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 15, 15, 15, 30, 30 },
+ /*176*/ { BARCODE_DAFT, -1, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16 },
+ /*177*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16 },
+ /*178*/ { BARCODE_DPD, -1, "0123456789012345678901234567", "", 0, 50, 1, 189, 378, 122 },
+ /*179*/ { BARCODE_DPD, COMPLIANT_HEIGHT, "0123456789012345678901234567", "", 0, 66.5, 1, 189, 378, 155 },
+ /*180*/ { BARCODE_MICROQR, -1, "12345", "", 0, 11, 11, 11, 22, 22 },
+ /*181*/ { BARCODE_MICROQR, COMPLIANT_HEIGHT, "12345", "", 0, 11, 11, 11, 22, 22 },
+ /*182*/ { BARCODE_HIBC_128, -1, "1234567890", "", 0, 50, 1, 123, 246, 116 },
+ /*183*/ { BARCODE_HIBC_128, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 123, 246, 116 },
+ /*184*/ { BARCODE_HIBC_39, -1, "1234567890", "", 0, 50, 1, 223, 446, 116 },
+ /*185*/ { BARCODE_HIBC_39, COMPLIANT_HEIGHT, "1234567890", "", 0, 50, 1, 223, 446, 116 },
+ /*186*/ { BARCODE_HIBC_DM, -1, "ABC", "", 0, 12, 12, 12, 24, 24 },
+ /*187*/ { BARCODE_HIBC_DM, COMPLIANT_HEIGHT, "ABC", "", 0, 12, 12, 12, 24, 24 },
+ /*188*/ { BARCODE_HIBC_QR, -1, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
+ /*189*/ { BARCODE_HIBC_QR, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
+ /*190*/ { BARCODE_HIBC_PDF, -1, "1234567890", "", 0, 24, 8, 103, 206, 48 },
+ /*191*/ { BARCODE_HIBC_PDF, COMPLIANT_HEIGHT, "1234567890", "", 0, 24, 8, 103, 206, 48 },
+ /*192*/ { BARCODE_HIBC_MICPDF, -1, "1234567890", "", 0, 28, 14, 38, 76, 56 },
+ /*193*/ { BARCODE_HIBC_MICPDF, COMPLIANT_HEIGHT, "1234567890", "", 0, 28, 14, 38, 76, 56 },
+ /*194*/ { BARCODE_HIBC_BLOCKF, -1, "1234567890", "", 0, 30, 3, 101, 242, 64 },
+ /*195*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, "1234567890", "", 0, 30, 3, 101, 242, 64 },
+ /*196*/ { BARCODE_HIBC_AZTEC, -1, "1234567890AB", "", 0, 19, 19, 19, 38, 38 },
+ /*197*/ { BARCODE_HIBC_AZTEC, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 19, 19, 19, 38, 38 },
+ /*198*/ { BARCODE_DOTCODE, -1, "ABC", "", 0, 11, 11, 16, 33, 23 },
+ /*199*/ { BARCODE_DOTCODE, COMPLIANT_HEIGHT, "ABC", "", 0, 11, 11, 16, 33, 23 },
+ /*200*/ { BARCODE_HANXIN, -1, "1234567890AB", "", 0, 23, 23, 23, 46, 46 },
+ /*201*/ { BARCODE_HANXIN, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 23, 23, 23, 46, 46 },
+ /*202*/ { BARCODE_MAILMARK_2D, -1, "012100123412345678AB19XY1A 0", "", 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", "", 0, 50, 1, 156, 312, 116 },
+ /*205*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, "EE876543216CA", "", 0, 50, 1, 156, 312, 116 },
+ /*206*/ { BARCODE_MAILMARK_4S, -1, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20 },
+ /*207*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, "01000000000000000AA00AA0A", "", 0, 8, 3, 155, 310, 16 },
+ /*208*/ { BARCODE_AZRUNE, -1, "255", "", 0, 11, 11, 11, 22, 22 },
+ /*209*/ { BARCODE_AZRUNE, COMPLIANT_HEIGHT, "255", "", 0, 11, 11, 11, 22, 22 },
+ /*210*/ { BARCODE_CODE32, -1, "12345678", "", 0, 50, 1, 103, 206, 116 },
+ /*211*/ { BARCODE_CODE32, COMPLIANT_HEIGHT, "12345678", "", 0, 20, 1, 103, 206, 56 },
+ /*212*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01", 0, 50, 7, 99, 226, 116 },
+ /*213*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "123456789012", "[20]01", 0, 81, 7, 99, 226, 178 },
+ /*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", 0, 81, 7, 125, 276, 178 },
+ /*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", 0, 81, 7, 152, 330, 178 },
+ /*218*/ { BARCODE_EANX_CC, -1, "1234567", "[20]01", 0, 50, 8, 72, 162, 116 },
+ /*219*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, "1234567", "[20]01", 0, 69, 8, 72, 162, 154 },
+ /*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", ZINT_WARN_NONCOMPLIANT, 69, 8, 98, 212, 154 },
+ /*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", ZINT_WARN_NONCOMPLIANT, 69, 8, 125, 266, 154 },
+ /*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", 0, 71, 5, 145, 290, 158 },
+ /*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", 0, 40, 5, 100, 200, 96 },
+ /*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", 0, 19, 6, 79, 158, 54 },
+ /*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", 0, 41, 5, 134, 268, 98 },
+ /*232*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01", 0, 50, 7, 99, 226, 116 },
+ /*233*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, "12345678901", "[20]01", 0, 81, 7, 99, 226, 178 },
+ /*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", 0, 81, 7, 127, 276, 178 },
+ /*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", 0, 81, 7, 154, 330, 178 },
+ /*238*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01", 0, 50, 9, 55, 134, 116 },
+ /*239*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, "1234567", "[20]01", 0, 85, 9, 55, 134, 186 },
+ /*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", 0, 85, 9, 81, 184, 186 },
+ /*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", 0, 85, 9, 108, 238, 186 },
+ /*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", 0, 24, 9, 56, 112, 48 },
+ /*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", 0, 80, 11, 56, 112, 160 },
+ /*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", 0, 78, 9, 102, 204, 156 },
+ /*250*/ { BARCODE_CHANNEL, -1, "01", "", 0, 50, 1, 19, 38, 116 },
+ /*251*/ { BARCODE_CHANNEL, COMPLIANT_HEIGHT, "01", "", 0, 20, 1, 19, 38, 56 },
+ /*252*/ { BARCODE_CODEONE, -1, "12345678901234567890", "", 0, 16, 16, 18, 36, 32 },
+ /*253*/ { BARCODE_CODEONE, COMPLIANT_HEIGHT, "12345678901234567890", "", 0, 16, 16, 18, 36, 32 },
+ /*254*/ { BARCODE_GRIDMATRIX, -1, "ABC", "", 0, 18, 18, 18, 36, 36 },
+ /*255*/ { BARCODE_GRIDMATRIX, COMPLIANT_HEIGHT, "ABC", "", 0, 18, 18, 18, 36, 36 },
+ /*256*/ { BARCODE_UPNQR, -1, "1234567890AB", "", 0, 77, 77, 77, 154, 154 },
+ /*257*/ { BARCODE_UPNQR, COMPLIANT_HEIGHT, "1234567890AB", "", 0, 77, 77, 77, 154, 154 },
+ /*258*/ { BARCODE_ULTRA, -1, "1234567890", "", 0, 13, 13, 18, 36, 26 },
+ /*259*/ { BARCODE_ULTRA, COMPLIANT_HEIGHT, "1234567890", "", 0, 13, 13, 18, 36, 26 },
+ /*260*/ { BARCODE_RMQR, -1, "12345", "", 0, 11, 11, 27, 54, 22 },
+ /*261*/ { BARCODE_RMQR, COMPLIANT_HEIGHT, "12345", "", 0, 11, 11, 27, 54, 22 },
+ /*262*/ { BARCODE_BC412, -1, "1234567", "", 0, 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 i, length, ret;
struct zint_symbol *symbol = NULL;
const char *text;
+ int ret_buf;
testStartSymbol(p_ctx->func_name, &symbol);
@@ -408,30 +409,44 @@ static void test_buffer(const testCtx *const p_ctx) {
} else {
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);
- 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);
- assert_zero(ret, "i:%d ZBarcode_Buffer(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
- assert_nonnull(symbol->bitmap, "i:%d ZBarcode_Buffer(%s) bitmap NULL\n", i, testUtilBarcodeName(data[i].symbology));
+ ret_buf = ZBarcode_Buffer(symbol, 0);
+ assert_zero(ret_buf, "i:%d ZBarcode_Buffer(%s) ret_buf %d != 0 (%s)\n",
+ 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) {
- 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),
- 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);
} 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->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",
- 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);
+ 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->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",
+ 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);
@@ -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 */
/* 27*/ { BARCODE_EANX, 0, EANUPC_GUARD_WHITESPACE, "123456", 0, 50, 1, 67, 162, 110, 106 /*text_row*/, 0, 14, 106, 148, 14 }, /* EAN-8 */
/* 28*/ { BARCODE_EANX, 1 /*empty*/, -1, "123456", 0, 50, 1, 67, 162, 116, 106 /*text_row*/, 0, 14, 106, 148, 14 }, /* EAN-8 */
- /* 29*/ { BARCODE_EANX, -1, -1, "123456+12", 0, 50, 1, 94, 212, 116, 106 /*text_row*/, 20, 58, 5, 148, 68 }, /* EAN-8 + EAN-2 */
- /* 30*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456+12", 0, 50, 1, 94, 212, 116, 106 /*text_row*/, 20, 58, 5, 148, 68 }, /* EAN-8 + EAN-2 */
- /* 31*/ { BARCODE_EANX, 0, -1, "123456+12", 0, 50, 1, 94, 212, 110, 106 /*text_row*/, 20, 58, 5, 148, 68 }, /* EAN-8 + EAN-2 */
- /* 32*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456+12", 0, 50, 1, 94, 212, 116, 106 /*text_row*/, 0, 14, 6, 202, 8 }, /* EAN-8 + EAN-2 */
- /* 33*/ { BARCODE_EANX, 0, EANUPC_GUARD_WHITESPACE, "123456+12", 0, 50, 1, 94, 212, 110, 106 /*text_row*/, 0, 14, 6, 202, 8 }, /* EAN-8 + EAN-2 */
- /* 34*/ { BARCODE_EANX, 1 /*empty*/, -1, "123456+12", 0, 50, 1, 94, 212, 116, 106 /*text_row*/, 0, 14, 6, 202, 8 }, /* EAN-8 + EAN-2 */
- /* 35*/ { BARCODE_EANX, -1, -1, "123456+12345", 0, 50, 1, 121, 266, 116, 106 /*text_row*/, 20, 58, 5, 148, 122 }, /* EAN-8 + EAN-5 */
- /* 36*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "123456+12345", 0, 50, 1, 121, 266, 116, 106 /*text_row*/, 20, 58, 5, 148, 122 }, /* EAN-8 + EAN-5 */
- /* 37*/ { BARCODE_EANX, 0, -1, "123456+12345", 0, 50, 1, 121, 266, 110, 106 /*text_row*/, 20, 58, 5, 148, 122 }, /* EAN-8 + EAN-5 */
- /* 38*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456+12345", 0, 50, 1, 121, 266, 116, 106 /*text_row*/, 0, 14, 6, 256, 10 }, /* EAN-8 + EAN-5 */
- /* 39*/ { BARCODE_EANX, 0, EANUPC_GUARD_WHITESPACE, "123456+12345", 0, 50, 1, 121, 266, 110, 106 /*text_row*/, 0, 14, 6, 256, 10 }, /* EAN-8 + EAN-5 */
- /* 40*/ { BARCODE_EANX, 1 /*empty*/, -1, "123456+12345", 0, 50, 1, 121, 266, 116, 106 /*text_row*/, 0, 14, 6, 256, 10 }, /* EAN-8 + EAN-5 */
+ /* 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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 */
/* 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 */
@@ -573,40 +588,54 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
length = (int) strlen(data[i].data);
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);
- 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->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->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->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",
- 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);
+ 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);
- 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 */
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) {
- 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);
+ if (i && data[i - 1].symbology == symbol->symbology && data[i - 1].show_hrt
+ && data[i - 1].expected_text_row != -1) {
+ 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 {
int text_bits_set = 0;
int row = data[i].expected_text_row;
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)) {
text_bits_set = 1;
break;
}
}
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 {
- 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 row = data[i].expected_text2_row;
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)) {
text2_bits_set = 1;
break;
}
}
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 {
- 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, "" },
/* 7*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012", -1, 0, 116, 226, "1234567890128", -1, "1234567890128", -1, "" },
/* 8*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012+12", -1, 0, 116, 276, "1234567890128+12", -1, "", -1, "" },
- /* 9*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012+12", -1, 0, 116, 276, "1234567890128+12", -1, "1234567890128+12", -1, "" },
+ /* 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, "" },
/* 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 */
@@ -3347,24 +3379,24 @@ static void test_perf_scale(const testCtx *const p_ctx) {
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func */
- { "test_options", test_options, },
- { "test_buffer", test_buffer, },
- { "test_upcean_hrt", test_upcean_hrt, },
- { "test_row_separator", test_row_separator, },
- { "test_stacking", test_stacking, },
- { "test_stacking_too_many", test_stacking_too_many, },
- { "test_output_options", test_output_options, },
- { "test_draw_string_wrap", test_draw_string_wrap, },
- { "test_code128_utf8", test_code128_utf8, },
- { "test_scale", test_scale, },
- { "test_guard_descent", test_guard_descent, },
- { "test_quiet_zones", test_quiet_zones, },
- { "test_text_gap", test_text_gap, },
- { "test_buffer_plot", test_buffer_plot, },
- { "test_height", test_height, },
- { "test_height_per_row", test_height_per_row, },
- { "test_hrt_raw_text", test_hrt_raw_text, },
- { "test_perf_scale", test_perf_scale, },
+ { "test_options", test_options },
+ { "test_buffer", test_buffer },
+ { "test_upcean_hrt", test_upcean_hrt },
+ { "test_row_separator", test_row_separator },
+ { "test_stacking", test_stacking },
+ { "test_stacking_too_many", test_stacking_too_many },
+ { "test_output_options", test_output_options },
+ { "test_draw_string_wrap", test_draw_string_wrap },
+ { "test_code128_utf8", test_code128_utf8 },
+ { "test_scale", test_scale },
+ { "test_guard_descent", test_guard_descent },
+ { "test_quiet_zones", test_quiet_zones },
+ { "test_text_gap", test_text_gap },
+ { "test_buffer_plot", test_buffer_plot },
+ { "test_height", test_height },
+ { "test_height_per_row", test_height_per_row },
+ { "test_hrt_raw_text", test_hrt_raw_text },
+ { "test_perf_scale", test_perf_scale },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
diff --git a/backend/tests/test_rss.c b/backend/tests/test_rss.c
index e15a0df0..33a4c783 100644
--- a/backend/tests/test_rss.c
+++ b/backend/tests/test_rss.c
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
}
diff --git a/backend/tests/test_svg.c b/backend/tests/test_svg.c
index 02059078..2c029ddd 100644
--- a/backend/tests/test_svg.c
+++ b/backend/tests/test_svg.c
@@ -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", "" },
/* 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", "" },
- /* 52*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", 0, "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", "" },
- /* 54*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "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", "" },
- /* 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", "" },
- /* 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", "" },
- /* 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", "" },
- /* 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", "" },
+ /* 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", "", ZINT_WARN_NONCOMPLIANT, "ean8_2addon_gws.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", "", 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", 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", 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", 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", 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", "" },
/* 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", "" },
@@ -163,7 +163,8 @@ static void test_print(const testCtx *const p_ctx) {
have_libreoffice = testUtilHaveLibreOffice();
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)) {
ret = testUtilMkDir(data_dir_path);
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();
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) {
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);
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);
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) {
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,
- 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].option_3, data[i].height, data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle,
+ i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
+ 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].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,
testUtilErrorName(data[i].ret), data[i].expected_file, data[i].comment);
ret = testUtilRename(symbol->outfile, expected_file);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
if (have_libreoffice) {
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) {
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 {
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);
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;
ret = ZBarcode_Print(symbol, data[i].rotate_angle);
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_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");
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 */
#endif
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 */
- 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);
- 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_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);
+ 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_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;
@@ -308,7 +325,8 @@ static void test_outfile(const testCtx *const p_ctx) {
symbol.vector = NULL;
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();
}
diff --git a/backend/tests/test_tif.c b/backend/tests/test_tif.c
index 2effea62..2686568c 100644
--- a/backend/tests/test_tif.c
+++ b/backend/tests/test_tif.c
@@ -117,19 +117,22 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
symbol->debug |= debug;
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) {
testUtilStrCpyRepeat(data_buf, data[i].pattern, size);
} else {
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;
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 (have_tiffinfo) {
@@ -225,7 +228,8 @@ static void test_print(const testCtx *const p_ctx) {
if (p_ctx->generate) {
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)) {
ret = testUtilMkDir(data_dir_path);
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();
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) {
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);
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);
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) {
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),
- data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].option_1, data[i].option_2,
+ i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
+ 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,
- 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);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
if (have_tiffinfo) {
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) {
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 {
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);
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 */
- assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
+ /* For BARCODE_MEMORY_FILE */
+ 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)) {
assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
@@ -314,12 +331,13 @@ static void test_print(const testCtx *const p_ctx) {
symbol->output_options |= BARCODE_MEMORY_FILE;
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);
+ 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_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
- 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",
- i, testUtilBarcodeName(data[i].symbology));
+ 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",
+ i, testUtilBarcodeName(data[i].symbology));
}
ZBarcode_Delete(symbol);
@@ -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 */
#endif
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 */
- 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);
- 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_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);
+ 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_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;
diff --git a/backend/tests/test_upcean.c b/backend/tests/test_upcean.c
index bb04de47..c4920f35 100644
--- a/backend/tests/test_upcean.c
+++ b/backend/tests/test_upcean.c
@@ -115,7 +115,9 @@ static void test_upce_input(const testCtx *const p_ctx) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
- length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -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);
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 (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
char modules_dump[8192 + 1];
- assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
- 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);
+ assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
+ "i:%d testUtilModulesDump == -1\n", i);
+ 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);
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)) {
int cmp_len, ret_len;
char modules_dump[8192 + 1];
- assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
- ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 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);
+ assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
+ "i:%d testUtilModulesDump == -1\n", i);
+ ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
+ sizeof(cmp_buf), &cmp_len);
+ assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
+ i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].hrt, (int) strlen(data[i].hrt),
NULL /*primary*/, escaped, &ret_len);
@@ -178,14 +186,17 @@ static void test_upca_print(const testCtx *const p_ctx) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
- length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -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);
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");
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);
@@ -298,11 +309,14 @@ static void test_upca_input(const testCtx *const p_ctx) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
- length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -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);
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);
}
@@ -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)", "" },
/* 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)", "" },
- /* 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" },
- /* 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" },
/* 50*/ { BARCODE_EANX, "1", 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)", "" },
/*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" },
- /*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'", "" },
- /*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'", "" },
- /*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'", "" },
- /*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'", "" },
- /*112*/ { BARCODE_EANX_CHK, "1236+12345", 0, "", "" },
- /*113*/ { BARCODE_EANX_CHK, "123+12345", 0, "", "3 happens to be correct check digit" },
+ /*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", 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'", "" },
/*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'", "" },
- /*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)", "" },
/*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)", "" },
/*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" },
/*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)", "" },
@@ -470,18 +484,21 @@ static void test_eanx_input(const testCtx *const p_ctx) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
- length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -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);
if (p_ctx->generate) {
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)),
data[i].comment);
} else {
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);
@@ -623,7 +640,9 @@ static void test_isbn_input(const testCtx *const p_ctx) {
symbol = ZBarcode_Create();
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);
@@ -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)),
data[i].comment);
} 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_zero(strcmp(symbol->errtxt, data[i].ret_errtxt), "i:%d errtxt %s != %s\n", i, symbol->errtxt, data[i].ret_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);
+ 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) {
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" },
/* 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", "" },
- /* 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", "" },
- /* 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", "" },
/* 13*/ { BARCODE_EANX, BARCODE_RAW_TEXT, "12345678", 0, "0000123456784", "0000123456784" },
/* 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", "" },
/* 37*/ { BARCODE_ISBNX, BARCODE_RAW_TEXT, "9781234567897", 0, "9781234567897", "9781234567897" },
/* 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", "" },
- /* 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", "" },
- /* 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", "" },
- /* 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", "" },
- /* 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", "" },
- /* 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", "" },
- /* 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", "" },
- /* 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 */
- /* 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 */
- /* 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 */
- /* 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 */
- /* 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 */
- /* 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 */
- /* 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 */
- /* 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 */
- /* 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 */
/* 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)) */
/* 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)) */
/* 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)) */
/* 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)) */
/* 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", "" },
- /* 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", "" },
/* 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 */
- /* 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", "" },
- /* 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", "" },
- /* 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", "" },
- /* 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", "" },
- /* 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", "" },
- /*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", "" },
- /*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", "" },
- /*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);
int i, length, ret;
@@ -783,8 +805,8 @@ static void test_hrt(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n");
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, -1, debug);
+ -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
+ data[i].data, -1, debug);
expected_length = (int) strlen(data[i].expected);
expected_raw_length = (int) strlen(data[i].expected_raw);
@@ -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, symbol->raw_segs[0].length, expected_raw_length);
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
- "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length);
+ "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 {
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();
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);
- 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);
- 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);
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",
"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"
},
- /* 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"
},
/* 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",
"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"
},
- /* 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"
},
/* 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();
assert_nonnull(symbol, "Symbol not created\n");
- length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
+ length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
+ -1 /*option_1*/, data[i].option_2, -1 /*option_3*/, -1 /*output_options*/,
+ data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
- assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
+ assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
+ i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n",
- i, testUtilBarcodeName(data[i].symbology), data[i].option_2, 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");
printf(" },\n");
} else {
if (ret < ZINT_ERROR) {
int width, row;
- assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
- assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
+ assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n",
+ i, symbol->rows, data[i].expected_rows, data[i].data);
+ assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n",
+ i, symbol->width, data[i].expected_width, data[i].data);
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
- assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
+ assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n",
+ i, ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) {
- ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
- assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
+ ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf,
+ sizeof(cmp_buf), NULL);
+ assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n",
+ i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
- i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected);
+ i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf,
+ data[i].expected);
}
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len;
char modules_dump[8192 + 1];
- assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
- ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 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);
+ assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
+ "i:%d testUtilModulesDump == -1\n", i);
+ ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
+ sizeof(cmp_buf), &cmp_len);
+ assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
+ i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
NULL /*primary*/, escaped, &ret_len);
@@ -1091,7 +1131,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
/* 5*/ { BARCODE_UPCE, "+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 },
- /* 8*/ { BARCODE_EANX, "+12345", -1, 0 },
+ /* 8*/ { BARCODE_EANX, "+12345", -1, ZINT_WARN_NONCOMPLIANT },
/* 9*/ { BARCODE_EANX, "+123456", -1, ZINT_ERROR_TOO_LONG },
/*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();
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);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
diff --git a/backend/tests/test_vector.c b/backend/tests/test_vector.c
index af3d700a..aadcb45a 100644
--- a/backend/tests/test_vector.c
+++ b/backend/tests/test_vector.c
@@ -543,7 +543,7 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
int symbology;
const char *data;
const char *composite;
-
+ int ret;
float expected_height;
int expected_rows;
int expected_width;
@@ -551,144 +551,145 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
float expected_vector_height;
};
struct item data[] = {
- /* 0*/ { BARCODE_CODE11, "1234567890", "", 50, 1, 108, 216, 116.28 },
- /* 1*/ { BARCODE_C25STANDARD, "1234567890", "", 50, 1, 117, 234, 116.28 },
- /* 2*/ { BARCODE_C25INTER, "1234567890", "", 50, 1, 99, 198, 116.28 },
- /* 3*/ { BARCODE_C25IATA, "1234567890", "", 50, 1, 149, 298, 116.28 },
- /* 4*/ { BARCODE_C25LOGIC, "1234567890", "", 50, 1, 109, 218, 116.28 },
- /* 5*/ { BARCODE_C25IND, "1234567890", "", 50, 1, 159, 318, 116.28 },
- /* 6*/ { BARCODE_CODE39, "1234567890", "", 50, 1, 155, 310, 116.28 },
- /* 7*/ { BARCODE_EXCODE39, "1234567890", "", 50, 1, 155, 310, 116.28 },
- /* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 226, 118 },
- /* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 226, 118 },
- /* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 122, 276, 118 },
- /* 11*/ { BARCODE_EANX_CHK, "1234567890128+12", "", 50, 1, 122, 276, 118 },
- /* 12*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 149, 330, 118 },
- /* 13*/ { BARCODE_EANX_CHK, "1234567890128+12345", "", 50, 1, 149, 330, 118 },
- /* 14*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 162, 118 },
- /* 15*/ { BARCODE_EANX_CHK, "12345670", "", 50, 1, 67, 162, 118 },
- /* 16*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 94, 212, 118 },
- /* 17*/ { BARCODE_EANX_CHK, "12345670+12", "", 50, 1, 94, 212, 118 },
- /* 18*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 121, 266, 118 },
- /* 19*/ { BARCODE_EANX_CHK, "12345670+12345", "", 50, 1, 121, 266, 118 },
- /* 20*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 104, 118 },
- /* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 104, 118 },
- /* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 50, 118 },
- /* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 50, 118 },
- /* 24*/ { BARCODE_GS1_128, "[01]12345678901231", "", 50, 1, 134, 268, 116.28 },
- /* 25*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 116.28 },
- /* 26*/ { BARCODE_CODE128, "1234567890", "", 50, 1, 90, 180, 116.28 },
- /* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 72, 1, 135, 270, 160.28 },
- /* 28*/ { BARCODE_DPIDENT, "12345678901", "", 72, 1, 117, 234, 160.28 },
- /* 29*/ { BARCODE_CODE16K, "1234567890", "", 20, 2, 70, 162, 44 },
- /* 30*/ { BARCODE_CODE49, "1234567890", "", 20, 2, 70, 162, 44 },
- /* 31*/ { BARCODE_CODE93, "1234567890", "", 50, 1, 127, 254, 116.28 },
- /* 32*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 },
- /* 33*/ { BARCODE_DBAR_OMN, "1234567890123", "", 50, 1, 96, 192, 116.28 },
- /* 34*/ { BARCODE_DBAR_LTD, "1234567890123", "", 50, 1, 79, 158, 116.28 },
- /* 35*/ { BARCODE_DBAR_EXP, "[01]12345678901231", "", 34, 1, 134, 268, 84.279999 },
- /* 36*/ { BARCODE_TELEPEN, "1234567890", "", 50, 1, 208, 416, 116.28 },
- /* 37*/ { BARCODE_UPCA, "12345678901", "", 50, 1, 95, 226, 118 },
- /* 38*/ { BARCODE_UPCA_CHK, "123456789012", "", 50, 1, 95, 226, 118 },
- /* 39*/ { BARCODE_UPCA, "12345678901+12", "", 50, 1, 124, 276, 118 },
- /* 40*/ { BARCODE_UPCA_CHK, "123456789012+12", "", 50, 1, 124, 276, 118 },
- /* 41*/ { BARCODE_UPCA, "12345678901+12345", "", 50, 1, 151, 330, 118 },
- /* 42*/ { BARCODE_UPCA_CHK, "123456789012+12345", "", 50, 1, 151, 330, 118 },
- /* 43*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 134, 118 },
- /* 44*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 134, 118 },
- /* 45*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 78, 184, 118 },
- /* 46*/ { BARCODE_UPCE_CHK, "12345670+12", "", 50, 1, 78, 184, 118 },
- /* 47*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 105, 238, 118 },
- /* 48*/ { BARCODE_UPCE_CHK, "12345670+12345", "", 50, 1, 105, 238, 118 },
- /* 49*/ { BARCODE_POSTNET, "12345678901", "", 12, 2, 123, 246, 24 },
- /* 50*/ { BARCODE_MSI_PLESSEY, "1234567890", "", 50, 1, 127, 254, 116.28 },
- /* 51*/ { BARCODE_FIM, "A", "", 50, 1, 17, 34, 100 },
- /* 52*/ { BARCODE_LOGMARS, "1234567890", "", 50, 1, 191, 382, 116.28 },
- /* 53*/ { BARCODE_PHARMA, "123456", "", 50, 1, 58, 116, 100 },
- /* 54*/ { BARCODE_PZN, "123456", "", 50, 1, 142, 284, 116.28 },
- /* 55*/ { BARCODE_PHARMA_TWO, "12345678", "", 10, 2, 29, 58, 20 },
- /* 56*/ { BARCODE_CEPNET, "12345678", "", 5.375, 2, 93, 186, 10.75 },
- /* 57*/ { BARCODE_PDF417, "1234567890", "", 21, 7, 103, 206, 42 },
- /* 58*/ { BARCODE_PDF417COMP, "1234567890", "", 21, 7, 69, 138, 42 },
- /* 59*/ { BARCODE_MAXICODE, "1234567890", "", 165, 33, 30, 60, 57.7333984 },
- /* 60*/ { BARCODE_QRCODE, "1234567890AB", "", 21, 21, 21, 42, 42 },
- /* 61*/ { BARCODE_CODE128AB, "1234567890", "", 50, 1, 145, 290, 116.28 },
- /* 62*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 8, 3, 133, 266, 16 },
- /* 63*/ { BARCODE_AUSREPLY, "12345678", "", 8, 3, 73, 146, 16 },
- /* 64*/ { BARCODE_AUSROUTE, "12345678", "", 8, 3, 73, 146, 16 },
- /* 65*/ { BARCODE_AUSREDIRECT, "12345678", "", 8, 3, 73, 146, 16 },
- /* 66*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 226, 118 },
- /* 67*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 122, 276, 118 },
- /* 68*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 149, 330, 118 },
- /* 69*/ { BARCODE_RM4SCC, "1234567890", "", 8, 3, 91, 182, 16 },
- /* 70*/ { BARCODE_DATAMATRIX, "ABC", "", 10, 10, 10, 20, 20 },
- /* 71*/ { BARCODE_EAN14, "1234567890123", "", 50, 1, 134, 268, 116.28 },
- /* 72*/ { BARCODE_VIN, "12345678701234567", "", 50, 1, 246, 492, 116.28 },
- /* 73*/ { BARCODE_CODABLOCKF, "1234567890", "", 20, 2, 101, 242, 44 },
- /* 74*/ { BARCODE_NVE18, "12345678901234567", "", 50, 1, 156, 312, 116.28 },
- /* 75*/ { BARCODE_JAPANPOST, "1234567890", "", 8, 3, 133, 266, 16 },
- /* 76*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 116.28 },
- /* 77*/ { BARCODE_DBAR_STK, "1234567890123", "", 13, 3, 50, 100, 26 },
- /* 78*/ { BARCODE_DBAR_OMNSTK, "1234567890123", "", 69, 5, 50, 100, 138 },
- /* 79*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901231", "", 71, 5, 102, 204, 142 },
- /* 80*/ { BARCODE_PLANET, "12345678901", "", 12, 2, 123, 246, 24 },
- /* 81*/ { BARCODE_MICROPDF417, "1234567890", "", 12, 6, 82, 164, 24 },
- /* 82*/ { BARCODE_USPS_IMAIL, "12345678901234567890", "", 8, 3, 129, 258, 16 },
- /* 83*/ { BARCODE_PLESSEY, "1234567890", "", 50, 1, 227, 454, 116.28 },
- /* 84*/ { BARCODE_TELEPEN_NUM, "1234567890", "", 50, 1, 128, 256, 116.28 },
- /* 85*/ { BARCODE_ITF14, "1234567890", "", 50, 1, 135, 330, 136.28 },
- /* 86*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174, 16 },
- /* 87*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30, 30 },
- /* 88*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
- /* 89*/ { BARCODE_DPD, "0123456789012345678901234567", "", 50, 1, 189, 378, 122.28 },
- /* 90*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 },
- /* 91*/ { BARCODE_HIBC_128, "1234567890", "", 50, 1, 123, 246, 116.28 },
- /* 92*/ { BARCODE_HIBC_39, "1234567890", "", 50, 1, 223, 446, 116.28 },
- /* 93*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24, 24 },
- /* 94*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42, 42 },
- /* 95*/ { BARCODE_HIBC_PDF, "1234567890", "", 24, 8, 103, 206, 48 },
- /* 96*/ { BARCODE_HIBC_MICPDF, "1234567890", "", 28, 14, 38, 76, 56 },
- /* 97*/ { BARCODE_HIBC_BLOCKF, "1234567890", "", 30, 3, 101, 242, 64 },
- /* 98*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38, 38 },
- /* 99*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 32, 22 },
- /*100*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46, 46 },
- /*101*/ { BARCODE_MAILMARK_2D, "012100123412345678AB19XY1A 0", "", 24, 24, 24, 48, 48 },
- /*102*/ { BARCODE_UPU_S10, "EE876543216CA", "", 50, 1, 156, 312, 116.28 },
- /*103*/ { BARCODE_MAILMARK_4S, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 },
- /*104*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 },
- /*105*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206, 116.28 },
- /*106*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 226, 118 },
- /*107*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 125, 276, 118 },
- /*108*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 152, 330, 118 },
- /*109*/ { BARCODE_EANX_CC, "1234567", "[20]01", 50, 8, 72, 162, 118 },
- /*110*/ { BARCODE_EANX_CC, "1234567+12", "[20]01", 50, 8, 98, 212, 118 },
- /*111*/ { BARCODE_EANX_CC, "1234567+12345", "[20]01", 50, 8, 125, 266, 118 },
- /*112*/ { BARCODE_GS1_128_CC, "[01]12345678901231", "[20]01", 50, 5, 145, 290, 116.28 },
- /*113*/ { BARCODE_DBAR_OMN_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 58.279999 },
- /*114*/ { BARCODE_DBAR_LTD_CC, "1234567890123", "[20]01", 19, 6, 79, 158, 54.279999 },
- /*115*/ { BARCODE_DBAR_EXP_CC, "[01]12345678901231", "[20]01", 41, 5, 134, 268, 98.279999 },
- /*116*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 226, 118 },
- /*117*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 127, 276, 118 },
- /*118*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 154, 330, 118 },
- /*119*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 134, 118 },
- /*120*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 81, 184, 118 },
- /*121*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 108, 238, 118 },
- /*122*/ { BARCODE_DBAR_STK_CC, "1234567890123", "[20]01", 24, 9, 56, 112, 48 },
- /*123*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 80, 11, 56, 112, 160 },
- /*124*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 },
- /*125*/ { BARCODE_CHANNEL, "01", "", 50, 1, 19, 38, 116.28 },
- /*126*/ { BARCODE_CODEONE, "12345678901234567890", "", 16, 16, 18, 36, 32 },
- /*127*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
- /*128*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 },
- /*129*/ { BARCODE_ULTRA, "1234567890", "", 13, 13, 18, 36, 26 },
- /*130*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54, 22 },
- /*131*/ { BARCODE_BC412, "1234567", "", 16.666666, 1, 102, 204, 49.613335 },
+ /* 0*/ { BARCODE_CODE11, "1234567890", "", 0, 50, 1, 108, 216, 116.28 },
+ /* 1*/ { BARCODE_C25STANDARD, "1234567890", "", 0, 50, 1, 117, 234, 116.28 },
+ /* 2*/ { BARCODE_C25INTER, "1234567890", "", 0, 50, 1, 99, 198, 116.28 },
+ /* 3*/ { BARCODE_C25IATA, "1234567890", "", 0, 50, 1, 149, 298, 116.28 },
+ /* 4*/ { BARCODE_C25LOGIC, "1234567890", "", 0, 50, 1, 109, 218, 116.28 },
+ /* 5*/ { BARCODE_C25IND, "1234567890", "", 0, 50, 1, 159, 318, 116.28 },
+ /* 6*/ { BARCODE_CODE39, "1234567890", "", 0, 50, 1, 155, 310, 116.28 },
+ /* 7*/ { BARCODE_EXCODE39, "1234567890", "", 0, 50, 1, 155, 310, 116.28 },
+ /* 8*/ { BARCODE_EANX, "123456789012", "", 0, 50, 1, 95, 226, 118 },
+ /* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 0, 50, 1, 95, 226, 118 },
+ /* 10*/ { BARCODE_EANX, "123456789012+12", "", 0, 50, 1, 122, 276, 118 },
+ /* 11*/ { BARCODE_EANX_CHK, "1234567890128+12", "", 0, 50, 1, 122, 276, 118 },
+ /* 12*/ { BARCODE_EANX, "123456789012+12345", "", 0, 50, 1, 149, 330, 118 },
+ /* 13*/ { BARCODE_EANX_CHK, "1234567890128+12345", "", 0, 50, 1, 149, 330, 118 },
+ /* 14*/ { BARCODE_EANX, "1234567", "", 0, 50, 1, 67, 162, 118 },
+ /* 15*/ { BARCODE_EANX_CHK, "12345670", "", 0, 50, 1, 67, 162, 118 },
+ /* 16*/ { BARCODE_EANX, "1234567+12", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 94, 212, 118 },
+ /* 17*/ { BARCODE_EANX_CHK, "12345670+12", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 94, 212, 118 },
+ /* 18*/ { BARCODE_EANX, "1234567+12345", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 121, 266, 118 },
+ /* 19*/ { BARCODE_EANX_CHK, "12345670+12345", "", ZINT_WARN_NONCOMPLIANT, 50, 1, 121, 266, 118 },
+ /* 20*/ { BARCODE_EANX, "1234", "", 0, 50, 1, 47, 104, 118 },
+ /* 21*/ { BARCODE_EANX_CHK, "1234", "", 0, 50, 1, 47, 104, 118 },
+ /* 22*/ { BARCODE_EANX, "12", "", 0, 50, 1, 20, 50, 118 },
+ /* 23*/ { BARCODE_EANX_CHK, "12", "", 0, 50, 1, 20, 50, 118 },
+ /* 24*/ { BARCODE_GS1_128, "[01]12345678901231", "", 0, 50, 1, 134, 268, 116.28 },
+ /* 25*/ { BARCODE_CODABAR, "A00000000B", "", 0, 50, 1, 102, 204, 116.28 },
+ /* 26*/ { BARCODE_CODE128, "1234567890", "", 0, 50, 1, 90, 180, 116.28 },
+ /* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 0, 72, 1, 135, 270, 160.28 },
+ /* 28*/ { BARCODE_DPIDENT, "12345678901", "", 0, 72, 1, 117, 234, 160.28 },
+ /* 29*/ { BARCODE_CODE16K, "1234567890", "", 0, 20, 2, 70, 162, 44 },
+ /* 30*/ { BARCODE_CODE49, "1234567890", "", 0, 20, 2, 70, 162, 44 },
+ /* 31*/ { BARCODE_CODE93, "1234567890", "", 0, 50, 1, 127, 254, 116.28 },
+ /* 32*/ { BARCODE_FLAT, "1234567890", "", 0, 50, 1, 90, 180, 100 },
+ /* 33*/ { BARCODE_DBAR_OMN, "1234567890123", "", 0, 50, 1, 96, 192, 116.28 },
+ /* 34*/ { BARCODE_DBAR_LTD, "1234567890123", "", 0, 50, 1, 79, 158, 116.28 },
+ /* 35*/ { BARCODE_DBAR_EXP, "[01]12345678901231", "", 0, 34, 1, 134, 268, 84.279999 },
+ /* 36*/ { BARCODE_TELEPEN, "1234567890", "", 0, 50, 1, 208, 416, 116.28 },
+ /* 37*/ { BARCODE_UPCA, "12345678901", "", 0, 50, 1, 95, 226, 118 },
+ /* 38*/ { BARCODE_UPCA_CHK, "123456789012", "", 0, 50, 1, 95, 226, 118 },
+ /* 39*/ { BARCODE_UPCA, "12345678901+12", "", 0, 50, 1, 124, 276, 118 },
+ /* 40*/ { BARCODE_UPCA_CHK, "123456789012+12", "", 0, 50, 1, 124, 276, 118 },
+ /* 41*/ { BARCODE_UPCA, "12345678901+12345", "", 0, 50, 1, 151, 330, 118 },
+ /* 42*/ { BARCODE_UPCA_CHK, "123456789012+12345", "", 0, 50, 1, 151, 330, 118 },
+ /* 43*/ { BARCODE_UPCE, "1234567", "", 0, 50, 1, 51, 134, 118 },
+ /* 44*/ { BARCODE_UPCE_CHK, "12345670", "", 0, 50, 1, 51, 134, 118 },
+ /* 45*/ { BARCODE_UPCE, "1234567+12", "", 0, 50, 1, 78, 184, 118 },
+ /* 46*/ { BARCODE_UPCE_CHK, "12345670+12", "", 0, 50, 1, 78, 184, 118 },
+ /* 47*/ { BARCODE_UPCE, "1234567+12345", "", 0, 50, 1, 105, 238, 118 },
+ /* 48*/ { BARCODE_UPCE_CHK, "12345670+12345", "", 0, 50, 1, 105, 238, 118 },
+ /* 49*/ { BARCODE_POSTNET, "12345678901", "", 0, 12, 2, 123, 246, 24 },
+ /* 50*/ { BARCODE_MSI_PLESSEY, "1234567890", "", 0, 50, 1, 127, 254, 116.28 },
+ /* 51*/ { BARCODE_FIM, "A", "", 0, 50, 1, 17, 34, 100 },
+ /* 52*/ { BARCODE_LOGMARS, "1234567890", "", 0, 50, 1, 191, 382, 116.28 },
+ /* 53*/ { BARCODE_PHARMA, "123456", "", 0, 50, 1, 58, 116, 100 },
+ /* 54*/ { BARCODE_PZN, "123456", "", 0, 50, 1, 142, 284, 116.28 },
+ /* 55*/ { BARCODE_PHARMA_TWO, "12345678", "", 0, 10, 2, 29, 58, 20 },
+ /* 56*/ { BARCODE_CEPNET, "12345678", "", 0, 5.375, 2, 93, 186, 10.75 },
+ /* 57*/ { BARCODE_PDF417, "1234567890", "", 0, 21, 7, 103, 206, 42 },
+ /* 58*/ { BARCODE_PDF417COMP, "1234567890", "", 0, 21, 7, 69, 138, 42 },
+ /* 59*/ { BARCODE_MAXICODE, "1234567890", "", 0, 165, 33, 30, 60, 57.7333984 },
+ /* 60*/ { BARCODE_QRCODE, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
+ /* 61*/ { BARCODE_CODE128AB, "1234567890", "", 0, 50, 1, 145, 290, 116.28 },
+ /* 62*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16 },
+ /* 63*/ { BARCODE_AUSREPLY, "12345678", "", 0, 8, 3, 73, 146, 16 },
+ /* 64*/ { BARCODE_AUSROUTE, "12345678", "", 0, 8, 3, 73, 146, 16 },
+ /* 65*/ { BARCODE_AUSREDIRECT, "12345678", "", 0, 8, 3, 73, 146, 16 },
+ /* 66*/ { BARCODE_ISBNX, "123456789", "", 0, 50, 1, 95, 226, 118 },
+ /* 67*/ { BARCODE_ISBNX, "123456789+12", "", 0, 50, 1, 122, 276, 118 },
+ /* 68*/ { BARCODE_ISBNX, "123456789+12345", "", 0, 50, 1, 149, 330, 118 },
+ /* 69*/ { BARCODE_RM4SCC, "1234567890", "", 0, 8, 3, 91, 182, 16 },
+ /* 70*/ { BARCODE_DATAMATRIX, "ABC", "", 0, 10, 10, 10, 20, 20 },
+ /* 71*/ { BARCODE_EAN14, "1234567890123", "", 0, 50, 1, 134, 268, 116.28 },
+ /* 72*/ { BARCODE_VIN, "12345678701234567", "", 0, 50, 1, 246, 492, 116.28 },
+ /* 73*/ { BARCODE_CODABLOCKF, "1234567890", "", 0, 20, 2, 101, 242, 44 },
+ /* 74*/ { BARCODE_NVE18, "12345678901234567", "", 0, 50, 1, 156, 312, 116.28 },
+ /* 75*/ { BARCODE_JAPANPOST, "1234567890", "", 0, 8, 3, 133, 266, 16 },
+ /* 76*/ { BARCODE_KOREAPOST, "123456", "", 0, 50, 1, 167, 334, 116.28 },
+ /* 77*/ { BARCODE_DBAR_STK, "1234567890123", "", 0, 13, 3, 50, 100, 26 },
+ /* 78*/ { BARCODE_DBAR_OMNSTK, "1234567890123", "", 0, 69, 5, 50, 100, 138 },
+ /* 79*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142 },
+ /* 80*/ { BARCODE_PLANET, "12345678901", "", 0, 12, 2, 123, 246, 24 },
+ /* 81*/ { BARCODE_MICROPDF417, "1234567890", "", 0, 12, 6, 82, 164, 24 },
+ /* 82*/ { BARCODE_USPS_IMAIL, "12345678901234567890", "", 0, 8, 3, 129, 258, 16 },
+ /* 83*/ { BARCODE_PLESSEY, "1234567890", "", 0, 50, 1, 227, 454, 116.28 },
+ /* 84*/ { BARCODE_TELEPEN_NUM, "1234567890", "", 0, 50, 1, 128, 256, 116.28 },
+ /* 85*/ { BARCODE_ITF14, "1234567890", "", 0, 50, 1, 135, 330, 136.28 },
+ /* 86*/ { BARCODE_KIX, "123456ABCDE", "", 0, 8, 3, 87, 174, 16 },
+ /* 87*/ { BARCODE_AZTEC, "1234567890AB", "", 0, 15, 15, 15, 30, 30 },
+ /* 88*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16 },
+ /* 89*/ { BARCODE_DPD, "0123456789012345678901234567", "", 0, 50, 1, 189, 378, 122.28 },
+ /* 90*/ { BARCODE_MICROQR, "12345", "", 0, 11, 11, 11, 22, 22 },
+ /* 91*/ { BARCODE_HIBC_128, "1234567890", "", 0, 50, 1, 123, 246, 116.28 },
+ /* 92*/ { BARCODE_HIBC_39, "1234567890", "", 0, 50, 1, 223, 446, 116.28 },
+ /* 93*/ { BARCODE_HIBC_DM, "ABC", "", 0, 12, 12, 12, 24, 24 },
+ /* 94*/ { BARCODE_HIBC_QR, "1234567890AB", "", 0, 21, 21, 21, 42, 42 },
+ /* 95*/ { BARCODE_HIBC_PDF, "1234567890", "", 0, 24, 8, 103, 206, 48 },
+ /* 96*/ { BARCODE_HIBC_MICPDF, "1234567890", "", 0, 28, 14, 38, 76, 56 },
+ /* 97*/ { BARCODE_HIBC_BLOCKF, "1234567890", "", 0, 30, 3, 101, 242, 64 },
+ /* 98*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 0, 19, 19, 19, 38, 38 },
+ /* 99*/ { BARCODE_DOTCODE, "ABC", "", 0, 11, 11, 16, 32, 22 },
+ /*100*/ { BARCODE_HANXIN, "1234567890AB", "", 0, 23, 23, 23, 46, 46 },
+ /*101*/ { BARCODE_MAILMARK_2D, "012100123412345678AB19XY1A 0", "", 0, 24, 24, 24, 48, 48 },
+ /*102*/ { BARCODE_UPU_S10, "EE876543216CA", "", 0, 50, 1, 156, 312, 116.28 },
+ /*103*/ { BARCODE_MAILMARK_4S, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20 },
+ /*104*/ { BARCODE_AZRUNE, "255", "", 0, 11, 11, 11, 22, 22 },
+ /*105*/ { BARCODE_CODE32, "12345678", "", 0, 50, 1, 103, 206, 116.28 },
+ /*106*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 0, 50, 7, 99, 226, 118 },
+ /*107*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 0, 50, 7, 125, 276, 118 },
+ /*108*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 0, 50, 7, 152, 330, 118 },
+ /*109*/ { BARCODE_EANX_CC, "1234567", "[20]01", 0, 50, 8, 72, 162, 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", ZINT_WARN_NONCOMPLIANT, 50, 8, 125, 266, 118 },
+ /*112*/ { BARCODE_GS1_128_CC, "[01]12345678901231", "[20]01", 0, 50, 5, 145, 290, 116.28 },
+ /*113*/ { BARCODE_DBAR_OMN_CC, "1234567890123", "[20]01", 0, 21, 5, 100, 200, 58.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", 0, 41, 5, 134, 268, 98.279999 },
+ /*116*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 0, 50, 7, 99, 226, 118 },
+ /*117*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 0, 50, 7, 127, 276, 118 },
+ /*118*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 0, 50, 7, 154, 330, 118 },
+ /*119*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 0, 50, 9, 55, 134, 118 },
+ /*120*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 0, 50, 9, 81, 184, 118 },
+ /*121*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 0, 50, 9, 108, 238, 118 },
+ /*122*/ { BARCODE_DBAR_STK_CC, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48 },
+ /*123*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 0, 80, 11, 56, 112, 160 },
+ /*124*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156 },
+ /*125*/ { BARCODE_CHANNEL, "01", "", 0, 50, 1, 19, 38, 116.28 },
+ /*126*/ { BARCODE_CODEONE, "12345678901234567890", "", 0, 16, 16, 18, 36, 32 },
+ /*127*/ { BARCODE_GRIDMATRIX, "ABC", "", 0, 18, 18, 18, 36, 36 },
+ /*128*/ { BARCODE_UPNQR, "1234567890AB", "", 0, 77, 77, 77, 154, 154 },
+ /*129*/ { BARCODE_ULTRA, "1234567890", "", 0, 13, 13, 18, 36, 26 },
+ /*130*/ { BARCODE_RMQR, "12345", "", 0, 11, 11, 27, 54, 22 },
+ /*131*/ { BARCODE_BC412, "1234567", "", 0, 16.666666, 1, 102, 204, 49.613335 },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol *symbol = NULL;
const char *text;
+ int ret_buf;
char errmsg[128] = {0}; /* Suppress clang -fsanitize=memory false positive */
testStartSymbol(p_ctx->func_name, &symbol);
@@ -713,27 +714,33 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
length = (int) strlen(text);
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);
- assert_zero(ret, "i:%d ZBarcode_Buffer_Vector(%d) ret %d != 0\n", i, data[i].symbology, ret);
+ ret_buf = ZBarcode_Buffer_Vector(symbol, 0);
+ 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);
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,
+ testUtilErrorName(ret),
symbol->height, symbol->rows, symbol->width, symbol->vector->width, symbol->vector->height);
} else {
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);
+ i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height);
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->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",
- 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",
- i, testUtilBarcodeName(data[i].symbology), symbol->vector->height, data[i].expected_vector_height);
+ 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",
+ 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",
+ i, testUtilBarcodeName(data[i].symbology), symbol->vector->height,
+ data[i].expected_vector_height);
assert_nonzero(check_vectors(symbol, errmsg), "i:%d (%s) %s\n",
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 */
/* 49*/ { BARCODE_ISBNX, 0, -1, "9784567890120+12345", 0, 50, 1, 149, 330.0, 110, -1, -1, -1, -1, 0 }, /* ISBN + EAN-5 */
/* 50*/ { BARCODE_ISBNX, -1, EANUPC_GUARD_WHITESPACE, "9784567890120+12345", 0, 50, 1, 149, 330.0, 118, 274, 15.6, 331, 15.6, 5 }, /* ISBN + EAN-5 */
- /* 51*/ { BARCODE_EANX, -1, -1, "1234567+12", 0, 50, 1, 94, 212, 118, 49, 117.2, 182, 15.6, 3 }, /* EAN-8 + EAN-2 */
- /* 52*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567+12", 0, 50, 1, 94, 212, 118, 49, 117.2, 182, 15.6, 3 }, /* EAN-8 + EAN-2 */
- /* 53*/ { BARCODE_EANX, 0, -1, "1234567+12", 0, 50, 1, 94, 212, 110, -1, -1, -1, -1, 0 }, /* EAN-8 + EAN-2 */
- /* 54*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "1234567+12", 0, 50, 1, 94, 212, 118, 182, 15.6, 213, 15.6, 5 }, /* EAN-8 + EAN-2 */
- /* 55*/ { BARCODE_EANX, -1, -1, "1234567+12345", 0, 50, 1, 121, 266, 118, 49, 117.2, 210, 15.6, 3 }, /* EAN-8 + EAN-5 */
- /* 56*/ { BARCODE_EANX, -1, BARCODE_RAW_TEXT, "1234567+12345", 0, 50, 1, 121, 266, 118, 49, 117.2, 210, 15.6, 3 }, /* EAN-8 + EAN-5 */
- /* 57*/ { BARCODE_EANX, 0, -1, "1234567+12345", 0, 50, 1, 121, 266, 110, -1, -1, -1, -1, 0 }, /* EAN-8 + EAN-5 */
- /* 58*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "1234567+12345", 0, 50, 1, 121, 266, 118, 210, 15.6, 210, 15.6, 5 }, /* EAN-8 + EAN-5 */
+ /* 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", 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", 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", 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", 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", 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", 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", 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 },
/* 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 },
@@ -1021,20 +1028,28 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
length = (int) strlen(data[i].data);
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);
- 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_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->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->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->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",
- 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",
- 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);
+ 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);
if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) {
testUtilVectorPrint(symbol);
@@ -1042,25 +1057,27 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
if (data[i].show_hrt) {
assert_nonnull(symbol->vector->strings, "i:%d (%s) vector->strings NULL\n",
- i, testUtilBarcodeName(data[i].symbology));
+ i, testUtilBarcodeName(data[i].symbology));
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",
- 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) {
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);
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 {
assert_null(symbol->vector->strings, "i:%d (%s) vector->strings NULL\n",
- i, testUtilBarcodeName(data[i].symbology));
+ i, testUtilBarcodeName(data[i].symbology));
}
string_cnt = cnt_strings(symbol);
assert_equal(string_cnt, data[i].expected_string_cnt, "i:%d (%s) cnt_strings(symbol) %d != %d\n",
- i, testUtilBarcodeName(data[i].symbology), string_cnt, data[i].expected_string_cnt);
+ i, testUtilBarcodeName(data[i].symbology), string_cnt, data[i].expected_string_cnt);
ZBarcode_Delete(symbol);
}
@@ -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, "" },
/* 7*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012", -1, 0, 118, 226, "1234567890128", -1, "1234567890128", -1, "" },
/* 8*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE, "123456789012+12", -1, 0, 118, 276, "1234567890128+12", -1, "", -1, "" },
- /* 9*/ { BARCODE_EANX, -1, -1, BARCODE_MEMORY_FILE | BARCODE_RAW_TEXT, "123456789012+12", -1, 0, 118, 276, "1234567890128+12", -1, "1234567890128+12", -1, "" },
+ /* 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, "" },
/* 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 */
@@ -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,
data[i].data, data[i].length, debug);
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
- expected_raw_length = data[i].expected_raw_length == -1 ? (int) strlen(data[i].expected_raw) : data[i].expected_raw_length;
+ expected_raw_length = data[i].expected_raw_length == -1 ? (int) strlen(data[i].expected_raw)
+ : data[i].expected_raw_length;
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n",
@@ -3221,9 +3239,12 @@ static void test_hrt_raw_text(const testCtx *const p_ctx) {
i, symbol->errtxt, data[i].expected_errtxt);
assert_nonnull(symbol->vector, "i:%d ZBarcode_Print(%s) vector NULL\n",
i, testUtilBarcodeName(data[i].symbology));
- 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_equal(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->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);
ZBarcode_Delete(symbol);
@@ -3247,10 +3268,10 @@ int main(int argc, char *argv[]) {
{ "test_scale", test_scale },
{ "test_guard_descent", test_guard_descent },
{ "test_quiet_zones", test_quiet_zones },
- { "test_text_gap", test_text_gap, },
+ { "test_text_gap", test_text_gap },
{ "test_height", test_height },
{ "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));
diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c
index ce0cb838..a93381bb 100644
--- a/backend/tests/testcommon.c
+++ b/backend/tests/testcommon.c
@@ -2915,6 +2915,10 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
if (upcean) {
if (symbology == BARCODE_EANX_CC && (primary_len <= 8 || (addon_posn && addon_posn <= 8))) {
bwipp_barcode = "ean8composite";
+ if (addon_posn) {
+ sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%spermitaddon",
+ strlen(bwipp_opts_buf) ? " " : "");
+ }
}
if (addon_posn) {
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)
&& (data_len <= 8 || (addon_posn && addon_posn <= 8))) {
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) {
testUtilISBNHyphenate(bwipp_data, addon_posn);
diff --git a/backend/tests/tools/bwipp_dump.ps.tar.xz b/backend/tests/tools/bwipp_dump.ps.tar.xz
index 25bbce81..9451c5de 100644
Binary files a/backend/tests/tools/bwipp_dump.ps.tar.xz and b/backend/tests/tools/bwipp_dump.ps.tar.xz differ
diff --git a/backend/upcean.c b/backend/upcean.c
index 3cf211da..d0d5366a 100644
--- a/backend/upcean.c
+++ b/backend/upcean.c
@@ -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'}
};
-/* 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) {
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 */
-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;
char emode, check_digit;
const char *parity;
char src_check_digit = '\0';
- unsigned char equivalent[12];
const unsigned char *hrt = symbol->text;
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'",
src_check_digit, check_digit);
}
+ equivalent[11] = check_digit;
/* Use the number system and check digit information to choose a parity scheme */
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 */
-static int upce(struct zint_symbol *symbol, unsigned char source[], int length, char dest[]) {
- return upce_cc(symbol, source, length, dest, 0 /*cc_rows*/);
+static int upce(struct zint_symbol *symbol, unsigned char source[], int length, char dest[],
+ unsigned char equivalent[12]) {
+ return upce_cc(symbol, source, length, dest, 0 /*cc_rows*/, equivalent);
}
/* 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) {
unsigned char first_part[14], second_part[6];
unsigned char local_source[20]; /* Allow 13 + "+" + 5 + 1 */
+ unsigned char equivalent[12] = {0}; /* For UPC-E - GTIN-12 equivalent */
char dest[1000] = {0};
int with_addon;
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_CHK:
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 {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 290,
"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 + 2] = 2;
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 {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 291,
"Input length %d wrong (6, 7 or 8 characters required)", first_part_len);
@@ -944,10 +947,40 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int len
ean_add_on(second_part, second_part_len, dest, addon_gap);
hrt_cat_chr_nochk(symbol, '+');
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 */
- return ZINT_ERROR_MEMORY; /* `rt_cpy()` only fails with OOM */
+ 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 */
+ }
+ } 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));
diff --git a/docs/manual.html b/docs/manual.html
index 524d33fc..9477870d 100644
--- a/docs/manual.html
+++ b/docs/manual.html
@@ -4343,10 +4343,12 @@ character set the data is in (UTF-8 data will be converted) in
href="#fn16" class="footnote-ref" id="fnref16"
role="doc-noteref">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 a plus (+
) sign. GS1 Composite data if any will
-be separated from the primary data (including any EAN/UPC add-ons) by a
-pipe (|
) character.
|
)
+character.
As a convenience the conversion done by Zint from UTF-8 to ECIs is diff --git a/docs/manual.pmd b/docs/manual.pmd index fb19b78c..a6386b97 100644 --- a/docs/manual.pmd +++ b/docs/manual.pmd @@ -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 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 -represented as `GS` characters. For EAN/UPC data, add-ons will be separated from -the main data with a plus (`+`) sign. GS1 Composite data if any will be -separated from the primary data (including any EAN/UPC add-ons) by a pipe (`|`) -character. +represented as `GS` (ASCII 29) characters. UPC-A and UPC-E data will be expanded +to EAN-13, as will EAN-8 but only if it has an add-on (otherwise it will remain +at 8 digits), and 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. [^15]: DotCode, Han Xin, Micro QR Code, QR Code and UPNQR have variable masks. Rectangular Micro QR Code has a fixed mask (4). diff --git a/docs/manual.txt b/docs/manual.txt index 3a385f1e..0b03a536 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -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 (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 -characters. For EAN/UPC data, add-ons will be separated from the main data with -a plus (+) sign. GS1 Composite data if any will be separated from the primary -data (including any EAN/UPC add-ons) by a pipe (|) character. +(ASCII 29) characters. UPC-A and UPC-E data will be expanded to EAN-13, as will +EAN-8 but only if it has an add-on (otherwise it will remain at 8 digits), and +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