Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zint/backend/tests/test_code49.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) 2020-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 char *pattern; | |
| 39 int length; | |
| 40 int ret; | |
| 41 int expected_rows; | |
| 42 int expected_width; | |
| 43 char *expected_errtxt; | |
| 44 }; | |
| 45 /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ | |
| 46 static const struct item data[] = { | |
| 47 /* 0*/ { "A", 49, 0, 8, 70, "" }, /* ANSI/AIM BC6-2000 Table 1 */ | |
| 48 /* 1*/ { "A", 50, ZINT_ERROR_TOO_LONG, -1, -1, "Error 432: Input too long, requires 50 codewords (maximum 49)" }, | |
| 49 /* 2*/ { "0", 81, 0, 8, 70, "" }, /* ANSI/AIM BC6-2000 Table 1 */ | |
| 50 /* 3*/ { "0", 82, ZINT_ERROR_TOO_LONG, -1, -1, "Error 430: Input length 82 too long (maximum 81)" }, | |
| 51 }; | |
| 52 const int data_size = ARRAY_SIZE(data); | |
| 53 int i, length, ret; | |
| 54 struct zint_symbol *symbol = NULL; | |
| 55 | |
| 56 char data_buf[4096]; | |
| 57 | |
| 58 testStartSymbol("test_large", &symbol); | |
| 59 | |
| 60 for (i = 0; i < data_size; i++) { | |
| 61 | |
| 62 if (testContinue(p_ctx, i)) continue; | |
| 63 | |
| 64 symbol = ZBarcode_Create(); | |
| 65 assert_nonnull(symbol, "Symbol not created\n"); | |
| 66 | |
| 67 testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length); | |
| 68 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)); | |
| 69 | |
| 70 length = testUtilSetSymbol(symbol, BARCODE_CODE49, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); | |
| 71 | |
| 72 ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); | |
| 73 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 74 assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); | |
| 75 assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); | |
| 76 | |
| 77 if (ret < ZINT_ERROR) { | |
| 78 assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); | |
| 79 assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); | |
| 80 } | |
| 81 | |
| 82 ZBarcode_Delete(symbol); | |
| 83 } | |
| 84 | |
| 85 testFinish(); | |
| 86 } | |
| 87 | |
| 88 static void test_input(const testCtx *const p_ctx) { | |
| 89 int debug = p_ctx->debug; | |
| 90 | |
| 91 struct item { | |
| 92 int input_mode; | |
| 93 int option_1; | |
| 94 char *data; | |
| 95 int length; | |
| 96 int ret; | |
| 97 int expected_rows; | |
| 98 int expected_width; | |
| 99 char *expected; | |
| 100 char *comment; | |
| 101 }; | |
| 102 /* | |
| 103 NUL U+0000, S1 SP (39) | |
| 104 US U+001F (\037, 31), S1 5 | |
| 105 */ | |
| 106 static const struct item data[] = { | |
| 107 /* 0*/ { UNICODE_MODE, -1, "é", -1, ZINT_ERROR_INVALID_DATA, 0, 0, "Error 431: Invalid character at position 1 in input, extended ASCII not allowed", "ASCII only" }, | |
| 108 /* 1*/ { UNICODE_MODE, -1, "EXAMPLE 2", -1, 0, 2, 70, "(16) 14 33 10 22 25 21 14 41 38 2 35 14 18 13 0 22", "2.3.7 Symbol Example" }, | |
| 109 /* 2*/ { UNICODE_MODE, -1, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", "2.3 Example 1: Numeric Encodation (Start 2, Numeric)" }, | |
| 110 /* 3*/ { UNICODE_MODE, -1, "123456", -1, 0, 2, 70, "(16) 5 17 9 6 48 48 48 34 48 48 36 9 23 41 2 11", "2.3 Example 1: Numeric Encodation" }, | |
| 111 /* 4*/ { UNICODE_MODE, -1, "12345678", -1, 0, 2, 70, "(16) 5 17 9 14 6 48 48 0 48 48 25 42 2 17 2 37", "2.3 Example 1: Numeric Encodation" }, | |
| 112 /* 5*/ { UNICODE_MODE, -1, "123456789", -1, 0, 2, 70, "(16) 5 17 9 46 16 37 48 31 48 48 7 26 9 39 2 32", "2.3 Example 1: Numeric Encodation" }, | |
| 113 /* 6*/ { UNICODE_MODE, -1, "1234567", -1, 0, 2, 70, "(16) 43 45 2 11 39 48 48 40 48 48 33 36 38 6 2 15", "2.3 Example 1: Numeric Encodation" }, | |
| 114 /* 7*/ { UNICODE_MODE, -1, "\037", -1, 0, 2, 70, "(16) 5 48 48 48 48 48 48 48 48 48 4 33 13 15 4 18", "US (Start 4, Alphanumeric S1)" }, | |
| 115 /* 8*/ { UNICODE_MODE, -1, "\000\037", 2, 0, 2, 70, "(16) 38 43 5 48 48 48 48 33 48 48 45 7 38 43 4 37", "NUL S1 US (Start 4, Alphanumeric S1)" }, | |
| 116 /* 9*/ { UNICODE_MODE, -1, "a\000", 2, 0, 2, 70, "(16) 10 43 38 48 48 48 48 38 48 48 32 33 14 15 5 48", "a S1 NUL (Start 5, Alphanumeric S2)" }, | |
| 117 /* 10*/ { UNICODE_MODE, -1, "ab", -1, 0, 2, 70, "(16) 10 44 11 48 48 48 48 12 48 48 27 39 42 0 5 13", "a S2 b (Start 5, Alphanumeric S2)" }, | |
| 118 /* 11*/ { UNICODE_MODE, -1, "\000A\000a\000", 5, 0, 2, 70, "(16) 38 10 43 38 44 10 43 30 38 48 25 23 38 32 4 12", "NUL A S1 NUL S2 a S1 (C18 30) NUL (Start 4, Alphanumeric S1)" }, | |
| 119 /* 12*/ { UNICODE_MODE, -1, "1234\037aA12345A", -1, 0, 3, 70, "(24) 1 2 3 4 43 5 44 4 10 10 48 5 17 9 48 0 10 48 19 2 13 32 7 33", "1 2 3 4 S1 US S2 (C18 4) a A NS 12345 NS (C28 0) A (Start 0, Alpha)" }, | |
| 120 /* 13*/ { GS1_MODE, -1, "[90]12345[91]AB12345", -1, 0, 4, 70, "(32) 45 48 47 15 4 7 9 28 48 45 9 1 10 11 48 25 5 17 9 48 48 48 48 27 48 48 37 39 26 8 14", "FNC1 NS 9012345 (C18 28) NS FNC1 9 1 A B NS (C28 25) 12345 Pad (4) (C38 27) (Start 0, Alpha)" }, | |
| 121 /* 14*/ { GS1_MODE | GS1PARENS_MODE, -1, "(90)12345(91)AB12345", -1, 0, 4, 70, "(32) 45 48 47 15 4 7 9 28 48 45 9 1 10 11 48 25 5 17 9 48 48 48 48 27 48 48 37 39 26 8 14", "FNC1 NS 9012345 (C18 28) NS FNC1 9 1 A B NS (C28 25) 12345 Pad (4) (C38 27) (Start 0, Alpha)" }, | |
| 122 /* 15*/ { UNICODE_MODE, -1, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, | |
| 123 /* 16*/ { UNICODE_MODE, 1, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 433: Minimum number of rows out of range (2 to 8)", "" }, | |
| 124 /* 17*/ { UNICODE_MODE, 9, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 433: Minimum number of rows out of range (2 to 8)", "" }, | |
| 125 /* 18*/ { UNICODE_MODE, 2, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, | |
| 126 /* 19*/ { UNICODE_MODE, 3, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, | |
| 127 /* 20*/ { UNICODE_MODE, 4, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, | |
| 128 /* 21*/ { UNICODE_MODE, 5, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, | |
| 129 /* 22*/ { UNICODE_MODE, 6, "1234567890123456789012345678901234567890", -1, 0, 6, 70, "(48) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, | |
| 130 /* 23*/ { UNICODE_MODE, 7, "1234567890123456789012345678901234567890", -1, 0, 7, 70, "(56) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, | |
| 131 /* 24*/ { UNICODE_MODE, 8, "1234567890123456789012345678901234567890", -1, 0, 8, 70, "(64) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, | |
| 132 /* 25*/ { UNICODE_MODE, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW", -1, 0, 8, 70, "(64) 10 11 12 13 14 15 16 42 17 18 19 20 21 22 23 42 24 25 26 27 28 29 30 42 31 32 33 34 35", "" }, | |
| 133 /* 26*/ { UNICODE_MODE, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX", -1, ZINT_ERROR_TOO_LONG, 0, 0, "Error 432: Input too long, requires 50 codewords (maximum 49)", "" }, | |
| 134 }; | |
| 135 const int data_size = ARRAY_SIZE(data); | |
| 136 int i, length, ret; | |
| 137 struct zint_symbol *symbol = NULL; | |
| 138 | |
| 139 char escaped[1024]; | |
| 140 char cmp_buf[8192]; | |
| 141 char cmp_msg[1024]; | |
| 142 | |
| 143 int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ | |
| 144 | |
| 145 testStartSymbol("test_input", &symbol); | |
| 146 | |
| 147 for (i = 0; i < data_size; i++) { | |
| 148 | |
| 149 if (testContinue(p_ctx, i)) continue; | |
| 150 | |
| 151 symbol = ZBarcode_Create(); | |
| 152 assert_nonnull(symbol, "Symbol not created\n"); | |
| 153 | |
| 154 symbol->debug = ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */ | |
| 155 | |
| 156 length = testUtilSetSymbol(symbol, BARCODE_CODE49, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); | |
| 157 | |
| 158 ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); | |
| 159 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 160 | |
| 161 if (p_ctx->generate) { | |
| 162 printf(" /*%3d*/ { %s, %d, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n", | |
| 163 i, testUtilInputModeName(data[i].input_mode), data[i].option_1, | |
| 164 testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, | |
| 165 testUtilErrorName(data[i].ret), symbol->rows, symbol->width, symbol->errtxt, data[i].comment); | |
| 166 } else { | |
| 167 assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); | |
| 168 if (ret < ZINT_ERROR) { | |
| 169 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); | |
| 170 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); | |
| 171 | |
| 172 if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) { | |
| 173 char modules_dump[4096]; | |
| 174 assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); | |
| 175 ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL); | |
| 176 assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); | |
| 177 | |
| 178 ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump); | |
| 179 assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", | |
| 180 i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump); | |
| 181 } | |
| 182 } | |
| 183 } | |
| 184 | |
| 185 ZBarcode_Delete(symbol); | |
| 186 } | |
| 187 | |
| 188 testFinish(); | |
| 189 } | |
| 190 | |
| 191 static void test_encode(const testCtx *const p_ctx) { | |
| 192 int debug = p_ctx->debug; | |
| 193 | |
| 194 struct item { | |
| 195 int input_mode; | |
| 196 int option_1; | |
| 197 char *data; | |
| 198 int ret; | |
| 199 | |
| 200 int expected_rows; | |
| 201 int expected_width; | |
| 202 char *comment; | |
| 203 char *expected; | |
| 204 }; | |
| 205 static const struct item data[] = { | |
| 206 /* 0*/ { UNICODE_MODE, -1, "MULTIPLE ROWS IN CODE 49", 0, 5, 70, "ANSI/AIM BC6-2000 Figure 1", | |
| 207 "1011111011001011101011100110000110111101011011111010111101000100001111" | |
| 208 "1010100001000010001001111000101110100110001111010010001011100011001111" | |
| 209 "1011001100000101101101110111000010110010110000111011101011110001101111" | |
| 210 "1010011001100100001111010010001100101011101111110011010001001111101111" | |
| 211 "1011001111001011101000000101001110111110111010001011010001101111101111" | |
| 212 }, | |
| 213 /* 1*/ { UNICODE_MODE, -1, "EXAMPLE 2", 0, 2, 70, "ANSI/AIM BC6-2000 Figure 3", | |
| 214 "1011000111011100101111001001000110110011110010100010001111000100101111" | |
| 215 "1011000100110010001100010110010000100001101001111010000001001011101111" | |
| 216 }, | |
| 217 /* 2*/ { UNICODE_MODE, 3, "EXAMPLE 2", 0, 3, 70, "Min 3 rows", | |
| 218 "1011000111011100101111001001000110110011110010100010001111000100101111" | |
| 219 "1011000100110010001010111011111100110011110010111010111011001111101111" | |
| 220 "1011001111001011101110011111001010100001000010001010111001111001101111" | |
| 221 }, | |
| 222 /* 3*/ { UNICODE_MODE, 8, "EXAMPLE 2", 0, 8, 70, "Min 8 rows", | |
| 223 "1011000111011100101111001001000110110011110010100010001111000100101111" | |
| 224 "1011000100110010001010111011111100110011110010111010111011001111101111" | |
| 225 "1010101110111111001010111011111100110011110010111011001110110001001111" | |
| 226 "1011001111001011101100111100101110101011101111110010111001000001101111" | |
| 227 "1010101110111111001100111100101110101011101111110011001110110001001111" | |
| 228 "1011001111001011101010111011111100101011101111110011001110110001001111" | |
| 229 "1010101110111111001010111011111100101011101111110010111001000001101111" | |
| 230 "1011110110100100001010000100010000111010010011111011001000111011001111" | |
| 231 }, | |
| 232 }; | |
| 233 const int data_size = ARRAY_SIZE(data); | |
| 234 int i, length, ret; | |
| 235 struct zint_symbol *symbol = NULL; | |
| 236 | |
| 237 char escaped[1024]; | |
| 238 char bwipp_buf[8192]; | |
| 239 char bwipp_msg[1024]; | |
| 240 | |
| 241 int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ | |
| 242 | |
| 243 testStartSymbol("test_encode", &symbol); | |
| 244 | |
| 245 for (i = 0; i < data_size; i++) { | |
| 246 | |
| 247 if (testContinue(p_ctx, i)) continue; | |
| 248 | |
| 249 symbol = ZBarcode_Create(); | |
| 250 assert_nonnull(symbol, "Symbol not created\n"); | |
| 251 | |
| 252 length = testUtilSetSymbol(symbol, BARCODE_CODE49, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); | |
| 253 | |
| 254 ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); | |
| 255 assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); | |
| 256 | |
| 257 if (p_ctx->generate) { | |
| 258 printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n", | |
| 259 i, testUtilInputModeName(data[i].input_mode), data[i].option_1, | |
| 260 testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), | |
| 261 testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment); | |
| 262 testUtilModulesPrint(symbol, " ", "\n"); | |
| 263 printf(" },\n"); | |
| 264 } else { | |
| 265 if (ret < ZINT_ERROR) { | |
| 266 int width, row; | |
| 267 | |
| 268 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); | |
| 269 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); | |
| 270 | |
| 271 ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); | |
| 272 assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); | |
| 273 | |
| 274 if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) { | |
| 275 ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf), NULL); | |
| 276 assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); | |
| 277 | |
| 278 ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); | |
| 279 assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", | |
| 280 i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); | |
| 281 } | |
| 282 } | |
| 283 } | |
| 284 | |
| 285 ZBarcode_Delete(symbol); | |
| 286 } | |
| 287 | |
| 288 testFinish(); | |
| 289 } | |
| 290 | |
| 291 int main(int argc, char *argv[]) { | |
| 292 | |
| 293 testFunction funcs[] = { /* name, func */ | |
| 294 { "test_large", test_large }, | |
| 295 { "test_input", test_input }, | |
| 296 { "test_encode", test_encode }, | |
| 297 }; | |
| 298 | |
| 299 testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); | |
| 300 | |
| 301 testReport(); | |
| 302 | |
| 303 return 0; | |
| 304 } | |
| 305 | |
| 306 /* vim: set ts=4 sw=4 et : */ |
