Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zint/backend/tests/test_maxicode.c @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 /* | |
| 2 libzint - the open source barcode library | |
| 3 Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com> | |
| 4 | |
| 5 Redistribution and use in source and binary forms, with or without | |
| 6 modification, are permitted provided that the following conditions | |
| 7 are met: | |
| 8 | |
| 9 1. Redistributions of source code must retain the above copyright | |
| 10 notice, this list of conditions and the following disclaimer. | |
| 11 2. Redistributions in binary form must reproduce the above copyright | |
| 12 notice, this list of conditions and the following disclaimer in the | |
| 13 documentation and/or other materials provided with the distribution. | |
| 14 3. Neither the name of the project nor the names of its contributors | |
| 15 may be used to endorse or promote products derived from this software | |
| 16 without specific prior written permission. | |
| 17 | |
| 18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |
| 19 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 20 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 21 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | |
| 22 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 23 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 24 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 25 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 26 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 27 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 28 SUCH DAMAGE. | |
| 29 */ | |
| 30 /* SPDX-License-Identifier: BSD-3-Clause */ | |
| 31 | |
| 32 #include "testcommon.h" | |
| 33 | |
| 34 static void test_large(const testCtx *const p_ctx) { | |
| 35 int debug = p_ctx->debug; | |
| 36 | |
| 37 struct item { | |
| 38 int option_1; | |
| 39 int option_2; | |
| 40 char *pattern; | |
| 41 int length; | |
| 42 char *primary; | |
| 43 int ret; | |
| 44 int expected_rows; | |
| 45 int expected_width; | |
| 46 int bwipp_cmp; | |
| 47 char *comment; | |
| 48 }; | |
| 49 /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ | |
| 50 static const struct item data[] = { | |
| 51 /* 0*/ { -1, -1, "1", 138, "", 0, 33, 30, 1, "Mode 4 (138 agrees with ISO/IEC 16023:2000)" }, | |
| 52 /* 1*/ { -1, -1, "1", 139, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 53 /* 2*/ { -1, -1, "1", 144, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 54 /* 3*/ { -1, -1, "1", 145, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "Absolute max" }, | |
| 55 /* 4*/ { -1, -1, "A", 93, "", 0, 33, 30, 1, "" }, | |
| 56 /* 5*/ { -1, -1, "A", 94, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 57 /* 6*/ { -1, -1, "\001", 91, "", 0, 33, 30, 1, "" }, | |
| 58 /* 7*/ { -1, -1, "\001", 92, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 59 /* 8*/ { -1, -1, "\200", 91, "", 0, 33, 30, 1, "" }, | |
| 60 /* 9*/ { -1, -1, "\200", 92, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 61 /* 10*/ { 2, -1, "1", 126, "123456789123123", 0, 33, 30, 1, "" }, | |
| 62 /* 11*/ { 2, -1, "1", 127, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 63 /* 12*/ { 2, -1, "A", 84, "123456789123123", 0, 33, 30, 1, "" }, | |
| 64 /* 13*/ { 2, -1, "A", 85, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 65 /* 14*/ { 2, 96 + 1, "1", 109, "123456789123123", 0, 33, 30, 1, "" }, | |
| 66 /* 15*/ { 2, 96 + 1, "1", 110, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 67 /* 16*/ { 2, 96 + 1, "1", 136, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "Absolute max with SCM vv" }, | |
| 68 /* 17*/ { 3, -1, "1", 126, "ABCDEF123123", 0, 33, 30, 1, "" }, | |
| 69 /* 18*/ { 3, -1, "1", 127, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 70 /* 19*/ { 3, -1, "A", 84, "ABCDEF123123", 0, 33, 30, 1, "" }, | |
| 71 /* 20*/ { 3, -1, "A", 85, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 72 /* 21*/ { 3, 96 + 1, "1", 109, "ABCDEF123123", 0, 33, 30, 1, "" }, | |
| 73 /* 22*/ { 3, 96 + 1, "1", 110, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 74 /* 23*/ { 0, -1, "1", 126, "123456789123123", 0, 33, 30, 1, "Mode 2" }, | |
| 75 /* 24*/ { 0, -1, "1", 127, "123456789123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 76 /* 25*/ { 0, -1, "1", 126, "ABCDEF123123", 0, 33, 30, 1, "Mode 3" }, | |
| 77 /* 26*/ { 0, -1, "1", 127, "ABCDEF123123", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 78 /* 27*/ { 5, -1, "1", 113, "", 0, 33, 30, 1, "Extra EEC" }, | |
| 79 /* 28*/ { 5, -1, "1", 114, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 80 /* 29*/ { 5, -1, "A", 77, "", 0, 33, 30, 1, "" }, | |
| 81 /* 30*/ { 5, -1, "A", 78, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 82 /* 31*/ { 6, -1, "1", 138, "", 0, 33, 30, 1, "" }, | |
| 83 /* 32*/ { 6, -1, "1", 139, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 84 /* 33*/ { 6, -1, "A", 93, "", 0, 33, 30, 1, "" }, | |
| 85 /* 34*/ { 6, -1, "A", 94, "", ZINT_ERROR_TOO_LONG, -1, -1, 1, "" }, | |
| 86 }; | |
| 87 const int data_size = ARRAY_SIZE(data); | |
| 88 int i, length, ret; | |
| 89 struct zint_symbol *symbol = NULL; | |
| 90 | |
| 91 char data_buf[256]; | |
| 92 char escaped[1024]; | |
| 93 char cmp_buf[32768]; | |
| 94 char cmp_msg[1024]; | |
| 95 const char expected_errtxt[] = "Error 553: Input too long, requires too many codewords (maximum 144)"; | |
| 96 | |
| 97 int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ | |
| 98 int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */ | |
| 99 | |
| 100 testStartSymbol("test_large", &symbol); | |
| 101 | |
| 102 for (i = 0; i < data_size; i++) { | |
| 103 | |
| 104 if (testContinue(p_ctx, i)) continue; | |
| 105 | |
| 106 symbol = ZBarcode_Create(); | |
| 107 assert_nonnull(symbol, "Symbol not created\n"); | |
| 108 | |
| 109 testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length); | |
| 110 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)); | |
| 111 | |
| 112 length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug); | |
| 113 strcpy(symbol->primary, data[i].primary); | |
| 114 | |
| 115 ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); | |
| 116 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 117 assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); | |
| 118 | |
| 119 if (ret < ZINT_ERROR) { | |
| 120 assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); | |
| 121 assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); | |
| 122 } else { | |
| 123 assert_zero(strcmp(symbol->errtxt, expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, expected_errtxt); | |
| 124 } | |
| 125 | |
| 126 if (ret < ZINT_ERROR) { | |
| 127 if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) { | |
| 128 if (!data[i].bwipp_cmp) { | |
| 129 if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); | |
| 130 } else { | |
| 131 char modules_dump[33 * 33 + 1]; | |
| 132 assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); | |
| 133 ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data_buf, length, symbol->primary, cmp_buf, sizeof(cmp_buf), NULL); | |
| 134 assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); | |
| 135 | |
| 136 ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump); | |
| 137 assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", | |
| 138 i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump); | |
| 139 } | |
| 140 } | |
| 141 if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data_buf, length, debug)) { | |
| 142 int cmp_len, ret_len; | |
| 143 char modules_dump[33 * 33 + 1]; | |
| 144 assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); | |
| 145 ret = testUtilZXingCPP(i, symbol, data_buf, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); | |
| 146 assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); | |
| 147 | |
| 148 ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data_buf, length, symbol->primary, escaped, &ret_len); | |
| 149 assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", | |
| 150 i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); | |
| 151 } | |
| 152 } | |
| 153 | |
| 154 ZBarcode_Delete(symbol); | |
| 155 } | |
| 156 | |
| 157 testFinish(); | |
| 158 } | |
| 159 | |
| 160 static void test_input(const testCtx *const p_ctx) { | |
| 161 int debug = p_ctx->debug; | |
| 162 | |
| 163 struct item { | |
| 164 int input_mode; | |
| 165 int eci; | |
| 166 int option_1; | |
| 167 int option_2; | |
| 168 struct zint_structapp structapp; | |
| 169 char *data; | |
| 170 int length; | |
| 171 char *primary; | |
| 172 int ret; | |
| 173 int expected_width; | |
| 174 char *expected; | |
| 175 int bwipp_cmp; | |
| 176 int zxingcpp_cmp; | |
| 177 char *comment; | |
| 178 }; | |
| 179 /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ | |
| 180 static const struct item data[] = { | |
| 181 /* 0*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 01 21 21 21 21 21 21 21 21 08 0E 19 2B 20 0C 24 06 32 1C 21 21 21 21 21 21 21 21", 1, 1, "" }, | |
| 182 /* 1*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 548: Primary Message empty", 1, 1, "" }, | |
| 183 /* 2*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "A123456", ZINT_ERROR_INVALID_DATA, 0, "Error 555: Non-numeric postcode in Primary Message", 1, 1, "" }, | |
| 184 /* 3*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "1123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", 1, 1, "1-digit postcode" }, | |
| 185 /* 4*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "1 123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", 1, 0, "1-digit postcode; ZXing-C++ test can't handle space" }, | |
| 186 /* 5*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "123456789123456", 0, 30, "(144) 12 05 0D 2F 35 11 32 1E 20 1C 0D 1D 3B 12 22 3F 30 14 23 1A 01 21 21 21 21 21 21 21", 1, 1, "9-digit postcode" }, | |
| 187 /* 6*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "1234567890123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Primary Message length 16 wrong (7 to 15 only)", 1, 1, "10-digit postcode" }, | |
| 188 /* 7*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "1123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", 1, 1, "1-digit postcode" }, | |
| 189 /* 8*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "123456789123456", 0, 30, "(144) 12 05 0D 2F 35 11 32 1E 20 1C 0D 1D 3B 12 22 3F 30 14 23 1A 01 21 21 21 21 21 21 21", 1, 1, "9-digit postcode" }, | |
| 190 /* 9*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "1234567890123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Primary Message length 16 wrong (7 to 15 only)", 1, 1, "10-digit postcode" }, | |
| 191 /* 10*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Primary Message length 6 wrong (7 to 15 only)", 1, 1, "0-digit postcode" }, | |
| 192 /* 11*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "12345678123456", 0, 30, "(144) 22 13 21 31 0B 00 32 1E 20 1C 04 14 07 30 10 07 08 28 1D 09 01 21 21 21 21 21 21 21", 1, 1, "8-digit postcode" }, | |
| 193 /* 12*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "12345678123456", 0, 30, "(144) 22 13 21 31 0B 00 32 1E 20 1C 04 14 07 30 10 07 08 28 1D 09 01 21 21 21 21 21 21 21", 1, 1, "8-digit postcode" }, | |
| 194 /* 13*/ { UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 548: Primary Message empty", 1, 1, "" }, | |
| 195 /* 14*/ { UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", -1, "A123456", 0, 30, "(144) 03 08 08 08 08 18 30 1E 20 1C 22 35 1C 0F 02 1A 26 04 10 31 01 21 21 21 21 21 21 21", 1, 1, "1-alphanumeric postcode" }, | |
| 196 /* 15*/ { UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", -1, "1123456", 0, 30, "(144) 03 08 08 08 08 18 3C 1E 20 1C 13 37 07 2C 26 2D 18 29 3F 2C 01 21 21 21 21 21 21 21", 1, 0, "1-digit postcode; ZXing-C++ test can't handle padding" }, | |
| 197 /* 16*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "A123456", 0, 30, "(144) 03 08 08 08 08 18 30 1E 20 1C 22 35 1C 0F 02 1A 26 04 10 31 01 21 21 21 21 21 21 21", 1, 1, "1-alphanumeric postcode" }, | |
| 198 /* 17*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "ABCDEF123456", 0, 30, "(144) 23 11 01 31 20 10 30 1E 20 1C 3C 1D 22 03 19 15 0F 20 0F 2A 01 21 21 21 21 21 21 21", 1, 1, "6-alphanumeric postcode" }, | |
| 199 /* 18*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "ABCDEFG123456", 0, 30, "(144) 23 11 01 31 20 10 30 1E 20 1C 3C 1D 22 03 19 15 0F 20 0F 2A 01 21 21 21 21 21 21 21", 1, 0, "7-alphanumeric postcode truncated; ZXing-C++ test can't handle truncation" }, | |
| 200 /* 19*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "ABCDE123456", 0, 30, "(144) 03 18 01 31 20 10 30 1E 20 1C 0F 38 38 1A 39 10 2F 37 22 12 01 21 21 21 21 21 21 21", 1, 1, "5-alphanumeric postcode" }, | |
| 201 /* 20*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "AAAAAA 840001", 0, 30, "(144) 13 10 10 10 10 10 00 12 07 00 17 36 2E 38 04 29 16 0D 27 16 01 21 21 21 21 21 21 21", 1, 0, "6-alphanumeric postcode with padding; ZXing-C++ test can't handle padding" }, | |
| 202 /* 21*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "AAAAA A840001", 0, 30, "(144) 03 18 10 10 10 10 00 12 07 00 19 07 29 31 26 01 23 2C 2E 07 01 21 21 21 21 21 21 21", 1, 0, "7-alphanumeric with embedded padding truncated; ZXing-C++ test can't handle truncation" }, | |
| 203 /* 22*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "AA\015AAA840001", ZINT_ERROR_INVALID_DATA, 0, "Error 556: Invalid character in postcode in Primary Message", 1, 1, "Alphanumeric postcode with CR" }, | |
| 204 /* 23*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "A#%-/A840001", 0, 30, "(144) 13 30 1B 1B 39 18 00 12 07 00 3F 1E 25 07 2A 1E 14 3C 28 2D 01 21 21 21 21 21 21 21", 1, 1, "Alphanumeric postcode with non-control Code A chars" }, | |
| 205 /* 24*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "1A23456", ZINT_ERROR_INVALID_DATA, 0, "Error 552: Non-numeric country code or service class in Primary Message", 1, 1, "Non-numeric country code" }, | |
| 206 /* 25*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "12345678912345A", ZINT_ERROR_INVALID_DATA, 0, "Error 552: Non-numeric country code or service class in Primary Message", 1, 1, "Non-numeric service class" }, | |
| 207 /* 26*/ { UNICODE_MODE, -1, 0, -1, { 0, 0, "" }, "A", -1, "123456789123456", 0, 30, "(144) 12 05 0D 2F 35 11 32 1E 20 1C 0D 1D 3B 12 22 3F 30 14 23 1A 01 21 21 21 21 21 21 21", 1, 1, "Auto-determine mode 2" }, | |
| 208 /* 27*/ { UNICODE_MODE, -1, 0, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 554: Primary Message empty", 1, 1, "Auto-determine mode 2/3 requires primary message" }, | |
| 209 /* 28*/ { UNICODE_MODE, -1, 0, -1, { 0, 0, "" }, "A", -1, "A23456123456", 0, 30, "(144) 23 1D 0D 3D 2C 1C 30 1E 20 1C 24 35 30 31 2A 0D 17 14 16 3D 01 21 21 21 21 21 21 21", 1, 1, "Auto-determine mode 3" }, | |
| 210 /* 29*/ { UNICODE_MODE, -1, -1, 100, { 0, 0, "" }, "A", -1, "123456123456", 0, 30, "(144) 02 10 22 07 00 20 31 1E 20 1C 0E 29 13 1B 0D 26 36 25 3B 22 3B 2A 29 3B 28 1E 30 31", 1, 1, "SCM prefix version" }, | |
| 211 /* 30*/ { UNICODE_MODE, -1, -1, 101, { 0, 0, "" }, "A", -1, "123456123456", ZINT_ERROR_INVALID_OPTION, 0, "Error 557: SCM prefix version '101' out of range (1 to 100)", 1, 1, "SCM prefix version" }, | |
| 212 /* 31*/ { UNICODE_MODE, 25, -1, 96 + 1, { 0, 0, "" }, "A", -1, "123456123456", ZINT_ERROR_INVALID_OPTION, 0, "Error 547: SCM prefix can not be used with ECI 25 (ECI must be ASCII compatible)", 1, 1, "SCM prefix version UTF-16BE" }, | |
| 213 /* 32*/ { UNICODE_MODE, 33, -1, 96 + 1, { 0, 0, "" }, "A", -1, "123456123456", ZINT_ERROR_INVALID_OPTION, 0, "Error 547: SCM prefix can not be used with ECI 33 (ECI must be ASCII compatible)", 1, 1, "SCM prefix version UTF-16LE" }, | |
| 214 /* 33*/ { UNICODE_MODE, 34, -1, 96 + 1, { 0, 0, "" }, "A", -1, "123456123456", ZINT_ERROR_INVALID_OPTION, 0, "Error 547: SCM prefix can not be used with ECI 34 (ECI must be ASCII compatible)", 1, 1, "SCM prefix version UTF-32BE" }, | |
| 215 /* 34*/ { UNICODE_MODE, 35, -1, 96 + 1, { 0, 0, "" }, "A", -1, "123456123456", ZINT_ERROR_INVALID_OPTION, 0, "Error 547: SCM prefix can not be used with ECI 35 (ECI must be ASCII compatible)", 1, 1, "SCM prefix version UTF-32LE" }, | |
| 216 /* 35*/ { UNICODE_MODE, 3, 2, 96 + 1, { 0, 0, "" }, "A", -1, "999999999840333", 0, 30, "(144) 32 3F 09 2B 39 1E 02 12 37 14 2F 1E 03 29 3E 1B 2D 2A 06 20 3B 2A 29 3B 28 1E 30 31", 1, 1, "SCM prefix version ISO/IEC 8859-1" }, | |
| 217 /* 36*/ { UNICODE_MODE, 170, 2, 96 + 1, { 0, 0, "" }, "A", -1, "1234567123456", 0, 30, "(144) 32 21 16 0B 01 30 31 1E 20 1C 13 22 04 28 0E 21 13 1E 3A 14 3B 2A 29 3B 28 1E 30 31", 1, 1, "SCM prefix version ASCII Invariant" }, | |
| 218 /* 37*/ { UNICODE_MODE, 20, 2, 96 + 1, { 0, 0, "" }, "テ", -1, "12345678123456", 0, 30, "(144) 22 13 21 31 0B 00 32 1E 20 1C 04 14 07 30 10 07 08 28 1D 09 3B 2A 29 3B 28 1E 30 31", 1, 1, "SCM prefix version Shift JIS" }, | |
| 219 /* 38*/ { UNICODE_MODE | ESCAPE_MODE, 3, 2, -1, { 0, 0, "" }, "[)>\\R01\\G96A", -1, "999999999840333", 0, 30, "(144) 32 3F 09 2B 39 1E 02 12 37 14 2F 1E 03 29 3E 1B 2D 2A 06 20 3B 2A 29 3B 28 1E 30 31", 1, 1, "Manual SCM prefix ISO/IEC 8859-1" }, | |
| 220 /* 39*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 03 01 21 21 21 21 21 21 2F 14 23 21 05 24 27 00 24 0C 21 21 21 21 21 21 21 21", 1, 1, "" }, | |
| 221 /* 40*/ { UNICODE_MODE, 31, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 1F 01 21 21 21 21 21 21 00 2F 0E 09 39 3B 24 1A 21 05 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x1F" }, | |
| 222 /* 41*/ { UNICODE_MODE, 32, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 20 20 01 21 21 21 21 21 3D 15 0F 30 0D 22 24 35 22 06 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x20" }, | |
| 223 /* 42*/ { UNICODE_MODE, 1023, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 2F 3F 01 21 21 21 21 21 2E 27 23 1D 35 19 21 04 3A 26 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x3FF" }, | |
| 224 /* 43*/ { UNICODE_MODE, 1024, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 30 10 00 01 21 21 21 21 11 2F 15 10 1D 29 06 35 14 2B 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x400" }, | |
| 225 /* 44*/ { UNICODE_MODE, 32767, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 37 3F 3F 01 21 21 21 21 3E 15 12 01 07 30 39 27 04 2B 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x7FFF" }, | |
| 226 /* 45*/ { UNICODE_MODE, 32768, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 38 08 00 00 01 21 21 21 10 30 3A 04 26 23 0E 21 3D 0F 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x8000" }, | |
| 227 /* 46*/ { UNICODE_MODE, 65535, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 38 0F 3F 3F 01 21 21 21 1C 0E 1D 39 3B 0D 38 25 00 30 21 21 21 21 21 21 21 21", 1, 1, "ECI 0xFFFF" }, | |
| 228 /* 47*/ { UNICODE_MODE, 65536, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 38 10 00 00 01 21 21 21 2B 1F 24 06 38 2E 17 1B 10 2F 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x10000" }, | |
| 229 /* 48*/ { UNICODE_MODE, 131071, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 38 1F 3F 3F 01 21 21 21 0F 05 09 04 2F 3A 17 09 36 31 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x1FFFF" }, | |
| 230 /* 49*/ { UNICODE_MODE, 999999, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 3B 34 08 3F 01 21 21 21 26 3B 2B 23 08 17 32 05 26 35 21 21 21 21 21 21 21 21", 1, 1, "Max ECI" }, | |
| 231 /* 50*/ { UNICODE_MODE, -1, 1, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 550: Mode '1' out of range (2 to 6)", 1, 1, "" }, | |
| 232 /* 51*/ { UNICODE_MODE, -1, 7, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 550: Mode '7' out of range (2 to 6)", 1, 1, "" }, | |
| 233 /* 52*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015", -1, "", 0, 30, "(144) 04 00 21 21 21 21 21 21 21 21 37 32 10 01 24 1B 10 11 38 0C 21 21 21 21 21 21 21 21", 1, 1, "" }, | |
| 234 /* 53*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015\034\035\036 ", -1, "", 0, 30, "(144) 04 00 1C 1D 1E 20 21 21 21 21 3E 18 0B 14 22 27 2D 3A 18 22 21 21 21 21 21 21 21 21", 1, 1, "Code Set A" }, | |
| 235 /* 54*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "abc\034\035\036 ,./:", -1, "", 0, 30, "(144) 04 3F 01 02 03 1C 1D 1E 2F 30 21 1F 2B 2A 35 0A 00 10 36 1D 31 32 33 21 21 21 21 21", 1, 1, "Code Set B" }, | |
| 236 /* 55*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\001\002\003\015\034\035\036 ", -1, "", 0, 30, "(144) 04 3E 3E 01 02 03 0D 20 21 22 3D 0F 31 3A 0C 0C 34 26 27 31 3B 1C 1C 1C 1C 1C 1C 1C", 1, 1, "Code Set E" }, | |
| 237 /* 56*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "ÀÀÀ\034\035\036 ", -1, "", 0, 30, "(144) 04 3C 3C 00 00 00 1C 1D 1E 3B 3C 05 39 07 18 15 25 36 28 11 3A 21 21 21 21 21 21 21", 1, 1, "Code Set C" }, | |
| 238 /* 57*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "ààà\034\035\036 ", -1, "", 0, 30, "(144) 04 3D 3D 00 00 00 1C 1D 1E 3B 06 26 23 19 32 1E 0C 1A 05 11 3A 21 21 21 21 21 21 21", 1, 1, "Code Set D" }, | |
| 239 /* 58*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\001\034\001\035\001\036\001a:b", -1, "", 0, 30, "(144) 04 3E 3E 01 20 01 21 01 22 01 27 0B 35 01 08 0D 16 02 17 1A 3F 01 33 02 21 21 21 21", 1, 1, "" }, | |
| 240 /* 59*/ { UNICODE_MODE, -1, -1, -1, { 1, 2, "" }, "A", -1, "", 0, 30, "(144) 04 21 01 01 21 21 21 21 21 21 09 0B 26 03 37 0E 25 27 07 1E 21 21 21 21 21 21 21 21", 1, 1, "" }, | |
| 241 /* 60*/ { UNICODE_MODE, -1, -1, -1, { 0, 2, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 559: Structured Append index '0' out of range (1 to count 2)", 1, 1, "" }, | |
| 242 /* 61*/ { UNICODE_MODE, -1, -1, -1, { 1, 1, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 558: Structured Append count '1' out of range (2 to 8)", 1, 1, "" }, | |
| 243 /* 62*/ { UNICODE_MODE, -1, -1, -1, { 1, 9, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 558: Structured Append count '9' out of range (2 to 8)", 1, 1, "" }, | |
| 244 /* 63*/ { UNICODE_MODE, -1, -1, -1, { 3, 2, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 559: Structured Append index '3' out of range (1 to count 2)", 1, 1, "" }, | |
| 245 /* 64*/ { UNICODE_MODE, -1, -1, -1, { 1, 2, "A" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 549: Structured Append ID not available for MaxiCode", 1, 1, "" }, | |
| 246 /* 65*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "b..A", -1, "", 0, 30, "(144) 04 3B 02 2E 2E 01 21 21 21 21 11 1C 30 14 2D 3E 16 0E 0C 31 21 21 21 21 21 21 21 21", 1, 1, "" }, | |
| 247 /* 66*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A123456789b123456789bbbA", -1, "", 0, 30, "(144) 04 01 1F 07 16 3C 34 15 3F 02 10 1B 28 22 20 32 37 0C 0B 2A 1F 07 16 3C 34 15 02 02", 1, 1, "" }, | |
| 248 /* 67*/ { ESCAPE_MODE, -1, -1, -1, { 0, 0, "" }, "\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192\\d224\\d224\\d224\\d192", -1, "", 0, 30, "(144) 04 3C 00 3D 3D 00 00 00 3C 00 34 39 0E 35 1D 25 00 1B 28 03 00 00 00 3C 00 00 00 00", 1, 1, "BWIPP PR #279" }, | |
| 249 /* 68*/ { ESCAPE_MODE, -1, 2, -1, { 0, 0, "" }, "1Z34567890\\GUPSN\\G102562\\G034\\G\\G1/1\\G\\GY\\G2201 Second St\\GFt Myers\\GFL\\R\\E", -1, "339010000840001", 0, 30, "(144) 02 34 21 13 03 15 02 12 07 00 0C 03 00 38 24 04 0B 1F 2F 21 31 1A 33 34 35 36 37 38", 1, 1, "" }, | |
| 250 /* 69*/ { DATA_MODE | ESCAPE_MODE, -1, -1, -1, { 0, 0, "" }, "ABabcdeAabcdABCabcdABabc\\d192\\d192 \\d192\\d224\\d224\\d028\\d224\\d001\\d001\\d001\\d029\\d00112345678a123456789aABCDa\\d192\\d224\\d001\\d192\\d001\\d224\\d030\\d004", -1, "", 0, 30, "(144) 04 01 02 3F 01 02 03 04 05 3B 25 28 3F 32 0D 10 0D 0F 35 11 01 01 02 03 04 39 01 02", 1, 1, "Exercises all latches & no. of shifts" }, | |
| 251 /* 70*/ { UNICODE_MODE, 1023, 3, 96 + 1, { 2, 3, "" }, "A", -1, "P144275001", 0, 30, "(144) 03 08 08 0D 1D 0C 34 04 05 00 13 29 0C 17 0F 15 2E 38 00 0B 21 0A 3B 2A 29 3B 28 1E", 1, 1, "ECI, Structured Append, SCM" }, | |
| 252 }; | |
| 253 const int data_size = ARRAY_SIZE(data); | |
| 254 int i, length, ret; | |
| 255 struct zint_symbol *symbol = NULL; | |
| 256 | |
| 257 char escaped[1024]; | |
| 258 char cmp_buf[32768]; | |
| 259 char cmp_msg[1024]; | |
| 260 | |
| 261 int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ | |
| 262 int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */ | |
| 263 | |
| 264 testStartSymbol("test_input", &symbol); | |
| 265 | |
| 266 for (i = 0; i < data_size; i++) { | |
| 267 | |
| 268 if (testContinue(p_ctx, i)) continue; | |
| 269 | |
| 270 symbol = ZBarcode_Create(); | |
| 271 assert_nonnull(symbol, "Symbol not created\n"); | |
| 272 | |
| 273 symbol->debug = ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */ | |
| 274 | |
| 275 length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); | |
| 276 if (data[i].structapp.count) { | |
| 277 symbol->structapp = data[i].structapp; | |
| 278 } | |
| 279 strcpy(symbol->primary, data[i].primary); | |
| 280 | |
| 281 ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); | |
| 282 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 283 | |
| 284 if (p_ctx->generate) { | |
| 285 printf(" /*%3d*/ { %s, %d, %d, %d, { %d, %d, \"%s\" }, \"%s\", %d, \"%s\", %s, %d, \"%s\", %d, %d, \"%s\" },\n", | |
| 286 i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, data[i].option_2, | |
| 287 data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, | |
| 288 testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, data[i].primary, | |
| 289 testUtilErrorName(data[i].ret), symbol->width, symbol->errtxt, data[i].bwipp_cmp, data[i].zxingcpp_cmp, data[i].comment); | |
| 290 } else { | |
| 291 if (ret < ZINT_ERROR) { | |
| 292 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); | |
| 293 } | |
| 294 assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); | |
| 295 | |
| 296 if (ret < ZINT_ERROR) { | |
| 297 if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) { | |
| 298 if (!data[i].bwipp_cmp) { | |
| 299 if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); | |
| 300 } else { | |
| 301 char modules_dump[33 * 33 + 1]; | |
| 302 assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); | |
| 303 ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, symbol->primary, cmp_buf, sizeof(cmp_buf), NULL); | |
| 304 assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); | |
| 305 | |
| 306 ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump); | |
| 307 assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", | |
| 308 i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump); | |
| 309 } | |
| 310 } | |
| 311 if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) { | |
| 312 if (!data[i].zxingcpp_cmp) { | |
| 313 if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not ZXing-C++ compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); | |
| 314 } else { | |
| 315 int cmp_len, ret_len; | |
| 316 char modules_dump[33 * 33 + 1]; | |
| 317 assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); | |
| 318 ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); | |
| 319 assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); | |
| 320 | |
| 321 ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, symbol->primary, escaped, &ret_len); | |
| 322 assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", | |
| 323 i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); | |
| 324 } | |
| 325 } | |
| 326 } | |
| 327 } | |
| 328 | |
| 329 ZBarcode_Delete(symbol); | |
| 330 } | |
| 331 | |
| 332 testFinish(); | |
| 333 } | |
| 334 | |
| 335 static void test_encode(const testCtx *const p_ctx) { | |
| 336 int debug = p_ctx->debug; | |
| 337 | |
| 338 struct item { | |
| 339 int input_mode; | |
| 340 int option_1; | |
| 341 int option_2; | |
| 342 struct zint_structapp structapp; | |
| 343 char *data; | |
| 344 int length; | |
| 345 char *primary; | |
| 346 int ret; | |
| 347 | |
| 348 int expected_rows; | |
| 349 int expected_width; | |
| 350 int bwipp_cmp; | |
| 351 char *comment; | |
| 352 char *expected; | |
| 353 }; | |
| 354 static const struct item data[] = { | |
| 355 /* 0*/ { -1, -1, -1, { 0, 0, "" }, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", -1, "", 0, 33, 30, 1, "ISO/IEC 16023:2000 Figure 2 (and L1), same", | |
| 356 "011111010000001000001000100111" | |
| 357 "000100000001000000001010000000" | |
| 358 "001011001100100110110010010010" | |
| 359 "100000010001100010010000000000" | |
| 360 "001011000000101000001010110011" | |
| 361 "111010001000001011001000111100" | |
| 362 "100000000110000010010000000000" | |
| 363 "000010100010010010001001111100" | |
| 364 "111011100000001000000110000000" | |
| 365 "000000011011000000010100011000" | |
| 366 "101111000001010110001100000011" | |
| 367 "001110001010000000111010001110" | |
| 368 "000111100000000000100001011000" | |
| 369 "100010000000000000000111001000" | |
| 370 "100000001000000000011000001000" | |
| 371 "000010111000000000000010000010" | |
| 372 "111000001000000000001000001101" | |
| 373 "011000000000000000001000100100" | |
| 374 "000000101100000000001001010001" | |
| 375 "101010001000000000100111001100" | |
| 376 "001000011000000000011100001010" | |
| 377 "000000000000000000110000100000" | |
| 378 "101011001010100001000101010001" | |
| 379 "100011110010101001101010001010" | |
| 380 "011010000000000101011010011111" | |
| 381 "000001110011111111111100010100" | |
| 382 "001110100111000101011000011100" | |
| 383 "110111011100100001101001010110" | |
| 384 "000001011011101010010111001100" | |
| 385 "111000110111100010001111011110" | |
| 386 "101111010111111000010110111001" | |
| 387 "001001101111101101101010011100" | |
| 388 "001011000000111101100100001000" | |
| 389 }, | |
| 390 /* 1*/ { -1, 4, -1, { 0, 0, "" }, "MaxiCode (19 chars)", -1, "", 0, 33, 30, 1, "ISO/IEC 16023:2000 Figure H1 **NOT SAME** different encodation (figure uses '3 Shift A' among other differences)", | |
| 391 "000111011111010000001010110111" | |
| 392 "101101010001110001000000110110" | |
| 393 "101110001010111100100111111011" | |
| 394 "010101010101010101010101010100" | |
| 395 "000000000000000000000000000011" | |
| 396 "101010101010101010101010101010" | |
| 397 "010101010101010101010101010111" | |
| 398 "000000000000000000000000000010" | |
| 399 "101010101010101010101010101011" | |
| 400 "010101011111111100000001010100" | |
| 401 "000000000011110110001000000001" | |
| 402 "101010101110000000111010101010" | |
| 403 "010101100010000000001101010110" | |
| 404 "000000101000000000001000000010" | |
| 405 "101010000000000000011010101001" | |
| 406 "010101010000000000001101010110" | |
| 407 "000000001000000000001000000010" | |
| 408 "101010110000000000001010101010" | |
| 409 "010101101100000000010101010111" | |
| 410 "000000100000000000000000000000" | |
| 411 "101010010110000000000110101011" | |
| 412 "010101010110000000001001010110" | |
| 413 "000000000110001011000000000011" | |
| 414 "101010100110111001010010101010" | |
| 415 "010101010101010101011100100010" | |
| 416 "000000000000000000000000101100" | |
| 417 "101010101010101010101010101101" | |
| 418 "011000111100100001011011100100" | |
| 419 "001010011100001010001111100100" | |
| 420 "111010000011101011110001010100" | |
| 421 "000111001100100000010011000110" | |
| 422 "100000101101100000001000111110" | |
| 423 "011101000100000001001111101001" | |
| 424 }, | |
| 425 /* 2*/ { ESCAPE_MODE, 2, 96 + 1, { 0, 0, "" }, "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G634 ALPHA DR\\GPITTSBURGH\\GPA\\R\\E", -1, "152382802840001", 0, 33, 30, 1, "ISO/IEC 16023:2000 Figure B2 **NOT SAME** uses different encodation (figure precedes PAD chars with Latch B)", | |
| 426 "110101110110111110111111101111" | |
| 427 "010101010111000011011000010010" | |
| 428 "110110110001001010100110010001" | |
| 429 "111000101010101111111111111110" | |
| 430 "001111000010110010011000000011" | |
| 431 "001001110010101010100000000000" | |
| 432 "111011111110111111101111111110" | |
| 433 "100110000011001001110000001010" | |
| 434 "010001100010101010101001110001" | |
| 435 "110111100011010000011011111100" | |
| 436 "001100110011110000001110101001" | |
| 437 "101110101000000001011111011010" | |
| 438 "101010000000000000010110111111" | |
| 439 "111101100000000000011011100010" | |
| 440 "101010010000000000000110011101" | |
| 441 "001000010000000000011100011110" | |
| 442 "010011001000000000001000001010" | |
| 443 "000000101000000000001010000010" | |
| 444 "000100111100000000001110101010" | |
| 445 "000010101100000000001000110000" | |
| 446 "100000111010000000011101100000" | |
| 447 "101000100000000000110110100000" | |
| 448 "001000001110100101100110100101" | |
| 449 "011001110010101001100000001000" | |
| 450 "000010100010110001010101111010" | |
| 451 "100111000011111000001101101010" | |
| 452 "110010001001010010100000001101" | |
| 453 "000001000110110100111010111100" | |
| 454 "010111010010100100001111011010" | |
| 455 "110111001110101010101101110100" | |
| 456 "011011110001010100010111010011" | |
| 457 "000111101001100001111000010110" | |
| 458 "000100101000110000000111110011" | |
| 459 }, | |
| 460 /* 3*/ { ESCAPE_MODE, 2, 96 + 1, { 0, 0, "" }, "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G634 ALPHA DR\\GPITTSBURGH\\GPA\\R\\E", -1, "15238840001", 0, 33, 30, 1, "OkapiBarcode zero-pad postcode lacking +4 (US 840 only), ISO/IEC 16023:2000 Annex B.1.4a", | |
| 461 "110101110110111110111111101111" | |
| 462 "010101010111000011011000010010" | |
| 463 "110110110001001010100110010001" | |
| 464 "111000101010101111111111111110" | |
| 465 "001111000010110010011000000011" | |
| 466 "001001110010101010100000000000" | |
| 467 "111011111110111111101111111110" | |
| 468 "100110000011001001110000001010" | |
| 469 "010001100010101010101001110001" | |
| 470 "110111101111010000011011111100" | |
| 471 "001100111111000000001010101001" | |
| 472 "101110100000000001010011011010" | |
| 473 "101010010010000000010110111111" | |
| 474 "111101110000000000010011100010" | |
| 475 "101010110000000000000110011101" | |
| 476 "001000010000000000001100011110" | |
| 477 "010011001000000000001000001010" | |
| 478 "000000101000000000001010000010" | |
| 479 "000100001100000000000010101010" | |
| 480 "000010010100000000000100110000" | |
| 481 "100000111100000000010001100000" | |
| 482 "101000101000000000111110100000" | |
| 483 "001000001110100101011010100101" | |
| 484 "011001111110011001010100001000" | |
| 485 "000010100010110001010101111010" | |
| 486 "100111000011111000001101101010" | |
| 487 "110010001001010010100000001101" | |
| 488 "000001000110110100111010111100" | |
| 489 "010111010010100100001111011010" | |
| 490 "110111001110101010101101110100" | |
| 491 "011011110001010100010111010011" | |
| 492 "000111101001100001111000010110" | |
| 493 "000100101000110000000111110011" | |
| 494 }, | |
| 495 /* 4*/ { -1, 3, -1, { 0, 0, "" }, "CEN", -1, "B1050056999", 0, 33, 30, 1, "ISO/IEC 16023:2000 B.1 Example (primary only given, data arbitrary); verified manually against tec-it", | |
| 496 "000000010101010101010101010111" | |
| 497 "001011000000000000000000000010" | |
| 498 "111001101010101010101010101000" | |
| 499 "010101010101010101010101010110" | |
| 500 "000000000000000000000000000001" | |
| 501 "101010101010101010101010101010" | |
| 502 "010101010101010101010101010100" | |
| 503 "000000000000000000000000000010" | |
| 504 "101010101010101010101010101000" | |
| 505 "010101010111100000100101010110" | |
| 506 "000000000001110000010100000010" | |
| 507 "101010101000000011010010101010" | |
| 508 "010101111100000000100001010110" | |
| 509 "000000001100000000011000000010" | |
| 510 "101010100100000000011110101001" | |
| 511 "010101011000000000000001010110" | |
| 512 "000000101000000000001000000001" | |
| 513 "101010110000000000001010101010" | |
| 514 "010101010000000000011101010101" | |
| 515 "000000101000000000011100000000" | |
| 516 "101010111100000000001010101001" | |
| 517 "010101011110000000011101010110" | |
| 518 "000000001110000001111000000011" | |
| 519 "101010101011011001000110101010" | |
| 520 "010101010101010101011100100010" | |
| 521 "000000000000000000000011011100" | |
| 522 "101010101010101010101001110100" | |
| 523 "111011101110000110101011010110" | |
| 524 "100001011111111101000011100111" | |
| 525 "110100001000001101100010100110" | |
| 526 "110110111111011110000011011111" | |
| 527 "010010001001110010000101000010" | |
| 528 "010001011010000011010010011100" | |
| 529 }, | |
| 530 /* 5*/ { UNICODE_MODE | ESCAPE_MODE, -1, -1, { 0, 0, "" }, "Comité Européen de Normalisation\034rue de Stassart 36\034B-1050 BRUXELLES\034TEL +3225196811", -1, "", 0, 33, 30, 1, "ISO/IEC 16023:2000 Example F.5 **NOT SAME** uses different encodation (2 Shift A among other things)", | |
| 531 "110010100010110000000100000111" | |
| 532 "011010001100110110111110101100" | |
| 533 "111010011100101010011100101101" | |
| 534 "000000100010000000001000001100" | |
| 535 "111101100000011100110011110110" | |
| 536 "011110001011100010100111011110" | |
| 537 "101010000100000111101000101010" | |
| 538 "110010101110101101001000000010" | |
| 539 "000110101100101111110010111111" | |
| 540 "111101111011111000111110100000" | |
| 541 "100000110101111010011110000000" | |
| 542 "011100110100000000101100011000" | |
| 543 "100001000110000000101011111100" | |
| 544 "110011101100000000111000001000" | |
| 545 "000110111100000000011010001011" | |
| 546 "101010010000000000001000011100" | |
| 547 "011000001000000000001000000000" | |
| 548 "001001010000000000001101000010" | |
| 549 "000000100100000000010000101010" | |
| 550 "101111101100000000010010001110" | |
| 551 "100000101110000000011110110000" | |
| 552 "101101011010000001110000001010" | |
| 553 "110001000110001011000111101001" | |
| 554 "111111000110000001110000100010" | |
| 555 "001000010001010101010111010000" | |
| 556 "110100110100000000000010001010" | |
| 557 "101111001110101010101101100111" | |
| 558 "011010000110010001100100101010" | |
| 559 "011100000011000100100111111110" | |
| 560 "010100011110011011111011000100" | |
| 561 "000000100010100101010010010010" | |
| 562 "001111010001110000011001100110" | |
| 563 "000100001011101000111010000010" | |
| 564 }, | |
| 565 /* 6*/ { -1, -1, -1, { 0, 0, "" }, "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", -1, "", 0, 33, 30, 1, "Numeric compaction, verified manually against TEC-IT", | |
| 566 "101101010111101101010111101111" | |
| 567 "110110111011110110111011110100" | |
| 568 "111101001111111101001111111100" | |
| 569 "010111101101010111101101010110" | |
| 570 "111001111110111001111110111000" | |
| 571 "000111111111000111111111000110" | |
| 572 "011110110101011110110101011111" | |
| 573 "101111011011101111011011101100" | |
| 574 "111111110100111111110100111101" | |
| 575 "101101011111110100101001111010" | |
| 576 "111110111111011010010110011111" | |
| 577 "111111000000000000000101111100" | |
| 578 "110101001100000000110001111010" | |
| 579 "011011101100000000001110111100" | |
| 580 "110100101100000000010111111110" | |
| 581 "101101111000000000001101011110" | |
| 582 "111110001000000000001011100100" | |
| 583 "111111101000000000001100011110" | |
| 584 "110101111000000000011001111000" | |
| 585 "011011001100000000111010111110" | |
| 586 "110100110110000000111011111110" | |
| 587 "111011010010000000100101011100" | |
| 588 "011111101110111111111011100101" | |
| 589 "111111110110011001111000011100" | |
| 590 "010101111011010101111010001110" | |
| 591 "101110111101101110110110000000" | |
| 592 "010011111111010011110011000000" | |
| 593 "101010001001110111000101100100" | |
| 594 "110111101010011001100011111000" | |
| 595 "111000110011011001001101000110" | |
| 596 "111010010010001000101000010101" | |
| 597 "101111000100011110110011011100" | |
| 598 "011111000110100011001101000000" | |
| 599 }, | |
| 600 /* 7*/ { -1, 5, -1, { 0, 0, "" }, "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\037\237\240\242\243\244\245\246\247\251\255\256\266\225\226\227\230\231\232\233\234\235\236", 51, "", 0, 33, 30, 1, "Mode 5 set E", | |
| 601 "000000000000000000101010101011" | |
| 602 "100101010111111111000000001000" | |
| 603 "110010011100100111001001110011" | |
| 604 "010101010101011010101010101000" | |
| 605 "010110101010001101010110101010" | |
| 606 "100011011000110101100011011000" | |
| 607 "010101010101111111111111111100" | |
| 608 "010111111111000000001010101010" | |
| 609 "011100100111001001110010011110" | |
| 610 "101010101011110000001010111100" | |
| 611 "111111111111110010010011010110" | |
| 612 "000000000110000010001000100010" | |
| 613 "101010110010000000001110101011" | |
| 614 "111111111000000000001011111100" | |
| 615 "000000110100000000001100000010" | |
| 616 "101010010000000000001010101000" | |
| 617 "111111001000000000001011111101" | |
| 618 "000000100000000000001000000010" | |
| 619 "101010100000000000001010101001" | |
| 620 "111111000000000000000011111110" | |
| 621 "000000100100000000011100000000" | |
| 622 "001011110100000001110111111000" | |
| 623 "000111000010110101110111101111" | |
| 624 "001110100010110001001010110010" | |
| 625 "110011000100101011100101101100" | |
| 626 "101111101011010011111111100110" | |
| 627 "010001100101111110101001111101" | |
| 628 "001000011101100111100101110010" | |
| 629 "110100001111010010010010001111" | |
| 630 "100010011100101000100000101100" | |
| 631 "110100100100100001111100000111" | |
| 632 "011111011011101100100101001010" | |
| 633 "000011101111000101100100011101" | |
| 634 }, | |
| 635 /* 8*/ { -1, 6, -1, { 0, 0, "" }, "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\241\250\253\257\260\264\267\270\273\277\212\213\214\215\216\217\220\221\222\223\224", -1, "", 0, 33, 30, 1, "Mode 6 set D", | |
| 636 "000000000000000000101010101011" | |
| 637 "100101010111111111000000001010" | |
| 638 "110010011100100111001001110001" | |
| 639 "010101010101010110101010101010" | |
| 640 "101010100000000001010110101000" | |
| 641 "110110001101100001100011011000" | |
| 642 "010101010101010111111111111111" | |
| 643 "010101011111111100000000101000" | |
| 644 "001001110010011100100111001001" | |
| 645 "010111110111110000000011111110" | |
| 646 "000001011011110010011101101011" | |
| 647 "101001101110000001000100110110" | |
| 648 "010101110000000000000001010110" | |
| 649 "000000101000000000000000000010" | |
| 650 "101010110100000000000110101010" | |
| 651 "010101010000000000001001010100" | |
| 652 "000000001000000000001000000011" | |
| 653 "101010100000000000001010101010" | |
| 654 "010101101100000000001001010111" | |
| 655 "000000101000000000001000000010" | |
| 656 "101010010110000000011010101001" | |
| 657 "010101011100000000111101010100" | |
| 658 "000000001110110111011000000011" | |
| 659 "101010100110110001100110101010" | |
| 660 "010101010101010101011001011100" | |
| 661 "000000000000000000001000000000" | |
| 662 "101010101010101010101010100010" | |
| 663 "101100011100101000011001110100" | |
| 664 "011100110000010001111110111110" | |
| 665 "101101100000111001011101001010" | |
| 666 "001100111110101100001101010101" | |
| 667 "011111001010000101000011000110" | |
| 668 "101111010010011100100011110010" | |
| 669 }, | |
| 670 /* 9*/ { -1, 6, -1, { 0, 0, "" }, "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\252\254\261\262\263\265\271\272\274\275\276\200\201\202\203\204\205\206\207\210\211", -1, "", 0, 33, 30, 1, "Mode 6 set C", | |
| 671 "000000000000000000101010101011" | |
| 672 "100101010111111111000000001010" | |
| 673 "110010011100100111001001110001" | |
| 674 "010101010101010110101010101010" | |
| 675 "101010100000000001010110101000" | |
| 676 "110110001101100001100011011000" | |
| 677 "010101010101010111111111111111" | |
| 678 "010101011111111100000000101000" | |
| 679 "001001110010011100100111001001" | |
| 680 "010111111111110000000111111110" | |
| 681 "000001010111110010010001101011" | |
| 682 "101001101010000001001100110110" | |
| 683 "010101100000000000000101010110" | |
| 684 "000000011000000000000100000010" | |
| 685 "101010110100000000000010101010" | |
| 686 "010101010000000000001001010100" | |
| 687 "000000001000000000001000000011" | |
| 688 "101010100000000000001010101010" | |
| 689 "010101110000000000001001010111" | |
| 690 "000000111100000000001100000010" | |
| 691 "101010110000000000010110101001" | |
| 692 "010101010100000000101101010100" | |
| 693 "000000001010110101011000000011" | |
| 694 "101010100010110001010110101010" | |
| 695 "010101010101010101011001011100" | |
| 696 "000000000000000000001000000000" | |
| 697 "101010101010101010101010100010" | |
| 698 "101100011100101000011001110100" | |
| 699 "011100110000010001111110111110" | |
| 700 "101101100000111001011101001010" | |
| 701 "001100111110101100001101010101" | |
| 702 "011111001010000101000011000110" | |
| 703 "101111010010011100100011110010" | |
| 704 }, | |
| 705 /* 10*/ { UNICODE_MODE | ESCAPE_MODE, 4, -1, { 0, 0, "" }, "`abcdefghijklmnopqrstuvwxyz\034\\G\\R{}~\177;<=>?[\\\\]^_ ,./:@!|", -1, "", 0, 33, 30, 1, "Mode 4 Set B", | |
| 706 "000000000000000010101010101011" | |
| 707 "010101011111111100000000101010" | |
| 708 "001001110010011100100111001000" | |
| 709 "010101010101101010101010101010" | |
| 710 "101010000000111111010101101000" | |
| 711 "011000110100011000011000110110" | |
| 712 "010101010101010101111111111110" | |
| 713 "100101010111111111000000001010" | |
| 714 "110010011100100111001001110010" | |
| 715 "010101011111000000000101111110" | |
| 716 "000000001101001010011000101000" | |
| 717 "101010101000000000100110011000" | |
| 718 "010101010000000000001001010101" | |
| 719 "000000111000000000001000000000" | |
| 720 "101010111100000000011010101010" | |
| 721 "010101010000000000000101010110" | |
| 722 "000000001000000000001000000010" | |
| 723 "101010100000000000001010101010" | |
| 724 "010101110100000000001101010101" | |
| 725 "000000010100000000101100000000" | |
| 726 "101010110100000000001010101000" | |
| 727 "010101010000000001010001010110" | |
| 728 "000000000010111111001000000010" | |
| 729 "101010101010110001011110101000" | |
| 730 "010101010101010101010010101000" | |
| 731 "000000000000000000000101100100" | |
| 732 "101010101010101010100010010110" | |
| 733 "001101100000000100111111111100" | |
| 734 "011101101001110010100010011010" | |
| 735 "111001101111100110001001101000" | |
| 736 "000001100000101010001100101010" | |
| 737 "100100110011010101001011100100" | |
| 738 "001000101111010000111000010101" | |
| 739 }, | |
| 740 /* 11*/ { UNICODE_MODE | ESCAPE_MODE, 4, -1, { 0, 0, "" }, "\\rABCDEFGHIJKLMNOPQRSTUVWXYZ\034\\G\\R \"#$%&'()*+,-./0123456789:", -1, "", 0, 33, 30, 1, "Mode 4 Set A", | |
| 741 "000000000000001010101010101011" | |
| 742 "010101111111110000000010101010" | |
| 743 "100111001001110010011100100101" | |
| 744 "010101010101011010101010101000" | |
| 745 "101010100000001111110101011011" | |
| 746 "110110001101000110000110001100" | |
| 747 "010101010101010111100010111101" | |
| 748 "010101011111111100111010111000" | |
| 749 "001001110010011100111101000000" | |
| 750 "010101010011000000000001111000" | |
| 751 "000000001001001010010100011001" | |
| 752 "101010100010000000010010011010" | |
| 753 "010101000000000000000001010111" | |
| 754 "000000110100000000100100000010" | |
| 755 "101010110000000000001010101001" | |
| 756 "010101010000000000001101010110" | |
| 757 "000000001000000000001000000000" | |
| 758 "101010100000000000001010101000" | |
| 759 "010101001100000000001101010100" | |
| 760 "000000111000000000101100000000" | |
| 761 "101010000010000000011110101001" | |
| 762 "010101010000000000100101010110" | |
| 763 "000000001110000001101000000000" | |
| 764 "101010100011000001001110101000" | |
| 765 "010101010101010101011100010100" | |
| 766 "000000000000000000001011000100" | |
| 767 "101010101010101010101011110001" | |
| 768 "100101110110110010101111111100" | |
| 769 "101101011111001110100110100100" | |
| 770 "010001101100100011100111010100" | |
| 771 "010000101010001111010111011001" | |
| 772 "010010011001101010010001111100" | |
| 773 "100111100111001110011000011011" | |
| 774 }, | |
| 775 /* 12*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ABCDabcdAabcABabcABCabcABCDaABCabABCabcABCéa", -1, "", 0, 33, 30, 1, "Mode 4 LCHB SHA 2SHA 3SHA LCHA SHB LCHB 3SHA 3SHA SHD", | |
| 776 "110000000011000000000011000011" | |
| 777 "010000000001000000000001000000" | |
| 778 "111010011100100110011110100101" | |
| 779 "000000001100000000110000000000" | |
| 780 "000000000110000000110000000010" | |
| 781 "110110101100110110111101101100" | |
| 782 "110000110000000000001100000000" | |
| 783 "110000010000000000000100000000" | |
| 784 "111001101001111001111010011110" | |
| 785 "010101010011000000001000001100" | |
| 786 "000000000001000010001000011111" | |
| 787 "101010100110000000010010101000" | |
| 788 "010101000010000000000001010101" | |
| 789 "000000001000000000101000000000" | |
| 790 "101010100000000000010010101010" | |
| 791 "010101011000000000001101010110" | |
| 792 "000000001000000000001000000001" | |
| 793 "101010001000000000001010101000" | |
| 794 "010101001100000000001001010111" | |
| 795 "000000111000000000011000000010" | |
| 796 "101010101000000000001110101000" | |
| 797 "010101010110000000010101010100" | |
| 798 "000000001110001111001100000001" | |
| 799 "101010101111000001101110101000" | |
| 800 "010101010101010101011101000110" | |
| 801 "000000000000000000000000000110" | |
| 802 "101010101010101010101101100100" | |
| 803 "000010001010001010000101010000" | |
| 804 "101000000111100010010001111100" | |
| 805 "101001111000010101010110110010" | |
| 806 "011101111110011111011100001000" | |
| 807 "110001000010011110111101111000" | |
| 808 "011010011011111110001000000010" | |
| 809 }, | |
| 810 /* 13*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ÀÁÂÃ1", -1, "", 0, 33, 30, 1, "Mode 4 LCKC LCHA", | |
| 811 "010101010101010101010101010111" | |
| 812 "000000000000000000000000000000" | |
| 813 "101010101010101010101010101010" | |
| 814 "010101010101010101010101010110" | |
| 815 "000000000000000000000000000001" | |
| 816 "101010101010101010101010101000" | |
| 817 "010101010101010101010101010110" | |
| 818 "000000000000000000000000000010" | |
| 819 "101010101010101010101010101001" | |
| 820 "010101011111110000111001010100" | |
| 821 "000000001111110010001000000000" | |
| 822 "101010101010000000011110101010" | |
| 823 "010101000100000000000101010110" | |
| 824 "000000110000000000000100000000" | |
| 825 "101010011000000000001110101000" | |
| 826 "010101110000000000001001010110" | |
| 827 "000000101000000000001000000010" | |
| 828 "101010000000000000001110101000" | |
| 829 "010101001100000000000001010111" | |
| 830 "000000100100000000001000000010" | |
| 831 "101010010000000000010110101011" | |
| 832 "010101011100000000001101010100" | |
| 833 "000000001010110101111100000011" | |
| 834 "101010101010110001111110101010" | |
| 835 "010101010101010101011111010111" | |
| 836 "000000000000000000001111010110" | |
| 837 "101010101010101010100000000010" | |
| 838 "111111110000111100000101000000" | |
| 839 "010110101111000011110101010100" | |
| 840 "101010100000010101011111101010" | |
| 841 "111101011010000011110101101010" | |
| 842 "010110101111010110101010111100" | |
| 843 "010100000000010110101010010100" | |
| 844 }, | |
| 845 /* 14*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ÀÁÂÃ123456789", -1, "", 0, 33, 30, 1, "Mode 4 LCKC NS", | |
| 846 "111110110101010101010101010111" | |
| 847 "111010010000000000000000000000" | |
| 848 "000010011010101010101010101000" | |
| 849 "010101010101010101010101010100" | |
| 850 "000000000000000000000000000001" | |
| 851 "101010101010101010101010101010" | |
| 852 "010101010101010101010101010101" | |
| 853 "000000000000000000000000000000" | |
| 854 "101010101010101010101010101001" | |
| 855 "010101010111110000110001010110" | |
| 856 "000000000011110010010000000010" | |
| 857 "101010100110000000111010101010" | |
| 858 "010101011000000000001001010101" | |
| 859 "000000101000000000001000000000" | |
| 860 "101010000100000000000110101011" | |
| 861 "010101010000000000001101010110" | |
| 862 "000000001000000000001000000000" | |
| 863 "101010100000000000001010101000" | |
| 864 "010101100000000000001001010100" | |
| 865 "000000001000000000001100000010" | |
| 866 "101010110000000000011010101001" | |
| 867 "010101010100000000011001010100" | |
| 868 "000000001110110101111000000000" | |
| 869 "101010101010110001000110101010" | |
| 870 "010101010101010101010000101101" | |
| 871 "000000000000000000001110011100" | |
| 872 "101010101010101010100111100010" | |
| 873 "011101100110110110100011110010" | |
| 874 "010001101101001001100100011011" | |
| 875 "100011011110110000101000000010" | |
| 876 "101101111000011101010000100101" | |
| 877 "000000111100011110100001110000" | |
| 878 "101000000010100111001011110101" | |
| 879 }, | |
| 880 /* 15*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "àáâã1", -1, "", 0, 33, 30, 1, "Mode 4 LCKD LCHA", | |
| 881 "010101010101010101010101010111" | |
| 882 "000000000000000000000000000000" | |
| 883 "101010101010101010101010101010" | |
| 884 "010101010101010101010101010110" | |
| 885 "000000000000000000000000000001" | |
| 886 "101010101010101010101010101000" | |
| 887 "010101010101010101010101010110" | |
| 888 "000000000000000000000000000010" | |
| 889 "101010101010101010101010101001" | |
| 890 "010101010111110000111101010100" | |
| 891 "000000000011110010000100000000" | |
| 892 "101010101110000000010110101010" | |
| 893 "010101010100000000000001010110" | |
| 894 "000000000000000000000000000000" | |
| 895 "101010011000000000001010101000" | |
| 896 "010101110000000000001001010110" | |
| 897 "000000101000000000001000000010" | |
| 898 "101010000000000000001110101000" | |
| 899 "010101010000000000000001010111" | |
| 900 "000000110000000000001100000010" | |
| 901 "101010110110000000011010101011" | |
| 902 "010101010100000000011101010100" | |
| 903 "000000001110110111111100000011" | |
| 904 "101010101110110001001110101010" | |
| 905 "010101010101010101011111010111" | |
| 906 "000000000000000000001111010110" | |
| 907 "101010101010101010100000000010" | |
| 908 "111111110000111100000101000000" | |
| 909 "010110101111000011110101010100" | |
| 910 "101010100000010101011111101010" | |
| 911 "111101011010000011110101101010" | |
| 912 "010110101111010110101010111100" | |
| 913 "010100000000010110101010010100" | |
| 914 }, | |
| 915 /* 16*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "¢£¤¥1", -1, "", 0, 33, 30, 1, "Mode 4 LCKE LCHA", | |
| 916 "010101010101010101010101010111" | |
| 917 "000000000000000000000000000000" | |
| 918 "101010101010101010101010101010" | |
| 919 "010101010101010101010101010110" | |
| 920 "000000000000000000000000000001" | |
| 921 "101010101010101010101010101000" | |
| 922 "010101010101010101010101010110" | |
| 923 "000000000000000000000000000010" | |
| 924 "101010101010101010101010101001" | |
| 925 "010101010111110100110001010100" | |
| 926 "000000000101110110000100000000" | |
| 927 "101010101010000000011110101010" | |
| 928 "010101010110000000001001010110" | |
| 929 "000000010000000000111000000000" | |
| 930 "101010011000000000001110101000" | |
| 931 "010101111000000000001001010110" | |
| 932 "000000101000000000001000000010" | |
| 933 "101010000000000000001110101000" | |
| 934 "010101111000000000001101010111" | |
| 935 "000000111100000000111000000010" | |
| 936 "101010001100000000111110101011" | |
| 937 "010101011110000001011101010100" | |
| 938 "000000001010110001011100000011" | |
| 939 "101010101010110101101010101010" | |
| 940 "010101010101010101011111010111" | |
| 941 "000000000000000000001111010110" | |
| 942 "101010101010101010100000000010" | |
| 943 "111111110000111100000101000000" | |
| 944 "010110101111000011110101010100" | |
| 945 "101010100000010101011111101010" | |
| 946 "111101011010000011110101101010" | |
| 947 "010110101111010110101010111100" | |
| 948 "010100000000010110101010010100" | |
| 949 }, | |
| 950 /* 17*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "¢£¤¥123456789", -1, "", 0, 33, 30, 1, "Mode 4 LCKE NS", | |
| 951 "111110101010101010101010101011" | |
| 952 "111010111111111111111111111100" | |
| 953 "000010000000000000000000000011" | |
| 954 "101010101010101010101010101010" | |
| 955 "111111111111111111111111111101" | |
| 956 "000000000000000000000000000010" | |
| 957 "101010101010101010101010101011" | |
| 958 "111111111111111111111111111100" | |
| 959 "000000000000000000000000000011" | |
| 960 "101010101111110100111010101000" | |
| 961 "111111111001110110011111111101" | |
| 962 "000000000110000000111000000000" | |
| 963 "101010001010000000000110101011" | |
| 964 "111111001000000000110111111110" | |
| 965 "000000000100000000000100000011" | |
| 966 "101010011000000000001110101010" | |
| 967 "111111001000000000001011111101" | |
| 968 "000000100000000000001000000000" | |
| 969 "101010010100000000000110101001" | |
| 970 "111111010000000000111111111100" | |
| 971 "000000101100000000110000000001" | |
| 972 "101010100110000001001010101010" | |
| 973 "111111111110110001011011111101" | |
| 974 "000000001010110101010000000010" | |
| 975 "101010101010101010100110111001" | |
| 976 "111111111111111111110110001100" | |
| 977 "000000000000000000001100010001" | |
| 978 "001110001011100101010100110000" | |
| 979 "010000101010111000100010110100" | |
| 980 "111011010110010000010100011000" | |
| 981 "111100010011001010110101010101" | |
| 982 "011100101001010011011100111100" | |
| 983 "101101110111011101011010011101" | |
| 984 }, | |
| 985 /* 18*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ABCDE12abcde1ÀÁÂ⣤¥1àáâãabcde123A123456789àáâ㢣¤¥abc", -1, "", 0, 33, 30, 1, "Mode 4 mixed sets", | |
| 986 "000000001111111100000000111111" | |
| 987 "000010101100111100000000111100" | |
| 988 "011100101110000000100111010111" | |
| 989 "001100000000111111110101010110" | |
| 990 "001100000000111100010101101010" | |
| 991 "101111011000101010011000110110" | |
| 992 "000000001111111100100010111110" | |
| 993 "000010101100000000111010111000" | |
| 994 "011100101110011110111101000010" | |
| 995 "000000001011001100010111111010" | |
| 996 "000000000001000010000111111000" | |
| 997 "110110001110000000011110101000" | |
| 998 "111101000010000000001101010101" | |
| 999 "111110110000000000100110010100" | |
| 1000 "010101101000000000010111001001" | |
| 1001 "010100110000000000001100001110" | |
| 1002 "000000101000000000001000001110" | |
| 1003 "101011110000000000001101101110" | |
| 1004 "010101101000000000000001010101" | |
| 1005 "000000000100000000010000000010" | |
| 1006 "101010100000000000000110101001" | |
| 1007 "010101010100000000000101010100" | |
| 1008 "000000001010001011100000000011" | |
| 1009 "101010101011000001011010101000" | |
| 1010 "010101010101010101011001101001" | |
| 1011 "000000000000000000001010110000" | |
| 1012 "101010101010101010100111000000" | |
| 1013 "001010111101110100110011111010" | |
| 1014 "011101101010101100110000010101" | |
| 1015 "011100101111011110010010111010" | |
| 1016 "100101101011010111110011101011" | |
| 1017 "100010001001110010101010111000" | |
| 1018 "111010110110001100101000010001" | |
| 1019 }, | |
| 1020 /* 19*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789MNO123456789", -1, "", 0, 33, 30, 1, "Mode 4 spaced NSs", | |
| 1021 "001011111000100010111110001011" | |
| 1022 "101011101000111010111010101100" | |
| 1023 "110100001011111101000010001101" | |
| 1024 "100010111110001000101111100010" | |
| 1025 "111010101110101110101011101011" | |
| 1026 "110110000001111110100000011110" | |
| 1027 "001011111000100010111110001010" | |
| 1028 "101011101010111010111010011110" | |
| 1029 "110100001011111101000010001110" | |
| 1030 "100010110111101100010011100000" | |
| 1031 "110110100001111010011111101010" | |
| 1032 "111010000100000000101100011100" | |
| 1033 "001011101010000000001011100010" | |
| 1034 "101011111100000000110110100110" | |
| 1035 "110100001100000000010000100100" | |
| 1036 "101111011000000000000110001000" | |
| 1037 "101011001000000000001010101100" | |
| 1038 "100000001000000000001001111110" | |
| 1039 "001000101100000000000110111101" | |
| 1040 "011110001100000000111010111010" | |
| 1041 "111111100010000000000101000001" | |
| 1042 "111110000010000000001010001010" | |
| 1043 "101110101010000011011011111011" | |
| 1044 "000001110111001001101011001010" | |
| 1045 "100000001000101111100001000111" | |
| 1046 "101111111110101110101001010000" | |
| 1047 "101001111111010000100110111011" | |
| 1048 "101100110110010001111000100000" | |
| 1049 "111101100110001110010001110001" | |
| 1050 "000101001110100101000001111000" | |
| 1051 "101101001001111010110101100000" | |
| 1052 "011101000011011001001111111000" | |
| 1053 "111010010011100000100100111111" | |
| 1054 }, | |
| 1055 /* 20*/ { UNICODE_MODE, 4, -1, { 3, 7, "" }, "THIS IS A 91 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, APPENDED, MAXICODE SYMBOL...", -1, "", 0, 33, 30, 1, "Mode 4 Structured Append", | |
| 1056 "010001111101000000100000100011" | |
| 1057 "000000010000000100000000101000" | |
| 1058 "001000101000110010011011001000" | |
| 1059 "000100011000100100000000011000" | |
| 1060 "110000001010000010101100000010" | |
| 1061 "100010000010110010001111000100" | |
| 1062 "001010000000011000001001000010" | |
| 1063 "100000001010001001001000100110" | |
| 1064 "101111101110000000100000011010" | |
| 1065 "000100010011101000000110000010" | |
| 1066 "110000000111100010001100111100" | |
| 1067 "100010001010000000000011000010" | |
| 1068 "000000001010000000010101110101" | |
| 1069 "111010110000000000010100101100" | |
| 1070 "110010111100000000001100000011" | |
| 1071 "000010010000000000001010000100" | |
| 1072 "111000001000000000001000000000" | |
| 1073 "011000010000000000001100100000" | |
| 1074 "000000001100000000011001010000" | |
| 1075 "101010010100000000000111001100" | |
| 1076 "001000000000000000001000001001" | |
| 1077 "000000000010000000000000100000" | |
| 1078 "101011000110011011000001010001" | |
| 1079 "100011111010000001000010001000" | |
| 1080 "011010000000000101011111110010" | |
| 1081 "000001110011111111111010100000" | |
| 1082 "001110100111000101011001001100" | |
| 1083 "011010010100110111100101011100" | |
| 1084 "101101001001011111000110110111" | |
| 1085 "110001110110110001000011001010" | |
| 1086 "011100001000111100110111011110" | |
| 1087 "010101011101100110111011100100" | |
| 1088 "011001000011110011011110111010" | |
| 1089 }, | |
| 1090 /* 21*/ { UNICODE_MODE, 3, -1, { 1, 8, "" }, "COMMISSION FOR EUROPEAN NORMALIZATION, RUE DE STASSART 36, B-1050 BRUXELLES", -1, "B1050056999", 0, 33, 30, 1, "Mode 3 Structured Append", | |
| 1091 "010000000000001010000000010011" | |
| 1092 "001000111111010000011111001000" | |
| 1093 "101111111010101111101101000101" | |
| 1094 "000001000000100010100001100010" | |
| 1095 "111100110010001100101000001110" | |
| 1096 "110100011010001101101000011100" | |
| 1097 "100000000010001000000001011010" | |
| 1098 "001100110101001001111111000010" | |
| 1099 "011010001001100010110100000111" | |
| 1100 "100100000111100000100101001000" | |
| 1101 "000010100001110000010100101010" | |
| 1102 "110010001000000011010000101000" | |
| 1103 "100010111100000000100010001001" | |
| 1104 "100000001100000000011000000000" | |
| 1105 "001011100100000000011111100100" | |
| 1106 "010111011000000000000011011010" | |
| 1107 "001110101000000000001000001000" | |
| 1108 "000001110000000000001011000000" | |
| 1109 "000111010000000000011111111101" | |
| 1110 "001100101000000000011100100010" | |
| 1111 "011010111100000000001000100000" | |
| 1112 "000010101110000000011110000110" | |
| 1113 "111001101110000001111000000000" | |
| 1114 "001000101011011001000101010000" | |
| 1115 "000010010101010101010000111101" | |
| 1116 "111000000000000000001110100000" | |
| 1117 "001011101010101010101000100010" | |
| 1118 "001100110110100101101100010110" | |
| 1119 "111100110000110110000010011001" | |
| 1120 "011100011110101010001100000000" | |
| 1121 "011001100010001111111000101001" | |
| 1122 "011111110000111010001010001100" | |
| 1123 "110010001001001011011111100111" | |
| 1124 }, | |
| 1125 /* 22*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "am.//ab,\034TA# z\015!", -1, "", 0, 33, 30, 1, "Was test_best_supported_set", | |
| 1126 "101110000101101100110101010111" | |
| 1127 "110110000011010100100000000010" | |
| 1128 "001000101111011100101010101010" | |
| 1129 "010101010101010101010101010110" | |
| 1130 "000000000000000000000000000001" | |
| 1131 "101010101010101010101010101010" | |
| 1132 "010101010101010101010101010100" | |
| 1133 "000000000000000000000000000010" | |
| 1134 "101010101010101010101010101011" | |
| 1135 "010101010111001100000101010110" | |
| 1136 "000000001011000010000000000001" | |
| 1137 "101010101100000000100110101010" | |
| 1138 "010101001100000000101101010110" | |
| 1139 "000000100000000000010000000010" | |
| 1140 "101010110000000000010010101011" | |
| 1141 "010101011000000000000101010100" | |
| 1142 "000000001000000000001000000000" | |
| 1143 "101010001000000000001010101000" | |
| 1144 "010101010000000000001101010101" | |
| 1145 "000000001100000000000000000010" | |
| 1146 "101010110010000000010110101011" | |
| 1147 "010101010100000001111001010110" | |
| 1148 "000000001110110111111100000000" | |
| 1149 "101010100110111101011010101000" | |
| 1150 "010101010101010101011101100010" | |
| 1151 "000000000000000000000101101000" | |
| 1152 "101010101010101010100011011000" | |
| 1153 "000000100000111000011101111100" | |
| 1154 "110001011111000111110010001000" | |
| 1155 "001011000001011000000110100000" | |
| 1156 "110010000110011010101100011010" | |
| 1157 "011011001001000010000110011100" | |
| 1158 "000010111111111111001110001110" | |
| 1159 }, | |
| 1160 }; | |
| 1161 const int data_size = ARRAY_SIZE(data); | |
| 1162 int i, length, ret; | |
| 1163 struct zint_symbol *symbol = NULL; | |
| 1164 | |
| 1165 char escaped[1024]; | |
| 1166 char cmp_buf[8192]; | |
| 1167 char cmp_msg[1024]; | |
| 1168 | |
| 1169 int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ | |
| 1170 int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */ | |
| 1171 | |
| 1172 testStartSymbol("test_encode", &symbol); | |
| 1173 | |
| 1174 for (i = 0; i < data_size; i++) { | |
| 1175 | |
| 1176 if (testContinue(p_ctx, i)) continue; | |
| 1177 | |
| 1178 symbol = ZBarcode_Create(); | |
| 1179 assert_nonnull(symbol, "Symbol not created\n"); | |
| 1180 | |
| 1181 length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); | |
| 1182 if (data[i].structapp.count) { | |
| 1183 symbol->structapp = data[i].structapp; | |
| 1184 } | |
| 1185 strcpy(symbol->primary, data[i].primary); | |
| 1186 | |
| 1187 ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); | |
| 1188 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 1189 | |
| 1190 if (p_ctx->generate) { | |
| 1191 printf(" /*%3d*/ { %s, %d, %d, { %d, %d, \"%s\" }, \"%s\", %d, \"%s\", %s, %d, %d, %d, \"%s\",\n", | |
| 1192 i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, | |
| 1193 data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, | |
| 1194 testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, | |
| 1195 data[i].primary, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); | |
| 1196 testUtilModulesPrint(symbol, " ", "\n"); | |
| 1197 printf(" },\n"); | |
| 1198 } else { | |
| 1199 if (ret < ZINT_ERROR) { | |
| 1200 int width, row; | |
| 1201 | |
| 1202 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); | |
| 1203 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); | |
| 1204 | |
| 1205 ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); | |
| 1206 assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); | |
| 1207 | |
| 1208 if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) { | |
| 1209 if (!data[i].bwipp_cmp) { | |
| 1210 if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); | |
| 1211 } else { | |
| 1212 ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, data[i].primary, cmp_buf, sizeof(cmp_buf), NULL); | |
| 1213 assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); | |
| 1214 | |
| 1215 ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); | |
| 1216 assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", | |
| 1217 i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); | |
| 1218 } | |
| 1219 } | |
| 1220 if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) { | |
| 1221 int cmp_len, ret_len; | |
| 1222 char modules_dump[17984 + 1]; | |
| 1223 assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); | |
| 1224 ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); | |
| 1225 assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); | |
| 1226 | |
| 1227 ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, data[i].primary, escaped, &ret_len); | |
| 1228 assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", | |
| 1229 i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); | |
| 1230 } | |
| 1231 } | |
| 1232 } | |
| 1233 | |
| 1234 ZBarcode_Delete(symbol); | |
| 1235 } | |
| 1236 | |
| 1237 testFinish(); | |
| 1238 } | |
| 1239 | |
| 1240 static void test_encode_segs(const testCtx *const p_ctx) { | |
| 1241 int debug = p_ctx->debug; | |
| 1242 | |
| 1243 struct item { | |
| 1244 int input_mode; | |
| 1245 int option_1; | |
| 1246 int option_2; | |
| 1247 struct zint_structapp structapp; | |
| 1248 struct zint_seg segs[3]; | |
| 1249 char *primary; | |
| 1250 int ret; | |
| 1251 | |
| 1252 int expected_rows; | |
| 1253 int expected_width; | |
| 1254 int bwipp_cmp; | |
| 1255 char *comment; | |
| 1256 char *expected; | |
| 1257 }; | |
| 1258 static const struct item data[] = { | |
| 1259 /* 0*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, "", 0, 33, 30, 1, "ISO 16023:2000 4.15.4 example", | |
| 1260 "010101010101010101010101010111" | |
| 1261 "000000000000000000000000000000" | |
| 1262 "101010101010101010101010101010" | |
| 1263 "010101010101010101010101010110" | |
| 1264 "000000000000000000000000000001" | |
| 1265 "101010101010101010101010101000" | |
| 1266 "010101010101010101010101010110" | |
| 1267 "000000000000000000000000000010" | |
| 1268 "101010101010101010101010101001" | |
| 1269 "010101010011010100000101010100" | |
| 1270 "000000000011111110001000000000" | |
| 1271 "101010101110000000101010101010" | |
| 1272 "010101110110000000110101010110" | |
| 1273 "000000110000000000100100000000" | |
| 1274 "101010011000000000010010101000" | |
| 1275 "010101111000000000001001010110" | |
| 1276 "000000001000000000001000000010" | |
| 1277 "101010001000000000001110101000" | |
| 1278 "010101111100000000000001010111" | |
| 1279 "000000010000000000110100000010" | |
| 1280 "101010000110000000010110101011" | |
| 1281 "010101011010000001110001010100" | |
| 1282 "000000000010110101000100000011" | |
| 1283 "101010100111110001001110101010" | |
| 1284 "010101010101010101011111010111" | |
| 1285 "000000000000000000001111010110" | |
| 1286 "101010101010101010100000000010" | |
| 1287 "111111110000111100000101000000" | |
| 1288 "010110101111000011110101010100" | |
| 1289 "101010100000010101011111101010" | |
| 1290 "111101011010000011110101101010" | |
| 1291 "010110101111010110101010111100" | |
| 1292 "010100000000010110101010010100" | |
| 1293 }, | |
| 1294 /* 1*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 0 }, { TU(""), 0, 0 } }, "", ZINT_WARN_USES_ECI, 33, 30, 1, "ISO 16023:2000 4.15.4 example auto-ECI", | |
| 1295 "010101010101010101010101010111" | |
| 1296 "000000000000000000000000000000" | |
| 1297 "101010101010101010101010101010" | |
| 1298 "010101010101010101010101010110" | |
| 1299 "000000000000000000000000000001" | |
| 1300 "101010101010101010101010101000" | |
| 1301 "010101010101010101010101010110" | |
| 1302 "000000000000000000000000000010" | |
| 1303 "101010101010101010101010101001" | |
| 1304 "010101010011010100000101010100" | |
| 1305 "000000000011111110001000000000" | |
| 1306 "101010101110000000101010101010" | |
| 1307 "010101110110000000110101010110" | |
| 1308 "000000110000000000100100000000" | |
| 1309 "101010011000000000010010101000" | |
| 1310 "010101111000000000001001010110" | |
| 1311 "000000001000000000001000000010" | |
| 1312 "101010001000000000001110101000" | |
| 1313 "010101111100000000000001010111" | |
| 1314 "000000010000000000110100000010" | |
| 1315 "101010000110000000010110101011" | |
| 1316 "010101011010000001110001010100" | |
| 1317 "000000000010110101000100000011" | |
| 1318 "101010100111110001001110101010" | |
| 1319 "010101010101010101011111010111" | |
| 1320 "000000000000000000001111010110" | |
| 1321 "101010101010101010100000000010" | |
| 1322 "111111110000111100000101000000" | |
| 1323 "010110101111000011110101010100" | |
| 1324 "101010100000010101011111101010" | |
| 1325 "111101011010000011110101101010" | |
| 1326 "010110101111010110101010111100" | |
| 1327 "010100000000010110101010010100" | |
| 1328 }, | |
| 1329 /* 2*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("Ж"), -1, 7 }, { TU("¶"), -1, 0 }, { TU(""), 0, 0 } }, "", 0, 33, 30, 1, "ISO 16023:2000 4.15.4 example inverted", | |
| 1330 "010101010101010101010101010111" | |
| 1331 "000000000000000000000000000000" | |
| 1332 "101010101010101010101010101010" | |
| 1333 "010101010101010101010101010110" | |
| 1334 "000000000000000000000000000001" | |
| 1335 "101010101010101010101010101000" | |
| 1336 "010101010101010101010101010110" | |
| 1337 "000000000000000000000000000010" | |
| 1338 "101010101010101010101010101001" | |
| 1339 "010101010011000000110101010100" | |
| 1340 "000000000111100010011000000000" | |
| 1341 "101010100110000000011010101010" | |
| 1342 "010101010110000000110101010110" | |
| 1343 "000000000000000000111100000000" | |
| 1344 "101010101000000000001110101000" | |
| 1345 "010101110000000000001101010110" | |
| 1346 "000000001000000000001000000010" | |
| 1347 "101010111000000000001110101000" | |
| 1348 "010101101000000000010101010111" | |
| 1349 "000000100100000000111000000010" | |
| 1350 "101010011010000000110110101011" | |
| 1351 "010101010110000001111001010100" | |
| 1352 "000000001010101111101100000011" | |
| 1353 "101010101110010101110010101010" | |
| 1354 "010101010101010101011111010111" | |
| 1355 "000000000000000000001111010110" | |
| 1356 "101010101010101010100000000010" | |
| 1357 "111111110000111100000101000000" | |
| 1358 "010110101111000011110101010100" | |
| 1359 "101010100000010101011111101010" | |
| 1360 "111101011010000011110101101010" | |
| 1361 "010110101111010110101010111100" | |
| 1362 "010100000000010110101010010100" | |
| 1363 }, | |
| 1364 /* 3*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("Ж"), -1, 0 }, { TU("¶"), -1, 0 }, { TU(""), 0, 0 } }, "", ZINT_WARN_USES_ECI, 33, 30, 1, "ISO 16023:2000 4.15.4 example inverted auto-ECI", | |
| 1365 "010101010101010101010101010111" | |
| 1366 "000000000000000000000000000000" | |
| 1367 "101010101010101010101010101010" | |
| 1368 "010101010101010101010101010110" | |
| 1369 "000000000000000000000000000001" | |
| 1370 "101010101010101010101010101000" | |
| 1371 "010101010101010101010101010110" | |
| 1372 "000000000000000000000000000010" | |
| 1373 "101010101010101010101010101001" | |
| 1374 "010101010011000000110101010100" | |
| 1375 "000000000111100010011000000000" | |
| 1376 "101010100110000000011010101010" | |
| 1377 "010101010110000000110101010110" | |
| 1378 "000000000000000000111100000000" | |
| 1379 "101010101000000000001110101000" | |
| 1380 "010101110000000000001101010110" | |
| 1381 "000000001000000000001000000010" | |
| 1382 "101010111000000000001110101000" | |
| 1383 "010101101000000000010101010111" | |
| 1384 "000000100100000000111000000010" | |
| 1385 "101010011010000000110110101011" | |
| 1386 "010101010110000001111001010100" | |
| 1387 "000000001010101111101100000011" | |
| 1388 "101010101110010101110010101010" | |
| 1389 "010101010101010101011111010111" | |
| 1390 "000000000000000000001111010110" | |
| 1391 "101010101010101010100000000010" | |
| 1392 "111111110000111100000101000000" | |
| 1393 "010110101111000011110101010100" | |
| 1394 "101010100000010101011111101010" | |
| 1395 "111101011010000011110101101010" | |
| 1396 "010110101111010110101010111100" | |
| 1397 "010100000000010110101010010100" | |
| 1398 }, | |
| 1399 /* 4*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("Pixel 4a 128 GB:$439.97"), -1, 3 }, { TU("Pixel 4a 128 GB:¥3149.79"), -1, 29 }, { TU("Pixel 4a 128 GB:444,90 €"), -1, 17 } }, "", 0, 33, 30, 1, "AIM ITS/04-023:2022 Annex A example (shortened)", | |
| 1400 "011111000111111101000011011111" | |
| 1401 "001001000000000100100001101010" | |
| 1402 "000011100010010000110101000001" | |
| 1403 "110000100011101010111101111110" | |
| 1404 "111110010111001101100111010000" | |
| 1405 "110010001011001011111001101110" | |
| 1406 "011111000111111101000011110110" | |
| 1407 "001001000000000100100001111000" | |
| 1408 "000011100010010000110101011100" | |
| 1409 "011111111011001000000111011110" | |
| 1410 "110110000101000110011000011100" | |
| 1411 "011000101100000000100011000100" | |
| 1412 "111110001110000000011010101110" | |
| 1413 "100101101100000000001000001110" | |
| 1414 "111011001100000000001110001100" | |
| 1415 "011100010000000000000000100010" | |
| 1416 "001111001000000000001010010111" | |
| 1417 "001100110000000000001010001000" | |
| 1418 "111100011100000000011001111110" | |
| 1419 "100100110000000000110100000010" | |
| 1420 "001110000110000000011100100110" | |
| 1421 "111111001110000001011000011100" | |
| 1422 "101001000110101011001110000100" | |
| 1423 "000001010110011101111011000000" | |
| 1424 "110111110111010101011111010000" | |
| 1425 "101101000011010000000101101100" | |
| 1426 "000010000001001010100001001111" | |
| 1427 "001010001101110010110101001000" | |
| 1428 "111110111100101100111101000110" | |
| 1429 "010000000001111110111001010000" | |
| 1430 "110101000010011011010111000110" | |
| 1431 "100010110010010000000010010100" | |
| 1432 "100011010011101111001011000001" | |
| 1433 }, | |
| 1434 /* 5*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("$439.97"), -1, 3 }, { TU("¥3149.79"), -1, 29 }, { TU("444,90 €"), -1, 17 } }, "", 0, 33, 30, 1, "AIM ITS/04-023:2022 Annex A example price only", | |
| 1435 "101011011101111111110111111011" | |
| 1436 "011111101101000010011110010100" | |
| 1437 "111001110100111000100111101110" | |
| 1438 "010101010111011111011111111010" | |
| 1439 "000000000111000001111010100011" | |
| 1440 "101010100001000010000000001010" | |
| 1441 "010101010101010101010101010111" | |
| 1442 "000000000000000000000000000010" | |
| 1443 "101010101010101010101010101000" | |
| 1444 "010101010111001100100001010100" | |
| 1445 "000000001001000110011100000010" | |
| 1446 "101010100010000000011110101010" | |
| 1447 "010101011110000000001101010100" | |
| 1448 "000000101000000000010000000000" | |
| 1449 "101010001100000000000110101000" | |
| 1450 "010101111000000000001001010110" | |
| 1451 "000000101000000000001000000010" | |
| 1452 "101010011000000000001110101010" | |
| 1453 "010101110100000000001101010101" | |
| 1454 "000000001000000000011000000000" | |
| 1455 "101010010010000000101010101000" | |
| 1456 "010101010100000001111101010100" | |
| 1457 "000000000110101111101000000011" | |
| 1458 "101010100110011101000110101000" | |
| 1459 "010101010101010101011001001110" | |
| 1460 "000000000000000000000000000100" | |
| 1461 "101010101010101010100101100101" | |
| 1462 "001001110101111010110011011100" | |
| 1463 "001100001100101000100101110110" | |
| 1464 "011101100101000100110011000100" | |
| 1465 "000100101101010011010011101111" | |
| 1466 "010111011011100000011000101000" | |
| 1467 "001111010010000100010110011110" | |
| 1468 }, | |
| 1469 /* 6*/ { DATA_MODE, -1, -1, { 0, 0, "" }, { { TU("\266"), 1, 0 }, { TU("\266"), 1, 7 }, { TU("\266"), 1, 0 } }, "", 0, 33, 30, 1, "Standard example + extra seg, data mode", | |
| 1470 "101010101010101010101010101011" | |
| 1471 "111111111111111111111111111100" | |
| 1472 "000000000000000000000000000011" | |
| 1473 "101010101010101010101010101010" | |
| 1474 "111111111111111111111111111111" | |
| 1475 "000000000000000000000000000000" | |
| 1476 "101010101010101010101010101011" | |
| 1477 "111111111111111111111111111110" | |
| 1478 "000000000000000000000000000011" | |
| 1479 "101010100011110100111010101000" | |
| 1480 "111111110011111110000011111111" | |
| 1481 "000000001110000000111000000010" | |
| 1482 "101010110110000000101110101010" | |
| 1483 "111111111100000000110011111100" | |
| 1484 "000000001100000000010100000011" | |
| 1485 "101010010000000000001110101010" | |
| 1486 "111111001000000000001011111110" | |
| 1487 "000000000000000000001000000010" | |
| 1488 "101010101000000000010010101001" | |
| 1489 "111111110100000000100011111110" | |
| 1490 "000000110000000000111100000010" | |
| 1491 "101010100100000001110110101010" | |
| 1492 "111111111110111101101111111101" | |
| 1493 "000000000011111001100100000010" | |
| 1494 "101010101010101010101010010110" | |
| 1495 "111111111111111111110101111110" | |
| 1496 "000000000000000000000101101010" | |
| 1497 "000001010101000010100101111110" | |
| 1498 "101001011111101011111010000010" | |
| 1499 "111111110000101011110101101010" | |
| 1500 "000000001111111101011111000010" | |
| 1501 "111100001111010101010101111110" | |
| 1502 "000010100101010111111010101010" | |
| 1503 }, | |
| 1504 /* 7*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("αβ"), -1, 0 }, { TU("ÿ"), -1, 0 }, { TU("貫やぐ禁"), -1, 20 } }, "", ZINT_WARN_USES_ECI, 33, 30, 1, "Auto-ECI", | |
| 1505 "101001111110111100111101111111" | |
| 1506 "011011111100001100001111110010" | |
| 1507 "110011000010011001010101100010" | |
| 1508 "010101010101010101010101111000" | |
| 1509 "000000000000000000000000011010" | |
| 1510 "101010101010101010101010010100" | |
| 1511 "010101010101010101010101010101" | |
| 1512 "000000000000000000000000000010" | |
| 1513 "101010101010101010101010101011" | |
| 1514 "010101010111000000110101010110" | |
| 1515 "000000001011010010000000000000" | |
| 1516 "101010100000000000111010101000" | |
| 1517 "010101100100000000110101010111" | |
| 1518 "000000011000000000011100000000" | |
| 1519 "101010010000000000010010101010" | |
| 1520 "010101010000000000001101010110" | |
| 1521 "000000001000000000001000000011" | |
| 1522 "101010000000000000001010101010" | |
| 1523 "010101100000000000010001010100" | |
| 1524 "000000000000000000010100000010" | |
| 1525 "101010110010000000110010101000" | |
| 1526 "010101011000000001001001010110" | |
| 1527 "000000000010101011101100000000" | |
| 1528 "101010100010011101101110101000" | |
| 1529 "010101010101010101011111011101" | |
| 1530 "000000000000000000000110001000" | |
| 1531 "101010101010101010100100010011" | |
| 1532 "001001001011101100110001101010" | |
| 1533 "100011101101100100001001100101" | |
| 1534 "110000000110011111100001111000" | |
| 1535 "000011110000100000101100001100" | |
| 1536 "101111001101000010111111110000" | |
| 1537 "001001000010100001000011101011" | |
| 1538 }, | |
| 1539 /* 8*/ { UNICODE_MODE, -1, -1, { 1, 2, "" }, { { TU("αβ"), -1, 9 }, { TU("ÿ"), -1, 3 }, { TU("貫やぐ禁"), -1, 20 } }, "", 0, 33, 30, 1, "Structured Append", | |
| 1540 "000110100111111011110011110111" | |
| 1541 "001001101111110000110000111100" | |
| 1542 "110011001100001001100101010101" | |
| 1543 "010101010101010101011110111110" | |
| 1544 "000000000000000000000110001101" | |
| 1545 "101010101010101010100101001010" | |
| 1546 "010101010101010101010101010111" | |
| 1547 "000000000000000000000000000010" | |
| 1548 "101010101010101010101010101000" | |
| 1549 "010101010011001100000001010110" | |
| 1550 "000000000101001110001000000011" | |
| 1551 "101010101010000000101110101000" | |
| 1552 "010101111000000000110001010101" | |
| 1553 "000000110100000000100000000010" | |
| 1554 "101010001100000000011010101011" | |
| 1555 "010101011000000000000101010100" | |
| 1556 "000000001000000000001000000010" | |
| 1557 "101010001000000000001010101000" | |
| 1558 "010101100000000000011101010110" | |
| 1559 "000000001000000000001000000010" | |
| 1560 "101010101110000000011010101001" | |
| 1561 "010101010110000000010101010110" | |
| 1562 "000000001110011011011000000010" | |
| 1563 "101010100011000001100010101010" | |
| 1564 "010101010101010101011010110111" | |
| 1565 "000000000000000000001111011010" | |
| 1566 "101010101010101010101101010010" | |
| 1567 "111001010001101011001010011100" | |
| 1568 "001101001101101110010010110011" | |
| 1569 "101000100011001111100000101000" | |
| 1570 "100000000110100010001110000100" | |
| 1571 "101000101011101111110001101000" | |
| 1572 "000010101010000010000100110100" | |
| 1573 }, | |
| 1574 /* 9*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("ab"), -1, 3 }, { TU("ABCD"), -1, 4 }, { TU(""), 0, 0 } }, "", 0, 33, 30, 1, "Code Set B then A", | |
| 1575 "000000010101010101010101010111" | |
| 1576 "000010000000000000000000000010" | |
| 1577 "011100101010101010101010101001" | |
| 1578 "010101010101010101010101010110" | |
| 1579 "000000000000000000000000000010" | |
| 1580 "101010101010101010101010101010" | |
| 1581 "010101010101010101010101010100" | |
| 1582 "000000000000000000000000000000" | |
| 1583 "101010101010101010101010101011" | |
| 1584 "010101010111000000110001010100" | |
| 1585 "000000001011000010000100000000" | |
| 1586 "101010100000000000111110101010" | |
| 1587 "010101110010000000111001010110" | |
| 1588 "000000000000000000101000000010" | |
| 1589 "101010011000000000010110101011" | |
| 1590 "010101011000000000000001010110" | |
| 1591 "000000001000000000001000000001" | |
| 1592 "101010101000000000001010101000" | |
| 1593 "010101000000000000001001010101" | |
| 1594 "000000001000000000001100000010" | |
| 1595 "101010001110000000111010101001" | |
| 1596 "010101010010000001111101010100" | |
| 1597 "000000000110101111011000000010" | |
| 1598 "101010101010010001101010101010" | |
| 1599 "010101010101010101011110000100" | |
| 1600 "000000000000000000001100111010" | |
| 1601 "101010101010101010101100000000" | |
| 1602 "110000011010110101000110100010" | |
| 1603 "100100110111110111001111101011" | |
| 1604 "011111111011111001110100101100" | |
| 1605 "101000010001001011101111001010" | |
| 1606 "011011011101010101001101001000" | |
| 1607 "001010010110100000100111101000" | |
| 1608 }, | |
| 1609 /* 10*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("\004\004\004\004"), -1, 3 }, { TU("ABCD"), -1, 4 }, { TU("abcd"), -1, 5 } }, "", 0, 33, 30, 0, "Code Set E then A then B; BWIPP different encodation, LCHA before 2nd ECI not after, same codeword count, same result", | |
| 1610 "001100000000100011000000000111" | |
| 1611 "100100000010011011000000100000" | |
| 1612 "000110011100111011100111001010" | |
| 1613 "010101010101010101010101010100" | |
| 1614 "000000000000000000000000000011" | |
| 1615 "101010101010101010101010101010" | |
| 1616 "010101010101010101010101010111" | |
| 1617 "000000000000000000000000000010" | |
| 1618 "101010101010101010101010101000" | |
| 1619 "010101010111000000000001010110" | |
| 1620 "000000001001001010011100000011" | |
| 1621 "101010100100000000000110101010" | |
| 1622 "010101101010000000110101010100" | |
| 1623 "000000100100000000111000000010" | |
| 1624 "101010111100000000000010101001" | |
| 1625 "010101010000000000000001010110" | |
| 1626 "000000001000000000001000000001" | |
| 1627 "101010100000000000001010101010" | |
| 1628 "010101110100000000010101010110" | |
| 1629 "000000111000000000110100000000" | |
| 1630 "101010000110000000101010101011" | |
| 1631 "010101010000000001010101010110" | |
| 1632 "000000000110100011101100000011" | |
| 1633 "101010100011011101111110101010" | |
| 1634 "010101010101010101010101101000" | |
| 1635 "000000000000000000001001000010" | |
| 1636 "101010101010101010101010110111" | |
| 1637 "100010010101100011100111000100" | |
| 1638 "110110101110100010100011010011" | |
| 1639 "100001111011001010101000111000" | |
| 1640 "101100010110101111011111100011" | |
| 1641 "111010100101000101001011011000" | |
| 1642 "011111000111001010010000111100" | |
| 1643 }, | |
| 1644 /* 11*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("12345678"), -1, 3 }, { TU("91234567901"), -1, 4 }, { TU("12345678"), -1, 5 } }, "", 0, 33, 30, 1, "Digits spanning ECIs", | |
| 1645 "111000111110001111011010001111" | |
| 1646 "010110010011111100001101100010" | |
| 1647 "001100101011100111111011101001" | |
| 1648 "010101010101011111111111111110" | |
| 1649 "000000000000000110101010000010" | |
| 1650 "101010101010100011011000110110" | |
| 1651 "010101010101010101010101010111" | |
| 1652 "000000000000000000000000000010" | |
| 1653 "101010101010101010101010101001" | |
| 1654 "010101011111001100010001010100" | |
| 1655 "000000000001001010011000000010" | |
| 1656 "101010100000000000101010101000" | |
| 1657 "010101011110000000011001010110" | |
| 1658 "000000011000000000001100000010" | |
| 1659 "101010101100000000011110101010" | |
| 1660 "010101111000000000000101010100" | |
| 1661 "000000101000000000001000000000" | |
| 1662 "101010101000000000001110101000" | |
| 1663 "010101010100000000000101010110" | |
| 1664 "000000001100000000100000000000" | |
| 1665 "101010001110000000101110101001" | |
| 1666 "010101011100000001010101010110" | |
| 1667 "000000001010101111111000000011" | |
| 1668 "101010101010011101101110101000" | |
| 1669 "010101010101010101011010001010" | |
| 1670 "000000000000000000000110111110" | |
| 1671 "101010101010101010100011111111" | |
| 1672 "011111100011010101000000000110" | |
| 1673 "111111010001111000000100101010" | |
| 1674 "011101100000010110110001000100" | |
| 1675 "101110111111001001111001110000" | |
| 1676 "010101101100001010110111001100" | |
| 1677 "101011011010100110010010100111" | |
| 1678 }, | |
| 1679 /* 12*/ { UNICODE_MODE, -1, 96 + 1, { 0, 0, "" }, { { TU("12345678"), -1, 3 }, { TU("91234567901"), -1, 4 }, { TU("12345678"), -1, 5 } }, "9999840012", 0, 33, 30, 1, "SCM prefix mode 2", | |
| 1680 "110101110110111110111110001111" | |
| 1681 "010101010111000011011001000000" | |
| 1682 "110110110001001010100111111001" | |
| 1683 "110010111100101111111111111110" | |
| 1684 "111111000110010110101010000010" | |
| 1685 "011011101000110011011000110100" | |
| 1686 "110110100011111111111111110100" | |
| 1687 "000011011000000010101010010010" | |
| 1688 "111110111010011100100111001001" | |
| 1689 "010101010011010000011101010110" | |
| 1690 "000000000001100000000100000001" | |
| 1691 "101010101110000001011010101000" | |
| 1692 "010101100010000000000001010100" | |
| 1693 "000000100000000000001000000000" | |
| 1694 "101010110000000000001110101000" | |
| 1695 "010101110000000000011101010110" | |
| 1696 "000000101000000000001000000011" | |
| 1697 "101010000000000000011010101010" | |
| 1698 "010101011100000000000101010110" | |
| 1699 "000000111000000000000100000010" | |
| 1700 "101010100110000000001010101011" | |
| 1701 "010101011000000001101101010100" | |
| 1702 "000000001010000011010100000010" | |
| 1703 "101010100110000001010110101000" | |
| 1704 "010101010101010101010010100111" | |
| 1705 "000000000000000000001111100100" | |
| 1706 "101010101010101010100000011011" | |
| 1707 "001001001110011001111101100010" | |
| 1708 "110000110000100111010010101000" | |
| 1709 "110001111010010001001101000010" | |
| 1710 "100110000010010001101011000111" | |
| 1711 "110011010111010010100011101000" | |
| 1712 "111010011111011100110001010110" | |
| 1713 }, | |
| 1714 /* 13*/ { UNICODE_MODE, 3, 96 + 1, { 0, 0, "" }, { { TU("12345678"), -1, 3 }, { TU("91234567901"), -1, 4 }, { TU("12345678"), -1, 5 } }, "B999840012", 0, 33, 30, 1, "SCM prefix mode 3", | |
| 1715 "110101110110111110111110001111" | |
| 1716 "010101010111000011011001000000" | |
| 1717 "110110110001001010100111111001" | |
| 1718 "110010111100101111111111111110" | |
| 1719 "111111000110010110101010000010" | |
| 1720 "011011101000110011011000110100" | |
| 1721 "110110100011111111111111110100" | |
| 1722 "000011011000000010101010010010" | |
| 1723 "111110111010011100100111001001" | |
| 1724 "010101011011100000011101010110" | |
| 1725 "000000000101010000001000000001" | |
| 1726 "101010100100000011011010101000" | |
| 1727 "010101000000000000110001010100" | |
| 1728 "000000100000000000110000000000" | |
| 1729 "101010000000000000000110101000" | |
| 1730 "010101111000000000001101010110" | |
| 1731 "000000101000000000001000000011" | |
| 1732 "101010000000000000001010101010" | |
| 1733 "010101100100000000010101010110" | |
| 1734 "000000101000000000110100000010" | |
| 1735 "101010110100000000001110101011" | |
| 1736 "010101011110000000001001010100" | |
| 1737 "000000000010000101110100000010" | |
| 1738 "101010100111011001110010101000" | |
| 1739 "010101010101010101010010100111" | |
| 1740 "000000000000000000001111100100" | |
| 1741 "101010101010101010100000011011" | |
| 1742 "001001001110011001111101100010" | |
| 1743 "110000110000100111010010101000" | |
| 1744 "110001111010010001001101000010" | |
| 1745 "100110000010010001101011000111" | |
| 1746 "110011010111010010100011101000" | |
| 1747 "111010011111011100110001010110" | |
| 1748 }, | |
| 1749 }; | |
| 1750 const int data_size = ARRAY_SIZE(data); | |
| 1751 int i, j, seg_count, ret; | |
| 1752 struct zint_symbol *symbol = NULL; | |
| 1753 | |
| 1754 char escaped[1024]; | |
| 1755 char cmp_buf[8192]; | |
| 1756 char cmp_msg[1024]; | |
| 1757 | |
| 1758 int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ | |
| 1759 int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */ | |
| 1760 | |
| 1761 testStartSymbol("test_encode_segs", &symbol); | |
| 1762 | |
| 1763 for (i = 0; i < data_size; i++) { | |
| 1764 | |
| 1765 if (testContinue(p_ctx, i)) continue; | |
| 1766 | |
| 1767 symbol = ZBarcode_Create(); | |
| 1768 assert_nonnull(symbol, "Symbol not created\n"); | |
| 1769 | |
| 1770 testUtilSetSymbol(symbol, BARCODE_MAXICODE, data[i].input_mode, -1 /*eci*/, | |
| 1771 data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, NULL, 0, debug); | |
| 1772 if (data[i].structapp.count) { | |
| 1773 symbol->structapp = data[i].structapp; | |
| 1774 } | |
| 1775 strcpy(symbol->primary, data[i].primary); | |
| 1776 for (j = 0, seg_count = 0; j < 3 && data[i].segs[j].length; j++, seg_count++); | |
| 1777 | |
| 1778 ret = ZBarcode_Encode_Segs(symbol, data[i].segs, seg_count); | |
| 1779 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode_Segs ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 1780 | |
| 1781 if (p_ctx->generate) { | |
| 1782 char escaped1[4096]; | |
| 1783 char escaped2[4096]; | |
| 1784 int length = data[i].segs[0].length == -1 ? (int) ustrlen(data[i].segs[0].source) : data[i].segs[0].length; | |
| 1785 int length1 = data[i].segs[1].length == -1 ? (int) ustrlen(data[i].segs[1].source) : data[i].segs[1].length; | |
| 1786 int length2 = data[i].segs[2].length == -1 ? (int) ustrlen(data[i].segs[2].source) : data[i].segs[2].length; | |
| 1787 printf(" /*%3d*/ { %s, %d, %d, { %d, %d, \"%s\" }, { { TU(\"%s\"), %d, %d }, { TU(\"%s\"), %d, %d }, { TU(\"%s\"), %d, %d } }, \"%s\", %s, %d, %d, %d, \"%s\",\n", | |
| 1788 i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, | |
| 1789 data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, | |
| 1790 testUtilEscape((const char *) data[i].segs[0].source, length, escaped, sizeof(escaped)), data[i].segs[0].length, data[i].segs[0].eci, | |
| 1791 testUtilEscape((const char *) data[i].segs[1].source, length1, escaped1, sizeof(escaped1)), data[i].segs[1].length, data[i].segs[1].eci, | |
| 1792 testUtilEscape((const char *) data[i].segs[2].source, length2, escaped2, sizeof(escaped2)), data[i].segs[2].length, data[i].segs[2].eci, | |
| 1793 data[i].primary, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); | |
| 1794 testUtilModulesPrint(symbol, " ", "\n"); | |
| 1795 printf(" },\n"); | |
| 1796 } else { | |
| 1797 if (ret < ZINT_ERROR) { | |
| 1798 int width, row; | |
| 1799 | |
| 1800 assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); | |
| 1801 assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); | |
| 1802 | |
| 1803 ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); | |
| 1804 assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d\n", i, ret, width, row); | |
| 1805 | |
| 1806 if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) { | |
| 1807 if (!data[i].bwipp_cmp) { | |
| 1808 if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); | |
| 1809 } else { | |
| 1810 ret = testUtilBwippSegs(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].segs, seg_count, data[i].primary, cmp_buf, sizeof(cmp_buf)); | |
| 1811 assert_zero(ret, "i:%d %s testUtilBwippSegs ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); | |
| 1812 | |
| 1813 ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected); | |
| 1814 assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", | |
| 1815 i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected); | |
| 1816 } | |
| 1817 } | |
| 1818 if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, (const char *) data[i].segs[0].source, data[i].segs[0].length, debug)) { | |
| 1819 if (data[i].input_mode == DATA_MODE) { | |
| 1820 if (debug & ZINT_DEBUG_TEST_PRINT) { | |
| 1821 printf("i:%d multiple segments in DATA_MODE not currently supported for ZXing-C++ testing (%s)\n", | |
| 1822 i, testUtilBarcodeName(symbol->symbology)); | |
| 1823 } | |
| 1824 } else { | |
| 1825 int cmp_len, ret_len; | |
| 1826 char modules_dump[17984 + 1]; | |
| 1827 assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); | |
| 1828 ret = testUtilZXingCPP(i, symbol, (const char *) data[i].segs[0].source, data[i].segs[0].length, | |
| 1829 modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); | |
| 1830 assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); | |
| 1831 | |
| 1832 ret = testUtilZXingCPPCmpSegs(symbol, cmp_msg, cmp_buf, cmp_len, data[i].segs, seg_count, | |
| 1833 data[i].primary, escaped, &ret_len); | |
| 1834 assert_zero(ret, "i:%d %s testUtilZXingCPPCmpSegs %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", | |
| 1835 i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); | |
| 1836 } | |
| 1837 } | |
| 1838 } | |
| 1839 } | |
| 1840 | |
| 1841 ZBarcode_Delete(symbol); | |
| 1842 } | |
| 1843 | |
| 1844 testFinish(); | |
| 1845 } | |
| 1846 | |
| 1847 /* #181 Nico Gunkel OSS-Fuzz */ | |
| 1848 static void test_fuzz(const testCtx *const p_ctx) { | |
| 1849 int debug = p_ctx->debug; | |
| 1850 | |
| 1851 struct item { | |
| 1852 int eci; | |
| 1853 char *data; | |
| 1854 int length; | |
| 1855 int ret; | |
| 1856 }; | |
| 1857 /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ | |
| 1858 static const struct item data[] = { | |
| 1859 /* 0*/ { -1, "\223\223\223\223\223\200\000\060\060\020\122\104\060\343\000\000\040\104\104\104\104\177\377\040\000\324\336\000\000\000\000\104\060\060\060\060\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\060\104\104\000\000\000\040\104\104\104\104\177\377\377\377\324\336\000\000\000\000\104\377\104\001\104\104\104\104\104\104\233\233\060\060\060\060\060\060\060\060\060\325\074", 107, ZINT_ERROR_TOO_LONG }, /* Original OSS-Fuzz triggering data */ | |
| 1860 /* 1*/ { -1, "AaAaAaAaAaAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA123456789", -1, ZINT_ERROR_TOO_LONG }, /* Add 6 lowercase a's so 6 SHIFTS inserted so 6 + 138 (max input len) = 144 and numbers come at end of buffer */ | |
| 1861 /* 2*/ { -1, "AaAaAaAaAaAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA123456789A", -1, ZINT_ERROR_TOO_LONG }, | |
| 1862 /* 3*/ { -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", -1, ZINT_ERROR_TOO_LONG }, | |
| 1863 /* 4*/ { 32768, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", -1, ZINT_ERROR_TOO_LONG }, | |
| 1864 /* 5*/ { -1, "AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa", -1, ZINT_ERROR_TOO_LONG }, | |
| 1865 }; | |
| 1866 const int data_size = ARRAY_SIZE(data); | |
| 1867 int i, length, ret; | |
| 1868 struct zint_symbol *symbol = NULL; | |
| 1869 | |
| 1870 testStartSymbol("test_fuzz", &symbol); | |
| 1871 | |
| 1872 for (i = 0; i < data_size; i++) { | |
| 1873 | |
| 1874 if (testContinue(p_ctx, i)) continue; | |
| 1875 | |
| 1876 symbol = ZBarcode_Create(); | |
| 1877 assert_nonnull(symbol, "Symbol not created\n"); | |
| 1878 | |
| 1879 length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, -1 /*input_mode*/, data[i].eci, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); | |
| 1880 | |
| 1881 ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); | |
| 1882 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 1883 | |
| 1884 ZBarcode_Delete(symbol); | |
| 1885 } | |
| 1886 | |
| 1887 testFinish(); | |
| 1888 } | |
| 1889 | |
| 1890 #include <time.h> | |
| 1891 | |
| 1892 #define TEST_PERF_ITER_MILLES 10 | |
| 1893 #define TEST_PERF_ITERATIONS (TEST_PERF_ITER_MILLES * 1000) | |
| 1894 #define TEST_PERF_TIME(arg) (((arg) * 1000.0) / CLOCKS_PER_SEC) | |
| 1895 | |
| 1896 /* Not a real test, just performance indicator */ | |
| 1897 static void test_perf(const testCtx *const p_ctx) { | |
| 1898 int debug = p_ctx->debug; | |
| 1899 | |
| 1900 struct item { | |
| 1901 int symbology; | |
| 1902 int input_mode; | |
| 1903 int option_1; | |
| 1904 int option_2; | |
| 1905 char *data; | |
| 1906 char *primary; | |
| 1907 int ret; | |
| 1908 | |
| 1909 int expected_rows; | |
| 1910 int expected_width; | |
| 1911 char *comment; | |
| 1912 }; | |
| 1913 static const struct item data[] = { | |
| 1914 /* 0*/ { BARCODE_MAXICODE, UNICODE_MODE | ESCAPE_MODE, -1, -1, | |
| 1915 "1Z34567890\\GUPSN\\G102562\\G034\\G\\G1/1\\G\\GY\\G2201 Second St\\GFt Myers\\GFL\\R\\E", | |
| 1916 "339010000840001", 0, 33, 30, "Mode 2" }, | |
| 1917 /* 1*/ { BARCODE_MAXICODE, UNICODE_MODE, 4, -1, "MaxiCode (19 chars)", "", 0, 33, 30, "Mode 4 small" }, | |
| 1918 /* 2*/ { BARCODE_MAXICODE, DATA_MODE | ESCAPE_MODE, 4, -1, "ABCDabcdAabcABabcABCabcABCDaABCabABCabcABC\\d233a", "", 0, 33, 30, "Mode 4 medium" }, | |
| 1919 /* 3*/ { BARCODE_MAXICODE, DATA_MODE | ESCAPE_MODE, 4, -1, | |
| 1920 "ABabcdeAabcdABCabcdABabc\\d192\\d192 \\d192\\d224\\d224\\d028\\d224\\d001\\d001\\d001\\d029\\d00112345678a123456789aABCDa\\d192\\d224\\d001\\d192\\d001\\d224\\d030\\d004", | |
| 1921 "", 0, 33, 30, "Mode 4 latches" }, | |
| 1922 /* 4*/ { BARCODE_MAXICODE, UNICODE_MODE, 4, -1, | |
| 1923 "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", "", 0, 33, 30, "Mode 4 txt max" }, | |
| 1924 /* 5*/ { BARCODE_MAXICODE, UNICODE_MODE, 4, -1, | |
| 1925 "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", | |
| 1926 "", 0, 33, 30, "Mode 4 num max" }, | |
| 1927 }; | |
| 1928 const int data_size = ARRAY_SIZE(data); | |
| 1929 int i, length, ret; | |
| 1930 struct zint_symbol *symbol; | |
| 1931 | |
| 1932 clock_t start; | |
| 1933 clock_t total_create = 0, total_encode = 0, total_buffer = 0; | |
| 1934 clock_t diff_create, diff_encode, diff_buffer; | |
| 1935 int comment_max = 0; | |
| 1936 | |
| 1937 if (!(debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */ | |
| 1938 return; | |
| 1939 } | |
| 1940 | |
| 1941 for (i = 0; i < data_size; i++) if ((int) strlen(data[i].comment) > comment_max) comment_max = (int) strlen(data[i].comment); | |
| 1942 | |
| 1943 printf("Iterations %d\n", TEST_PERF_ITERATIONS); | |
| 1944 | |
| 1945 for (i = 0; i < data_size; i++) { | |
| 1946 int j; | |
| 1947 | |
| 1948 if (testContinue(p_ctx, i)) continue; | |
| 1949 | |
| 1950 diff_create = diff_encode = diff_buffer = 0; | |
| 1951 | |
| 1952 for (j = 0; j < TEST_PERF_ITERATIONS; j++) { | |
| 1953 start = clock(); | |
| 1954 symbol = ZBarcode_Create(); | |
| 1955 diff_create += clock() - start; | |
| 1956 assert_nonnull(symbol, "Symbol not created\n"); | |
| 1957 | |
| 1958 length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); | |
| 1959 strcpy(symbol->primary, data[i].primary); | |
| 1960 | |
| 1961 start = clock(); | |
| 1962 ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); | |
| 1963 diff_encode += clock() - start; | |
| 1964 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 1965 | |
| 1966 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); | |
| 1967 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); | |
| 1968 | |
| 1969 #if 0 | |
| 1970 start = clock(); | |
| 1971 ret = ZBarcode_Buffer(symbol, 0 /*rotate_angle*/); | |
| 1972 diff_buffer += clock() - start; | |
| 1973 assert_zero(ret, "i:%d ZBarcode_Buffer ret %d != 0 (%s)\n", i, ret, symbol->errtxt); | |
| 1974 #endif | |
| 1975 | |
| 1976 ZBarcode_Delete(symbol); | |
| 1977 } | |
| 1978 | |
| 1979 printf("%*s: encode % 8gms, buffer % 8gms, create % 8gms\n", comment_max, data[i].comment, | |
| 1980 TEST_PERF_TIME(diff_encode), TEST_PERF_TIME(diff_buffer), TEST_PERF_TIME(diff_create)); | |
| 1981 | |
| 1982 total_create += diff_create; | |
| 1983 total_encode += diff_encode; | |
| 1984 total_buffer += diff_buffer; | |
| 1985 } | |
| 1986 if (p_ctx->index == -1) { | |
| 1987 printf("%*s: encode % 8gms, buffer % 8gms, create % 8gms\n", comment_max, "totals", | |
| 1988 TEST_PERF_TIME(total_encode), TEST_PERF_TIME(total_buffer), TEST_PERF_TIME(total_create)); | |
| 1989 } | |
| 1990 } | |
| 1991 | |
| 1992 int main(int argc, char *argv[]) { | |
| 1993 | |
| 1994 testFunction funcs[] = { /* name, func */ | |
| 1995 { "test_large", test_large }, | |
| 1996 { "test_input", test_input }, | |
| 1997 { "test_encode", test_encode }, | |
| 1998 { "test_encode_segs", test_encode_segs }, | |
| 1999 { "test_fuzz", test_fuzz }, | |
| 2000 { "test_perf", test_perf }, | |
| 2001 }; | |
| 2002 | |
| 2003 testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); | |
| 2004 | |
| 2005 testReport(); | |
| 2006 | |
| 2007 return 0; | |
| 2008 } | |
| 2009 | |
| 2010 /* vim: set ts=4 sw=4 et : */ |
