mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-20 10:15:10 -04:00
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA RMQR: fix ECI encoding (wrong bit length for indicator) MICROQR: check versions M1 and M2 for allowed characters so as to give better error messages DOTCODE: some small optimizations common.c: add is_chr(), segs_length(), segs_cpy() CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add namespace prefixes to static funcs/data includes: use Z_ prefix, unuse double underscore prefixes (guard defines) manual.txt: compress some tables using double/treble column sets
This commit is contained in:
parent
3b9d989894
commit
f58c80e290
81 changed files with 12026 additions and 4701 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2020 - 2021 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2020-2022 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
|
@ -27,7 +27,6 @@
|
|||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include "testcommon.h"
|
||||
|
||||
|
@ -74,112 +73,118 @@ static void test_large(int index, int debug) {
|
|||
/* 25*/ { -1, 1, { 0, 0, "" }, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 26*/ { 3, 1, { 0, 0, "" }, "A", 4, 0, 16, 18 }, /* With ECI */
|
||||
/* 27*/ { 3, 1, { 0, 0, "" }, "A", 5, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 26*/ { -1, 1, { 1, 2, "" }, "A", 10, 0, 16, 18 }, /* With Structured Append */
|
||||
/* 27*/ { -1, 1, { 1, 2, "" }, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 28*/ { 3, 1, { 1, 2, "" }, "A", 2, 0, 16, 18 }, /* With ECI and Structured Append 1st symbol */
|
||||
/* 29*/ { 3, 1, { 1, 2, "" }, "A", 3, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 30*/ { 3, 1, { 2, 2, "" }, "A", 4, 0, 16, 18 }, /* With ECI and Structured Append subsequent symbol */
|
||||
/* 31*/ { 3, 1, { 2, 2, "" }, "A", 5, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 32*/ { -1, 1, { 0, 0, "" }, "\001", 10, 0, 16, 18 },
|
||||
/* 33*/ { -1, 1, { 0, 0, "" }, "\001", 11, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 34*/ { -1, 1, { 0, 0, "" }, "\200", 8, 0, 16, 18 },
|
||||
/* 35*/ { -1, 1, { 0, 0, "" }, "\200", 9, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 36*/ { -1, 2, { 0, 0, "" }, "1", 44, 0, 22, 22 }, /* Version B */
|
||||
/* 37*/ { -1, 2, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 38*/ { -1, 2, { 0, 0, "" }, "A", 27, 0, 22, 22 },
|
||||
/* 39*/ { -1, 2, { 0, 0, "" }, "A", 28, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 40*/ { -1, 2, { 0, 0, "" }, "A", 26, 0, 22, 22 },
|
||||
/* 41*/ { -1, 2, { 0, 0, "" }, "\001", 19, 0, 22, 22 },
|
||||
/* 42*/ { -1, 2, { 0, 0, "" }, "\001", 20, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 43*/ { -1, 2, { 0, 0, "" }, "\200", 17, 0, 22, 22 },
|
||||
/* 44*/ { -1, 2, { 0, 0, "" }, "\200", 18, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 45*/ { -1, 3, { 0, 0, "" }, "1", 104, 0, 28, 32 }, /* Version C */
|
||||
/* 46*/ { -1, 3, { 0, 0, "" }, "1", 105, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 47*/ { -1, 3, { 0, 0, "" }, "A", 64, 0, 28, 32 },
|
||||
/* 48*/ { -1, 3, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 49*/ { -1, 3, { 0, 0, "" }, "\001", 44, 0, 28, 32 },
|
||||
/* 50*/ { -1, 3, { 0, 0, "" }, "\001", 45, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 51*/ { -1, 3, { 0, 0, "" }, "\200", 42, 0, 28, 32 },
|
||||
/* 52*/ { -1, 3, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 53*/ { -1, 4, { 0, 0, "" }, "1", 217, 0, 40, 42 }, /* Version D */
|
||||
/* 54*/ { -1, 4, { 0, 0, "" }, "1", 218, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 55*/ { -1, 4, { 0, 0, "" }, "A", 135, 0, 40, 42 },
|
||||
/* 56*/ { -1, 4, { 0, 0, "" }, "A", 136, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 57*/ { -1, 4, { 0, 0, "" }, "\001", 91, 0, 40, 42 },
|
||||
/* 58*/ { -1, 4, { 0, 0, "" }, "\001", 92, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 59*/ { -1, 4, { 0, 0, "" }, "\200", 89, 0, 40, 42 },
|
||||
/* 60*/ { -1, 4, { 0, 0, "" }, "\200", 90, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 61*/ { -1, 5, { 0, 0, "" }, "1", 435, 0, 52, 54 }, /* Version E (note 435 multiple of 3) */
|
||||
/* 62*/ { -1, 5, { 0, 0, "" }, "1", 436, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 63*/ { -1, 5, { 0, 0, "" }, "1", 434, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */
|
||||
/* 64*/ { -1, 5, { 0, 0, "" }, "1", 433, 0, 52, 54 },
|
||||
/* 65*/ { -1, 5, { 0, 0, "" }, "A", 271, 0, 52, 54 },
|
||||
/* 66*/ { -1, 5, { 0, 0, "" }, "A", 272, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 67*/ { -1, 5, { 0, 0, "" }, "\001", 182, 0, 52, 54 },
|
||||
/* 68*/ { -1, 5, { 0, 0, "" }, "\001", 183, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 69*/ { -1, 5, { 0, 0, "" }, "\200", 180, 0, 52, 54 },
|
||||
/* 70*/ { -1, 5, { 0, 0, "" }, "\200", 181, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 71*/ { -1, 6, { 0, 0, "" }, "1", 886, 0, 70, 76 }, /* Version F */
|
||||
/* 72*/ { -1, 6, { 0, 0, "" }, "1", 887, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 73*/ { -1, 6, { 0, 0, "" }, "A", 553, 0, 70, 76 },
|
||||
/* 74*/ { -1, 6, { 0, 0, "" }, "A", 554, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 75*/ { -1, 6, { 0, 0, "" }, "\001", 370, 0, 70, 76 },
|
||||
/* 76*/ { -1, 6, { 0, 0, "" }, "\001", 371, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 77*/ { -1, 6, { 0, 0, "" }, "\200", 368, 0, 70, 76 },
|
||||
/* 78*/ { -1, 6, { 0, 0, "" }, "\200", 369, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 79*/ { -1, 7, { 0, 0, "" }, "1", 1755, 0, 104, 98 }, /* Version G (note 1755 multiple of 3) */
|
||||
/* 80*/ { -1, 7, { 0, 0, "" }, "1", 1756, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 81*/ { -1, 7, { 0, 0, "" }, "1", 1754, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */
|
||||
/* 82*/ { -1, 7, { 0, 0, "" }, "1", 1753, 0, 104, 98 },
|
||||
/* 83*/ { -1, 7, { 0, 0, "" }, "A", 1096, 0, 104, 98 },
|
||||
/* 84*/ { -1, 7, { 0, 0, "" }, "A", 1097, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 85*/ { -1, 7, { 0, 0, "" }, "\001", 732, 0, 104, 98 },
|
||||
/* 86*/ { -1, 7, { 0, 0, "" }, "\001", 733, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 87*/ { -1, 7, { 0, 0, "" }, "\200", 730, 0, 104, 98 },
|
||||
/* 88*/ { -1, 7, { 0, 0, "" }, "\200", 731, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 89*/ { -1, 8, { 0, 0, "" }, "1", 3550, 0, 148, 134 }, /* Version H */
|
||||
/* 90*/ { -1, 8, { 0, 0, "" }, "1", 3551, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 91*/ { -1, 8, { 0, 0, "" }, "A", 2218, 0, 148, 134 },
|
||||
/* 92*/ { -1, 8, { 0, 0, "" }, "A", 2219, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 93*/ { -1, 8, { 0, 0, "" }, "\001", 1480, 0, 148, 134 },
|
||||
/* 94*/ { -1, 8, { 0, 0, "" }, "\001", 1481, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 95*/ { -1, 8, { 0, 0, "" }, "\200", 1478, 0, 148, 134 },
|
||||
/* 96*/ { -1, 8, { 0, 0, "" }, "\200", 1479, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 97*/ { -1, 9, { 0, 0, "" }, "1", 6, 0, 8, 11 }, /* Version S-10 */
|
||||
/* 98*/ { -1, 9, { 0, 0, "" }, "1", 7, 0, 8, 21 }, /* -> S-20 */
|
||||
/* 99*/ { -1, 9, { 0, 0, "" }, "1", 12, 0, 8, 21 }, /* Version S-20 */
|
||||
/*100*/ { -1, 9, { 0, 0, "" }, "1", 13, 0, 8, 31 }, /* -> S-30 */
|
||||
/*101*/ { -1, 9, { 0, 0, "" }, "1", 18, 0, 8, 31 }, /* Version S-30 */
|
||||
/*102*/ { -1, 9, { 0, 0, "" }, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*103*/ { -1, 9, { 0, 0, "" }, "1", 17, 0, 8, 31 },
|
||||
/*104*/ { -1, 10, { 0, 0, "" }, "1", 22, 0, 16, 17 }, /* Version T-16 */
|
||||
/*105*/ { -1, 10, { 0, 0, "" }, "1", 23, 0, 16, 33 }, /* -> T-32 */
|
||||
/*106*/ { -1, 10, { 0, 0, "" }, "A", 13, 0, 16, 17 },
|
||||
/*107*/ { -1, 10, { 0, 0, "" }, "A", 14, 0, 16, 33 }, /* -> T-32 */
|
||||
/*108*/ { -1, 10, { 0, 0, "" }, "\001", 10, 0, 16, 17 },
|
||||
/*109*/ { -1, 10, { 0, 0, "" }, "\001", 11, 0, 16, 33 }, /* -> T-32 */
|
||||
/*110*/ { -1, 10, { 0, 0, "" }, "\200", 8, 0, 16, 17 },
|
||||
/*111*/ { -1, 10, { 0, 0, "" }, "\200", 9, 0, 16, 33 }, /* -> T-32 */
|
||||
/*112*/ { -1, 10, { 0, 0, "" }, "1", 56, 0, 16, 33 }, /* Version T-32 */
|
||||
/*113*/ { -1, 10, { 0, 0, "" }, "1", 57, 0, 16, 49 }, /* -> T-48 */
|
||||
/*114*/ { -1, 10, { 0, 0, "" }, "A", 34, 0, 16, 33 },
|
||||
/*115*/ { -1, 10, { 0, 0, "" }, "A", 35, 0, 16, 49 }, /* -> T-48 */
|
||||
/*116*/ { -1, 10, { 0, 0, "" }, "\001", 24, 0, 16, 33 },
|
||||
/*117*/ { -1, 10, { 0, 0, "" }, "\001", 25, 0, 16, 49 }, /* -> T-48 */
|
||||
/*118*/ { -1, 10, { 0, 0, "" }, "\200", 22, 0, 16, 33 },
|
||||
/*119*/ { -1, 10, { 0, 0, "" }, "\200", 23, 0, 16, 49 }, /* -> T-48 */
|
||||
/*120*/ { -1, 10, { 0, 0, "" }, "1", 90, 0, 16, 49 }, /* Version T-48 (note 90 multiple of 3) */
|
||||
/*121*/ { -1, 10, { 0, 0, "" }, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*122*/ { -1, 10, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */
|
||||
/*123*/ { -1, 10, { 0, 0, "" }, "1", 88, 0, 16, 49 },
|
||||
/*124*/ { -1, 10, { 0, 0, "" }, "A", 55, 0, 16, 49 },
|
||||
/*125*/ { -1, 10, { 0, 0, "" }, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*126*/ { -1, 10, { 0, 0, "" }, "A", 90, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*127*/ { -1, 10, { 0, 0, "" }, "\001", 38, 0, 16, 49 },
|
||||
/*128*/ { -1, 10, { 0, 0, "" }, "\001", 39, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*129*/ { -1, 10, { 0, 0, "" }, "\001", 90, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*130*/ { -1, 10, { 0, 0, "" }, "\200", 36, 0, 16, 49 },
|
||||
/*131*/ { -1, 10, { 0, 0, "" }, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 28*/ { -1, 1, { 1, 2, "" }, "A", 10, 0, 16, 18 }, /* With Structured Append */
|
||||
/* 29*/ { -1, 1, { 1, 2, "" }, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 30*/ { 3, 1, { 1, 2, "" }, "A", 2, 0, 16, 18 }, /* With ECI and Structured Append 1st symbol */
|
||||
/* 31*/ { 3, 1, { 1, 2, "" }, "A", 3, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 32*/ { 3, 1, { 2, 2, "" }, "A", 4, 0, 16, 18 }, /* With ECI and Structured Append subsequent symbol */
|
||||
/* 33*/ { 3, 1, { 2, 2, "" }, "A", 5, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 34*/ { -1, 1, { 0, 0, "" }, "\001", 10, 0, 16, 18 },
|
||||
/* 35*/ { -1, 1, { 0, 0, "" }, "\001", 11, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 36*/ { -1, 1, { 0, 0, "" }, "\200", 8, 0, 16, 18 },
|
||||
/* 37*/ { -1, 1, { 0, 0, "" }, "\200", 9, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 38*/ { -1, 2, { 0, 0, "" }, "1", 44, 0, 22, 22 }, /* Version B */
|
||||
/* 39*/ { -1, 2, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 40*/ { -1, 2, { 0, 0, "" }, "A", 27, 0, 22, 22 },
|
||||
/* 41*/ { -1, 2, { 0, 0, "" }, "A", 28, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 42*/ { -1, 2, { 0, 0, "" }, "A", 26, 0, 22, 22 },
|
||||
/* 43*/ { -1, 2, { 0, 0, "" }, "\001", 19, 0, 22, 22 },
|
||||
/* 44*/ { -1, 2, { 0, 0, "" }, "\001", 20, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 45*/ { -1, 2, { 0, 0, "" }, "\200", 17, 0, 22, 22 },
|
||||
/* 46*/ { -1, 2, { 0, 0, "" }, "\200", 18, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 47*/ { -1, 3, { 0, 0, "" }, "1", 104, 0, 28, 32 }, /* Version C */
|
||||
/* 48*/ { -1, 3, { 0, 0, "" }, "1", 105, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 49*/ { -1, 3, { 0, 0, "" }, "A", 64, 0, 28, 32 },
|
||||
/* 50*/ { -1, 3, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 51*/ { -1, 3, { 0, 0, "" }, "\001", 44, 0, 28, 32 },
|
||||
/* 52*/ { -1, 3, { 0, 0, "" }, "\001", 45, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 53*/ { -1, 3, { 0, 0, "" }, "\200", 42, 0, 28, 32 },
|
||||
/* 54*/ { -1, 3, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 55*/ { -1, 4, { 0, 0, "" }, "1", 217, 0, 40, 42 }, /* Version D */
|
||||
/* 56*/ { -1, 4, { 0, 0, "" }, "1", 218, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 57*/ { -1, 4, { 0, 0, "" }, "A", 135, 0, 40, 42 },
|
||||
/* 58*/ { -1, 4, { 0, 0, "" }, "A", 136, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 59*/ { -1, 4, { 0, 0, "" }, "\001", 91, 0, 40, 42 },
|
||||
/* 60*/ { -1, 4, { 0, 0, "" }, "\001", 92, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 61*/ { -1, 4, { 0, 0, "" }, "\200", 89, 0, 40, 42 },
|
||||
/* 62*/ { -1, 4, { 0, 0, "" }, "\200", 90, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 63*/ { -1, 5, { 0, 0, "" }, "1", 435, 0, 52, 54 }, /* Version E (note 435 multiple of 3) */
|
||||
/* 64*/ { -1, 5, { 0, 0, "" }, "1", 436, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 65*/ { -1, 5, { 0, 0, "" }, "1", 434, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */
|
||||
/* 66*/ { -1, 5, { 0, 0, "" }, "1", 433, 0, 52, 54 },
|
||||
/* 67*/ { -1, 5, { 0, 0, "" }, "A", 271, 0, 52, 54 },
|
||||
/* 68*/ { -1, 5, { 0, 0, "" }, "A", 272, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 69*/ { -1, 5, { 0, 0, "" }, "\001", 182, 0, 52, 54 },
|
||||
/* 70*/ { -1, 5, { 0, 0, "" }, "\001", 183, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 71*/ { -1, 5, { 0, 0, "" }, "\200", 180, 0, 52, 54 },
|
||||
/* 72*/ { -1, 5, { 0, 0, "" }, "\200", 181, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 73*/ { -1, 6, { 0, 0, "" }, "1", 886, 0, 70, 76 }, /* Version F */
|
||||
/* 74*/ { -1, 6, { 0, 0, "" }, "1", 887, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 75*/ { -1, 6, { 0, 0, "" }, "A", 553, 0, 70, 76 },
|
||||
/* 76*/ { -1, 6, { 0, 0, "" }, "A", 554, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 77*/ { -1, 6, { 0, 0, "" }, "\001", 370, 0, 70, 76 },
|
||||
/* 78*/ { -1, 6, { 0, 0, "" }, "\001", 371, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 79*/ { -1, 6, { 0, 0, "" }, "\200", 368, 0, 70, 76 },
|
||||
/* 80*/ { -1, 6, { 0, 0, "" }, "\200", 369, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 81*/ { -1, 7, { 0, 0, "" }, "1", 1755, 0, 104, 98 }, /* Version G (note 1755 multiple of 3) */
|
||||
/* 82*/ { -1, 7, { 0, 0, "" }, "1", 1756, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 83*/ { -1, 7, { 0, 0, "" }, "1", 1754, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */
|
||||
/* 84*/ { -1, 7, { 0, 0, "" }, "1", 1753, 0, 104, 98 },
|
||||
/* 85*/ { -1, 7, { 0, 0, "" }, "A", 1096, 0, 104, 98 },
|
||||
/* 86*/ { -1, 7, { 0, 0, "" }, "A", 1097, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 87*/ { -1, 7, { 0, 0, "" }, "\001", 732, 0, 104, 98 },
|
||||
/* 88*/ { -1, 7, { 0, 0, "" }, "\001", 733, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 89*/ { -1, 7, { 0, 0, "" }, "\200", 730, 0, 104, 98 },
|
||||
/* 90*/ { -1, 7, { 0, 0, "" }, "\200", 731, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 91*/ { -1, 8, { 0, 0, "" }, "1", 3550, 0, 148, 134 }, /* Version H */
|
||||
/* 92*/ { -1, 8, { 0, 0, "" }, "1", 3551, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 93*/ { -1, 8, { 0, 0, "" }, "A", 2218, 0, 148, 134 },
|
||||
/* 94*/ { -1, 8, { 0, 0, "" }, "A", 2219, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 95*/ { -1, 8, { 0, 0, "" }, "\001", 1480, 0, 148, 134 },
|
||||
/* 96*/ { -1, 8, { 0, 0, "" }, "\001", 1481, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 97*/ { -1, 8, { 0, 0, "" }, "\200", 1478, 0, 148, 134 },
|
||||
/* 98*/ { -1, 8, { 0, 0, "" }, "\200", 1479, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 99*/ { -1, 9, { 0, 0, "" }, "1", 6, 0, 8, 11 }, /* Version S-10 */
|
||||
/*100*/ { -1, 9, { 0, 0, "" }, "1", 7, 0, 8, 21 }, /* -> S-20 */
|
||||
/*101*/ { -1, 9, { 0, 0, "" }, "1", 12, 0, 8, 21 }, /* Version S-20 */
|
||||
/*102*/ { -1, 9, { 0, 0, "" }, "1", 13, 0, 8, 31 }, /* -> S-30 */
|
||||
/*103*/ { -1, 9, { 0, 0, "" }, "1", 18, 0, 8, 31 }, /* Version S-30 */
|
||||
/*104*/ { -1, 9, { 0, 0, "" }, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*105*/ { -1, 9, { 0, 0, "" }, "1", 17, 0, 8, 31 },
|
||||
/*106*/ { -1, 10, { 0, 0, "" }, "1", 22, 0, 16, 17 }, /* Version T-16 */
|
||||
/*107*/ { -1, 10, { 0, 0, "" }, "1", 23, 0, 16, 33 }, /* -> T-32 */
|
||||
/*108*/ { -1, 10, { 0, 0, "" }, "A", 13, 0, 16, 17 },
|
||||
/*109*/ { -1, 10, { 0, 0, "" }, "A", 14, 0, 16, 33 }, /* -> T-32 */
|
||||
/*110*/ { -1, 10, { 0, 0, "" }, "\001", 10, 0, 16, 17 },
|
||||
/*111*/ { -1, 10, { 0, 0, "" }, "\001", 11, 0, 16, 33 }, /* -> T-32 */
|
||||
/*112*/ { -1, 10, { 0, 0, "" }, "\200", 8, 0, 16, 17 },
|
||||
/*113*/ { -1, 10, { 0, 0, "" }, "\200", 9, 0, 16, 33 }, /* -> T-32 */
|
||||
/*114*/ { -1, 10, { 0, 0, "" }, "1", 56, 0, 16, 33 }, /* Version T-32 */
|
||||
/*115*/ { -1, 10, { 0, 0, "" }, "1", 57, 0, 16, 49 }, /* -> T-48 */
|
||||
/*116*/ { -1, 10, { 0, 0, "" }, "A", 34, 0, 16, 33 },
|
||||
/*117*/ { -1, 10, { 0, 0, "" }, "A", 35, 0, 16, 49 }, /* -> T-48 */
|
||||
/*118*/ { -1, 10, { 0, 0, "" }, "\001", 24, 0, 16, 33 },
|
||||
/*119*/ { -1, 10, { 0, 0, "" }, "\001", 25, 0, 16, 49 }, /* -> T-48 */
|
||||
/*120*/ { -1, 10, { 0, 0, "" }, "\200", 22, 0, 16, 33 },
|
||||
/*121*/ { -1, 10, { 0, 0, "" }, "\200", 23, 0, 16, 49 }, /* -> T-48 */
|
||||
/*122*/ { -1, 10, { 0, 0, "" }, "1", 90, 0, 16, 49 }, /* Version T-48 (note 90 multiple of 3) */
|
||||
/*123*/ { -1, 10, { 0, 0, "" }, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*124*/ { -1, 10, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */
|
||||
/*125*/ { -1, 10, { 0, 0, "" }, "1", 88, 0, 16, 49 },
|
||||
/*126*/ { -1, 10, { 0, 0, "" }, "A", 55, 0, 16, 49 },
|
||||
/*127*/ { -1, 10, { 0, 0, "" }, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*128*/ { -1, 10, { 0, 0, "" }, "A", 90, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*129*/ { -1, 10, { 0, 0, "" }, "\001", 38, 0, 16, 49 },
|
||||
/*130*/ { -1, 10, { 0, 0, "" }, "\001", 39, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*131*/ { -1, 10, { 0, 0, "" }, "\001", 90, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*132*/ { -1, 10, { 0, 0, "" }, "\\", 38, 0, 16, 49 },
|
||||
/*133*/ { -1, 10, { 0, 0, "" }, "\\", 39, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*134*/ { -1, 10, { 0, 0, "" }, "\200", 36, 0, 16, 49 },
|
||||
/*135*/ { -1, 10, { 0, 0, "" }, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*136*/ { 3, 10, { 0, 0, "" }, "A", 46, 0, 16, 49 }, /* Version T-48 with ECI (9 less as PAD escape char + "\123456") */
|
||||
/*137*/ { 3, 10, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/*138*/ { 3, 10, { 0, 0, "" }, "\001", 32, 0, 16, 49 },
|
||||
/*139*/ { 3, 10, { 0, 0, "" }, "\001", 33, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
@ -2927,7 +2932,7 @@ static void test_encode(int index, int generate, int debug) {
|
|||
if (!data[i].bwipp_cmp) {
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
} else {
|
||||
ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
|
||||
ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
|
||||
|
@ -2944,6 +2949,405 @@ static void test_encode(int index, int generate, int debug) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_encode_segs(int index, int generate, int debug) {
|
||||
|
||||
struct item {
|
||||
int input_mode;
|
||||
int option_2;
|
||||
struct zint_structapp structapp;
|
||||
struct zint_seg segs[3];
|
||||
int ret;
|
||||
|
||||
int expected_rows;
|
||||
int expected_width;
|
||||
int bwipp_cmp;
|
||||
char *comment;
|
||||
char *expected;
|
||||
};
|
||||
// Figure examples AIM USS Code One (USSCO) Revision March 3, 2000
|
||||
struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 16, 18, 1, "Standard example",
|
||||
"100011010111100011"
|
||||
"000110110110110111"
|
||||
"010110100010001000"
|
||||
"110110001000101001"
|
||||
"111010001111111011"
|
||||
"000010000000100000"
|
||||
"111111111111111111"
|
||||
"000000000000000000"
|
||||
"011111111111111110"
|
||||
"010000000000000010"
|
||||
"011111111111111110"
|
||||
"101101111011100110"
|
||||
"100001001111100110"
|
||||
"010110111000101011"
|
||||
"001010010011101001"
|
||||
"010100101110110001"
|
||||
},
|
||||
/* 1*/ { UNICODE_MODE, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 0 }, { TU(""), 0, 0 } }, ZINT_WARN_USES_ECI, 16, 18, 1, "Standard example auto-ECI",
|
||||
"100011010111100011"
|
||||
"000110110110110111"
|
||||
"010110100010001000"
|
||||
"110110001000101001"
|
||||
"111010001111111011"
|
||||
"000010000000100000"
|
||||
"111111111111111111"
|
||||
"000000000000000000"
|
||||
"011111111111111110"
|
||||
"010000000000000010"
|
||||
"011111111111111110"
|
||||
"101101111011100110"
|
||||
"100001001111100110"
|
||||
"010110111000101011"
|
||||
"001010010011101001"
|
||||
"010100101110110001"
|
||||
},
|
||||
/* 2*/ { UNICODE_MODE, -1, { 0, 0, "" }, { { TU("Ж"), -1, 7 }, { TU("¶"), -1, 0 }, { TU(""), 0, 0 } }, 0, 22, 22, 1, "Standard example inverted",
|
||||
"1000110101010110001000"
|
||||
"0001101101110100100010"
|
||||
"1000101110001101011000"
|
||||
"1001101011011111010010"
|
||||
"1000101000111000111000"
|
||||
"0010100101101101110001"
|
||||
"1000101000100010001101"
|
||||
"0000100000000000100000"
|
||||
"1111111111111111111111"
|
||||
"0000000000000000000000"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0001000100010001101111"
|
||||
"1010110111011111100100"
|
||||
"1100011010110110101000"
|
||||
"1111001110101001101101"
|
||||
"1011101010111001100100"
|
||||
"0010011101100011101011"
|
||||
"0011010111000001111101"
|
||||
},
|
||||
/* 3*/ { UNICODE_MODE, -1, { 0, 0, "" }, { { TU("Ж"), -1, 0 }, { TU("¶"), -1, 0 }, { TU(""), 0, 0 } }, ZINT_WARN_USES_ECI, 22, 22, 1, "Standard example inverted auto-ECI",
|
||||
"1000110101010110001000"
|
||||
"0001101101110100100010"
|
||||
"1000101110001101011000"
|
||||
"1001101011011111010010"
|
||||
"1000101000111000111000"
|
||||
"0010100101101101110001"
|
||||
"1000101000100010001101"
|
||||
"0000100000000000100000"
|
||||
"1111111111111111111111"
|
||||
"0000000000000000000000"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0001000100010001101111"
|
||||
"1010110111011111100100"
|
||||
"1100011010110110101000"
|
||||
"1111001110101001101101"
|
||||
"1011101010111001100100"
|
||||
"0010011101100011101011"
|
||||
"0011010111000001111101"
|
||||
},
|
||||
/* 4*/ { UNICODE_MODE, -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, 70, 76, 0, "AIM ITS/04-023:2022 Annex A example; BWIPP different encodation",
|
||||
"1000110101010110001000100011111010110011011010101111000111000010111011110011"
|
||||
"0001101101110100100010010110111110100101111100011011101000110101010010101010"
|
||||
"0111101111011010010111011010001100110000001000101000110001000100001101101011"
|
||||
"0000101011011101100100110010010001001000010000001011010011100011000100100001"
|
||||
"1111100000100110111110011110110100000010000011101001010001000011011100100100"
|
||||
"1100101111101000110111111110010010000100110010101010101001100011100101100001"
|
||||
"0111101011111100101010001110001011100101100010001010011110001111001011101100"
|
||||
"0000101000111101011101101010111100111101001000101011110111101001100111100011"
|
||||
"1111100011010001100110011010011001100010101111001010111110001001010110100111"
|
||||
"1011101010011111111111011110110001010000100110001010001000000000001001101000"
|
||||
"0110100110001000110110001010001000110011001100101001000100101111001011101110"
|
||||
"0101101100000001000001000010110100010010100000001001110010010101000100100110"
|
||||
"1011111010101111011011111011001010111101110010101100111100111011001101111011"
|
||||
"0100100010111101011100010010110110101010100110111010110001001110101011101100"
|
||||
"1101100011101010101010101110001011010101100010001010010101111011000011101101"
|
||||
"1011101010001101000001001110111100011101001000101000110001111101100010101000"
|
||||
"0110100000100100110011100010111100010010100001011010011100010111110100100111"
|
||||
"0010101000101100001101000010101100110001111110111011000001011110101011101110"
|
||||
"0010100110000010010000111110011101011000000101111001010000001000001000101000"
|
||||
"0111100100110110111100101110101110111100011001011011001000010011111001101000"
|
||||
"1110101100110101100110110010101011000011111110101000110010110100101110100010"
|
||||
"1111100111101001000001010010011110001000111111101001011101110000011011100101"
|
||||
"1000101000100010001000100010100010001000100010001010001000100010001000101000"
|
||||
"0001100001000100010001000110000100010001000100011000010001000100010001100001"
|
||||
"1000111000100010001000100011100010001000100010001110001000100010001000111000"
|
||||
"0001100001000100010001000110000100010001000100011000010001000100010001100001"
|
||||
"1000101000100010001000100010100010001000100010001010001000100010001000101000"
|
||||
"0001100001000100010001000110000100010001000100011000010001000100010001100001"
|
||||
"1000101000100010001000100010100010001000100010001010001000100010001000101000"
|
||||
"0001100001000100010001000110000100010001000100011000010001000100010001100001"
|
||||
"0000100000000000000000000010000000000000000000001000000000000000000000100000"
|
||||
"1111111111111111111111111111111111111111111111111111111111111111111111111111"
|
||||
"0000000000000000000000000010000000000000000000000000000000000000000000100000"
|
||||
"1111111111111111111111111111111111111111111111111111111111111111111111111111"
|
||||
"0000000000000000000000000010000000000000000000000000000000000000000000100000"
|
||||
"1111111111111111111111111111111111111111111111111111111111111111111111111111"
|
||||
"0000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"0111111111111111111111111111111111111111111111111111111111111111111111111110"
|
||||
"0100000000000000000000000000000000000000000000000000000000000000000000000010"
|
||||
"0111111111111111111111111111111111111111111111111111111111111111111111111110"
|
||||
"1000101000100010001000100010100010001000100010001010001000100010001000101000"
|
||||
"0001100001000100010001000110000100010001000100011000010001000100010001100001"
|
||||
"1000101000100010001000100010100010001000100010001010001000100010001000101000"
|
||||
"0001100001000100010001000110000100010001000100011000010001000100010001100001"
|
||||
"1000101000100010001000100010100010001000100010001010001000100010001000101000"
|
||||
"0001110001000100010001000111000100010001000100011100010001000100010001110001"
|
||||
"1000101000100010001000100010100010001000100010001010001000100010001000101000"
|
||||
"0001100001000100010001000110000100010001000100011000010001000100010001100001"
|
||||
"1000101000100010001000100010100010001000100010001010001000100010001000101000"
|
||||
"0001100001000100010001000110000100010001000100011000010001000100010001100001"
|
||||
"1000101000100010001000100010100010001000100010001010001000100010001000101000"
|
||||
"0001100001000100010001000110000100010001000100011000010001000100010001100001"
|
||||
"1000101000100010001000100010100010001000100010001010001000111001101111100110"
|
||||
"0001100001000100010001000110000100010001000100011000010001000110100010100101"
|
||||
"0101101000101000110010110110001110100100110101001000001100000010011101100010"
|
||||
"0100101100111011100101111110111100100011111000111010110101000110001000100111"
|
||||
"1011100010000010011110111110111011110111001100111000101011101100001101100001"
|
||||
"0011111101010101000010110011010000101111001101011101101100000011001101111110"
|
||||
"1001101110000000010100100110001000011000010000001001100010100101011001100000"
|
||||
"1010100110110100010001001110110010011100001101001000000010100010111111100101"
|
||||
"0001101110111011011001101110001100010010110101111000101011101001111000100000"
|
||||
"0100100011110110101101100110010110110100101011001011011000011001000111100011"
|
||||
"1010101111011001001000100110010011010011110100101010010111000101001001100110"
|
||||
"1011100010101101111110010010001011100010010101111001001111010100011111100001"
|
||||
"0110101001011011001101100110110001100100010000101011010010101001110100100110"
|
||||
"1101101000100011101100101110100110011111100111111001010100100101111101100010"
|
||||
"1100100010111011001011100010100100011110001000101011000010100011101011101111"
|
||||
"1110100101000010010101100010010111010111001110011010010101111110100000100011"
|
||||
"0110101011010011001101110110100011011101001011011001000100000001110011101110"
|
||||
"1110110001111000110010010111100110011010101100011101011011100000011001110111"
|
||||
},
|
||||
/* 5*/ { UNICODE_MODE, -1, { 0, 0, "" }, { { TU("price:$439.97"), -1, 3 }, { TU("零售价:¥3149.79"), -1, 29 }, { TU("Preis:444,90 €"), -1, 17 } }, 0, 40, 42, 1, "AIM ITS/04-023:2022 Annex A example price only",
|
||||
"100011010101011000101100100001110111110110"
|
||||
"000110110111010010001010010100010011101010"
|
||||
"011010011000110010101010001100101110100101"
|
||||
"010010011010110101111001101011110011101101"
|
||||
"100010100010011110001000110011101100101101"
|
||||
"001010001011110111101001000100111010101011"
|
||||
"101110110100111010101010101010110010101101"
|
||||
"110010101110100011011000000100111111100001"
|
||||
"010110100010001001011001011101100110100111"
|
||||
"110110001000100011001001001101101010100100"
|
||||
"001110101000110010111001001011100010101000"
|
||||
"101110111001011101111000000110110101100001"
|
||||
"100011100010001000101100100010001000111000"
|
||||
"000110000100010001001001000100010001100001"
|
||||
"100010100010001000101000100010001000101000"
|
||||
"000010000000000000001000000000000000100000"
|
||||
"111111111111111111111111111111111111111111"
|
||||
"000000000000000000000000000000000000000000"
|
||||
"011111111111111111111111111111111111111110"
|
||||
"010000000000000000000000000000000000000010"
|
||||
"011111111111111111111111111111111111111110"
|
||||
"010000000000000000000000000000000000000010"
|
||||
"011111111111111111111111111111111111111110"
|
||||
"010000000000000000000000000000000000000010"
|
||||
"011111111111111111111111111111111111111110"
|
||||
"000110000100010001001001000100010001100001"
|
||||
"100010100010001000101000100010001000101000"
|
||||
"000111000100010001001101000100010001110001"
|
||||
"100010100010001000101000100010001000101000"
|
||||
"000110000100010001001001000100010001100001"
|
||||
"100010101101011000011000010110000000101110"
|
||||
"000110111010101011001011011010010011100010"
|
||||
"100010000110000101101011111101110001100010"
|
||||
"010110010000111010111000101011000010101010"
|
||||
"111010111101001011001010101000001111100000"
|
||||
"011110101101000001001001011001010000100111"
|
||||
"110110011011111111111000000001111100101100"
|
||||
"110110001001101110101011000011000000101111"
|
||||
"100110111001001100101001010010001011100111"
|
||||
"111011100100101100101111011011100100111101"
|
||||
},
|
||||
/* 6*/ { DATA_MODE, -1, { 0, 0, "" }, { { TU("\266"), 1, 0 }, { TU("\266"), 1, 7 }, { TU("\266"), 1, 0 } }, 0, 22, 22, 1, "Standard example + extra seg, data mode",
|
||||
"1000110101111000110101"
|
||||
"0001101101101101111101"
|
||||
"1000101000100011100011"
|
||||
"0010100010100110110111"
|
||||
"0101101000100010001110"
|
||||
"1101100010001001011011"
|
||||
"0011101000100010000010"
|
||||
"0000100000000000100000"
|
||||
"1111111111111111111111"
|
||||
"0000000000000000000000"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0111000100010001100011"
|
||||
"1100010110011101101111"
|
||||
"1100000111010111101001"
|
||||
"0010000001001111101110"
|
||||
"1100100101010100100110"
|
||||
"1110101101100111101011"
|
||||
"1001101001111010111100"
|
||||
},
|
||||
/* 7*/ { UNICODE_MODE, -1, { 1, 15, "" }, { { TU("A"), -1, 3 }, { TU("B"), -1, 4 }, { TU("C"), -1, 5 } }, 0, 22, 22, 1, "Structured Append (Group mode) 1st symbol, with ECI",
|
||||
"1000111110000001010101"
|
||||
"0001101001111011011101"
|
||||
"1000101000100001000101"
|
||||
"0010100010010100101101"
|
||||
"1000101000100001000101"
|
||||
"0010100010011000111101"
|
||||
"1000101000100001000111"
|
||||
"0000100000000000100000"
|
||||
"1111111111111111111111"
|
||||
"0000000000000000000000"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0010001001110100100100"
|
||||
"0010010011001111101011"
|
||||
"1101000100011110101010"
|
||||
"0000000001000101101000"
|
||||
"1101010110111101101011"
|
||||
"0011010110111100101011"
|
||||
"1111101011110000110101"
|
||||
},
|
||||
/* 8*/ { UNICODE_MODE, -1, { 3, 15, "" }, { { TU("A"), -1, 3 }, { TU("B"), -1, 4 }, { TU("C"), -1, 5 } }, 0, 22, 22, 1, "Structured Append (Group mode) subsequent symbol, with ECI",
|
||||
"0010111110010110001000"
|
||||
"1100101001110100100010"
|
||||
"1000100100010110001000"
|
||||
"0101100010110100100010"
|
||||
"1000100100010110001000"
|
||||
"0110100011110100100010"
|
||||
"1000100100100010001100"
|
||||
"0000100000000000100000"
|
||||
"1111111111111111111111"
|
||||
"0000000000000000000000"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0111010000010001101101"
|
||||
"0001110000100010101101"
|
||||
"0101011110011000101110"
|
||||
"1111110110000110100111"
|
||||
"0100001100101001100010"
|
||||
"1111010111000111100011"
|
||||
"0010100111110110110101"
|
||||
},
|
||||
/* 9*/ { UNICODE_MODE, -1, { 128, 128, "" }, { { TU("A"), -1, 3 }, { TU("B"), -1, 4 }, { TU("C"), -1, 5 } }, 0, 22, 22, 1, "Structured Append (Extended Group mode)",
|
||||
"1000111000111001011000"
|
||||
"0000100000100111010010"
|
||||
"1000101000010001011000"
|
||||
"0010100101001011010010"
|
||||
"1000101000010001011000"
|
||||
"0010100110001111010010"
|
||||
"1000101000010010000001"
|
||||
"0000100000000000100000"
|
||||
"1111111111111111111111"
|
||||
"0000000000000000000000"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0100000000000000000010"
|
||||
"0111111111111111111110"
|
||||
"0010011101000001101001"
|
||||
"1111101010101110101001"
|
||||
"0111011000100101100010"
|
||||
"1111010000001010101101"
|
||||
"0010001100101010101111"
|
||||
"0000110101011010101000"
|
||||
"0110000110100100110110"
|
||||
},
|
||||
/* 10*/ { UNICODE_MODE, 9, { 0, 0, "" }, { { TU("A"), -1, 3 }, { TU("B"), -1, 4 }, { TU("C"), -1, 5 } }, ZINT_ERROR_INVALID_OPTION, 0, 0, 1, "Multiple segments not suppoted for Version S",
|
||||
""
|
||||
},
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, j, seg_count, ret;
|
||||
struct zint_symbol *symbol;
|
||||
|
||||
char escaped[8192];
|
||||
char bwipp_buf[32768];
|
||||
char bwipp_msg[1024];
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise
|
||||
|
||||
testStart("test_encode_segs");
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (index != -1 && i != index) continue;
|
||||
if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i);
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
testUtilSetSymbol(symbol, BARCODE_CODEONE, data[i].input_mode, -1 /*eci*/,
|
||||
-1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/,
|
||||
NULL, 0, debug);
|
||||
if (data[i].structapp.count) {
|
||||
symbol->structapp = data[i].structapp;
|
||||
}
|
||||
for (j = 0, seg_count = 0; j < 3 && data[i].segs[j].length; j++, seg_count++);
|
||||
|
||||
ret = ZBarcode_Encode_Segs(symbol, data[i].segs, seg_count);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode_Segs ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (generate) {
|
||||
char escaped1[4096];
|
||||
char escaped2[4096];
|
||||
int length = data[i].segs[0].length == -1 ? (int) ustrlen(data[i].segs[0].source) : data[i].segs[0].length;
|
||||
int length1 = data[i].segs[1].length == -1 ? (int) ustrlen(data[i].segs[1].source) : data[i].segs[1].length;
|
||||
int length2 = data[i].segs[2].length == -1 ? (int) ustrlen(data[i].segs[2].source) : data[i].segs[2].length;
|
||||
printf(" /*%3d*/ { %s, %d, { %d, %d, \"%s\" }, { { TU(\"%s\"), %d, %d }, { TU(\"%s\"), %d, %d }, { TU(\"%s\"), %d, %d } }, %s, %d, %d, %d, \"%s\",\n",
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].option_2,
|
||||
data[i].structapp.index, data[i].structapp.count, data[i].structapp.id,
|
||||
testUtilEscape((const char *) data[i].segs[0].source, length, escaped, sizeof(escaped)), data[i].segs[0].length, data[i].segs[0].eci,
|
||||
testUtilEscape((const char *) data[i].segs[1].source, length1, escaped1, sizeof(escaped1)), data[i].segs[1].length, data[i].segs[1].eci,
|
||||
testUtilEscape((const char *) data[i].segs[2].source, length2, escaped2, sizeof(escaped2)), data[i].segs[2].length, data[i].segs[2].eci,
|
||||
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
|
||||
if (ret < ZINT_ERROR) {
|
||||
testUtilModulesPrint(symbol, " ", "\n");
|
||||
} else {
|
||||
printf(" \"\"\n");
|
||||
}
|
||||
printf(" },\n");
|
||||
} else {
|
||||
if (ret < ZINT_ERROR) {
|
||||
int width, row;
|
||||
|
||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n",
|
||||
i, symbol->rows, data[i].expected_rows);
|
||||
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n",
|
||||
i, symbol->width, data[i].expected_width);
|
||||
|
||||
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
|
||||
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d\n",
|
||||
i, ret, width, row);
|
||||
|
||||
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) {
|
||||
if (!data[i].bwipp_cmp) {
|
||||
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
|
||||
} else {
|
||||
ret = testUtilBwippSegs(i, symbol, -1, data[i].option_2, -1, data[i].segs, seg_count, NULL, bwipp_buf, sizeof(bwipp_buf));
|
||||
assert_zero(ret, "i:%d %s testUtilBwippSegs ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
|
||||
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_fuzz(int index, int debug) {
|
||||
|
||||
struct item {
|
||||
|
@ -2990,6 +3394,7 @@ int main(int argc, char *argv[]) {
|
|||
{ "test_large", test_large, 1, 0, 1 },
|
||||
{ "test_input", test_input, 1, 0, 1 },
|
||||
{ "test_encode", test_encode, 1, 1, 1 },
|
||||
{ "test_encode_segs", test_encode_segs, 1, 1, 1 },
|
||||
{ "test_fuzz", test_fuzz, 1, 0, 1 },
|
||||
};
|
||||
|
||||
|
@ -2999,3 +3404,5 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue