Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zint/backend/tests/test_gridmtx.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_2; | |
| 39 int option_3; | |
| 40 char *pattern; | |
| 41 int length; | |
| 42 int ret; | |
| 43 int expected_rows; | |
| 44 int expected_width; | |
| 45 char *expected_errtxt; | |
| 46 }; | |
| 47 /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ | |
| 48 static const struct item data[] = { | |
| 49 /* 0*/ { -1, -1, "1", 2751, 0, 162, 162, "" }, | |
| 50 /* 1*/ { -1, -1, "1", 2752, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, | |
| 51 /* 2*/ { -1, -1, "1", 2755, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, /* Triggers buffer > 9191 */ | |
| 52 /* 3*/ { -1, -1, "A", 1836, 0, 162, 162, "" }, | |
| 53 /* 4*/ { -1, -1, "A", 1837, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, | |
| 54 /* 5*/ { -1, -1, "A1", 1529, 0, 162, 162, "" }, | |
| 55 /* 6*/ { -1, -1, "A1", 1530, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, | |
| 56 /* 7*/ { -1, -1, "\200", 1143, 0, 162, 162, "" }, | |
| 57 /* 8*/ { -1, -1, "\200", 1144, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, | |
| 58 /* 9*/ { -1, ZINT_FULL_MULTIBYTE, "\241", 1410, 0, 162, 162, "" }, | |
| 59 /* 10*/ { -1, ZINT_FULL_MULTIBYTE, "\241", 1412, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, | |
| 60 /* 11*/ { 1, -1, "1", 18, 0, 18, 18, "" }, | |
| 61 /* 12*/ { 1, -1, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 1, requires 13 codewords (maximum 11)" }, | |
| 62 /* 13*/ { 1, -1, "A", 13, 0, 18, 18, "" }, | |
| 63 /* 14*/ { 1, -1, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 1, requires 12 codewords (maximum 11)" }, | |
| 64 /* 15*/ { 1, -1, "\200", 7, 0, 18, 18, "" }, | |
| 65 /* 16*/ { 1, -1, "\200", 8, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 1, requires 12 codewords (maximum 11)" }, | |
| 66 /* 17*/ { 1, ZINT_FULL_MULTIBYTE, "\241", 8, 0, 18, 18, "" }, | |
| 67 /* 18*/ { 1, ZINT_FULL_MULTIBYTE, "\241", 10, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 1, requires 12 codewords (maximum 11)" }, | |
| 68 /* 19*/ { 2, ZINT_FULL_MULTIBYTE, "\241", 40, 0, 30, 30, "" }, | |
| 69 /* 20*/ { 2, ZINT_FULL_MULTIBYTE, "\241", 41, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 2, requires 42 codewords (maximum 40)" }, | |
| 70 /* 21*/ { 3, -1, "A", 108, 0, 42, 42, "" }, | |
| 71 /* 22*/ { 3, -1, "A", 109, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 3, requires 80 codewords (maximum 79)" }, | |
| 72 /* 23*/ { 4, -1, "A", 202, 0, 54, 54, "" }, | |
| 73 /* 24*/ { 4, -1, "A", 203, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 4, requires 147 codewords (maximum 146)" }, | |
| 74 /* 25*/ { 5, -1, "1", 453, 0, 66, 66, "" }, | |
| 75 /* 26*/ { 5, -1, "1", 454, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 5, requires 220 codewords (maximum 218)" }, | |
| 76 /* 27*/ { 6, -1, "1", 633, 0, 78, 78, "" }, | |
| 77 /* 28*/ { 6, -1, "1", 634, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 6, requires 306 codewords (maximum 305)" }, | |
| 78 /* 29*/ { 7, -1, "\200", 352, 0, 90, 90, "" }, | |
| 79 /* 30*/ { 7, -1, "\200", 353, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 7, requires 406 codewords (maximum 405)" }, | |
| 80 /* 31*/ { 8, -1, "A", 727, 0, 102, 102, "" }, | |
| 81 /* 32*/ { 8, -1, "A", 728, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 8, requires 522 codewords (maximum 521)" }, | |
| 82 /* 33*/ { 9, -1, "A", 908, 0, 114, 114, "" }, | |
| 83 /* 34*/ { 9, -1, "A", 909, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 9, requires 651 codewords (maximum 650)" }, | |
| 84 /* 35*/ { 10, -1, "1", 1662, 0, 126, 126, "" }, | |
| 85 /* 36*/ { 10, -1, "1", 1663, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 10, requires 796 codewords (maximum 794)" }, | |
| 86 /* 37*/ { 11, -1, "1", 1995, 0, 138, 138, "" }, | |
| 87 /* 38*/ { 11, -1, "1", 1996, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 11, requires 954 codewords (maximum 953)" }, | |
| 88 /* 39*/ { 11, -1, "1", 2748, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 11, requires 1311 codewords (maximum 953)" }, | |
| 89 /* 40*/ { 12, -1, "1", 2355, 0, 150, 150, "" }, | |
| 90 /* 41*/ { 12, -1, "1", 2356, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 12, requires 1126 codewords (maximum 1125)" }, | |
| 91 }; | |
| 92 const int data_size = ARRAY_SIZE(data); | |
| 93 int i, length, ret; | |
| 94 struct zint_symbol *symbol = NULL; | |
| 95 | |
| 96 char data_buf[2800 + 1]; | |
| 97 | |
| 98 testStartSymbol("test_large", &symbol); | |
| 99 | |
| 100 for (i = 0; i < data_size; i++) { | |
| 101 | |
| 102 if (testContinue(p_ctx, i)) continue; | |
| 103 | |
| 104 symbol = ZBarcode_Create(); | |
| 105 assert_nonnull(symbol, "Symbol not created\n"); | |
| 106 | |
| 107 testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length); | |
| 108 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)); | |
| 109 | |
| 110 length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, data[i].option_3, -1 /*output_options*/, data_buf, data[i].length, debug); | |
| 111 | |
| 112 ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); | |
| 113 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 114 assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); | |
| 115 assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); | |
| 116 | |
| 117 if (ret < ZINT_ERROR) { | |
| 118 assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); | |
| 119 assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); | |
| 120 } | |
| 121 | |
| 122 ZBarcode_Delete(symbol); | |
| 123 } | |
| 124 | |
| 125 testFinish(); | |
| 126 } | |
| 127 | |
| 128 static void test_options(const testCtx *const p_ctx) { | |
| 129 int debug = p_ctx->debug; | |
| 130 | |
| 131 struct item { | |
| 132 int option_1; | |
| 133 int option_2; | |
| 134 struct zint_structapp structapp; | |
| 135 char *data; | |
| 136 int ret_encode; | |
| 137 int ret_vector; | |
| 138 int expected_size; | |
| 139 const char *expected_errtxt; | |
| 140 }; | |
| 141 /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ | |
| 142 static const struct item data[] = { | |
| 143 /* 0*/ { 0, 0, { 0, 0, "" }, "12345", 0, 0, 18, "" }, | |
| 144 /* 1*/ { 0, 1, { 0, 0, "" }, "12345", 0, 0, 18, "" }, | |
| 145 /* 2*/ { 0, 2, { 0, 0, "" }, "12345", 0, 0, 30, "" }, | |
| 146 /* 3*/ { 0, 14, { 0, 0, "" }, "12345", 0, 0, 18, "" }, /* Version > max version 13 so ignored */ | |
| 147 /* 4*/ { 0, 13, { 0, 0, "" }, "12345", 0, 0, 162, "" }, | |
| 148 /* 5*/ { 0, 1, { 0, 0, "" }, "1234567890123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 1, requires 13 codewords (maximum 11)" }, | |
| 149 /* 6*/ { 0, 2, { 0, 0, "" }, "1234567890123456789", 0, 0, 30, "" }, | |
| 150 /* 7*/ { 0, 0, { 0, 0, "" }, "123456789012345678", 0, 0, 30, "" }, /* Version auto-set to 2 */ | |
| 151 /* 8*/ { 0, 1, { 0, 0, "" }, "123456789012345678", 0, 0, 18, "" }, | |
| 152 /* 9*/ { 5, 1, { 0, 0, "" }, "123456789012345678", 0, 0, 18, "" }, /* Version specified so overrides ECC level which gets reduced to 4 */ | |
| 153 /* 10*/ { 5, 0, { 0, 0, "" }, "123456789012345678", 0, 0, 30, "" }, /* Version not specified so increased to allow for ECC level */ | |
| 154 /* 11*/ { 6, 0, { 0, 0, "" }, "123456789012345678", 0, 0, 30, "" }, /* ECC > max ECC 5 so ignored and auto-settings version 2, ECC 4 used */ | |
| 155 /* 12*/ { 1, 0, { 0, 0, "" }, "123456789012345678", 0, 0, 30, "" }, /* ECC < min ECC 2, ECC 2 used */ | |
| 156 /* 13*/ { 4, 1, { 0, 0, "" }, "123456789012345678", 0, 0, 18, "" }, | |
| 157 /* 14*/ { 0, 0, { 1, 2, "" }, "12345", 0, 0, 18, "" }, | |
| 158 /* 15*/ { 0, 0, { 1, 1, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 536: Structured Append count '1' out of range (2 to 16)" }, | |
| 159 /* 16*/ { 0, 0, { 1, 17, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 536: Structured Append count '17' out of range (2 to 16)" }, | |
| 160 /* 17*/ { 0, 0, { 0, 2, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 537: Structured Append index '0' out of range (1 to count 2)" }, | |
| 161 /* 18*/ { 0, 0, { 3, 2, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 537: Structured Append index '3' out of range (1 to count 2)" }, | |
| 162 /* 19*/ { 0, 0, { 1, 2, "255" }, "12345", 0, 0, 18, "" }, | |
| 163 /* 20*/ { 0, 0, { 1, 2, "1234" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 538: Structured Append ID length 4 too long (3 digit maximum)" }, | |
| 164 /* 21*/ { 0, 0, { 1, 2, "A" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 539: Invalid Structured Append ID (digits only)" }, | |
| 165 /* 22*/ { 0, 0, { 1, 2, "256" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 530: Structured Append ID value '256' out of range (0 to 255)" }, | |
| 166 }; | |
| 167 const int data_size = ARRAY_SIZE(data); | |
| 168 int i, length, ret; | |
| 169 struct zint_symbol *symbol = NULL; | |
| 170 | |
| 171 testStartSymbol("test_options", &symbol); | |
| 172 | |
| 173 for (i = 0; i < data_size; i++) { | |
| 174 | |
| 175 if (testContinue(p_ctx, i)) continue; | |
| 176 | |
| 177 symbol = ZBarcode_Create(); | |
| 178 assert_nonnull(symbol, "Symbol not created\n"); | |
| 179 | |
| 180 length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); | |
| 181 if (data[i].structapp.count) { | |
| 182 symbol->structapp = data[i].structapp; | |
| 183 } | |
| 184 | |
| 185 ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); | |
| 186 assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); | |
| 187 if (ret < ZINT_ERROR) { | |
| 188 assert_equal(symbol->width, data[i].expected_size, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_size); | |
| 189 assert_equal(symbol->rows, data[i].expected_size, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_size); | |
| 190 } | |
| 191 assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d symbol->errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt); | |
| 192 | |
| 193 if (data[i].ret_vector != -1) { | |
| 194 ret = ZBarcode_Buffer_Vector(symbol, 0); | |
| 195 assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d\n", i, ret, data[i].ret_vector); | |
| 196 } | |
| 197 | |
| 198 ZBarcode_Delete(symbol); | |
| 199 } | |
| 200 | |
| 201 testFinish(); | |
| 202 } | |
| 203 | |
| 204 static void test_input(const testCtx *const p_ctx) { | |
| 205 int debug = p_ctx->debug; | |
| 206 | |
| 207 struct item { | |
| 208 int input_mode; | |
| 209 int eci; | |
| 210 int output_options; | |
| 211 int option_3; | |
| 212 struct zint_structapp structapp; | |
| 213 char *data; | |
| 214 int ret; | |
| 215 int expected_eci; | |
| 216 char *expected; | |
| 217 char *comment; | |
| 218 }; | |
| 219 /* | |
| 220 é U+00E9 in ISO 8859-1 plus other ISO 8859 (but not in ISO 8859-7 or ISO 8859-11), Win 1250 plus other Win, in GB 2312 0xA8A6, UTF-8 C3A9 | |
| 221 β U+03B2 in ISO 8859-7 Greek (but not other ISO 8859 or Win page), in GB 2312 0xA6C2, UTF-8 CEB2 | |
| 222 ÿ U+00FF in ISO 8859-1 0xFF, not in GB 2312, outside first byte and second byte range, UTF-8 C3BF | |
| 223 ㈩ U+3229 in GB 2312 0x226E | |
| 224 一 U+4E00 in GB 2312 0x523B | |
| 225 */ | |
| 226 static const struct item data[] = { | |
| 227 /* 0*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "é", 0, 0, "08 54 6F 78 00", "H1 (GB 2312) Note: Grid Matrix default is GB 2312, not ISO 8859-1" }, | |
| 228 /* 1*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "é", 0, 3, "60 01 58 00 74 40", "ECI-3 B1 (ISO 8859-1)" }, | |
| 229 /* 2*/ { UNICODE_MODE, 29, -1, -1, { 0, 0, "" }, "é", 0, 29, "60 0E 44 2A 37 7C 00", "ECI-29 H1 (GB 2312)" }, | |
| 230 /* 3*/ { UNICODE_MODE, 26, -1, -1, { 0, 0, "" }, "é", 0, 26, "60 0D 18 01 61 6A 20", "ECI-26 B2 (UTF-8)" }, | |
| 231 /* 4*/ { UNICODE_MODE, 26, -1, ZINT_FULL_MULTIBYTE, { 0, 0, "" }, "é", 0, 26, "60 0D 05 28 4F 7C 00", "ECI-26 H1 (UTF-8) (full multibyte)" }, | |
| 232 /* 5*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "é", 0, 0, "30 03 43 54 40", "B2 (UTF-8)" }, | |
| 233 /* 6*/ { DATA_MODE, 0, -1, ZINT_FULL_MULTIBYTE, { 0, 0, "" }, "é", 0, 0, "0A 51 1F 78 00", "H1 (UTF-8) (full multibyte)" }, | |
| 234 /* 7*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "\351", 0, 0, "30 01 69 00", "B1 (ISO 8859-1) (0xE9)" }, | |
| 235 /* 8*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "β", 0, 0, "08 40 2F 78 00", "H1 (GB 2312)" }, | |
| 236 /* 9*/ { UNICODE_MODE, 9, -1, -1, { 0, 0, "" }, "β", 0, 9, "60 04 58 00 71 00", "ECI-9 B1 (ISO 8859-7)" }, | |
| 237 /* 10*/ { UNICODE_MODE, 29, -1, -1, { 0, 0, "" }, "β", 0, 29, "60 0E 44 20 17 7C 00", "ECI-29 H1 (GB 2312)" }, | |
| 238 /* 11*/ { UNICODE_MODE, 26, -1, -1, { 0, 0, "" }, "β", 0, 26, "60 0D 18 01 67 2C 40", "ECI-26 H1 (UTF-8)" }, | |
| 239 /* 12*/ { UNICODE_MODE, 26, -1, ZINT_FULL_MULTIBYTE, { 0, 0, "" }, "β", 0, 26, "60 0D 05 6B 17 7C 00", "ECI-26 H1 (UTF-8) (full multibyte)" }, | |
| 240 /* 13*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "β", 0, 0, "30 03 4E 59 00", "B2 (UTF-8)" }, | |
| 241 /* 14*/ { DATA_MODE, 0, -1, ZINT_FULL_MULTIBYTE, { 0, 0, "" }, "β", 0, 0, "0B 56 2F 78 00", "H1 (UTF-8) (full multibyte)" }, | |
| 242 /* 15*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ÿ", ZINT_WARN_USES_ECI, 3, "Warning 60 01 58 00 7F 40", "ECI-3 B1 (ISO 8859-1)" }, | |
| 243 /* 16*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ÿÿÿ", ZINT_WARN_USES_ECI, 3, "Warning 60 01 58 02 7F 7F 7F 70", "ECI-3 B3 (ISO 8859-1)" }, | |
| 244 /* 17*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "㈩一", 0, 0, "08 15 68 0E 7F 70 00", "H2 (GB 2312)" }, | |
| 245 /* 18*/ { UNICODE_MODE, 29, -1, -1, { 0, 0, "" }, "㈩一", 0, 29, "60 0E 44 0A 74 07 3F 78 00", "ECI-29 H2 (GB 2312)" }, | |
| 246 /* 19*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "\177\177", 0, 0, "30 02 7F 3F 40", "B2 (ASCII)" }, | |
| 247 /* 20*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "\177\177\177", 0, 0, "30 04 7F 3F 5F 60", "B3 (ASCII)" }, | |
| 248 /* 21*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123", 0, 0, "10 1E 7F 68", "N3 (ASCII)" }, | |
| 249 /* 22*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, " 123", 0, 0, "11 7A 03 6F 7D 00", "N4 (ASCII)" }, | |
| 250 /* 23*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1+23", 0, 0, "11 7B 03 6F 7D 00", "N4 (ASCII)" }, | |
| 251 /* 24*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "12.3", 0, 0, "11 7C 63 6F 7D 00", "N4 (ASCII)" }, | |
| 252 /* 25*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123,", 0, 0, "10 1E 7F 73 76 5E 60", "N3 L1 (ASCII)" }, | |
| 253 /* 26*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123,4", 0, 0, "14 1E 7F 51 48 3F 50", "N5 (ASCII)" }, | |
| 254 /* 27*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "\015\012123", 0, 0, "11 7D 63 6F 7D 00", "N4 (ASCII) (EOL)" }, | |
| 255 /* 28*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1\015\01223", 0, 0, "11 7E 03 6F 7D 00", "N4 (ASCII) (EOL)" }, | |
| 256 /* 29*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "12\015\0123", 0, 0, "11 7E 23 6F 7D 00", "N4 (ASCII) (EOL)" }, | |
| 257 /* 30*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123\015\012", 0, 0, "10 1E 7F 7C 01 06 42 40", "N3 B2 (ASCII) (EOL)" }, | |
| 258 /* 31*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123\015\0124", 0, 0, "14 1E 7F 5D 48 3F 50", "N5 (ASCII) (EOL)" }, | |
| 259 /* 32*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "2.2.0", 0, 0, "15 7C 46 73 78 40 07 7A", "N5 (ASCII)" }, | |
| 260 /* 33*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "2.2.0.5", 0, 0, "30 0C 32 17 0C 45 63 01 38 6A 00", "B7 (ASCII)" }, | |
| 261 /* 34*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "2.2.0.56", 0, 0, "13 7C 46 73 78 40 07 71 46 0F 74", "N8 (ASCII)" }, | |
| 262 /* 35*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "20.12.13.\015\012", 0, 0, "11 7C 66 27 79 0D 2F 7F 00 45 60 68 28 00", "N8 B3 (ASCII)" }, | |
| 263 /* 36*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ABCDE\011F", 0, 0, "20 01 08 32 3E 49 17 30", "U7 (ASCII)" }, | |
| 264 /* 37*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1 1234ABCD12.2abcd-12", 0, 0, "13 7A 23 41 2A 3F 68 01 08 3E 4F 66 1E 5F 70 00 44 1F 2F 6E 0F 0F 74", "N6 U4 N4 L4 N3 (ASCII)" }, | |
| 265 /* 38*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1 123ABCDE12.2abcd-12", 0, 0, "28 1F 40 42 06 28 59 43 27 01 05 7D 56 42 49 16 34 7F 6D 30 08 2F 60", "M21 (ASCII)" }, | |
| 266 /* 39*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "国外通信教材 Matlab6.5", 0, 0, "09 63 27 20 4E 24 1F 05 21 58 22 13 7E 1E 4C 78 09 56 00 3D 3F 4A 45 3F 50", "H6 U2 L5 N3 (GB 2312) (Same as D.2 example)" }, | |
| 267 /* 40*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAT", 0, 0, "20 00 4F 30", "U3 (ASCII)" }, | |
| 268 /* 41*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "aat", 0, 0, "18 00 4F 30", "L3 (ASCII)" }, | |
| 269 /* 42*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAT2556", 0, 0, "20 00 4F 58 7F 65 47 7A", "U3 N4 (ASCII) (note same bit count as M7)" }, | |
| 270 /* 43*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAT2556 ", 0, 0, "29 22 4E 42 0A 14 37 6F 60", "M8 (ASCII)" }, | |
| 271 /* 44*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAT2556 电", 0, 0, "29 22 4E 42 0A 14 37 6F 62 2C 1F 7E 00", "M8 H1 (GB 2312)" }, | |
| 272 /* 45*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, " 200", 0, 0, "11 7A 06 23 7D 00", "N4 (ASCII)" }, | |
| 273 /* 46*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, " 200mA至", 0, 0, "2F 60 40 00 60 2B 78 63 41 7F 40", "M6 H1 (GB 2312)" }, | |
| 274 /* 47*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "2A tel:86 019 82512738", 0, 0, "28 22 5F 4F 29 48 5F 6D 7E 6F 55 57 1F 28 63 0F 5A 11 64 0F 74", "M2 L5(with control) N15 (ASCII)" }, | |
| 275 /* 48*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "至2A tel:86 019 82512738", 0, 0, "30 07 56 60 4C 48 13 6A 32 17 7B 3F 5B 75 35 67 6A 18 63 76 44 39 03 7D 00", "B4 L5(with control) N15 (GB 2312)" }, | |
| 276 /* 49*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", 0, 0, "(62) 29 22 22 1C 4E 41 42 7E 0A 40 14 00 37 7E 6F 00 62 7E 2C 00 1C 7E 4B 00 41 7E 18 00", "M8 H11 M6 B4 L5(with control) N15 (GB 2312) (*NOT SAME* as D3 example Figure D.1, M8 H11 M6 H1 M3 L4(with control) N15, which uses a few more bits)" }, | |
| 277 /* 50*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::", 0, 0, "(588) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B512 (ASCII)" }, | |
| 278 /* 51*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\177", 0, 0, "(591) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B513 (ASCII)" }, | |
| 279 /* 52*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::至", 0, 0, "(591) 37 68 68 68 68 68 74 7C 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B511 H1 (GB 2312)" }, | |
| 280 /* 53*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::至:", 0, 0, "(592) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B513 (GB 2312)" }, | |
| 281 /* 54*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "电电123456", 0, 0, "09 30 72 61 7F 70 41 76 72 1F 68", "H2 (GB 2312) N6" }, | |
| 282 /* 55*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "电电abcdef", 0, 0, "09 30 72 61 7F 71 00 08 43 10 5D 40", "H2 (GB 2312) L6" }, | |
| 283 /* 56*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "电电电电电\011\011\011", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 7F 14 02 04 42 21 10", "H5 (GB 2312) B3" }, | |
| 284 /* 57*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1234567电电", 0, 0, "14 1E 6E 22 5E 3F 59 30 72 61 7F 70 00", "N7 H2 (GB 2312)" }, | |
| 285 /* 58*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "12345678mA 2", 0, 0, "12 1E 6E 23 06 3F 76 02 5F 02 7E 00", "N8 M4" }, | |
| 286 /* 59*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ABCDEFG电电", 0, 0, "20 01 08 32 0A 37 05 43 4B 07 7F 40", "U7 H2 (GB 2312)" }, | |
| 287 /* 60*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ABCDEFGHIJ8mA 2", 0, 0, "20 01 08 32 0A 31 68 27 70 46 02 5F 02 7E 00", "U10 M5" }, | |
| 288 /* 61*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ABCDEFGHIJ\011\011\011\011", 0, 0, "20 01 08 32 0A 31 68 27 78 03 04 42 21 10 48 00", "U10 B4" }, | |
| 289 /* 62*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "8mA B123456789", 0, 0, "29 0C 05 3E 17 7C 40 7B 39 0C 2B 7E 40", "M5 N9" }, | |
| 290 /* 63*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "8mA aABCDEFGH", 0, 0, "29 0C 05 3E 49 7D 00 04 21 48 29 47 6C", "M5 U8" }, | |
| 291 /* 64*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "\011\011\011\011123456", 0, 0, "30 06 09 04 42 21 12 03 6D 64 3F 50", "B4 N6" }, | |
| 292 /* 65*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "\011\011\011\011ABCDEF", 0, 0, "30 06 09 04 42 21 14 00 11 06 21 3B", "B4 U6" }, | |
| 293 /* 66*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "\011\011\011\0118mA 2", 0, 0, "30 06 09 04 42 21 15 11 40 57 60 5F 40", "B4 M5" }, | |
| 294 /* 67*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "电电电电电\015\012", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 73 03 7E 00", "H7 (GB 2312)" }, | |
| 295 /* 68*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "电电电电电12", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 7B 37 7E 00", "H7 (GB 2312)" }, | |
| 296 /* 69*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1234567.8\015\012123456", 0, 0, "10 1E 6E 23 79 30 67 77 0F 37 11 7E 40", "N17" }, | |
| 297 /* 70*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "˘", ZINT_WARN_USES_ECI, 4, "Warning 60 02 18 00 51 00", "ECI-4 B1 (ISO 8859-2)" }, | |
| 298 /* 71*/ { UNICODE_MODE, 4, -1, -1, { 0, 0, "" }, "˘", 0, 4, "60 02 18 00 51 00", "ECI-4 B1 (ISO 8859-2)" }, | |
| 299 /* 72*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "Ħ", ZINT_WARN_USES_ECI, 5, "Warning 60 02 58 00 50 40", "ECI-5 B1 (ISO 8859-3)" }, | |
| 300 /* 73*/ { UNICODE_MODE, 5, -1, -1, { 0, 0, "" }, "Ħ", 0, 5, "60 02 58 00 50 40", "ECI-5 B1 (ISO 8859-3)" }, | |
| 301 /* 74*/ { UNICODE_MODE, 6, -1, -1, { 0, 0, "" }, "ĸ", 0, 6, "60 03 18 00 51 00", "ECI-6 B1 (ISO 8859-4)" }, | |
| 302 /* 75*/ { UNICODE_MODE, 7, -1, -1, { 0, 0, "" }, "Ж", 0, 7, "60 03 58 00 5B 00", "ECI-7 B1 (ISO 8859-5)" }, | |
| 303 /* 76*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "Ș", ZINT_WARN_USES_ECI, 18, "Warning 60 09 18 00 55 00", "ECI-18 B1 (ISO 8859-16)" }, | |
| 304 /* 77*/ { UNICODE_MODE, 18, -1, -1, { 0, 0, "" }, "Ș", 0, 18, "60 09 18 00 55 00", "ECI-18 B1 (ISO 8859-16)" }, | |
| 305 /* 78*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "テ", 0, 0, "08 34 6F 78 00", "H1 (GB 2312)" }, | |
| 306 /* 79*/ { UNICODE_MODE, 20, -1, -1, { 0, 0, "" }, "テ", 0, 20, "60 0A 18 01 41 59 20", "ECI-20 B2 (SHIFT JIS)" }, | |
| 307 /* 80*/ { UNICODE_MODE, 20, -1, -1, { 0, 0, "" }, "テテ", 0, 20, "60 0A 18 03 41 59 30 36 28 00", "ECI-20 B4 (SHIFT JIS)" }, | |
| 308 /* 81*/ { UNICODE_MODE, 20, -1, -1, { 0, 0, "" }, "\\\\", 0, 20, "60 0A 18 03 40 57 70 15 78 00", "ECI-20 B4 (SHIFT JIS)" }, | |
| 309 /* 82*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "…", 0, 0, "08 01 5F 78 00", "H1 (GB 2312)" }, | |
| 310 /* 83*/ { UNICODE_MODE, 21, -1, -1, { 0, 0, "" }, "…", 0, 21, "60 0A 58 00 42 40", "ECI-21 B1 (Win 1250)" }, | |
| 311 /* 84*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "Ґ", ZINT_WARN_USES_ECI, 22, "Warning 60 0B 18 00 52 40", "ECI-22 B1 (Win 1251)" }, | |
| 312 /* 85*/ { UNICODE_MODE, 22, -1, -1, { 0, 0, "" }, "Ґ", 0, 22, "60 0B 18 00 52 40", "ECI-22 B1 (Win 1251)" }, | |
| 313 /* 86*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "˜", ZINT_WARN_USES_ECI, 23, "Warning 60 0B 58 00 4C 00", "ECI-23 B1 (Win 1252)" }, | |
| 314 /* 87*/ { UNICODE_MODE, 23, -1, -1, { 0, 0, "" }, "˜", 0, 23, "60 0B 58 00 4C 00", "ECI-23 B1 (Win 1252)" }, | |
| 315 /* 88*/ { UNICODE_MODE, 24, -1, -1, { 0, 0, "" }, "پ", 0, 24, "60 0C 18 00 40 40", "ECI-24 B1 (Win 1256)" }, | |
| 316 /* 89*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "က", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 70 60 10 00", "ECI-26 B3 (UTF-8)" }, | |
| 317 /* 90*/ { UNICODE_MODE, 25, -1, -1, { 0, 0, "" }, "က", 0, 25, "60 0C 58 01 08 00 00", "ECI-25 B2 (UCS-2BE)" }, | |
| 318 /* 91*/ { UNICODE_MODE, 25, -1, -1, { 0, 0, "" }, "ကက", 0, 25, "60 0C 58 03 08 00 02 00 00 00", "ECI-25 B4 (UCS-2BE)" }, | |
| 319 /* 92*/ { UNICODE_MODE, 25, -1, -1, { 0, 0, "" }, "12", 0, 25, "60 0C 58 03 00 0C 20 03 10 00", "ECI-25 B4 (UCS-2BE ASCII)" }, | |
| 320 /* 93*/ { UNICODE_MODE, 27, -1, -1, { 0, 0, "" }, "@", 0, 27, "60 0D 4F 77 2E 60", "ECI-27 L1 (ASCII)" }, | |
| 321 /* 94*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "龘", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 74 6F 53 00", "ECI-26 B3 (UTF-8)" }, | |
| 322 /* 95*/ { UNICODE_MODE, 28, -1, -1, { 0, 0, "" }, "龘", 0, 28, "60 0E 18 01 7C 75 20", "ECI-28 B2 (Big5)" }, | |
| 323 /* 96*/ { UNICODE_MODE, 28, -1, -1, { 0, 0, "" }, "龘龘", 0, 28, "60 0E 18 03 7C 75 3F 1D 28 00", "ECI-28 B4 (Big5)" }, | |
| 324 /* 97*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "齄", 0, 0, "0F 4B 6F 78 00", "H1 (GB 2312)" }, | |
| 325 /* 98*/ { UNICODE_MODE, 29, -1, -1, { 0, 0, "" }, "齄", 0, 29, "60 0E 47 65 77 7C 00", "ECI-29 H1 (GB 2312)" }, | |
| 326 /* 99*/ { UNICODE_MODE, 29, -1, -1, { 0, 0, "" }, "齄齄", 0, 29, "60 0E 47 65 77 4B 6F 78 00", "ECI-29 H2 (GB 2312)" }, | |
| 327 /*100*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "가", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 75 2C 10 00", "ECI-26 B3 (UTF-8)" }, | |
| 328 /*101*/ { UNICODE_MODE, 30, -1, -1, { 0, 0, "" }, "가", 0, 30, "60 0F 18 01 58 28 20", "ECI-30 B2 (EUC-KR)" }, | |
| 329 /*102*/ { UNICODE_MODE, 30, -1, -1, { 0, 0, "" }, "가가", 0, 30, "60 0F 18 03 58 28 36 0A 08 00", "ECI-30 B4 (EUC-KR)" }, | |
| 330 /*103*/ { UNICODE_MODE, 170, -1, -1, { 0, 0, "" }, "?", 0, 170, "60 55 0F 77 26 60", "ECI-170 L1 (ASCII invariant)" }, | |
| 331 /*104*/ { DATA_MODE, 899, -1, -1, { 0, 0, "" }, "\200", 0, 899, "63 41 58 00 40 00", "ECI-899 B1 (8-bit binary)" }, | |
| 332 /*105*/ { UNICODE_MODE, 900, -1, -1, { 0, 0, "" }, "é", 0, 900, "63 42 18 01 61 6A 20", "ECI-900 B2 (no conversion)" }, | |
| 333 /*106*/ { UNICODE_MODE, 1024, -1, -1, { 0, 0, "" }, "é", 0, 1024, "64 08 00 30 03 43 54 40", "ECI-1024 B2 (no conversion)" }, | |
| 334 /*107*/ { UNICODE_MODE, 32768, -1, -1, { 0, 0, "" }, "é", 0, 32768, "66 08 00 01 40 0E 0E 52 00", "ECI-32768 B2 (no conversion)" }, | |
| 335 /*108*/ { UNICODE_MODE, 811800, -1, -1, { 0, 0, "" }, "é", ZINT_ERROR_INVALID_OPTION, 811800, "Error 533: ECI code '811800' out of range (0 to 811799)", "" }, | |
| 336 /*109*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "β", ZINT_ERROR_INVALID_DATA, 3, "Error 535: Invalid character in input for ECI '3'", "" }, | |
| 337 /*110*/ { UNICODE_MODE, 0, READER_INIT, -1, { 0, 0, "" }, "12", 0, 0, "51 11 71 7E 40", "" }, | |
| 338 /*111*/ { UNICODE_MODE, 0, -1, -1, { 1, 16, "" }, "12", 0, 0, "48 03 60 24 3C 3F 50", "FNC2 ID0 Cnt15 Ind0 N2" }, | |
| 339 /*112*/ { UNICODE_MODE, 0, READER_INIT, -1, { 1, 16, "" }, "12", 0, 0, "54 40 1E 02 23 63 7D 00", "FNC3 FNC2 ID0 Cnt15 Ind0 N2" }, | |
| 340 /*113*/ { UNICODE_MODE, 0, -1, -1, { 2, 16, "" }, "12", 0, 0, "48 03 62 24 3C 3F 50", "FNC2 ID0 Cnt15 Ind1 N2" }, | |
| 341 /*114*/ { UNICODE_MODE, 0, READER_INIT, -1, { 2, 16, "" }, "12", 0, 0, "48 03 62 24 3C 3F 50", "FNC2 ID0 Cnt15 Ind1 N2 (FNC3 omitted)" }, | |
| 342 /*115*/ { UNICODE_MODE, 0, -1, -1, { 3, 3, "255" }, "12", 0, 0, "4F 7C 44 24 3C 3F 50", "FNC2 ID256 Cnt2 Ind2 N2" }, | |
| 343 }; | |
| 344 const int data_size = ARRAY_SIZE(data); | |
| 345 int i, length, ret; | |
| 346 struct zint_symbol *symbol = NULL; | |
| 347 | |
| 348 char escaped[1024]; | |
| 349 | |
| 350 testStartSymbol("test_input", &symbol); | |
| 351 | |
| 352 for (i = 0; i < data_size; i++) { | |
| 353 | |
| 354 if (testContinue(p_ctx, i)) continue; | |
| 355 | |
| 356 symbol = ZBarcode_Create(); | |
| 357 assert_nonnull(symbol, "Symbol not created\n"); | |
| 358 | |
| 359 debug |= ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */ | |
| 360 | |
| 361 length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, data[i].option_3, data[i].output_options, data[i].data, -1, debug); | |
| 362 if (data[i].structapp.count) { | |
| 363 symbol->structapp = data[i].structapp; | |
| 364 } | |
| 365 | |
| 366 ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); | |
| 367 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); | |
| 368 | |
| 369 if (p_ctx->generate) { | |
| 370 printf(" /*%3d*/ { %s, %d, %s, %s, { %d, %d, \"%s\" }, \"%s\", %s, %d, \"%s\", \"%s\" },\n", | |
| 371 i, testUtilInputModeName(data[i].input_mode), data[i].eci, testUtilOutputOptionsName(data[i].output_options), | |
| 372 testUtilOption3Name(BARCODE_GRIDMATRIX, data[i].option_3), | |
| 373 data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, | |
| 374 testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), | |
| 375 testUtilErrorName(data[i].ret), ret < ZINT_ERROR ? symbol->eci : -1, symbol->errtxt, data[i].comment); | |
| 376 } else { | |
| 377 if (ret < ZINT_ERROR) { | |
| 378 assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n", i, symbol->eci, data[i].expected_eci); | |
| 379 } | |
| 380 assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); | |
| 381 } | |
| 382 | |
| 383 ZBarcode_Delete(symbol); | |
| 384 } | |
| 385 | |
| 386 testFinish(); | |
| 387 } | |
| 388 | |
| 389 static void test_encode(const testCtx *const p_ctx) { | |
| 390 int debug = p_ctx->debug; | |
| 391 | |
| 392 struct item { | |
| 393 char *data; | |
| 394 int input_mode; | |
| 395 int option_1; | |
| 396 int option_2; | |
| 397 int ret; | |
| 398 | |
| 399 int expected_rows; | |
| 400 int expected_width; | |
| 401 char *comment; | |
| 402 char *expected; | |
| 403 }; | |
| 404 static const struct item data[] = { | |
| 405 /* 0*/ { "1234", UNICODE_MODE, -1, -1, 0, 18, 18, "", | |
| 406 "111111000000111111" | |
| 407 "101111001100101001" | |
| 408 "100101000010100001" | |
| 409 "111011011100101111" | |
| 410 "101011011000111011" | |
| 411 "111111000000111111" | |
| 412 "000000111111000000" | |
| 413 "001100100001001110" | |
| 414 "001110111111011110" | |
| 415 "001010100011000000" | |
| 416 "010100101001000000" | |
| 417 "000000111111000000" | |
| 418 "111111000000111111" | |
| 419 "101001001100101001" | |
| 420 "111001000000101111" | |
| 421 "111001000100110001" | |
| 422 "111111000000100001" | |
| 423 "111111000000111111" | |
| 424 }, | |
| 425 /* 1*/ { "Grid Matrix", UNICODE_MODE, 5, -1, 0, 30, 30, "AIMD014 Figure 1 **NOT SAME** different encodation, uses Upper and Lower whereas figure uses Mixed and Lower", | |
| 426 "111111000000111111000000111111" | |
| 427 "110111010110110111010110110011" | |
| 428 "100011011110111111011110111111" | |
| 429 "110001000000100001000000100001" | |
| 430 "101101000000100001000000100001" | |
| 431 "111111000000111111000000111111" | |
| 432 "000000111111000000111111000000" | |
| 433 "010000101111001000101101010000" | |
| 434 "000100111111000000110011010110" | |
| 435 "001110100001011000111111001000" | |
| 436 "001010100001001010111011000010" | |
| 437 "000000111111000000111111000000" | |
| 438 "111111000000111111000000111111" | |
| 439 "110001001110100101001000110001" | |
| 440 "111111011110111111000010111111" | |
| 441 "110111000000100101000010100101" | |
| 442 "100111000000100011011100100011" | |
| 443 "111111000000111111000000111111" | |
| 444 "000000111111000000111111000000" | |
| 445 "010100101111001110101101010110" | |
| 446 "011100111111000000110001001100" | |
| 447 "001010100001000110110111011110" | |
| 448 "000010100001011100110001000000" | |
| 449 "000000111111000000111111000000" | |
| 450 "111111000000111111000000111111" | |
| 451 "110101010000110101010010110101" | |
| 452 "110111000000110011001010101111" | |
| 453 "111101010010110101010010111011" | |
| 454 "101111010010100001010010110111" | |
| 455 "111111000000111111000000111111" | |
| 456 }, | |
| 457 /* 2*/ { "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", UNICODE_MODE, 3, 3, 0, 42, 42, "AIMD014 Figure D.1 **NOT SAME** different encodation, see test_input dataset", | |
| 458 "111111000000111111000000111111000000111111" | |
| 459 "101101001100101111001010101011001100101101" | |
| 460 "110001011010110101010000100011000000100001" | |
| 461 "110001001110111111010000101111010010101111" | |
| 462 "101101010100100111011000110111011000111101" | |
| 463 "111111000000111111000000111111000000111111" | |
| 464 "000000111111000000111111000000111111000000" | |
| 465 "001010100111000000100011000110100101001110" | |
| 466 "011010101101001100101011000110110001011110" | |
| 467 "000010111011001110100101001110110101000000" | |
| 468 "000110111111011010100011011100100001000000" | |
| 469 "000000111111000000111111000000111111000000" | |
| 470 "111111000000111111000000111111000000111111" | |
| 471 "101101000110111111011100111001000010101111" | |
| 472 "110111011100111011000010110101010100111111" | |
| 473 "100011010000111101001000100001011110100001" | |
| 474 "100111010110110111011100110101000110100001" | |
| 475 "111111000000111111000000111111000000111111" | |
| 476 "000000111111000000111111000000111111000000" | |
| 477 "001010100001011110110011011110100111001110" | |
| 478 "010010111001000000100011001110111111011110" | |
| 479 "010100111111011000100101010110111111000000" | |
| 480 "001010101011000100110011001110111011000000" | |
| 481 "000000111111000000111111000000111111000000" | |
| 482 "111111000000111111000000111111000000111111" | |
| 483 "101001000000111001011100111011000010101101" | |
| 484 "111011001000111001001010101101011110111101" | |
| 485 "110011010100101001010010101101001110100001" | |
| 486 "100001001000100011011000100101000100100001" | |
| 487 "111111000000111111000000111111000000111111" | |
| 488 "000000111111000000111111000000111111000000" | |
| 489 "001110100011000110100101000000100001001110" | |
| 490 "010000100111001010111101000010100001010100" | |
| 491 "010100100111010000101011000000100001000100" | |
| 492 "001110100001000110111111001100101001000100" | |
| 493 "000000111111000000111111000000111111000000" | |
| 494 "111111000000111111000000111111000000111111" | |
| 495 "101011001110101001001100101011001010101111" | |
| 496 "100011011010100001011100101001010000110101" | |
| 497 "111101000110110001000100100111010110110011" | |
| 498 "100001001000110011011110110001000100100101" | |
| 499 "111111000000111111000000111111000000111111" | |
| 500 }, | |
| 501 }; | |
| 502 const int data_size = ARRAY_SIZE(data); | |
| 503 int i, length, ret; | |
| 504 struct zint_symbol *symbol = NULL; | |
| 505 | |
| 506 testStartSymbol("test_encode", &symbol); | |
| 507 | |
| 508 for (i = 0; i < data_size; i++) { | |
| 509 | |
| 510 if (testContinue(p_ctx, i)) continue; | |
| 511 | |
| 512 symbol = ZBarcode_Create(); | |
| 513 assert_nonnull(symbol, "Symbol not created\n"); | |
| 514 | |
| 515 length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); | |
| 516 | |
| 517 ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); | |
| 518 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 519 | |
| 520 if (p_ctx->generate) { | |
| 521 printf(" /*%3d*/ { \"%s\", %s, %d, %d, %s, %d, %d, \"%s\",\n", | |
| 522 i, data[i].data, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, testUtilErrorName(data[i].ret), | |
| 523 symbol->rows, symbol->width, data[i].comment); | |
| 524 testUtilModulesPrint(symbol, " ", "\n"); | |
| 525 printf(" },\n"); | |
| 526 } else { | |
| 527 if (ret < ZINT_ERROR) { | |
| 528 int width, row; | |
| 529 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); | |
| 530 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); | |
| 531 | |
| 532 ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); | |
| 533 assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); | |
| 534 } | |
| 535 } | |
| 536 | |
| 537 ZBarcode_Delete(symbol); | |
| 538 } | |
| 539 | |
| 540 testFinish(); | |
| 541 } | |
| 542 | |
| 543 static void test_encode_segs(const testCtx *const p_ctx) { | |
| 544 int debug = p_ctx->debug; | |
| 545 | |
| 546 struct item { | |
| 547 int input_mode; | |
| 548 int option_1; | |
| 549 int option_2; | |
| 550 struct zint_structapp structapp; | |
| 551 struct zint_seg segs[3]; | |
| 552 int ret; | |
| 553 | |
| 554 int expected_rows; | |
| 555 int expected_width; | |
| 556 char *comment; | |
| 557 char *expected; | |
| 558 }; | |
| 559 /* | |
| 560 ¶ not in GB 2312 (in ISO/IEC 8869-1) | |
| 561 Ж in GB 2312 (and ISO/IEC 8859-5) | |
| 562 */ | |
| 563 static const struct item data[] = { | |
| 564 /* 0*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, ZINT_WARN_USES_ECI, 30, 30, "Standard example (adds ECI 3 for ¶)", | |
| 565 "111111000000111111000000111111" | |
| 566 "111111011110111111011110111111" | |
| 567 "100001011110111111011110111111" | |
| 568 "100101000000100001000000100001" | |
| 569 "100011000000100001000000100001" | |
| 570 "111111000000111111000000111111" | |
| 571 "000000111111000000111111000000" | |
| 572 "011110110111010000110001011110" | |
| 573 "000110111111000000100011011110" | |
| 574 "000100100001001010111011000000" | |
| 575 "001110100001010000110111000000" | |
| 576 "000000111111000000111111000000" | |
| 577 "111111000000111111000000111111" | |
| 578 "111101010110101001010000111111" | |
| 579 "100001011110100001001110111111" | |
| 580 "100011000000111101000000100001" | |
| 581 "111111000000100001000000100001" | |
| 582 "111111000000111111000000111111" | |
| 583 "000000111111000000111111000000" | |
| 584 "011000110111010000110001011110" | |
| 585 "011100111111000000100011001010" | |
| 586 "000010100001001100101101000010" | |
| 587 "011100100001011000100001001110" | |
| 588 "000000111111000000111111000000" | |
| 589 "111111000000111111000000111111" | |
| 590 "111001011110111011011100111011" | |
| 591 "100001010100111101001110110001" | |
| 592 "110011001110101111010110110001" | |
| 593 "100011001100110011010100100101" | |
| 594 "111111000000111111000000111111" | |
| 595 }, | |
| 596 /* 1*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 0 }, { TU(""), 0, 0 } }, ZINT_WARN_USES_ECI, 30, 30, "Standard example auto-ECI (adds ECI-3 from ¶, ECI-29 for Ж)", | |
| 597 "111111000000111111000000111111" | |
| 598 "111111011110111111011110111111" | |
| 599 "100001011110111111011110111111" | |
| 600 "100101000000100001000000100001" | |
| 601 "100011000000100001000000100001" | |
| 602 "111111000000111111000000111111" | |
| 603 "000000111111000000111111000000" | |
| 604 "011110110111010000110001011110" | |
| 605 "000110111111000000100011011110" | |
| 606 "000100100001001010111011000000" | |
| 607 "001110100001010000110111000000" | |
| 608 "000000111111000000111111000000" | |
| 609 "111111000000111111000000111111" | |
| 610 "111101010110101001010000111111" | |
| 611 "100001011110100001001110111111" | |
| 612 "100011000000111101000000100001" | |
| 613 "111111000000100001000000100001" | |
| 614 "111111000000111111000000111111" | |
| 615 "000000111111000000111111000000" | |
| 616 "011000110111010000110001011110" | |
| 617 "011100111111000000100011001010" | |
| 618 "000010100001001100101101000010" | |
| 619 "011100100001011000100001001110" | |
| 620 "000000111111000000111111000000" | |
| 621 "111111000000111111000000111111" | |
| 622 "111001011110111011011100111011" | |
| 623 "100001010100111101001110110001" | |
| 624 "110011001110101111010110110001" | |
| 625 "100011001100110011010100100101" | |
| 626 "111111000000111111000000111111" | |
| 627 }, | |
| 628 /* 2*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("Ж"), -1, 7 }, { TU("¶"), -1, 0 }, { TU(""), 0, 0 } }, ZINT_WARN_USES_ECI, 30, 30, "Standard example inverted", | |
| 629 "111111000000111111000000111111" | |
| 630 "111001011110111111011110111111" | |
| 631 "101111011110111111011110111111" | |
| 632 "111101000000100001000000100001" | |
| 633 "101011000000100001000000100001" | |
| 634 "111111000000111111000000111111" | |
| 635 "000000111111000000111111000000" | |
| 636 "011010110111010000110001011110" | |
| 637 "000000111111000000100011011110" | |
| 638 "010000100001001010111011000000" | |
| 639 "011000100001010000110111000000" | |
| 640 "000000111111000000111111000000" | |
| 641 "111111000000111111000000111111" | |
| 642 "111101010110101001010000111111" | |
| 643 "101011011110100011000110111111" | |
| 644 "111001000000111101000000100001" | |
| 645 "101011000000100001000000100001" | |
| 646 "111111000000111111000000111111" | |
| 647 "000000111111000000111111000000" | |
| 648 "011110110111010000110001011000" | |
| 649 "010000111111000000100011011000" | |
| 650 "001110100001001100101101001100" | |
| 651 "001100100001011000100001000000" | |
| 652 "000000111111000000111111000000" | |
| 653 "111111000000111111000000111111" | |
| 654 "111111011110111101011000111111" | |
| 655 "101111011010110001001110111101" | |
| 656 "110011001000101101001010110111" | |
| 657 "111101011000101001011010101001" | |
| 658 "111111000000111111000000111111" | |
| 659 }, | |
| 660 /* 3*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("Ж"), -1, 0 }, { TU("¶"), -1, 0 }, { TU(""), 0, 0 } }, ZINT_WARN_USES_ECI, 30, 30, "Standard example inverted auto-ECI", | |
| 661 "111111000000111111000000111111" | |
| 662 "111001011110111111011110111111" | |
| 663 "101111011110111111011110111111" | |
| 664 "111101000000100001000000100001" | |
| 665 "101011000000100001000000100001" | |
| 666 "111111000000111111000000111111" | |
| 667 "000000111111000000111111000000" | |
| 668 "011010110111010000110001011110" | |
| 669 "000000111111000000100011011110" | |
| 670 "010000100001001010111011000000" | |
| 671 "011000100001010000110111000000" | |
| 672 "000000111111000000111111000000" | |
| 673 "111111000000111111000000111111" | |
| 674 "111101010110101001010000111111" | |
| 675 "101011011110100011000110111111" | |
| 676 "111001000000111101000000100001" | |
| 677 "101011000000100001000000100001" | |
| 678 "111111000000111111000000111111" | |
| 679 "000000111111000000111111000000" | |
| 680 "011110110111010000110001011000" | |
| 681 "010000111111000000100011011000" | |
| 682 "001110100001001100101101001100" | |
| 683 "001100100001011000100001000000" | |
| 684 "000000111111000000111111000000" | |
| 685 "111111000000111111000000111111" | |
| 686 "111111011110111101011000111111" | |
| 687 "101111011010110001001110111101" | |
| 688 "110011001000101101001010110111" | |
| 689 "111101011000101001011010101001" | |
| 690 "111111000000111111000000111111" | |
| 691 }, | |
| 692 /* 4*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("product:Google Pixel 4a - 128 GB of Storage - Black;price:$439.97"), -1, 3 }, { TU("品名:Google 谷歌 Pixel 4a -128 GB的存储空间-黑色;零售价:¥3149.79"), -1, 29 }, { TU("Produkt:Google Pixel 4a - 128 GB Speicher - Schwarz;Preis:444,90 €"), -1, 17 } }, 0, 78, 78, "AIM ITS/04-023:2022 Annex A example", | |
| 693 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 694 "100001000100100011000110100011000010100001000100100001000010100111000000100111" | |
| 695 "111111001110101001010010111011001010100111010100101011011100101011001010101011" | |
| 696 "110111000010100101001000100111010100101011001110111111011100101111000110111011" | |
| 697 "111001011000100011010100101011010110101111010100100011011110110101001110111111" | |
| 698 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 699 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 700 "000010111111011110111001011110111111011010111111011010111111011110111111000010" | |
| 701 "011000110001000000110001011110101011010110111111011100100011011110111011001000" | |
| 702 "000100101111011010110001000000110011010000101111011110110001000010101111001100" | |
| 703 "011100110011000000100001010010111111000000110011011100100001011110101011010110" | |
| 704 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 705 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 706 "100001011010110001010110110111010010110111010000110101010110110001011010100011" | |
| 707 "111101001010100001001100110111001010111111000110101111011100101001010110100111" | |
| 708 "100011011010100111001110110011001010101101010000110111001110110101000000110101" | |
| 709 "110001010110111111000110100111001000111101001000110011011010100111000000110101" | |
| 710 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 711 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 712 "000100111011010110101001001000101011001100101111001010101111010100111111000100" | |
| 713 "010010101011011000101001011010101111011110101001000010111101000110111111010110" | |
| 714 "011100100001000000111011011100111001010010100011001000111011011110101101000100" | |
| 715 "010010100001000000111111010100111111011010111101010000111111000110100001010000" | |
| 716 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 717 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 718 "100011011010110111001000100011000000100101000110100111001110110011011000100101" | |
| 719 "101001010010100011001000100101011010101111011010111111011000111011001000101111" | |
| 720 "100011011010101001000100101111000000111111011010111111000000100001001110101001" | |
| 721 "101101011000100011001110100111000100110111000010101101000100110001011110110011" | |
| 722 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 723 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 724 "000000111111010100101101000100111101011000111101000110101001010100111111000010" | |
| 725 "011100111111001000100001000000101001000000111101011110111101001010100011001010" | |
| 726 "000000100111001100101011011110111101010110111001010100101101010100110001011100" | |
| 727 "000100111101000000110001010000110001000110110111011000100101011010100001010000" | |
| 728 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 729 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 730 "100111011010110111001100100011011000110111011000100111001000110001011110100011" | |
| 731 "110101011000111011001100100011011100110001010010111101000000111001011110100101" | |
| 732 "100111010000110001001110111011010000111101011000100011010100110011001010111101" | |
| 733 "111101000000100101011000100011001000100001011010100111001000100001001010111101" | |
| 734 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 735 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 736 "000010111111010010101101000100111001011110111111000110101101010000111101000110" | |
| 737 "001110110101000110100111011110101101011110111001010010101111001100101111010100" | |
| 738 "000100100101000010110011011010111011010100100001011100111001001110101111010100" | |
| 739 "001100101001001010101001011110111001011100110111000100110001001100100101010100" | |
| 740 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 741 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 742 "100101011110110001001000100111000010100001000000100001001110110111011100100011" | |
| 743 "101001011110101001001000101001001010111101010000101101011100111111011110100111" | |
| 744 "101011000100110111001110111101000000111011010010100001011110111001010000111001" | |
| 745 "110011010110111111000000110001011110110011010110101001011110110111000000110101" | |
| 746 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 747 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 748 "000100111111010000101111001010101111001000101111001100101011010110111111000000" | |
| 749 "011100100111000000100101000100100001011110101101011010111011011010111111011010" | |
| 750 "010010110001011100100101010000101001001100110011001010101011000100101011011110" | |
| 751 "011010100001000000100011010100111011001110110001001110111111001110111001000010" | |
| 752 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 753 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 754 "100001011000110001010110110011010100110101010100110101010010110101011100100101" | |
| 755 "111011010100100011011110111111010100101111011000110001011100111011010010100011" | |
| 756 "100001011110110101011010100001011010100001011110101111000110100101011100111011" | |
| 757 "100111011100111001010100110011000000111011011100111011010000110111010110110111" | |
| 758 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 759 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 760 "000100111111011110111011011110111001011110111111011110111101011110111001000110" | |
| 761 "010100111111000000100001011110101101011010111111000000111101011110100001011010" | |
| 762 "000000101001010000110111000100110001010010101011000000110111001110100001010110" | |
| 763 "001100110111000000101111011110100001001110111111000000110101010000100001010010" | |
| 764 "000000111111000000111111000000111111000000111111000000111111000000111111000000" | |
| 765 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 766 "100111000010100111000110100001000000100011000000100111000110100001000100100111" | |
| 767 "101101010110100111000010111111001000100011001010101011011110110011011100100101" | |
| 768 "101001001000110101000110111011010000100111010100110101000100101111001100111011" | |
| 769 "110011010110101111001110110111010000100111010010110111000100111111000010100001" | |
| 770 "111111000000111111000000111111000000111111000000111111000000111111000000111111" | |
| 771 }, | |
| 772 /* 5*/ { DATA_MODE, -1, -1, { 0, 0, "" }, { { TU("\266"), 1, 0 }, { TU("\266"), 1, 7 }, { TU("\266"), 1, 0 } }, 0, 30, 30, "Standard example + extra seg, data mode (ECIs 0, 7, 29)", | |
| 773 "111111000000111111000000111111" | |
| 774 "111111011110111111011110111111" | |
| 775 "101111011110111111011110111111" | |
| 776 "101111000000100001000000100001" | |
| 777 "101011000000100001000000100001" | |
| 778 "111111000000111111000000111111" | |
| 779 "000000111111000000111111000000" | |
| 780 "011100110111010000110001011110" | |
| 781 "010010111111000110111101011110" | |
| 782 "011100100001000110110001000000" | |
| 783 "010110100001001100100001000000" | |
| 784 "000000111111000000111111000000" | |
| 785 "111111000000111111000000111111" | |
| 786 "111101010000101001010000111111" | |
| 787 "100101000000100001000100111111" | |
| 788 "100001001100110111011000100001" | |
| 789 "110101000000100001000000100001" | |
| 790 "111111000000111111000000111111" | |
| 791 "000000111111000000111111000000" | |
| 792 "011000110001010100110001011000" | |
| 793 "001110110111010110111001011010" | |
| 794 "000110100001000000101011000010" | |
| 795 "010100100001000110110001010100" | |
| 796 "000000111111000000111111000000" | |
| 797 "111111000000111111000000111111" | |
| 798 "111011011000111101011100111011" | |
| 799 "100001001100100101010110101101" | |
| 800 "101111000000110001001000111001" | |
| 801 "100111010100111001001110101011" | |
| 802 "111111000000111111000000111111" | |
| 803 }, | |
| 804 /* 6*/ { UNICODE_MODE, -1, -1, { 1, 16, "" }, { { TU("齄齄"), -1, 29 }, { TU("Τεχτ"), -1, 0 }, { TU("Text"), -1, 0 } }, 0, 30, 30, "Structured Append (ECIs 29, 0, 0)", | |
| 805 "111111000000111111000000111111" | |
| 806 "111001011010111011011000111111" | |
| 807 "111011011110111101000000111111" | |
| 808 "101111010010100001001110100001" | |
| 809 "110111000100110011010110100001" | |
| 810 "111111000000111111000000111111" | |
| 811 "000000111111000000111111000000" | |
| 812 "011100110111010110110101011110" | |
| 813 "010000110001000100101011011110" | |
| 814 "010010101111011000111111000000" | |
| 815 "011000111111001110101111000000" | |
| 816 "000000111111000000111111000000" | |
| 817 "111111000000111111000000111111" | |
| 818 "111001010000101001010110111111" | |
| 819 "110101000100101111011000111111" | |
| 820 "111001001100101101001100100001" | |
| 821 "110001000010100001011110100001" | |
| 822 "111111000000111111000000111111" | |
| 823 "000000111111000000111111000000" | |
| 824 "011100110101010010110001011010" | |
| 825 "011010100011000000101111011100" | |
| 826 "001100100101001000110001000010" | |
| 827 "001100110001011000100101011100" | |
| 828 "000000111111000000111111000000" | |
| 829 "111111000000111111000000111111" | |
| 830 "111001011000111011011100111101" | |
| 831 "111011011010111111001110111101" | |
| 832 "101111001100111001001000101011" | |
| 833 "101101010000100101000000110001" | |
| 834 "111111000000111111000000111111" | |
| 835 }, | |
| 836 }; | |
| 837 const int data_size = ARRAY_SIZE(data); | |
| 838 int i, j, seg_count, ret; | |
| 839 struct zint_symbol *symbol = NULL; | |
| 840 | |
| 841 char escaped[8192]; | |
| 842 | |
| 843 testStartSymbol("test_encode_segs", &symbol); | |
| 844 | |
| 845 for (i = 0; i < data_size; i++) { | |
| 846 | |
| 847 if (testContinue(p_ctx, i)) continue; | |
| 848 | |
| 849 symbol = ZBarcode_Create(); | |
| 850 assert_nonnull(symbol, "Symbol not created\n"); | |
| 851 | |
| 852 testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, data[i].input_mode, -1 /*eci*/, | |
| 853 data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, | |
| 854 NULL, 0, debug); | |
| 855 for (j = 0, seg_count = 0; j < 3 && data[i].segs[j].length; j++, seg_count++); | |
| 856 | |
| 857 ret = ZBarcode_Encode_Segs(symbol, data[i].segs, seg_count); | |
| 858 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode_Segs ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 859 | |
| 860 if (p_ctx->generate) { | |
| 861 char escaped1[8192]; | |
| 862 char escaped2[8192]; | |
| 863 int length = data[i].segs[0].length == -1 ? (int) ustrlen(data[i].segs[0].source) : data[i].segs[0].length; | |
| 864 int length1 = data[i].segs[1].length == -1 ? (int) ustrlen(data[i].segs[1].source) : data[i].segs[1].length; | |
| 865 int length2 = data[i].segs[2].length == -1 ? (int) ustrlen(data[i].segs[2].source) : data[i].segs[2].length; | |
| 866 printf(" /*%3d*/ { %s, %d, %d, { %d, %d, \"%s\" }, { { TU(\"%s\"), %d, %d }, { TU(\"%s\"), %d, %d }, { TU(\"%s\"), %d, %d } }, %s, %d, %d, \"%s\",\n", | |
| 867 i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, | |
| 868 data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, | |
| 869 testUtilEscape((const char *) data[i].segs[0].source, length, escaped, sizeof(escaped)), data[i].segs[0].length, data[i].segs[0].eci, | |
| 870 testUtilEscape((const char *) data[i].segs[1].source, length1, escaped1, sizeof(escaped1)), data[i].segs[1].length, data[i].segs[1].eci, | |
| 871 testUtilEscape((const char *) data[i].segs[2].source, length2, escaped2, sizeof(escaped2)), data[i].segs[2].length, data[i].segs[2].eci, | |
| 872 testUtilErrorName(data[i].ret), | |
| 873 symbol->rows, symbol->width, data[i].comment); | |
| 874 testUtilModulesPrint(symbol, " ", "\n"); | |
| 875 printf(" },\n"); | |
| 876 } else { | |
| 877 if (ret < ZINT_ERROR) { | |
| 878 int width, row; | |
| 879 assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); | |
| 880 assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); | |
| 881 | |
| 882 ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); | |
| 883 assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d\n", i, ret, width, row); | |
| 884 } | |
| 885 } | |
| 886 | |
| 887 ZBarcode_Delete(symbol); | |
| 888 } | |
| 889 | |
| 890 testFinish(); | |
| 891 } | |
| 892 | |
| 893 #include <time.h> | |
| 894 | |
| 895 #define TEST_PERF_ITERATIONS 1000 | |
| 896 | |
| 897 /* Not a real test, just performance indicator */ | |
| 898 static void test_perf(const testCtx *const p_ctx) { | |
| 899 int debug = p_ctx->debug; | |
| 900 | |
| 901 struct item { | |
| 902 int symbology; | |
| 903 int input_mode; | |
| 904 int option_1; | |
| 905 int option_2; | |
| 906 char *data; | |
| 907 int ret; | |
| 908 | |
| 909 int expected_rows; | |
| 910 int expected_width; | |
| 911 char *comment; | |
| 912 }; | |
| 913 static const struct item data[] = { | |
| 914 /* 0*/ { BARCODE_GRIDMATRIX, UNICODE_MODE, -1, -1, | |
| 915 "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", | |
| 916 0, 66, 66, "97 chars, mixed modes" }, | |
| 917 /* 1*/ { BARCODE_GRIDMATRIX, UNICODE_MODE, -1, -1, | |
| 918 "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738" | |
| 919 "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738" | |
| 920 "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738" | |
| 921 "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738" | |
| 922 "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738" | |
| 923 "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738" | |
| 924 "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738" | |
| 925 "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738" | |
| 926 "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738" | |
| 927 "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", | |
| 928 0, 162, 162, "970 chars, mixed modes" }, | |
| 929 }; | |
| 930 const int data_size = ARRAY_SIZE(data); | |
| 931 int i, length, ret; | |
| 932 struct zint_symbol *symbol; | |
| 933 | |
| 934 clock_t start, total_encode = 0, total_buffer = 0, diff_encode, diff_buffer; | |
| 935 | |
| 936 if (!(debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */ | |
| 937 return; | |
| 938 } | |
| 939 | |
| 940 for (i = 0; i < data_size; i++) { | |
| 941 int j; | |
| 942 | |
| 943 if (testContinue(p_ctx, i)) continue; | |
| 944 | |
| 945 diff_encode = diff_buffer = 0; | |
| 946 | |
| 947 for (j = 0; j < TEST_PERF_ITERATIONS; j++) { | |
| 948 symbol = ZBarcode_Create(); | |
| 949 assert_nonnull(symbol, "Symbol not created\n"); | |
| 950 | |
| 951 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); | |
| 952 | |
| 953 start = clock(); | |
| 954 ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); | |
| 955 diff_encode += clock() - start; | |
| 956 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 957 | |
| 958 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); | |
| 959 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); | |
| 960 | |
| 961 start = clock(); | |
| 962 ret = ZBarcode_Buffer(symbol, 0 /*rotate_angle*/); | |
| 963 diff_buffer += clock() - start; | |
| 964 assert_zero(ret, "i:%d ZBarcode_Buffer ret %d != 0 (%s)\n", i, ret, symbol->errtxt); | |
| 965 | |
| 966 ZBarcode_Delete(symbol); | |
| 967 } | |
| 968 | |
| 969 printf("%s: diff_encode %gms, diff_buffer %gms\n", data[i].comment, diff_encode * 1000.0 / CLOCKS_PER_SEC, diff_buffer * 1000.0 / CLOCKS_PER_SEC); | |
| 970 | |
| 971 total_encode += diff_encode; | |
| 972 total_buffer += diff_buffer; | |
| 973 } | |
| 974 if (p_ctx->index != -1) { | |
| 975 printf("totals: encode %gms, buffer %gms\n", total_encode * 1000.0 / CLOCKS_PER_SEC, total_buffer * 1000.0 / CLOCKS_PER_SEC); | |
| 976 } | |
| 977 } | |
| 978 | |
| 979 int main(int argc, char *argv[]) { | |
| 980 | |
| 981 testFunction funcs[] = { /* name, func */ | |
| 982 { "test_large", test_large }, | |
| 983 { "test_options", test_options }, | |
| 984 { "test_input", test_input }, | |
| 985 { "test_encode", test_encode }, | |
| 986 { "test_encode_segs", test_encode_segs }, | |
| 987 { "test_perf", test_perf }, | |
| 988 }; | |
| 989 | |
| 990 testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); | |
| 991 | |
| 992 testReport(); | |
| 993 | |
| 994 return 0; | |
| 995 } | |
| 996 | |
| 997 /* vim: set ts=4 sw=4 et norl : */ |
