1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-06-10 07:33:43 +00:00

RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7

QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
  certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
  rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
  button, independently movable picker (NULL parent), preview colour changes,
  preview Data Window changes, add clear data (del) buttons, add zap button
  and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
  UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
  various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
This commit is contained in:
gitlost
2022-06-09 21:52:02 +01:00
parent fcd8492629
commit e30e1f9651
71 changed files with 2739 additions and 1027 deletions
+3 -2
View File
@@ -27,6 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
/* Note BARCODE_GS1_128, BARCODE_EAN14, BARCODE_NVE18 also tested in test_gs1.c */
@@ -102,7 +103,7 @@ static void test_large(int index, int debug) {
testFinish();
}
int c128_hrt_cpy_iso8859_1(struct zint_symbol *symbol, const unsigned char source[], const int length);
INTERNAL int c128_hrt_cpy_iso8859_1_test(struct zint_symbol *symbol, const unsigned char source[], const int length);
static void test_hrt_cpy_iso8859_1(int index, int debug) {
@@ -157,7 +158,7 @@ static void test_hrt_cpy_iso8859_1(int index, int debug) {
length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
ret = c128_hrt_cpy_iso8859_1(&symbol, (unsigned char *) data[i].data, length);
ret = c128_hrt_cpy_iso8859_1_test(&symbol, (unsigned char *) data[i].data, length);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) {
for (j = 0; j < ret; j++) {
fprintf(stderr, "symbol.text[%d] %2X\n", j, symbol.text[j]);
+9 -8
View File
@@ -27,6 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
#include "testcommon.h"
#include "../gs1.h"
@@ -655,8 +656,8 @@ static void test_reader_init(int index, int generate, int debug) {
#define ZINT_TEST_ENCODING
#ifdef ZINT_TEST_ENCODING
STATIC_UNLESS_ZINT_TEST int dm_encode(struct zint_symbol *symbol, const unsigned char source[],
const int length, const int eci, const int gs1, unsigned char target[], int *p_tp);
INTERNAL int dm_encode_test(struct zint_symbol *symbol, const unsigned char source[], const int length, const int eci,
const int gs1, unsigned char target[], int *p_tp);
#endif
static void test_input(int index, int generate, int debug) {
@@ -1019,7 +1020,7 @@ static void test_input(int index, int generate, int debug) {
binlen = 0;
symbol->input_mode = data[i - 1].input_mode;
gs1 = (symbol->input_mode & 0x07) != GS1_MODE ? 0 : (symbol->output_options & GS1_GS_SEPARATOR) ? 2 : 1;
ret = dm_encode(symbol, text, length, symbol->eci, gs1, binary[0], &binlen);
ret = dm_encode_test(symbol, text, length, symbol->eci, gs1, binary[0], &binlen);
assert_zero(ret, "i:%d dm_encode() FAST_MODE ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
binlens[0] = binlen;
@@ -1027,7 +1028,7 @@ static void test_input(int index, int generate, int debug) {
binlen = 0;
symbol->input_mode = data[i].input_mode;
gs1 = (symbol->input_mode & 0x07) != GS1_MODE ? 0 : (symbol->output_options & GS1_GS_SEPARATOR) ? 2 : 1;
ret = dm_encode(symbol, text, length, symbol->eci, gs1, binary[1], &binlen);
ret = dm_encode_test(symbol, text, length, symbol->eci, gs1, binary[1], &binlen);
assert_zero(ret, "i:%d dm_encode() minimal ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
binlens[1] = binlen;
@@ -5261,7 +5262,7 @@ static void test_encode(int index, int generate, int debug) {
binlen = 0;
symbol->input_mode = data[i - 1].input_mode;
gs1 = (symbol->input_mode & 0x07) != GS1_MODE ? 0 : (symbol->output_options & GS1_GS_SEPARATOR) ? 2 : 1;
ret = dm_encode(symbol, (unsigned char *) data[i].data, length, symbol->eci, gs1, binary[0], &binlen);
ret = dm_encode_test(symbol, (unsigned char *) data[i].data, length, symbol->eci, gs1, binary[0], &binlen);
assert_zero(ret, "i:%d dm_encode() FAST_MODE ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
binlens[0] = binlen;
@@ -5269,7 +5270,7 @@ static void test_encode(int index, int generate, int debug) {
binlen = 0;
symbol->input_mode = data[i].input_mode;
gs1 = (symbol->input_mode & 0x07) != GS1_MODE ? 0 : (symbol->output_options & GS1_GS_SEPARATOR) ? 2 : 1;
ret = dm_encode(symbol, (unsigned char *) data[i].data, length, symbol->eci, gs1, binary[1], &binlen);
ret = dm_encode_test(symbol, (unsigned char *) data[i].data, length, symbol->eci, gs1, binary[1], &binlen);
assert_zero(ret, "i:%d dm_encode() minimal ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
binlens[1] = binlen;
@@ -6627,7 +6628,7 @@ static void test_minimalenc(int index, int debug) {
binlen = 0;
symbol->input_mode |= FAST_MODE;
gs1 = (symbol->input_mode & 0x07) != GS1_MODE ? 0 : (symbol->output_options & GS1_GS_SEPARATOR) ? 2 : 1;
ret = dm_encode(symbol, (unsigned char *) data[i].data, length, symbol->eci, gs1, binary[0], &binlen);
ret = dm_encode_test(symbol, (unsigned char *) data[i].data, length, symbol->eci, gs1, binary[0], &binlen);
assert_equal(ret, data[i].ret, "i:%d dm_encode() FAST_MODE ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
binlens[0] = binlen;
@@ -6635,7 +6636,7 @@ static void test_minimalenc(int index, int debug) {
binlen = 0;
symbol->input_mode &= ~FAST_MODE;
gs1 = (symbol->input_mode & 0x07) != GS1_MODE ? 0 : (symbol->output_options & GS1_GS_SEPARATOR) ? 2 : 1;
ret = dm_encode(symbol, (unsigned char *) data[i].data, length, symbol->eci, gs1, binary[1], &binlen);
ret = dm_encode_test(symbol, (unsigned char *) data[i].data, length, symbol->eci, gs1, binary[1], &binlen);
assert_equal(ret, data[i].ret, "i:%d dm_encode() minimal ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
binlens[1] = binlen;
+77 -49
View File
@@ -27,6 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* Intelligent Mail barcode Encoder Test Case Reference Set (csv file)
* Copyright (C) 2009 U.S. Postal Service
@@ -34,6 +35,12 @@
#include "testcommon.h"
#include <time.h>
#define TEST_PERF_TIME(arg) (((arg) * 1000.0) / CLOCKS_PER_SEC)
#define TEST_CSV_PERF_ITERATIONS 100
//#define TEST_IMAIL_CSV_MAX 300
static void test_csv(int index, int debug) {
@@ -52,82 +59,103 @@ static void test_csv(int index, int debug) {
int ret;
int lc = 0;
int j;
clock_t start;
clock_t total = 0;
int test_performance = debug & ZINT_DEBUG_TEST_PERFORMANCE; /* -d 256 */
int perf_iterations = test_performance ? TEST_CSV_PERF_ITERATIONS : 1;
testStart("test_csv");
if (test_performance) {
printf("test_csv perf iterations: %d\n", perf_iterations);
}
assert_nonzero(testUtilDataPath(csvfile, sizeof(csvfile),
"/backend/tests/data/imail/usps/", "uspsIMbEncoderTestCases.csv"), "testUtilDataPath == 0\n");
fd = fopen(csvfile, "r");
assert_nonnull(fd, "fopen(%s) == NULL", csvfile);
for (j = 0; j < perf_iterations; j++) {
fd = fopen(csvfile, "r");
assert_nonnull(fd, "fopen(%s) == NULL", csvfile);
while (fgets(buffer, sizeof(buffer), fd) != NULL) {
const char *b;
struct zint_symbol *symbol;
while (fgets(buffer, sizeof(buffer), fd) != NULL) {
const char *b;
struct zint_symbol *symbol;
lc++;
lc++;
if (index != -1 && lc != index + 1) continue;
if (index != -1 && lc != index + 1) continue;
#ifdef TEST_IMAIL_CSV_MAX
if (lc > TEST_IMAIL_CSV_MAX && index == -1) {
break;
}
#endif
#ifdef TEST_IMAIL_CSV_MAX
if (lc > TEST_IMAIL_CSV_MAX && index == -1) {
break;
}
#endif
id[0] = tracking_code[0] = routing_code[0] = expected_daft[0] = return_code[0] = '\0';
id[0] = tracking_code[0] = routing_code[0] = expected_daft[0] = return_code[0] = '\0';
b = testUtilReadCSVField(buffer, id, sizeof(id));
assert_nonnull(b, "lc:%d id b == NULL", lc);
assert_equal(*b, ',', "lc:%d id *b %c != ','", lc, *b);
b = testUtilReadCSVField(buffer, id, sizeof(id));
assert_nonnull(b, "lc:%d id b == NULL", lc);
assert_equal(*b, ',', "lc:%d id *b %c != ','", lc, *b);
b = testUtilReadCSVField(++b, tracking_code, sizeof(tracking_code));
assert_nonnull(b, "lc:%d tracking_code b == NULL", lc);
assert_equal(*b, ',', "lc:%d tracking_code *b %c != ','", lc, *b);
b = testUtilReadCSVField(++b, tracking_code, sizeof(tracking_code));
assert_nonnull(b, "lc:%d tracking_code b == NULL", lc);
assert_equal(*b, ',', "lc:%d tracking_code *b %c != ','", lc, *b);
b = testUtilReadCSVField(++b, routing_code, sizeof(routing_code));
assert_nonnull(b, "lc:%d routing_code b == NULL", lc);
assert_equal(*b, ',', "lc:%d routing_code *b %c != ','", lc, *b);
b = testUtilReadCSVField(++b, routing_code, sizeof(routing_code));
assert_nonnull(b, "lc:%d routing_code b == NULL", lc);
assert_equal(*b, ',', "lc:%d routing_code *b %c != ','", lc, *b);
b = testUtilReadCSVField(++b, expected_daft, sizeof(expected_daft));
assert_nonnull(b, "lc:%d expected_daft b == NULL", lc);
assert_equal(*b, ',', "lc:%d expected_daft *b %c != ','", lc, *b);
b = testUtilReadCSVField(++b, expected_daft, sizeof(expected_daft));
assert_nonnull(b, "lc:%d expected_daft b == NULL", lc);
assert_equal(*b, ',', "lc:%d expected_daft *b %c != ','", lc, *b);
b = testUtilReadCSVField(++b, return_code, sizeof(return_code));
assert_nonnull(b, "lc:%d return_code b == NULL", lc);
assert_equal(*b, ',', "lc:%d return_code *b %c != ','", lc, *b);
b = testUtilReadCSVField(++b, return_code, sizeof(return_code));
assert_nonnull(b, "lc:%d return_code b == NULL", lc);
assert_equal(*b, ',', "lc:%d return_code *b %c != ','", lc, *b);
strcpy(data, tracking_code);
strcat(data, "-");
strcat(data, routing_code);
strcpy(data, tracking_code);
strcat(data, "-");
strcat(data, routing_code);
assert_nonzero(strlen(data), "lc:%d strlen(data) == 0", lc);
assert_nonzero(strlen(data), "lc:%d strlen(data) == 0", lc);
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
symbol->symbology = BARCODE_USPS_IMAIL;
symbol->debug |= debug;
symbol->symbology = BARCODE_USPS_IMAIL;
symbol->debug |= debug;
ret = ZBarcode_Encode(symbol, (unsigned char *) data, (int) strlen(data));
if (test_performance) {
start = clock();
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data, (int) strlen(data));
if (test_performance) {
total += clock() - start;
}
if (strcmp(return_code, "00") == 0) {
if (strcmp(return_code, "00") == 0) {
assert_zero(ret, "lc:%d ZBarcode_Encode ret %d != 0\n", lc, ret);
assert_zero(ret, "lc:%d ZBarcode_Encode ret %d != 0\n", lc, ret);
assert_equal(symbol->rows, 3, "rows %d != 3", symbol->rows);
assert_equal(symbol->rows, 3, "rows %d != 3", symbol->rows);
ret = testUtilDAFTConvert(symbol, actual_daft, sizeof(actual_daft));
assert_nonzero(ret, "lc:%d testUtilDAFTConvert == 0", lc);
assert_zero(strcmp(actual_daft, expected_daft), "lc:%d\n actual %s\nexpected %s\n", lc, actual_daft, expected_daft);
} else {
assert_nonzero(ret, "lc:%d ZBarcode_Encode ret %d == 0\n", lc, ret);
}
ret = testUtilDAFTConvert(symbol, actual_daft, sizeof(actual_daft));
assert_nonzero(ret, "lc:%d testUtilDAFTConvert == 0", lc);
assert_zero(strcmp(actual_daft, expected_daft), "lc:%d\n actual %s\nexpected %s\n", lc, actual_daft, expected_daft);
} else {
assert_nonzero(ret, "lc:%d ZBarcode_Encode ret %d == 0\n", lc, ret);
}
ZBarcode_Delete(symbol);
}
ZBarcode_Delete(symbol);
}
assert_zero(fclose(fd), "fclose != 0\n");
assert_zero(fclose(fd), "fclose != 0\n");
}
if (test_performance) {
printf("test_csv perf total: %8gms\n", TEST_PERF_TIME(total));
}
testFinish();
}
+6 -4
View File
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020 - 2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2022 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -27,7 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* vim: set ts=4 sw=4 et : */
/* SPDX-License-Identifier: BSD-3-Clause */
#include "testcommon.h"
#include "../large.h"
@@ -51,7 +51,7 @@
#define LI(l, h) { l, h }
int clz_u64(uint64_t x);
INTERNAL int clz_u64_test(uint64_t x);
static void test_clz_u64(int index) {
@@ -197,7 +197,7 @@ static void test_clz_u64(int index) {
if (index != -1 && i != index) continue;
ret = clz_u64(data[i].s);
ret = clz_u64_test(data[i].s);
assert_equal(ret, data[i].ret, "i:%d 0x%" LX_FMT "X ret %d != %d\n", i, data[i].s, ret, data[i].ret);
}
@@ -904,3 +904,5 @@ int main(int argc, char *argv[]) {
return 0;
}
/* vim: set ts=4 sw=4 et : */
+134 -35
View File
@@ -27,6 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
#include "testcommon.h"
#include <fcntl.h>
@@ -284,12 +285,12 @@ static void test_checks_segs(int index, int debug) {
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 205: Input segment count 0" },
/* 0*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 205: No input data" },
/* 1*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 257, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 771: Too many input segments (max 256)" },
/* 2*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 772: Input segment 0 source NULL" },
/* 3*/ { BARCODE_CODE128, -1, { { TU(""), 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 773: Input segment 0 length zero" },
/* 3*/ { BARCODE_CODE128, -1, { { TU(""), 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 778: No input data" },
/* 4*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 0 }, { NULL, 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 772: Input segment 1 source NULL" },
/* 4*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 0 }, { TU(""), 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 773: Input segment 1 length zero" },
/* 4*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 0 }, { TU(""), 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 773: Input segment 1 empty" },
/* 5*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 0 } }, 2, -1, 4, -1, ZINT_ERROR_INVALID_OPTION, "Error 774: Symbol ECI 4 must match segment zero ECI 3" },
/* 6*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 775: Symbology does not support multiple segments" },
/* 7*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching" },
@@ -330,6 +331,63 @@ static void test_checks_segs(int index, int debug) {
testFinish();
}
static void test_input_data(int index, int debug) {
struct item {
int symbology;
int input_mode;
char *data;
int length;
char *composite;
int ret;
char *expected;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_CODE128, -1, "1234", -1, "", 0, "" },
/* 1*/ { BARCODE_GS1_128, -1, "[01]12345678901231", -1, "", 0, "" },
/* 2*/ { BARCODE_GS1_128, -1, "", -1, "", ZINT_ERROR_INVALID_DATA, "Error 778: No input data" },
/* 3*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", -1, "[10]121212", 0, "" },
/* 4*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", -1, "", ZINT_ERROR_INVALID_DATA, "Error 779: No composite data in 2D component" },
/* 5*/ { BARCODE_GS1_128_CC, -1, "", -1, "[10]121212", ZINT_ERROR_INVALID_OPTION, "Error 445: No primary (linear) message in 2D composite" },
/* 6*/ { BARCODE_DATAMATRIX, -1, "", -1, "", ZINT_ERROR_INVALID_DATA, "Error 778: No input data (segment 0 empty)" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol *symbol;
char *text;
testStart("test_input_data");
for (i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
if (is_composite(data[i].symbology)) {
text = data[i].composite;
strcpy(symbol->primary, data[i].data);
} else {
text = data[i].data;
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
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 = strcmp(symbol->errtxt, data[i].expected);
assert_zero(ret, "i:%d (%d) strcmp(%s, %s) %d != 0\n", i, data[i].symbology, symbol->errtxt, data[i].expected, ret);
ZBarcode_Delete(symbol);
}
testFinish();
}
static void test_symbologies(void) {
int i, ret;
struct zint_symbol symbol = {0};
@@ -416,32 +474,72 @@ static void test_escape_char_process(int index, int generate, int debug) {
/* 6*/ { BARCODE_MAXICODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 30, "(144) 04 3E 3E 00 04 07 08 09 0A 0B 03 3D 2C 24 19 1E 23 1B 18 0E 0C 0D 1E 21 3C 1E 3C 31", 0, "" },
/* 7*/ { BARCODE_PDF417, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 120, "(24) 16 901 0 23 655 318 98 18 461 639 893 122 129 92 900 900 872 438 359 646 522 773 831", 0, "" },
/* 8*/ { BARCODE_ULTRA, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 20, "(15) 257 0 4 7 8 9 10 11 12 13 27 29 30 129 92", 0, "" },
/* 9*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\c", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character in input data", 0, "" },
/* 10*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\", ZINT_ERROR_INVALID_DATA, 0, "Error 236: Incomplete escape character in input data", 0, "" },
/* 11*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete escape character in input data", 0, "" },
/* 12*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete escape character in input data", 0, "" },
/* 13*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1g", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Corrupt escape character in input data", 0, "" },
/* 14*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xA01\\xFF", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 0, "" },
/* 15*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00A01\\u00FF", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 16*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xc3\\xbF", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 0, "" },
/* 17*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00fF", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 18*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\xc3\\xbF", 0, 10, "EB 80 81 47 1E 45 FC 93", 0, "" },
/* 19*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00fF", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 20*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete Unicode escape character in input data", 0, "" },
/* 21*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uF", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete Unicode escape character in input data", 0, "" },
/* 22*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u0F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete Unicode escape character in input data", 0, "" },
/* 23*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uFG", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete Unicode escape character in input data", 0, "" },
/* 24*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete Unicode escape character in input data", 0, "" },
/* 25*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00FG", ZINT_ERROR_INVALID_DATA, 0, "Error 211: Corrupt Unicode escape character in input data", 0, "" },
/* 26*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ufffe", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid Unicode BMP escape character in input data", 0, "Reversed BOM" },
/* 27*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ud800", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid Unicode BMP escape character in input data", 0, "Surrogate" },
/* 28*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\udfff", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid Unicode BMP escape character in input data", 0, "Surrogate" },
/* 29*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\xE2\\x82\\xAC", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 0, "Zint manual 4.10 Ex1" },
/* 30*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\u20AC", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 31*/ { BARCODE_DATAMATRIX, DATA_MODE, 17, "\\xA4", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 32*/ { BARCODE_DATAMATRIX, DATA_MODE, 28, "\\xB1\\x60", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 0, "Zint manual 4.10 Ex2" },
/* 33*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\u5E38", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
/* 34*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u007F", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
/* 9*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", 0, 18, "(32) 01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F E7 32 45 DB 70 5D E3 16 7B 2B 44 60 E1 55 F7 08", 0, "" },
/* 10*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", 0, 23, "2F 80 10 72 09 28 B3 0D 6F F3 00 30 E8 F4 0C 0C 0A E0 00 00 00", 0, "" },
/* 11*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\c", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input data", 0, "" },
/* 12*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\", ZINT_ERROR_INVALID_DATA, 0, "Error 236: Incomplete escape character in input data", 0, "" },
/* 13*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input data", 0, "" },
/* 14*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input data", 0, "" },
/* 15*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1g", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character for '\\x' escape sequence in input data (hexadecimal only)", 0, "" },
/* 16*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" },
/* 17*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" },
/* 18*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" },
/* 19*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12a", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character for '\\d' escape sequence in input data (decimal only)", 0, "" },
/* 20*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" },
/* 21*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o1", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" },
/* 22*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o12", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" },
/* 23*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o128", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character for '\\o' escape sequence in input data (octal only)", 0, "" },
/* 24*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xA01\\xFF", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 0, "" },
/* 25*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1601\\d255", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 26*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o2401\\o377", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 27*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00A01\\u00FF", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 28*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000A01\\U0000FF", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 29*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xc3\\xbF", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 0, "" },
/* 30*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d195\\d191", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 31*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o303\\o277", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 32*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00fF", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 33*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000fF", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 34*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\xc3\\xbF", 0, 10, "EB 80 81 47 1E 45 FC 93", 0, "" },
/* 35*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\d195\\d191", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 36*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\o303\\o277", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 37*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00fF", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 38*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000fF", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 39*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 40*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uF", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 41*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u0F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 42*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uFG", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 43*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 44*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00FG", ZINT_ERROR_INVALID_DATA, 0, "Error 211: Invalid character for '\\u' escape sequence in input data (hexadecimal only)", 0, "" },
/* 45*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ufffe", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\u' escape sequence in input data", 0, "Reversed BOM" },
/* 46*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ud800", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\u' escape sequence in input data", 0, "Surrogate" },
/* 47*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\udfff", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\u' escape sequence in input data", 0, "Surrogate" },
/* 48*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\xE2\\x82\\xAC", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 0, "Zint manual 4.10 Ex1" },
/* 49*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\u20AC", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 50*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\U0020AC", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 51*/ { BARCODE_DATAMATRIX, DATA_MODE, 17, "\\xA4", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 52*/ { BARCODE_DATAMATRIX, DATA_MODE, 28, "\\xB1\\x60", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 0, "Zint manual 4.10 Ex2" },
/* 53*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\u5E38", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
/* 54*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\U005E38", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
/* 55*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u007F", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
/* 56*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U00007F", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
/* 57*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 58*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UF", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 59*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 60*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UFG", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 61*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 62*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00FG", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 63*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ufffe", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Reversed BOM" },
/* 64*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ud800", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Surrogate" },
/* 65*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Udfff", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Surrogate" },
/* 66*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U000F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 67*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 68*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U110000", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\U' escape sequence in input data", 0, "" },
/* 69*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 25, "\\U10FFFF", 0, 14, "F1 1A 01 01 EB 80 EB 80 3F C0 9C 0B 4B B8 DA B7 B6 1A", 0, "" },
/* 70*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 26, "\\U10FFFF", 0, 14, "F1 1B 01 E7 EC 71 D7 6C 20 D6 B3 63 E2 18 B6 4C 7D 3E", 0, "" },
/* 71*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 32, "\\U10FFFF", 0, 32, "F1 21 01 EB 05 32 EB 25 3A 81 7E 98 9B 50 AC 1C E0 4E 51 BA 23", 0, "" },
/* 72*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 33, "\\U10FFFF", 0, 14, "F1 22 01 01 EB 80 EB 80 A3 E5 BE FB 1A 08 94 2E C3 74", 0, "" },
/* 73*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 34, "\\U10FFFF", 0, 16, "F1 23 01 01 01 01 01 01 EB 80 EB 80 F6 F1 5D 2A D1 0A BF BC B8 22 65 0C", 0, "" },
/* 74*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 35, "\\U10FFFF", 0, 16, "F1 24 01 01 01 01 EB 80 EB 80 01 01 7F 58 28 41 7F 63 0E EB A7 D8 D0 1F", 0, "" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@@ -1026,7 +1124,7 @@ static void test_valid_id(void) {
testFinish();
}
STATIC_UNLESS_ZINT_TEST int error_tag(struct zint_symbol *symbol, int error_number, const char *error_string);
INTERNAL int error_tag_test(struct zint_symbol *symbol, int error_number, const char *error_string);
static void test_error_tag(int index) {
@@ -1067,13 +1165,13 @@ static void test_error_tag(int index) {
symbol.warn_level = data[i].warn_level;
ret = error_tag(&symbol, data[i].error_number, data[i].data);
ret = error_tag_test(&symbol, data[i].error_number, data[i].data);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
assert_zero(strcmp(symbol.errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol.errtxt, data[i].expected);
if ((int) strlen(data[i].data) < 100) {
strcpy(symbol.errtxt, data[i].data);
ret = error_tag(&symbol, data[i].error_number, NULL);
ret = error_tag_test(&symbol, data[i].error_number, NULL);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
assert_zero(strcmp(symbol.errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol.errtxt, data[i].expected);
}
@@ -1082,7 +1180,7 @@ static void test_error_tag(int index) {
testFinish();
}
STATIC_UNLESS_ZINT_TEST void strip_bom(unsigned char *source, int *input_length);
INTERNAL void strip_bom_test(unsigned char *source, int *input_length);
static void test_strip_bom(void) {
@@ -1095,7 +1193,7 @@ static void test_strip_bom(void) {
strcpy(buf, data);
length = (int) strlen(buf);
strip_bom(TU(buf), &length);
strip_bom_test(TU(buf), &length);
assert_equal(length, 1, "length %d != 1\n", length);
assert_zero(buf[1], "buf[1] %d != 0\n", buf[1]);
@@ -1103,7 +1201,7 @@ static void test_strip_bom(void) {
strcpy(buf, bom_only);
length = (int) strlen(buf);
strip_bom(TU(buf), &length);
strip_bom_test(TU(buf), &length);
assert_equal(length, 3, "BOM only length %d != 3\n", length);
ret = strcmp(buf, bom_only);
assert_zero(ret, "BOM only strcmp ret %d != 0\n", ret);
@@ -1239,6 +1337,7 @@ int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
{ "test_checks", test_checks, 1, 0, 1 },
{ "test_checks_segs", test_checks_segs, 1, 0, 1 },
{ "test_input_data", test_input_data, 1, 0, 1 },
{ "test_symbologies", test_symbologies, 0, 0, 0 },
{ "test_input_mode", test_input_mode, 1, 0, 1 },
{ "test_escape_char_process", test_escape_char_process, 1, 1, 1 },
+6 -4
View File
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2021-2022 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -27,11 +27,11 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* vim: set ts=4 sw=4 et : */
/* SPDX-License-Identifier: BSD-3-Clause */
#include "testcommon.h"
STATIC_UNLESS_ZINT_TEST int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text,
INTERNAL int out_quiet_zones_test(const struct zint_symbol *symbol, const int hide_text,
float *left, float *right, float *top, float *bottom);
static void test_quiet_zones(void) {
@@ -46,7 +46,7 @@ static void test_quiet_zones(void) {
if (!ZBarcode_ValidID(i)) continue;
symbol.symbology = i;
symbol.output_options = BARCODE_QUIET_ZONES;
ret = out_quiet_zones(&symbol, hide_text, &left, &right, &top, &bottom);
ret = out_quiet_zones_test(&symbol, hide_text, &left, &right, &top, &bottom);
if (i != BARCODE_FLAT) { // Only one which isn't marked as done
assert_nonzero(ret, "i:%d %s not done\n", i, testUtilBarcodeName(i));
}
@@ -67,3 +67,5 @@ int main(int argc, char *argv[]) {
return 0;
}
/* vim: set ts=4 sw=4 et : */
+6 -4
View File
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020 - 2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2022 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -27,7 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* vim: set ts=4 sw=4 et : */
/* SPDX-License-Identifier: BSD-3-Clause */
#include "testcommon.h"
#include <errno.h>
@@ -337,7 +337,7 @@ struct wpng_error_type {
jmp_buf jmpbuf;
};
STATIC_UNLESS_ZINT_TEST void wpng_error_handler(png_structp png_ptr, png_const_charp msg);
INTERNAL void wpng_error_handler_test(png_structp png_ptr, png_const_charp msg);
static void test_wpng_error_handler(void) {
int ret;
@@ -363,7 +363,7 @@ static void test_wpng_error_handler(void) {
fp = fopen(filename, "r");
assert_nonnull(fp, "fopen(%s) for read failed\n", filename);
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, &wpng_error, wpng_error_handler, NULL);
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, &wpng_error, wpng_error_handler_test, NULL);
assert_nonnull(png_ptr, "png_create_write_struct failed\n");
info_ptr = png_create_info_struct(png_ptr);
@@ -429,3 +429,5 @@ int main(int argc, char *argv[]) {
return 0;
}
/* vim: set ts=4 sw=4 et : */
+6 -4
View File
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020 - 2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2022 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -27,7 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* vim: set ts=4 sw=4 et : */
/* SPDX-License-Identifier: BSD-3-Clause */
#include "testcommon.h"
#include <sys/stat.h>
@@ -180,7 +180,7 @@ static void test_print(int index, int generate, int debug) {
testFinish();
}
void ps_convert(const unsigned char *string, unsigned char *ps_string);
INTERNAL void ps_convert_test(const unsigned char *string, unsigned char *ps_string);
static void test_ps_convert(int index) {
@@ -202,7 +202,7 @@ static void test_ps_convert(int index) {
if (index != -1 && i != index) continue;
ps_convert((unsigned char *) data[i].data, converted);
ps_convert_test((unsigned char *) data[i].data, converted);
assert_zero(strcmp((char *) converted, data[i].expected), "i:%d ps_convert(%s) %s != %s\n", i, data[i].data, converted, data[i].expected);
}
@@ -253,3 +253,5 @@ int main(int argc, char *argv[]) {
return 0;
}
/* vim: set ts=4 sw=4 et : */
+606 -17
View File
@@ -27,6 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
#include "testcommon.h"
@@ -288,6 +289,23 @@ static void test_qr_input(int index, int generate, int debug) {
/*125*/ { UNICODE_MODE, 900, 4, 8 << 8, "é", 0, 900, "78 38 44 02 C3 A9 00 EC 11", 1, 1, "ECI-900 B2 (no conversion)" },
/*126*/ { UNICODE_MODE, 16384, 4, 8 << 8, "é", 0, 16384, "7C 04 00 04 02 C3 A9 00 EC", 1, 1, "ECI-16384 B2 (no conversion)" },
/*127*/ { UNICODE_MODE, 3, 4, -1, "product:Google Pixel 4a - 128 GB of Storage - Black;price:$439.97", 0, 3, "(86) 70 34 39 70 72 6F 64 75 63 74 3A 47 6F 6F 67 6C 65 20 50 69 78 65 6C 20 34 61 20 2D", 0, 1, "ECI-3 B57 A8; BWIPP different encodation (B65)" },
/*128*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\176", 0, 0, "80 10 1F 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x817E)" },
/*129*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\177", 0, 0, "40 28 17 F0 EC 11 EC 11 EC", 1, 1, "B2 (0x817F previously used Kanji mode, now excludes trailing 0x7F)" },
/*130*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\200", 0, 0, "80 10 20 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x8180)" },
/*131*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\237\176", 0, 0, "80 1B 5F 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x9F7E)" },
/*132*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\237\177", 0, 0, "40 29 F7 F0 EC 11 EC 11 EC", 1, 1, "B2 (0x9F7F previously used Kanji mode, now excludes trailing 0x7F)" },
/*133*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\340\176", 0, 0, "80 1B BF 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0xE07E)" },
/*134*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\340\177", 0, 0, "40 2E 07 F0 EC 11 EC 11 EC", 1, 1, "B2 (0xE07F previously used Kanji mode, now excludes trailing 0x7F)" },
/*135*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\352\244", 0, 0, "80 1F 92 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0xEAA4, last valid codepoint)" },
/*136*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\353\277", 0, 0, "80 1F FF 80 EC 11 EC 11 EC", 1, 1, "K1 (0xEBBF undefined in Shift JIS but not checked and uses Kanji mode)" },
/*137*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\353\300", 0, 0, "40 2E BC 00 EC 11 EC 11 EC", 1, 1, "B2 (0xEBC0 was always excluded)" },
/*138*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\300", 0, 0, "80 10 40 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x81C0)" },
/*139*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\374", 0, 0, "80 10 5E 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x81FC)" },
/*140*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\375", 0, 0, "40 28 1F D0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FD previously used Kanji mode, now excludes trailing 0xFD)" },
/*141*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\376", 0, 0, "40 28 1F E0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FE previously used Kanji mode, now excludes trailing 0xFE)" },
/*142*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\377", 0, 0, "40 28 1F F0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FF previously used Kanji mode, now excludes trailing 0xFF)" },
/*143*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\377", 0, 0, "40 28 1F F0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FF previously used Kanji mode, now excludes trailing 0xFF)" },
/*144*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\255", 0, 0, "80 10 36 80 EC 11 EC 11 EC", 1, 1, "K1 (0x81AD undefined in Shift JIS but not checked and uses Kanji mode)" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@@ -5854,6 +5872,576 @@ static void test_upnqr_encode(int index, int generate, int debug) {
testFinish();
}
static void test_rmqr_large(int index, int debug) {
struct item {
int option_1;
int option_2;
char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
};
// ISO/IEC 23941:2022 Table 6
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { 2, 1, "1", 12, 0, 7, 43 },
/* 1*/ { 2, 1, "1", 13, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 2*/ { 2, 1, "A", 7, 0, 7, 43 },
/* 3*/ { 2, 1, "A", 8, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 4*/ { 2, 1, "\200", 5, 0, 7, 43 },
/* 5*/ { 2, 1, "\200", 6, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 6*/ { 2, 1, "\201", 6, 0, 7, 43 }, // 3 Shift JIS 0x8181
/* 7*/ { 2, 1, "\201", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, // 4 Shift JIS 0x8181
/* 8*/ { 4, 1, "1", 5, 0, 7, 43 },
/* 9*/ { 4, 1, "1", 6, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 10*/ { 4, 1, "A", 3, 0, 7, 43 },
/* 11*/ { 4, 1, "A", 4, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 12*/ { 4, 1, "\200", 2, 0, 7, 43 },
/* 13*/ { 4, 1, "\200", 3, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 14*/ { 4, 1, "\201", 2, 0, 7, 43 }, // 1 Shift JIS 0x8181
/* 15*/ { 4, 1, "\201", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, // 2 Shift JIS 0x8181
/* 16*/ { 2, 2, "1", 26, 0, 7, 59 },
/* 17*/ { 2, 2, "1", 27, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 18*/ { 2, 2, "A", 16, 0, 7, 59 },
/* 19*/ { 2, 2, "A", 17, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 20*/ { 2, 2, "\200", 11, 0, 7, 59 },
/* 21*/ { 2, 2, "\200", 12, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 22*/ { 2, 2, "\201", 12, 0, 7, 59 }, // 6 Shift JIS 0x8181
/* 23*/ { 2, 2, "\201", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, // 7 Shift JIS 0x8181
/* 24*/ { 4, 2, "1", 14, 0, 7, 59 },
/* 25*/ { 4, 2, "1", 15, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 26*/ { 4, 2, "A", 8, 0, 7, 59 },
/* 27*/ { 4, 2, "A", 9, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 28*/ { 4, 2, "\200", 6, 0, 7, 59 },
/* 29*/ { 4, 2, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 30*/ { 4, 2, "\201", 6, 0, 7, 59 }, // 3 Shift JIS 0x8181
/* 31*/ { 4, 2, "\201", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, // 4 Shift JIS 0x8181
/* 32*/ { 2, 3, "1", 45, 0, 7, 77 },
/* 33*/ { 2, 3, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 34*/ { 2, 3, "A", 27, 0, 7, 77 },
/* 35*/ { 2, 3, "A", 28, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 36*/ { 2, 3, "\200", 19, 0, 7, 77 },
/* 37*/ { 2, 3, "\200", 20, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 38*/ { 2, 3, "\201", 22, 0, 7, 77 }, // 11 Shift JIS 0x8181
/* 39*/ { 2, 3, "\201", 24, ZINT_ERROR_TOO_LONG, -1, -1 }, // 12 Shift JIS 0x8181
/* 40*/ { 4, 3, "1", 21, 0, 7, 77 },
/* 41*/ { 4, 3, "1", 22, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 42*/ { 4, 3, "A", 13, 0, 7, 77 },
/* 43*/ { 4, 3, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 44*/ { 4, 3, "\200", 9, 0, 7, 77 },
/* 45*/ { 4, 3, "\200", 10, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 46*/ { 4, 3, "\201", 10, 0, 7, 77 }, // 5 Shift JIS 0x8181
/* 47*/ { 4, 3, "\201", 12, ZINT_ERROR_TOO_LONG, -1, -1 }, // 6 Shift JIS 0x8181
/* 48*/ { 2, 4, "1", 64, 0, 7, 99 },
/* 49*/ { 2, 4, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 50*/ { 2, 4, "A", 39, 0, 7, 99 },
/* 51*/ { 2, 4, "A", 40, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 52*/ { 2, 4, "\200", 27, 0, 7, 99 },
/* 53*/ { 2, 4, "\200", 28, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 54*/ { 2, 4, "\201", 32, 0, 7, 99 }, // 16 Shift JIS 0x8181
/* 55*/ { 2, 4, "\201", 34, ZINT_ERROR_TOO_LONG, -1, -1 }, // 17 Shift JIS 0x8181
/* 56*/ { 4, 4, "1", 30, 0, 7, 99 },
/* 57*/ { 4, 4, "1", 31, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 58*/ { 4, 4, "A", 18, 0, 7, 99 },
/* 59*/ { 4, 4, "A", 19, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 60*/ { 4, 4, "\200", 13, 0, 7, 99 },
/* 61*/ { 4, 4, "\200", 14, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 62*/ { 4, 4, "\201", 16, 0, 7, 99 }, // 8 Shift JIS 0x8181
/* 63*/ { 4, 4, "\201", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, // 9 Shift JIS 0x8181
/* 64*/ { 2, 5, "1", 102, 0, 7, 139 },
/* 65*/ { 2, 5, "1", 103, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 66*/ { 2, 5, "A", 62, 0, 7, 139 },
/* 67*/ { 2, 5, "A", 63, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 68*/ { 2, 5, "\200", 42, 0, 7, 139 },
/* 69*/ { 2, 5, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 70*/ { 2, 5, "\201", 52, 0, 7, 139 }, // 26 Shift JIS 0x8181
/* 71*/ { 2, 5, "\201", 54, ZINT_ERROR_TOO_LONG, -1, -1 }, // 27 Shift JIS 0x8181
/* 72*/ { 4, 5, "1", 54, 0, 7, 139 },
/* 73*/ { 4, 5, "1", 55, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 74*/ { 4, 5, "A", 33, 0, 7, 139 },
/* 75*/ { 4, 5, "A", 34, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 76*/ { 4, 5, "\200", 22, 0, 7, 139 },
/* 77*/ { 4, 5, "\200", 23, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 78*/ { 4, 5, "\201", 28, 0, 7, 139 }, // 14 Shift JIS 0x8181
/* 79*/ { 4, 5, "\201", 30, ZINT_ERROR_TOO_LONG, -1, -1 }, // 15 Shift JIS 0x8181
/* 80*/ { 2, 6, "1", 26, 0, 9, 43 },
/* 81*/ { 2, 6, "1", 27, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 82*/ { 2, 6, "A", 16, 0, 9, 43 },
/* 83*/ { 2, 6, "A", 17, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 84*/ { 2, 6, "\200", 11, 0, 9, 43 },
/* 85*/ { 2, 6, "\200", 12, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 86*/ { 2, 6, "\201", 12, 0, 9, 43 }, // 6 Shift JIS 0x8181
/* 87*/ { 2, 6, "\201", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, // 7 Shift JIS 0x8181
/* 88*/ { 4, 6, "1", 14, 0, 9, 43 },
/* 89*/ { 4, 6, "1", 15, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 90*/ { 4, 6, "A", 8, 0, 9, 43 },
/* 91*/ { 4, 6, "A", 9, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 92*/ { 4, 6, "\200", 6, 0, 9, 43 },
/* 93*/ { 4, 6, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 94*/ { 4, 6, "\201", 6, 0, 9, 43 }, // 3 Shift JIS 0x8181
/* 95*/ { 4, 6, "\201", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, // 4 Shift JIS 0x8181
/* 96*/ { 2, 7, "1", 47, 0, 9, 59 },
/* 97*/ { 2, 7, "1", 48, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 98*/ { 2, 7, "A", 29, 0, 9, 59 },
/* 99*/ { 2, 7, "A", 30, ZINT_ERROR_TOO_LONG, -1, -1 },
/*100*/ { 2, 7, "\200", 20, 0, 9, 59 },
/*101*/ { 2, 7, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 },
/*102*/ { 2, 7, "\201", 24, 0, 9, 59 }, // 12 Shift JIS 0x8181
/*103*/ { 2, 7, "\201", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, // 13 Shift JIS 0x8181
/*104*/ { 4, 7, "1", 23, 0, 9, 59 },
/*105*/ { 4, 7, "1", 24, ZINT_ERROR_TOO_LONG, -1, -1 },
/*106*/ { 4, 7, "A", 14, 0, 9, 59 },
/*107*/ { 4, 7, "A", 15, ZINT_ERROR_TOO_LONG, -1, -1 },
/*108*/ { 4, 7, "\200", 10, 0, 9, 59 },
/*109*/ { 4, 7, "\200", 11, ZINT_ERROR_TOO_LONG, -1, -1 },
/*110*/ { 4, 7, "\201", 12, 0, 9, 59 }, // 6 Shift JIS 0x8181
/*111*/ { 4, 7, "\201", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, // 7 Shift JIS 0x8181
/*112*/ { 2, 8, "1", 71, 0, 9, 77 },
/*113*/ { 2, 8, "1", 72, ZINT_ERROR_TOO_LONG, -1, -1 },
/*114*/ { 2, 8, "A", 43, 0, 9, 77 },
/*115*/ { 2, 8, "A", 44, ZINT_ERROR_TOO_LONG, -1, -1 },
/*116*/ { 2, 8, "\200", 30, 0, 9, 77 },
/*117*/ { 2, 8, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 },
/*118*/ { 2, 8, "\201", 36, 0, 9, 77 }, // 18 Shift JIS 0x8181
/*119*/ { 2, 8, "\201", 38, ZINT_ERROR_TOO_LONG, -1, -1 }, // 19 Shift JIS 0x8181
/*120*/ { 4, 8, "1", 37, 0, 9, 77 },
/*121*/ { 4, 8, "1", 38, ZINT_ERROR_TOO_LONG, -1, -1 },
/*122*/ { 4, 8, "A", 23, 0, 9, 77 },
/*123*/ { 4, 8, "A", 24, ZINT_ERROR_TOO_LONG, -1, -1 },
/*124*/ { 4, 8, "\200", 16, 0, 9, 77 },
/*125*/ { 4, 8, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 },
/*126*/ { 4, 8, "\201", 18, 0, 9, 77 }, // 9 Shift JIS 0x8181
/*127*/ { 4, 8, "\201", 20, ZINT_ERROR_TOO_LONG, -1, -1 }, // 10 Shift JIS 0x8181
/*128*/ { 2, 9, "1", 97, 0, 9, 99 },
/*129*/ { 2, 9, "1", 98, ZINT_ERROR_TOO_LONG, -1, -1 },
/*130*/ { 2, 9, "A", 59, 0, 9, 99 },
/*131*/ { 2, 9, "A", 60, ZINT_ERROR_TOO_LONG, -1, -1 },
/*132*/ { 2, 9, "\200", 40, 0, 9, 99 },
/*133*/ { 2, 9, "\200", 41, ZINT_ERROR_TOO_LONG, -1, -1 },
/*134*/ { 2, 9, "\201", 50, 0, 9, 99 }, // 25 Shift JIS 0x8181
/*135*/ { 2, 9, "\201", 52, ZINT_ERROR_TOO_LONG, -1, -1 }, // 26 Shift JIS 0x8181
/*136*/ { 4, 9, "1", 49, 0, 9, 99 },
/*137*/ { 4, 9, "1", 50, ZINT_ERROR_TOO_LONG, -1, -1 },
/*138*/ { 4, 9, "A", 30, 0, 9, 99 },
/*139*/ { 4, 9, "A", 31, ZINT_ERROR_TOO_LONG, -1, -1 },
/*140*/ { 4, 9, "\200", 20, 0, 9, 99 },
/*141*/ { 4, 9, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 },
/*142*/ { 4, 9, "\201", 24, 0, 9, 99 }, // 12 Shift JIS 0x8181
/*143*/ { 4, 9, "\201", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, // 13 Shift JIS 0x8181
/*144*/ { 2, 10, "1", 147, 0, 9, 139 },
/*145*/ { 2, 10, "1", 148, ZINT_ERROR_TOO_LONG, -1, -1 },
/*146*/ { 2, 10, "A", 89, 0, 9, 139 },
/*147*/ { 2, 10, "A", 90, ZINT_ERROR_TOO_LONG, -1, -1 },
/*148*/ { 2, 10, "\200", 61, 0, 9, 139 },
/*149*/ { 2, 10, "\200", 62, ZINT_ERROR_TOO_LONG, -1, -1 },
/*150*/ { 2, 10, "\201", 76, 0, 9, 139 }, // 36 Shift JIS 0x8181
/*151*/ { 2, 10, "\201", 78, ZINT_ERROR_TOO_LONG, -1, -1 }, // 37 Shift JIS 0x8181
/*152*/ { 4, 10, "1", 75, 0, 9, 139 },
/*153*/ { 4, 10, "1", 76, ZINT_ERROR_TOO_LONG, -1, -1 },
/*154*/ { 4, 10, "A", 46, 0, 9, 139 },
/*155*/ { 4, 10, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 },
/*156*/ { 4, 10, "\200", 31, 0, 9, 139 },
/*157*/ { 4, 10, "\200", 32, ZINT_ERROR_TOO_LONG, -1, -1 },
/*158*/ { 4, 10, "\201", 38, 0, 9, 139 }, // 19 Shift JIS 0x8181
/*159*/ { 4, 10, "\201", 40, ZINT_ERROR_TOO_LONG, -1, -1 }, // 20 Shift JIS 0x8181
/*160*/ { 2, 11, "1", 14, 0, 11, 27 },
/*161*/ { 2, 11, "1", 15, ZINT_ERROR_TOO_LONG, -1, -1 },
/*162*/ { 2, 11, "A", 8, 0, 11, 27 },
/*163*/ { 2, 11, "A", 9, ZINT_ERROR_TOO_LONG, -1, -1 },
/*164*/ { 2, 11, "\200", 6, 0, 11, 27 },
/*165*/ { 2, 11, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 },
/*166*/ { 2, 11, "\201", 6, 0, 11, 27 }, // 3 Shift JIS 0x8181
/*167*/ { 2, 11, "\201", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, // 4 Shift JIS 0x8181
/*168*/ { 4, 11, "1", 9, 0, 11, 27 },
/*169*/ { 4, 11, "1", 10, ZINT_ERROR_TOO_LONG, -1, -1 },
/*170*/ { 4, 11, "A", 6, 0, 11, 27 },
/*171*/ { 4, 11, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 },
/*172*/ { 4, 11, "\200", 4, 0, 11, 27 },
/*173*/ { 4, 11, "\200", 5, ZINT_ERROR_TOO_LONG, -1, -1 },
/*174*/ { 4, 11, "\201", 4, 0, 11, 27 }, // 2 Shift JIS 0x8181
/*175*/ { 4, 11, "\201", 6, ZINT_ERROR_TOO_LONG, -1, -1 }, // 3 Shift JIS 0x8181
/*176*/ { 2, 12, "1", 42, 0, 11, 43 },
/*177*/ { 2, 12, "1", 43, ZINT_ERROR_TOO_LONG, -1, -1 },
/*178*/ { 2, 12, "A", 26, 0, 11, 43 },
/*179*/ { 2, 12, "A", 27, ZINT_ERROR_TOO_LONG, -1, -1 },
/*180*/ { 2, 12, "\200", 18, 0, 11, 43 },
/*181*/ { 2, 12, "\200", 19, ZINT_ERROR_TOO_LONG, -1, -1 },
/*182*/ { 2, 12, "\201", 22, 0, 11, 43 }, // 11 Shift JIS 0x8181
/*183*/ { 2, 12, "\201", 24, ZINT_ERROR_TOO_LONG, -1, -1 }, // 12 Shift JIS 0x8181
/*184*/ { 4, 12, "1", 23, 0, 11, 43 },
/*185*/ { 4, 12, "1", 24, ZINT_ERROR_TOO_LONG, -1, -1 },
/*186*/ { 4, 12, "A", 14, 0, 11, 43 },
/*187*/ { 4, 12, "A", 15, ZINT_ERROR_TOO_LONG, -1, -1 },
/*188*/ { 4, 12, "\200", 10, 0, 11, 43 },
/*189*/ { 4, 12, "\200", 11, ZINT_ERROR_TOO_LONG, -1, -1 },
/*190*/ { 4, 12, "\201", 12, 0, 11, 43 }, // 6 Shift JIS 0x8181
/*191*/ { 4, 12, "\201", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, // 7 Shift JIS 0x8181
/*192*/ { 2, 13, "1", 71, 0, 11, 59 },
/*193*/ { 2, 13, "1", 72, ZINT_ERROR_TOO_LONG, -1, -1 },
/*194*/ { 2, 13, "A", 43, 0, 11, 59 },
/*195*/ { 2, 13, "A", 44, ZINT_ERROR_TOO_LONG, -1, -1 },
/*196*/ { 2, 13, "\200", 30, 0, 11, 59 },
/*197*/ { 2, 13, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 },
/*198*/ { 2, 13, "\201", 36, 0, 11, 59 }, // 18 Shift JIS 0x8181
/*199*/ { 2, 13, "\201", 38, ZINT_ERROR_TOO_LONG, -1, -1 }, // 19 Shift JIS 0x8181
/*200*/ { 4, 13, "1", 33, 0, 11, 59 },
/*201*/ { 4, 13, "1", 34, ZINT_ERROR_TOO_LONG, -1, -1 },
/*202*/ { 4, 13, "A", 20, 0, 11, 59 },
/*203*/ { 4, 13, "A", 21, ZINT_ERROR_TOO_LONG, -1, -1 },
/*204*/ { 4, 13, "\200", 14, 0, 11, 59 },
/*205*/ { 4, 13, "\200", 15, ZINT_ERROR_TOO_LONG, -1, -1 },
/*206*/ { 4, 13, "\201", 16, 0, 11, 59 }, // 8 Shift JIS 0x8181
/*207*/ { 4, 13, "\201", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, // 9 Shift JIS 0x8181
/*208*/ { 2, 14, "1", 100, 0, 11, 77 },
/*209*/ { 2, 14, "1", 101, ZINT_ERROR_TOO_LONG, -1, -1 },
/*210*/ { 2, 14, "A", 60, 0, 11, 77 },
/*211*/ { 2, 14, "A", 61, ZINT_ERROR_TOO_LONG, -1, -1 },
/*212*/ { 2, 14, "\200", 41, 0, 11, 77 },
/*213*/ { 2, 14, "\200", 42, ZINT_ERROR_TOO_LONG, -1, -1 },
/*214*/ { 2, 14, "\201", 50, 0, 11, 77 }, // 25 Shift JIS 0x8181
/*215*/ { 2, 14, "\201", 52, ZINT_ERROR_TOO_LONG, -1, -1 }, // 26 Shift JIS 0x8181
/*216*/ { 4, 14, "1", 52, 0, 11, 77 },
/*217*/ { 4, 14, "1", 53, ZINT_ERROR_TOO_LONG, -1, -1 },
/*218*/ { 4, 14, "A", 31, 0, 11, 77 },
/*219*/ { 4, 14, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 },
/*220*/ { 4, 14, "\200", 21, 0, 11, 77 },
/*221*/ { 4, 14, "\200", 22, ZINT_ERROR_TOO_LONG, -1, -1 },
/*222*/ { 4, 14, "\201", 26, 0, 11, 77 }, // 13 Shift JIS 0x8181
/*223*/ { 4, 14, "\201", 28, ZINT_ERROR_TOO_LONG, -1, -1 }, // 14 Shift JIS 0x8181
/*224*/ { 2, 15, "1", 133, 0, 11, 99 },
/*225*/ { 2, 15, "1", 134, ZINT_ERROR_TOO_LONG, -1, -1 },
/*226*/ { 2, 15, "A", 81, 0, 11, 99 },
/*227*/ { 2, 15, "A", 82, ZINT_ERROR_TOO_LONG, -1, -1 },
/*228*/ { 2, 15, "\200", 55, 0, 11, 99 },
/*229*/ { 2, 15, "\200", 56, ZINT_ERROR_TOO_LONG, -1, -1 },
/*230*/ { 2, 15, "\201", 68, 0, 11, 99 }, // 34 Shift JIS 0x8181
/*231*/ { 2, 15, "\201", 70, ZINT_ERROR_TOO_LONG, -1, -1 }, // 35 Shift JIS 0x8181
/*232*/ { 4, 15, "1", 66, 0, 11, 99 },
/*233*/ { 4, 15, "1", 67, ZINT_ERROR_TOO_LONG, -1, -1 },
/*234*/ { 4, 15, "A", 40, 0, 11, 99 },
/*235*/ { 4, 15, "A", 41, ZINT_ERROR_TOO_LONG, -1, -1 },
/*236*/ { 4, 15, "\200", 27, 0, 11, 99 },
/*237*/ { 4, 15, "\200", 28, ZINT_ERROR_TOO_LONG, -1, -1 },
/*238*/ { 4, 15, "\201", 34, 0, 11, 99 }, // 17 Shift JIS 0x8181
/*239*/ { 4, 15, "\201", 36, ZINT_ERROR_TOO_LONG, -1, -1 }, // 18 Shift JIS 0x8181
/*240*/ { 2, 16, "1", 198, 0, 11, 139 },
/*241*/ { 2, 16, "1", 199, ZINT_ERROR_TOO_LONG, -1, -1 },
/*242*/ { 2, 16, "A", 120, 0, 11, 139 },
/*243*/ { 2, 16, "A", 121, ZINT_ERROR_TOO_LONG, -1, -1 },
/*244*/ { 2, 16, "\200", 82, 0, 11, 139 },
/*245*/ { 2, 16, "\200", 83, ZINT_ERROR_TOO_LONG, -1, -1 },
/*246*/ { 2, 16, "\201", 102, 0, 11, 139 }, // 51 Shift JIS 0x8181
/*247*/ { 2, 16, "\201", 104, ZINT_ERROR_TOO_LONG, -1, -1 }, // 52 Shift JIS 0x8181
/*248*/ { 4, 16, "1", 97, 0, 11, 139 },
/*249*/ { 4, 16, "1", 98, ZINT_ERROR_TOO_LONG, -1, -1 },
/*250*/ { 4, 16, "A", 59, 0, 11, 139 },
/*251*/ { 4, 16, "A", 60, ZINT_ERROR_TOO_LONG, -1, -1 },
/*252*/ { 4, 16, "\200", 40, 0, 11, 139 },
/*253*/ { 4, 16, "\200", 41, ZINT_ERROR_TOO_LONG, -1, -1 },
/*254*/ { 4, 16, "\201", 50, 0, 11, 139 }, // 25 Shift JIS 0x8181
/*255*/ { 4, 16, "\201", 52, ZINT_ERROR_TOO_LONG, -1, -1 }, // 26 Shift JIS 0x8181
/*256*/ { 2, 17, "1", 26, 0, 13, 27 },
/*257*/ { 2, 17, "1", 27, ZINT_ERROR_TOO_LONG, -1, -1 },
/*258*/ { 2, 17, "A", 16, 0, 13, 27 },
/*259*/ { 2, 17, "A", 17, ZINT_ERROR_TOO_LONG, -1, -1 },
/*260*/ { 2, 17, "\200", 11, 0, 13, 27 },
/*261*/ { 2, 17, "\200", 12, ZINT_ERROR_TOO_LONG, -1, -1 },
/*262*/ { 2, 17, "\201", 12, 0, 13, 27 }, // 6 Shift JIS 0x8181
/*263*/ { 2, 17, "\201", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, // 7 Shift JIS 0x8181
/*264*/ { 4, 17, "1", 14, 0, 13, 27 },
/*265*/ { 4, 17, "1", 15, ZINT_ERROR_TOO_LONG, -1, -1 },
/*266*/ { 4, 17, "A", 8, 0, 13, 27 },
/*267*/ { 4, 17, "A", 9, ZINT_ERROR_TOO_LONG, -1, -1 },
/*268*/ { 4, 17, "\200", 6, 0, 13, 27 },
/*269*/ { 4, 17, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 },
/*270*/ { 4, 17, "\201", 6, 0, 13, 27 }, // 3 Shift JIS 0x8181
/*271*/ { 4, 17, "\201", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, // 4 Shift JIS 0x8181
/*272*/ { 2, 18, "1", 62, 0, 13, 43 },
/*273*/ { 2, 18, "1", 63, ZINT_ERROR_TOO_LONG, -1, -1 },
/*274*/ { 2, 18, "A", 37, 0, 13, 43 },
/*275*/ { 2, 18, "A", 38, ZINT_ERROR_TOO_LONG, -1, -1 },
/*276*/ { 2, 18, "\200", 26, 0, 13, 43 },
/*277*/ { 2, 18, "\200", 27, ZINT_ERROR_TOO_LONG, -1, -1 },
/*278*/ { 2, 18, "\201", 32, 0, 13, 43 }, // 16 Shift JIS 0x8181
/*279*/ { 2, 18, "\201", 34, ZINT_ERROR_TOO_LONG, -1, -1 }, // 17 Shift JIS 0x8181
/*280*/ { 4, 18, "1", 28, 0, 13, 43 },
/*281*/ { 4, 18, "1", 29, ZINT_ERROR_TOO_LONG, -1, -1 },
/*282*/ { 4, 18, "A", 17, 0, 13, 43 },
/*283*/ { 4, 18, "A", 18, ZINT_ERROR_TOO_LONG, -1, -1 },
/*284*/ { 4, 18, "\200", 12, 0, 13, 43 },
/*285*/ { 4, 18, "\200", 13, ZINT_ERROR_TOO_LONG, -1, -1 },
/*286*/ { 4, 18, "\201", 14, 0, 13, 43 }, // 7 Shift JIS 0x8181
/*287*/ { 4, 18, "\201", 16, ZINT_ERROR_TOO_LONG, -1, -1 }, // 8 Shift JIS 0x8181
/*288*/ { 2, 19, "1", 88, 0, 13, 59 },
/*289*/ { 2, 19, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 },
/*290*/ { 2, 19, "A", 53, 0, 13, 59 },
/*291*/ { 2, 19, "A", 54, ZINT_ERROR_TOO_LONG, -1, -1 },
/*292*/ { 2, 19, "\200", 36, 0, 13, 59 },
/*293*/ { 2, 19, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 },
/*294*/ { 2, 19, "\201", 44, 0, 13, 59 }, // 22 Shift JIS 0x8181
/*295*/ { 2, 19, "\201", 46, ZINT_ERROR_TOO_LONG, -1, -1 }, // 23 Shift JIS 0x8181
/*296*/ { 4, 19, "1", 45, 0, 13, 59 },
/*297*/ { 4, 19, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 },
/*298*/ { 4, 19, "A", 27, 0, 13, 59 },
/*299*/ { 4, 19, "A", 28, ZINT_ERROR_TOO_LONG, -1, -1 },
/*300*/ { 4, 19, "\200", 18, 0, 13, 59 },
/*301*/ { 4, 19, "\200", 19, ZINT_ERROR_TOO_LONG, -1, -1 },
/*302*/ { 4, 19, "\201", 22, 0, 13, 59 }, // 11 Shift JIS 0x8181
/*303*/ { 4, 19, "\201", 24, ZINT_ERROR_TOO_LONG, -1, -1 }, // 12 Shift JIS 0x8181
/*304*/ { 2, 20, "1", 124, 0, 13, 77 },
/*305*/ { 2, 20, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 },
/*306*/ { 2, 20, "A", 75, 0, 13, 77 },
/*307*/ { 2, 20, "A", 76, ZINT_ERROR_TOO_LONG, -1, -1 },
/*308*/ { 2, 20, "\200", 51, 0, 13, 77 },
/*309*/ { 2, 20, "\200", 52, ZINT_ERROR_TOO_LONG, -1, -1 },
/*310*/ { 2, 20, "\201", 62, 0, 13, 77 }, // 31 Shift JIS 0x8181
/*311*/ { 2, 20, "\201", 64, ZINT_ERROR_TOO_LONG, -1, -1 }, // 32 Shift JIS 0x8181
/*312*/ { 4, 20, "1", 66, 0, 13, 77 },
/*313*/ { 4, 20, "1", 67, ZINT_ERROR_TOO_LONG, -1, -1 },
/*314*/ { 4, 20, "A", 40, 0, 13, 77 },
/*315*/ { 4, 20, "A", 41, ZINT_ERROR_TOO_LONG, -1, -1 },
/*316*/ { 4, 20, "\200", 27, 0, 13, 77 },
/*317*/ { 4, 20, "\200", 28, ZINT_ERROR_TOO_LONG, -1, -1 },
/*318*/ { 4, 20, "\201", 34, 0, 13, 77 }, // 17 Shift JIS 0x8181
/*319*/ { 4, 20, "\201", 36, ZINT_ERROR_TOO_LONG, -1, -1 }, // 18 Shift JIS 0x8181
/*320*/ { 2, 21, "1", 171, 0, 13, 99 },
/*321*/ { 2, 21, "1", 172, ZINT_ERROR_TOO_LONG, -1, -1 },
/*322*/ { 2, 21, "A", 104, 0, 13, 99 },
/*323*/ { 2, 21, "A", 105, ZINT_ERROR_TOO_LONG, -1, -1 },
/*324*/ { 2, 21, "\200", 71, 0, 13, 99 },
/*325*/ { 2, 21, "\200", 72, ZINT_ERROR_TOO_LONG, -1, -1 },
/*326*/ { 2, 21, "\201", 88, 0, 13, 99 }, // 44 Shift JIS 0x8181
/*327*/ { 2, 21, "\201", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, // 45 Shift JIS 0x8181
/*328*/ { 4, 21, "1", 80, 0, 13, 99 },
/*329*/ { 4, 21, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 },
/*330*/ { 4, 21, "A", 49, 0, 13, 99 },
/*331*/ { 4, 21, "A", 50, ZINT_ERROR_TOO_LONG, -1, -1 },
/*332*/ { 4, 21, "\200", 33, 0, 13, 99 },
/*333*/ { 4, 21, "\200", 34, ZINT_ERROR_TOO_LONG, -1, -1 },
/*334*/ { 4, 21, "\201", 40, 0, 13, 99 }, // 20 Shift JIS 0x8181
/*335*/ { 4, 21, "\201", 42, ZINT_ERROR_TOO_LONG, -1, -1 }, // 21 Shift JIS 0x8181
/*336*/ { 2, 22, "1", 251, 0, 13, 139 },
/*337*/ { 2, 22, "1", 252, ZINT_ERROR_TOO_LONG, -1, -1 },
/*338*/ { 2, 22, "A", 152, 0, 13, 139 },
/*339*/ { 2, 22, "A", 153, ZINT_ERROR_TOO_LONG, -1, -1 },
/*340*/ { 2, 22, "\200", 104, 0, 13, 139 },
/*341*/ { 2, 22, "\200", 105, ZINT_ERROR_TOO_LONG, -1, -1 },
/*342*/ { 2, 22, "\201", 128, 0, 13, 139 }, // 64 Shift JIS 0x8181
/*343*/ { 2, 22, "\201", 130, ZINT_ERROR_TOO_LONG, -1, -1 }, // 65 Shift JIS 0x8181
/*344*/ { 4, 22, "1", 126, 0, 13, 139 },
/*345*/ { 4, 22, "1", 127, ZINT_ERROR_TOO_LONG, -1, -1 },
/*346*/ { 4, 22, "A", 76, 0, 13, 139 },
/*347*/ { 4, 22, "A", 77, ZINT_ERROR_TOO_LONG, -1, -1 },
/*348*/ { 4, 22, "\200", 52, 0, 13, 139 },
/*349*/ { 4, 22, "\200", 53, ZINT_ERROR_TOO_LONG, -1, -1 },
/*350*/ { 4, 22, "\201", 64, 0, 13, 139 }, // 32 Shift JIS 0x8181
/*351*/ { 4, 22, "\201", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, // 33 Shift JIS 0x8181
/*352*/ { 2, 23, "1", 76, 0, 15, 43 },
/*353*/ { 2, 23, "1", 77, ZINT_ERROR_TOO_LONG, -1, -1 },
/*354*/ { 2, 23, "A", 46, 0, 15, 43 },
/*355*/ { 2, 23, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 },
/*356*/ { 2, 23, "\200", 31, 0, 15, 43 },
/*357*/ { 2, 23, "\200", 32, ZINT_ERROR_TOO_LONG, -1, -1 },
/*358*/ { 2, 23, "\201", 38, 0, 15, 43 }, // 19 Shift JIS 0x8181
/*359*/ { 2, 23, "\201", 40, ZINT_ERROR_TOO_LONG, -1, -1 }, // 20 Shift JIS 0x8181
/*360*/ { 4, 23, "1", 33, 0, 15, 43 },
/*361*/ { 4, 23, "1", 34, ZINT_ERROR_TOO_LONG, -1, -1 },
/*362*/ { 4, 23, "A", 20, 0, 15, 43 },
/*363*/ { 4, 23, "A", 21, ZINT_ERROR_TOO_LONG, -1, -1 },
/*364*/ { 4, 23, "\200", 13, 0, 15, 43 },
/*365*/ { 4, 23, "\200", 14, ZINT_ERROR_TOO_LONG, -1, -1 },
/*366*/ { 4, 23, "\201", 16, 0, 15, 43 }, // 8 Shift JIS 0x8181
/*367*/ { 4, 23, "\201", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, // 9 Shift JIS 0x8181
/*368*/ { 2, 24, "1", 112, 0, 15, 59 },
/*369*/ { 2, 24, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 },
/*370*/ { 2, 24, "A", 68, 0, 15, 59 },
/*371*/ { 2, 24, "A", 69, ZINT_ERROR_TOO_LONG, -1, -1 },
/*372*/ { 2, 24, "\200", 46, 0, 15, 59 },
/*373*/ { 2, 24, "\200", 47, ZINT_ERROR_TOO_LONG, -1, -1 },
/*374*/ { 2, 24, "\201", 56, 0, 15, 59 }, // 28 Shift JIS 0x8181
/*375*/ { 2, 24, "\201", 58, ZINT_ERROR_TOO_LONG, -1, -1 }, // 29 Shift JIS 0x8181
/*376*/ { 4, 24, "1", 59, 0, 15, 59 },
/*377*/ { 4, 24, "1", 60, ZINT_ERROR_TOO_LONG, -1, -1 },
/*378*/ { 4, 24, "A", 36, 0, 15, 59 },
/*379*/ { 4, 24, "A", 37, ZINT_ERROR_TOO_LONG, -1, -1 },
/*380*/ { 4, 24, "\200", 24, 0, 15, 59 },
/*381*/ { 4, 24, "\200", 25, ZINT_ERROR_TOO_LONG, -1, -1 },
/*382*/ { 4, 24, "\201", 30, 0, 15, 59 }, // 30 Shift JIS 0x8181
/*383*/ { 4, 24, "\201", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, // 31 Shift JIS 0x8181
/*384*/ { 2, 25, "1", 157, 0, 15, 77 },
/*385*/ { 2, 25, "1", 158, ZINT_ERROR_TOO_LONG, -1, -1 },
/*386*/ { 2, 25, "A", 95, 0, 15, 77 },
/*387*/ { 2, 25, "A", 96, ZINT_ERROR_TOO_LONG, -1, -1 },
/*388*/ { 2, 25, "\200", 65, 0, 15, 77 },
/*389*/ { 2, 25, "\200", 66, ZINT_ERROR_TOO_LONG, -1, -1 },
/*390*/ { 2, 25, "\201", 80, 0, 15, 77 }, // 40 Shift JIS 0x8181
/*391*/ { 2, 25, "\201", 82, ZINT_ERROR_TOO_LONG, -1, -1 }, // 41 Shift JIS 0x8181
/*392*/ { 4, 25, "1", 71, 0, 15, 77 },
/*393*/ { 4, 25, "1", 72, ZINT_ERROR_TOO_LONG, -1, -1 },
/*394*/ { 4, 25, "A", 43, 0, 15, 77 },
/*395*/ { 4, 25, "A", 44, ZINT_ERROR_TOO_LONG, -1, -1 },
/*396*/ { 4, 25, "\200", 29, 0, 15, 77 },
/*397*/ { 4, 25, "\200", 30, ZINT_ERROR_TOO_LONG, -1, -1 },
/*398*/ { 4, 25, "\201", 36, 0, 15, 77 }, // 18 Shift JIS 0x8181
/*399*/ { 4, 25, "\201", 38, ZINT_ERROR_TOO_LONG, -1, -1 }, // 19 Shift JIS 0x8181
/*400*/ { 2, 26, "1", 207, 0, 15, 99 },
/*401*/ { 2, 26, "1", 208, ZINT_ERROR_TOO_LONG, -1, -1 },
/*402*/ { 2, 26, "A", 126, 0, 15, 99 },
/*403*/ { 2, 26, "A", 127, ZINT_ERROR_TOO_LONG, -1, -1 },
/*404*/ { 2, 26, "\200", 86, 0, 15, 99 },
/*405*/ { 2, 26, "\200", 87, ZINT_ERROR_TOO_LONG, -1, -1 },
/*406*/ { 2, 26, "\201", 106, 0, 15, 99 }, // 53 Shift JIS 0x8181
/*407*/ { 2, 26, "\201", 108, ZINT_ERROR_TOO_LONG, -1, -1 }, // 54 Shift JIS 0x8181
/*408*/ { 4, 26, "1", 111, 0, 15, 99 },
/*409*/ { 4, 26, "1", 112, ZINT_ERROR_TOO_LONG, -1, -1 },
/*410*/ { 4, 26, "A", 68, 0, 15, 99 },
/*411*/ { 4, 26, "A", 69, ZINT_ERROR_TOO_LONG, -1, -1 },
/*412*/ { 4, 26, "\200", 46, 0, 15, 99 },
/*413*/ { 4, 26, "\200", 47, ZINT_ERROR_TOO_LONG, -1, -1 },
/*414*/ { 4, 26, "\201", 56, 0, 15, 99 }, // 28 Shift JIS 0x8181
/*415*/ { 4, 26, "\201", 58, ZINT_ERROR_TOO_LONG, -1, -1 }, // 29 Shift JIS 0x8181
/*416*/ { 2, 27, "1", 301, 0, 15, 139 },
/*417*/ { 2, 27, "1", 302, ZINT_ERROR_TOO_LONG, -1, -1 },
/*418*/ { 2, 27, "A", 182, 0, 15, 139 },
/*419*/ { 2, 27, "A", 183, ZINT_ERROR_TOO_LONG, -1, -1 },
/*420*/ { 2, 27, "\200", 125, 0, 15, 139 },
/*421*/ { 2, 27, "\200", 126, ZINT_ERROR_TOO_LONG, -1, -1 },
/*422*/ { 2, 27, "\201", 154, 0, 15, 139 }, // 77 Shift JIS 0x8181
/*423*/ { 2, 27, "\201", 156, ZINT_ERROR_TOO_LONG, -1, -1 }, // 78 Shift JIS 0x8181
/*424*/ { 4, 27, "1", 162, 0, 15, 139 },
/*425*/ { 4, 27, "1", 163, ZINT_ERROR_TOO_LONG, -1, -1 },
/*426*/ { 4, 27, "A", 98, 0, 15, 139 },
/*427*/ { 4, 27, "A", 99, ZINT_ERROR_TOO_LONG, -1, -1 },
/*428*/ { 4, 27, "\200", 67, 0, 15, 139 },
/*429*/ { 4, 27, "\200", 68, ZINT_ERROR_TOO_LONG, -1, -1 },
/*430*/ { 4, 27, "\201", 82, 0, 15, 139 }, // 41 Shift JIS 0x8181
/*431*/ { 4, 27, "\201", 84, ZINT_ERROR_TOO_LONG, -1, -1 }, // 42 Shift JIS 0x8181
/*432*/ { 2, 28, "1", 90, 0, 17, 43 },
/*433*/ { 2, 28, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 },
/*434*/ { 2, 28, "A", 55, 0, 17, 43 },
/*435*/ { 2, 28, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 },
/*436*/ { 2, 28, "\200", 37, 0, 17, 43 },
/*437*/ { 2, 28, "\200", 38, ZINT_ERROR_TOO_LONG, -1, -1 },
/*438*/ { 2, 28, "\201", 46, 0, 17, 43 }, // 23 Shift JIS 0x8181
/*439*/ { 2, 28, "\201", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, // 24 Shift JIS 0x8181
/*440*/ { 4, 28, "1", 47, 0, 17, 43 },
/*441*/ { 4, 28, "1", 48, ZINT_ERROR_TOO_LONG, -1, -1 },
/*442*/ { 4, 28, "A", 28, 0, 17, 43 },
/*443*/ { 4, 28, "A", 29, ZINT_ERROR_TOO_LONG, -1, -1 },
/*444*/ { 4, 28, "\200", 19, 0, 17, 43 },
/*445*/ { 4, 28, "\200", 20, ZINT_ERROR_TOO_LONG, -1, -1 },
/*446*/ { 4, 28, "\201", 24, 0, 17, 43 }, // 12 Shift JIS 0x8181
/*447*/ { 4, 28, "\201", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, // 13 Shift JIS 0x8181
/*448*/ { 2, 29, "1", 131, 0, 17, 59 },
/*449*/ { 2, 29, "1", 132, ZINT_ERROR_TOO_LONG, -1, -1 },
/*450*/ { 2, 29, "A", 79, 0, 17, 59 },
/*451*/ { 2, 29, "A", 80, ZINT_ERROR_TOO_LONG, -1, -1 },
/*452*/ { 2, 29, "\200", 54, 0, 17, 59 },
/*453*/ { 2, 29, "\200", 55, ZINT_ERROR_TOO_LONG, -1, -1 },
/*454*/ { 2, 29, "\201", 66, 0, 17, 59 }, // 33 Shift JIS 0x8181
/*455*/ { 2, 29, "\201", 68, ZINT_ERROR_TOO_LONG, -1, -1 }, // 34 Shift JIS 0x8181
/*456*/ { 4, 29, "1", 63, 0, 17, 59 },
/*457*/ { 4, 29, "1", 64, ZINT_ERROR_TOO_LONG, -1, -1 },
/*458*/ { 4, 29, "A", 38, 0, 17, 59 },
/*459*/ { 4, 29, "A", 39, ZINT_ERROR_TOO_LONG, -1, -1 },
/*460*/ { 4, 29, "\200", 26, 0, 17, 59 },
/*461*/ { 4, 29, "\200", 27, ZINT_ERROR_TOO_LONG, -1, -1 },
/*462*/ { 4, 29, "\201", 32, 0, 17, 59 }, // 16 Shift JIS 0x8181
/*463*/ { 4, 29, "\201", 34, ZINT_ERROR_TOO_LONG, -1, -1 }, // 17 Shift JIS 0x8181
/*464*/ { 2, 30, "1", 183, 0, 17, 77 },
/*465*/ { 2, 30, "1", 184, ZINT_ERROR_TOO_LONG, -1, -1 },
/*466*/ { 2, 30, "A", 111, 0, 17, 77 },
/*467*/ { 2, 30, "A", 112, ZINT_ERROR_TOO_LONG, -1, -1 },
/*468*/ { 2, 30, "\200", 76, 0, 17, 77 },
/*469*/ { 2, 30, "\200", 77, ZINT_ERROR_TOO_LONG, -1, -1 },
/*470*/ { 2, 30, "\201", 94, 0, 17, 77 }, // 47 Shift JIS 0x8181
/*471*/ { 2, 30, "\201", 96, ZINT_ERROR_TOO_LONG, -1, -1 }, // 48 Shift JIS 0x8181
/*472*/ { 4, 30, "1", 87, 0, 17, 77 },
/*473*/ { 4, 30, "1", 88, ZINT_ERROR_TOO_LONG, -1, -1 },
/*474*/ { 4, 30, "A", 53, 0, 17, 77 },
/*475*/ { 4, 30, "A", 54, ZINT_ERROR_TOO_LONG, -1, -1 },
/*476*/ { 4, 30, "\200", 36, 0, 17, 77 },
/*477*/ { 4, 30, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 },
/*478*/ { 4, 30, "\201", 44, 0, 17, 77 }, // 22 Shift JIS 0x8181
/*479*/ { 4, 30, "\201", 46, ZINT_ERROR_TOO_LONG, -1, -1 }, // 23 Shift JIS 0x8181
/*480*/ { 2, 31, "1", 236, 0, 17, 99 },
/*481*/ { 2, 31, "1", 237, ZINT_ERROR_TOO_LONG, -1, -1 },
/*482*/ { 2, 31, "A", 143, 0, 17, 99 },
/*483*/ { 2, 31, "A", 144, ZINT_ERROR_TOO_LONG, -1, -1 },
/*484*/ { 2, 31, "\200", 98, 0, 17, 99 },
/*485*/ { 2, 31, "\200", 99, ZINT_ERROR_TOO_LONG, -1, -1 },
/*486*/ { 2, 31, "\201", 120, 0, 17, 99 }, // 60 Shift JIS 0x8181
/*487*/ { 2, 31, "\201", 122, ZINT_ERROR_TOO_LONG, -1, -1 }, // 61 Shift JIS 0x8181
/*488*/ { 4, 31, "1", 131, 0, 17, 99 },
/*489*/ { 4, 31, "1", 132, ZINT_ERROR_TOO_LONG, -1, -1 },
/*490*/ { 4, 31, "A", 79, 0, 17, 99 },
/*491*/ { 4, 31, "A", 80, ZINT_ERROR_TOO_LONG, -1, -1 },
/*492*/ { 4, 31, "\200", 54, 0, 17, 99 },
/*493*/ { 4, 31, "\200", 55, ZINT_ERROR_TOO_LONG, -1, -1 },
/*494*/ { 4, 31, "\201", 66, 0, 17, 99 }, // 33 Shift JIS 0x8181
/*495*/ { 4, 31, "\201", 68, ZINT_ERROR_TOO_LONG, -1, -1 }, // 34 Shift JIS 0x8181
/*496*/ { 2, 32, "1", 361, 0, 17, 139 },
/*497*/ { 2, 32, "1", 362, ZINT_ERROR_TOO_LONG, -1, -1 },
/*498*/ { 2, 32, "A", 219, 0, 17, 139 },
/*499*/ { 2, 32, "A", 220, ZINT_ERROR_TOO_LONG, -1, -1 },
/*500*/ { 2, 32, "\200", 150, 0, 17, 139 },
/*501*/ { 2, 32, "\200", 151, ZINT_ERROR_TOO_LONG, -1, -1 },
/*502*/ { 2, 32, "\201", 184, 0, 17, 139 }, // 92 Shift JIS 0x8181
/*503*/ { 2, 32, "\201", 186, ZINT_ERROR_TOO_LONG, -1, -1 }, // 93 Shift JIS 0x8181
/*504*/ { 4, 32, "1", 178, 0, 17, 139 },
/*505*/ { 4, 32, "1", 179, ZINT_ERROR_TOO_LONG, -1, -1 },
/*506*/ { 4, 32, "A", 108, 0, 17, 139 },
/*507*/ { 4, 32, "A", 109, ZINT_ERROR_TOO_LONG, -1, -1 },
/*508*/ { 4, 32, "\200", 74, 0, 17, 139 },
/*509*/ { 4, 32, "\200", 75, ZINT_ERROR_TOO_LONG, -1, -1 },
/*510*/ { 4, 32, "\201", 92, 0, 17, 139 }, // 46 Shift JIS 0x8181
/*511*/ { 4, 32, "\201", 94, ZINT_ERROR_TOO_LONG, -1, -1 }, // 47 Shift JIS 0x8181
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol *symbol;
char data_buf[ZINT_MAX_DATA_LEN];
testStart("test_rmqr_large");
for (i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length);
assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf));
length = testUtilSetSymbol(symbol, BARCODE_RMQR, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, ZINT_FULL_MULTIBYTE, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
}
symbol->input_mode |= FAST_MODE;
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
}
ZBarcode_Delete(symbol);
}
testFinish();
}
static void test_rmqr_options(int index, int debug) {
struct item {
@@ -6333,9 +6921,9 @@ static void test_rmqr_encode(int index, int generate, int debug) {
char *comment;
char *expected;
};
// ISO/IEC JTC1/SC31N000 (Draft 2019-6-24)
// ISO/IEC 23941:2022
struct item data[] = {
/* 0*/ { UNICODE_MODE, 4, 11, "0123456", 0, 11, 27, 1, "Draft ISO 2019-6-24 Annex I Figure I.2, R11x27-H, same",
/* 0*/ { UNICODE_MODE, 4, 11, "0123456", 0, 11, 27, 1, "ISO 23941 Annex I Figure I.2, R11x27-H, same",
"111111101010101010101010111"
"100000100110100001110100101"
"101110100001001111010011111"
@@ -6348,7 +6936,7 @@ static void test_rmqr_encode(int index, int generate, int debug) {
"101010100110010100111010001"
"111010101010101010101011111"
},
/* 1*/ { UNICODE_MODE, 2, 17, "12345678901234567890123456", 0, 13, 27, 1, "Draft ISO 2019-6-24 6.2 Figure 1, R13x27-M, same",
/* 1*/ { UNICODE_MODE, 2, 17, "12345678901234567890123456", 0, 13, 27, 1, "ISO 23941 6.2 Figure 1, R13x27-M, same",
"111111101010101010101010111"
"100000100001001100010011001"
"101110101100000011001110001"
@@ -6363,7 +6951,7 @@ static void test_rmqr_encode(int index, int generate, int debug) {
"100011010010010100000010001"
"111010101010101010101011111"
},
/* 2*/ { UNICODE_MODE, 2, 2, "0123456789012345", 0, 7, 59, 1, "Draft ISO 2019-6-24 7.4.2 Numeric mode Example, R7x59-M, same codewords",
/* 2*/ { UNICODE_MODE, 2, 2, "0123456789012345", 0, 7, 59, 1, "ISO 23941 7.4.2 Numeric mode Example, R7x59-M, same codewords",
"11111110101010101011101010101010101010111010101010101010111"
"10000010101111011110100001100001100001101100100101100100101"
"10111010100100001011110010110000011110111110111100011011111"
@@ -6372,7 +6960,7 @@ static void test_rmqr_encode(int index, int generate, int debug) {
"10000010101010110110100010111110010010101111101111110010001"
"11111110101010101011101010101010101010111010101010101011111"
},
/* 3*/ { UNICODE_MODE, 2, 2, "AC-42", 0, 7, 59, 1, "Draft ISO 2019-6-24 7.4.3 Alphanumeric mode Example, R7x59-M, same codewords",
/* 3*/ { UNICODE_MODE, 2, 2, "AC-42", 0, 7, 59, 1, "ISO 23941 7.4.3 Alphanumeric mode Example, R7x59-M, same codewords",
"11111110101010101011101010101010101010111010101010101010111"
"10000010101111010010110011010101100000101011001111100100101"
"10111010100100100011100100111100011101111100011011111011111"
@@ -6595,19 +7183,19 @@ static void test_rmqr_encode(int index, int generate, int debug) {
"10001001000010011011101110100010010001101111111101101000000110010000011010001"
"11101010101010101010101011101010101010101010101010111010101010101010101011111"
},
/* 22*/ { UNICODE_MODE, 2, 20, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", 0, 13, 77, 1, "R13x77-M with max 123 numerics (note 8 bit cci in draft 2019-6-24 when 7 suffices)",
/* 22*/ { UNICODE_MODE, 2, 20, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", 0, 13, 77, 1, "R13x77-M with max 123 numerics (note was 8 bit cci in draft 2019-6-24 when 7 suffices - corrected in ISO/IEC 23941:2022)",
"11111110101010101010101011101010101010101010101010111010101010101010101010111"
"10000010001111011110000010110000001101001111110110101010010010110011111011101"
"10111010001010000001000011100001010010100110011011111001000001111110100011001"
"10111010010011101110100110011001011011110110011101100011001010000010000010000"
"10111010010010111110100011010101011101110000000101110101111110010001000110011"
"10000010011110000011110100011001011101111111110110000100110010110011101011000"
"11111110111010011010000011010010110010010111011011111111010101111110110011111"
"00000000111011110111001110010000001000110001011101100110000110000010110101110"
"11111111010011101000010001110101101101110010000101011101110010000001101111111"
"01101010101001000000100000100000111110111111111011100100110100001011100110001"
"10110000001110100010011011100001011011010111011110111011010101110111111110101"
"10101101110110111100111010111111000100010001001101101110100100010100001010001"
"10000010001100001001010010111101110110110101101001101011011001000011001101101"
"10111010001011111111101011111110010001001001010111111010111100100101101011011"
"10111010010011001001111000101011110101101001011100100011110111011001010011110"
"10111010010010000101101011100011011110101010010010011000001101000010111011011"
"10000010011110010100000110001011110110000101101001100010101000000011101101010"
"11111110011111101010010101000001100001110001110111111111111000100101101011111"
"00000000010000010110000110000010010100101010010100100011101011011001010101110"
"11100011101100001111000101000000101100100001010010011110000001010010101111111"
"01010100110000011101011010011100101101000101101111001010100000110111000110001"
"10111001001100001100110011110011010111110001111111111011110000001001011110101"
"10100110000111111100100010100011100000011010110100101111001000011010001010001"
"11101010101010101010101011101010101010101010101010111010101010101010101011111"
},
/* 23*/ { UNICODE_MODE, 2, 23, "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", 0, 15, 43, 1, "R15x43-M with max 31 binary",
@@ -6984,6 +7572,7 @@ int main(int argc, char *argv[]) {
{ "test_upnqr_input", test_upnqr_input, 1, 1, 1 },
{ "test_upnqr_encode", test_upnqr_encode, 1, 1, 1 },
{ "test_rmqr_large", test_rmqr_large, 1, 0, 1 },
{ "test_rmqr_options", test_rmqr_options, 1, 0, 1 },
{ "test_rmqr_input", test_rmqr_input, 1, 1, 1 },
{ "test_rmqr_gs1", test_rmqr_gs1, 1, 1, 1 },
+3 -3
View File
@@ -27,6 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* Adapted from qrencode/tests/common.c
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
@@ -3513,8 +3514,7 @@ int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source,
return 0;
}
STATIC_UNLESS_ZINT_TEST int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string,
int *length);
INTERNAL int escape_char_process_test(struct zint_symbol *symbol, unsigned char *input_string, int *length);
#include "../gs1.h"
@@ -3559,7 +3559,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
if (is_escaped) {
memcpy(escaped, expected, expected_len);
ret = escape_char_process(symbol, (unsigned char *) escaped, &expected_len);
ret = escape_char_process_test(symbol, (unsigned char *) escaped, &expected_len);
if (ret != 0) {
sprintf(msg, "escape_char_process %d != 0", ret);
return 3;