1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-01-31 07:45:58 +00:00

GS1SE: exclude GS1_128 from requisite AIs check as may be spread

across multiple barcodes (ticket #348, props Harald Oehlmann and Terry Burton)
This commit is contained in:
gitlost
2026-01-30 12:09:13 +00:00
parent 1ba5ba41fb
commit cf5ef9ec20
3 changed files with 80 additions and 59 deletions

View File

@@ -1,4 +1,4 @@
Version 2.16.0.9 (dev) not released yet (2025-01-21) Version 2.16.0.9 (dev) not released yet (2025-01-30)
==================================================== ====================================================
**Incompatible changes** **Incompatible changes**
@@ -14,6 +14,8 @@ Changes
creating temporary file creating temporary file
- CLI: allow "tiff" as filetype (saved as ".tif"); - CLI: allow "tiff" as filetype (saved as ".tif");
add `ZINT_TEST`-only "--test" option to do various internal tests add `ZINT_TEST`-only "--test" option to do various internal tests
- GS1SE: exclude GS1_128 from requisite AIs check as may be spread across more
than one barcode (ticket #348, props Harald Oehlmann and Terry Burton)
Bugs Bugs
---- ----

View File

@@ -1,7 +1,7 @@
/* gs1.c - Verifies GS1 data */ /* gs1.c - Verifies GS1 data */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2009-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -1713,6 +1713,15 @@ static int gs1se_verify(struct zint_symbol *symbol, const unsigned char source[]
? ZINT_ERROR_MEMORY : ZINT_ERROR_ENCODING_PROBLEM; ? ZINT_ERROR_MEMORY : ZINT_ERROR_ENCODING_PROBLEM;
return z_errtxtf(error_number, symbol, 266, "GS1 Syntax Engine: %s", opts.msgBuf); return z_errtxtf(error_number, symbol, 266, "GS1 Syntax Engine: %s", opts.msgBuf);
} }
/* Do not check for required checks for GS1-128 as may be spread across multiple barcodes - ticket #348
and https://github.com/gs1/gs1-syntax-dictionary/issues/24 */
if (symbol->symbology == BARCODE_GS1_128) {
if (!gs1_encoder_setValidationEnabled(ctx, gs1_encoder_vREQUISITE_AIS, false)) {
const char *errmsg = gs1_encoder_getErrMsg(ctx);
return z_errtxtf(ZINT_ERROR_ENCODING_PROBLEM, symbol, 0, "Internal error using GS1SE: %.80s",
errmsg ? errmsg : "unknown");
}
}
if (is_digital_link) { if (is_digital_link) {
gs1se_ret = gs1_encoder_setDataStr(ctx, ZCCP(local_source2)); gs1se_ret = gs1_encoder_setDataStr(ctx, ZCCP(local_source2));

View File

@@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2025 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2025-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -456,6 +456,7 @@ static void test_gs1_verify(const testCtx *const p_ctx) {
int debug = p_ctx->debug; int debug = p_ctx->debug;
struct item { struct item {
int symbology;
int input_mode; int input_mode;
const char *data; const char *data;
int ret; int ret;
@@ -464,59 +465,68 @@ static void test_gs1_verify(const testCtx *const p_ctx) {
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = { static const struct item data[] = {
/* 0*/ { -1, "", ZINT_ERROR_INVALID_DATA, "", "264: Data does not start with an AI" }, /* 0*/ { BARCODE_GS1_128, -1, "", ZINT_ERROR_INVALID_DATA, "", "264: Data does not start with an AI" },
/* 1*/ { -1, "A", ZINT_ERROR_INVALID_DATA, "", "264: Data does not start with an AI" }, /* 1*/ { BARCODE_GS1_128, -1, "A", ZINT_ERROR_INVALID_DATA, "", "264: Data does not start with an AI" },
/* 2*/ { -1, "[", ZINT_ERROR_INVALID_DATA, "", "268: Failed to parse AI data" }, /* 2*/ { BARCODE_GS1_128, -1, "[", ZINT_ERROR_INVALID_DATA, "", "268: Failed to parse AI data" },
/* 3*/ { -1, "[]12", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: " }, /* 3*/ { BARCODE_GS1_128, -1, "[]12", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: " },
/* 4*/ { -1, "[1]12", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: 1" }, /* 4*/ { BARCODE_GS1_128, -1, "[1]12", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: 1" },
/* 5*/ { -1, "[242]123456[1]12", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: 1" }, /* 5*/ { BARCODE_GS1_128, -1, "[242]123456[1]12", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: 1" },
/* 6*/ { -1, "[12345]12", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: 12345" }, /* 6*/ { BARCODE_GS1_128, -1, "[12345]12", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: 12345" },
/* 7*/ { -1, "[9999]1234", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: 9999" }, /* 7*/ { BARCODE_GS1_128, -1, "[9999]1234", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: 9999" },
/* 8*/ { -1, "[[01]]1234", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: (01" }, /* 8*/ { BARCODE_GS1_128, -1, "[[01]]1234", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: (01" },
/* 9*/ { GS1PARENS_MODE, "((01))1234", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: (01" }, /* 9*/ { BARCODE_GS1_128, GS1PARENS_MODE, "((01))1234", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: (01" },
/* 10*/ { -1, "[1A]12", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: 1A" }, /* 10*/ { BARCODE_GS1_128, -1, "[1A]12", ZINT_ERROR_INVALID_DATA, "", "268: Unrecognised AI: 1A" },
/* 11*/ { -1, "[10]", ZINT_ERROR_INVALID_DATA, "", "268: Failed to parse AI data" }, /* 11*/ { BARCODE_GS1_128, -1, "[10]", ZINT_ERROR_INVALID_DATA, "", "268: Failed to parse AI data" },
/* 12*/ { -1, "[90]\012", ZINT_ERROR_INVALID_DATA, "", "267: AI (90): A non-CSET 82 character was found where a CSET 82 character is expected. (90)|\\x0A|" }, /* 12*/ { BARCODE_GS1_128, -1, "[90]\012", ZINT_ERROR_INVALID_DATA, "", "267: AI (90): A non-CSET 82 character was found where a CSET 82 character is expected. (90)|\\x0A|" },
/* 13*/ { -1, "[00]123456789012345678", ZINT_ERROR_INVALID_DATA, "", "267: AI (00): The numeric check digit is incorrect. (00)12345678901234567|8|" }, /* 13*/ { BARCODE_GS1_128, -1, "[00]123456789012345678", ZINT_ERROR_INVALID_DATA, "", "267: AI (00): The numeric check digit is incorrect. (00)12345678901234567|8|" },
/* 14*/ { -1, "[00]123456789012345675", 0, "00123456789012345675", "" }, /* 14*/ { BARCODE_GS1_128, -1, "[00]123456789012345675", 0, "00123456789012345675", "" },
/* 15*/ { GS1PARENS_MODE, "(00)123456789012345675", 0, "00123456789012345675", "" }, /* 15*/ { BARCODE_GS1_128, GS1PARENS_MODE, "(00)123456789012345675", 0, "00123456789012345675", "" },
/* 16*/ { -1, "[00]12345678901234567", ZINT_ERROR_INVALID_DATA, "", "268: AI (00) value is too short" }, /* 16*/ { BARCODE_GS1_128, -1, "[00]12345678901234567", ZINT_ERROR_INVALID_DATA, "", "268: AI (00) value is too short" },
/* 17*/ { -1, "[00]1234567890123456789", ZINT_ERROR_INVALID_DATA, "", "268: AI (00) value is too long" }, /* 17*/ { BARCODE_GS1_128, -1, "[00]1234567890123456789", ZINT_ERROR_INVALID_DATA, "", "268: AI (00) value is too long" },
/* 18*/ { -1, "[3910]123123456789012345", ZINT_ERROR_INVALID_DATA, "", "267: AI (3910): A valid ISO 4217 three-digit currency code is required. (3910)|123|" }, /* 18*/ { BARCODE_GS1_128, -1, "[3910]123123456789012345", ZINT_ERROR_INVALID_DATA, "", "267: AI (3910): A valid ISO 4217 three-digit currency code is required. (3910)|123|" },
/* 19*/ { -1, "[3910]997123456789012345", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (3910) are not satisfied: 8020" }, /* 19*/ { BARCODE_GS1_128, -1, "[3910]997123456789012345", 0, "3910997123456789012345", "" },
/* 20*/ { -1, "[3910]997123456789012345[8020]REF123", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (8020) are not satisfied: 415" }, /* 20*/ { BARCODE_DBAR_EXP, -1, "[3910]997123456789012345", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (3910) are not satisfied: 8020" },
/* 21*/ { -1, "[3910]997123456789012345[8020]REF123[415]1234567890123", ZINT_ERROR_INVALID_DATA, "", "267: AI (415): The numeric check digit is incorrect. (415)123456789012|3|" }, /* 21*/ { BARCODE_GS1_128, -1, "[3910]997123456789012345[8020]REF123", 0, "3910997123456789012345\0358020REF123", "" },
/* 22*/ { -1, "[3910]997123456789012345[8020]REF123[415]1234567890128", 0, "3910997123456789012345\0358020REF123\0354151234567890128", "" }, /* 22*/ { BARCODE_DBAR_EXP, -1, "[3910]997123456789012345[8020]REF123", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (8020) are not satisfied: 415" },
/* 23*/ { GS1PARENS_MODE, "(3910)997123456789012345(8020)REF123(415)1234567890128", 0, "3910997123456789012345\0358020REF123\0354151234567890128", "" }, /* 23*/ { BARCODE_GS1_128, -1, "[3910]997123456789012345[8020]REF123[415]1234567890123", ZINT_ERROR_INVALID_DATA, "", "267: AI (415): The numeric check digit is incorrect. (415)123456789012|3|" },
/* 24*/ { -1, "[402]13131313131313132", ZINT_ERROR_INVALID_DATA, "", "267: AI (402): The numeric check digit is incorrect. (402)1313131313131313|2|" }, /* 24*/ { BARCODE_GS1_128, -1, "[3910]997123456789012345[8020]REF123[415]1234567890128", 0, "3910997123456789012345\0358020REF123\0354151234567890128", "" },
/* 25*/ { -1, "[402]13131313131313130", 0, "40213131313131313130", "" }, /* 25*/ { BARCODE_GS1_128, GS1PARENS_MODE, "(3910)997123456789012345(8020)REF123(415)1234567890128", 0, "3910997123456789012345\0358020REF123\0354151234567890128", "" },
/* 26*/ { -1, "[4309]1234567890123456789A", ZINT_ERROR_INVALID_DATA, "", "267: AI (4309): A non-digit character was found where a digit is expected. (4309)1234567890123456789|A|" }, /* 26*/ { BARCODE_GS1_128, -1, "[402]13131313131313132", ZINT_ERROR_INVALID_DATA, "", "267: AI (402): The numeric check digit is incorrect. (402)1313131313131313|2|" },
/* 27*/ { -1, "[7006]200132", ZINT_ERROR_INVALID_DATA, "", "267: AI (7006): The date contains an illegal day of the month. (7006)2001|32|" }, /* 27*/ { BARCODE_GS1_128, -1, "[402]13131313131313130", 0, "40213131313131313130", "" },
/* 28*/ { -1, "[7006]200131", ZINT_ERROR_INVALID_DATA, "7006200131", "268: Required AIs for AI (7006) are not satisfied: 01,02" }, /* 28*/ { BARCODE_GS1_128, -1, "[4309]1234567890123456789A", ZINT_ERROR_INVALID_DATA, "", "267: AI (4309): A non-digit character was found where a digit is expected. (4309)1234567890123456789|A|" },
/* 29*/ { -1, "[7006]200131[01]12345678901231", 0, "7006200131\0350112345678901231", "" }, /* 29*/ { BARCODE_GS1_128, -1, "[7006]200132", ZINT_ERROR_INVALID_DATA, "", "267: AI (7006): The date contains an illegal day of the month. (7006)2001|32|" },
/* 30*/ { -1, "[8001]12345678901234", ZINT_ERROR_INVALID_DATA, "", "267: AI (8001): The winding direction must be either \"0\", \"1\" or \"9\". (8001)123456789012|3|" }, /* 30*/ { BARCODE_GS1_128, -1, "[7006]200131", 0, "7006200131", "" },
/* 31*/ { -1, "[8001]12345678901294", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (8001) are not satisfied: 01" }, /* 31*/ { BARCODE_AZTEC, GS1_MODE, "[7006]200131", ZINT_ERROR_INVALID_DATA, "7006200131", "268: Required AIs for AI (7006) are not satisfied: 01,02" },
/* 32*/ { -1, "[8001]12345678901294[01]12345678901231", 0, "800112345678901294\0350112345678901231", "" }, /* 32*/ { BARCODE_GS1_128, -1, "[7006]200131[01]12345678901231", 0, "7006200131\0350112345678901231", "" },
/* 33*/ { -1, "[8004]abcdefghijklmnopqrstuvwxyz1234", ZINT_ERROR_INVALID_DATA, "", "267: AI (8004): The GS1 Company Prefix is invalid. (8004)|a|bcdefghijklmnopqrstuvwxyz1234" }, /* 33*/ { BARCODE_GS1_128, -1, "[8001]12345678901234", ZINT_ERROR_INVALID_DATA, "", "267: AI (8001): The winding direction must be either \"0\", \"1\" or \"9\". (8001)123456789012|3|" },
/* 34*/ { -1, "[8004]123", ZINT_ERROR_INVALID_DATA, "", "267: AI (8004): The component is shorter than the minimum length GS1 Company Prefix. (8004)|123|" }, /* 34*/ { BARCODE_GS1_128, -1, "[8001]12345678901294", 0, "800112345678901294", "" },
/* 35*/ { -1, "[8004]1234efghijklmnopqrstuvwxyz1234", 0, "80041234efghijklmnopqrstuvwxyz1234", "" }, /* 35*/ { BARCODE_QRCODE, GS1_MODE, "[8001]12345678901294", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (8001) are not satisfied: 01" },
/* 36*/ { -1, "[8007]abcdefghijklmnopqrstuvwxyz12345678", ZINT_ERROR_INVALID_DATA, "", "267: AI (8007): The IBAN must start with a valid ISO 3166 two-character country code. (8007)|ab|cdefghijklmnopqrstuvwxyz12345678" }, /* 36*/ { BARCODE_GS1_128, -1, "[8001]12345678901294[01]12345678901231", 0, "800112345678901294\0350112345678901231", "" },
/* 37*/ { -1, "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (8007) are not satisfied: 415" }, /* 37*/ { BARCODE_GS1_128, -1, "[8004]abcdefghijklmnopqrstuvwxyz1234", ZINT_ERROR_INVALID_DATA, "", "267: AI (8004): The GS1 Company Prefix is invalid. (8004)|a|bcdefghijklmnopqrstuvwxyz1234" },
/* 38*/ { -1, "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678[415]1234567890128", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (415) are not satisfied: 8020" }, /* 38*/ { BARCODE_GS1_128, -1, "[8004]123", ZINT_ERROR_INVALID_DATA, "", "267: AI (8004): The component is shorter than the minimum length GS1 Company Prefix. (8004)|123|" },
/* 39*/ { -1, "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678[415]1234567890128[8020]REF123", 0, "8007AD95EFGHIJKLMNOPQRSTUVWXYZ12345678\03541512345678901288020REF123", "" }, /* 39*/ { BARCODE_GS1_128, -1, "[8004]1234efghijklmnopqrstuvwxyz1234", 0, "80041234efghijklmnopqrstuvwxyz1234", "" },
/* 40*/ { -1, "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXY^", ZINT_ERROR_INVALID_DATA, "", "268: AI (8030) contains illegal ^ character" }, /* 40*/ { BARCODE_GS1_128, -1, "[8007]abcdefghijklmnopqrstuvwxyz12345678", ZINT_ERROR_INVALID_DATA, "", "267: AI (8007): The IBAN must start with a valid ISO 3166 two-character country code. (8007)|ab|cdefghijklmnopqrstuvwxyz12345678" },
/* 41*/ { -1, "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (8030) are not satisfied: 00,01+21,253,255,8003,8004,8006+21,8010+8011,8017,8018" }, /* 41*/ { BARCODE_GS1_128, -1, "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678", 0, "8007AD95EFGHIJKLMNOPQRSTUVWXYZ12345678", "" },
/* 42*/ { -1, "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ[8018]123456789012345675", 0, "8030-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ\0358018123456789012345675", "" }, /* 42*/ { BARCODE_DATAMATRIX, GS1_MODE, "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (8007) are not satisfied: 415" },
/* 43*/ { -1, "[01]12345678901234[7006]200101", ZINT_ERROR_INVALID_DATA, "", "267: AI (01): The numeric check digit is incorrect. (01)1234567890123|4|" }, /* 43*/ { BARCODE_GS1_128, -1, "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678[415]1234567890128", 0, "8007AD95EFGHIJKLMNOPQRSTUVWXYZ12345678\0354151234567890128", "" },
/* 44*/ { -1, "[01]12345678901231[7006]200101", 0, "01123456789012317006200101", "" }, /* 44*/ { BARCODE_PDF417, GS1_MODE, "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678[415]1234567890128", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (415) are not satisfied: 8020" },
/* 45*/ { -1, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (3901) are not satisfied: 255,8020" }, /* 45*/ { BARCODE_GS1_128, -1, "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678[415]1234567890128[8020]REF123", 0, "8007AD95EFGHIJKLMNOPQRSTUVWXYZ12345678\03541512345678901288020REF123", "" },
/* 46*/ { -1, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12[255]1234567890128", ZINT_ERROR_INVALID_DATA, "", "268: It is invalid to pair AI (01) with AI (255)" }, /* 46*/ { BARCODE_GS1_128, -1, "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXY^", ZINT_ERROR_INVALID_DATA, "", "268: AI (8030) contains illegal ^ character" },
/* 47*/ { -1, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12[8020]REF123", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (8020) are not satisfied: 415" }, /* 47*/ { BARCODE_GS1_128, -1, "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, "8030-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ", "" },
/* 48*/ { -1, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12[8020]REF123[415]1234567890128", 0, "25312345678901284\0350112345678901231390112345678901234\03520128020REF123\0354151234567890128", "" }, /* 48*/ { BARCODE_DBAR_EXP, -1, "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (8030) are not satisfied: 00,01+21,253,255,8003,8004,8006+21,8010+8011,8017,8018" },
/* 49*/ { -1, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12[8020]REF123[415]1234567890128[90]123", 0, "25312345678901284\0350112345678901231390112345678901234\03520128020REF123\035415123456789012890123", "" }, /* 49*/ { BARCODE_GS1_128, -1, "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ[8018]123456789012345675", 0, "8030-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ\0358018123456789012345675", "" },
/* 50*/ { -1, "[8001]12345678901294[01]12345678901231|[8012]VER1", 0, "800112345678901294\0350112345678901231|8012VER1", "" }, /* Composite */ /* 50*/ { BARCODE_GS1_128, -1, "[01]12345678901234[7006]200101", ZINT_ERROR_INVALID_DATA, "", "267: AI (01): The numeric check digit is incorrect. (01)1234567890123|4|" },
/* 51*/ { -1, "[8001]12345678901294[01]12345678901231[415]1234567890128|[8020]ABCDEFGHIJKLMNOPQRSTUVXWY", 0, "800112345678901294\03501123456789012314151234567890128|8020ABCDEFGHIJKLMNOPQRSTUVXWY", "" }, /* 51*/ { BARCODE_GS1_128, -1, "[01]12345678901231[7006]200101", 0, "01123456789012317006200101", "" },
/* 52*/ { -1, "[8001]12345678901294[01]12345678901231|[415]1234567890128[8020]ABCDEFGHIJKLMNOPQRSTUVXWY", 0, "800112345678901294\0350112345678901231|41512345678901288020ABCDEFGHIJKLMNOPQRSTUVXWY", "" }, /* 52*/ { BARCODE_GS1_128, -1, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12", 0, "25312345678901284\0350112345678901231390112345678901234\0352012", "" },
/* 53*/ { BARCODE_AZTEC, GS1_MODE, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (3901) are not satisfied: 255,8020" },
/* 54*/ { BARCODE_GS1_128, -1, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12[255]1234567890128", ZINT_ERROR_INVALID_DATA, "", "268: It is invalid to pair AI (01) with AI (255)" },
/* 55*/ { BARCODE_GS1_128, -1, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12[8020]REF123", 0, "25312345678901284\0350112345678901231390112345678901234\03520128020REF123", "" },
/* 56*/ { BARCODE_DATAMATRIX, GS1_MODE, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12[8020]REF123", ZINT_ERROR_INVALID_DATA, "", "268: Required AIs for AI (8020) are not satisfied: 415" },
/* 57*/ { BARCODE_GS1_128, -1, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12[8020]REF123[415]1234567890128", 0, "25312345678901284\0350112345678901231390112345678901234\03520128020REF123\0354151234567890128", "" },
/* 58*/ { BARCODE_GS1_128, -1, "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12[8020]REF123[415]1234567890128[90]123", 0, "25312345678901284\0350112345678901231390112345678901234\03520128020REF123\035415123456789012890123", "" },
/* 59*/ { BARCODE_GS1_128, -1, "[8001]12345678901294[01]12345678901231|[8012]VER1", 0, "800112345678901294\0350112345678901231|8012VER1", "" }, /* Composite */
/* 60*/ { BARCODE_GS1_128, -1, "[8001]12345678901294[01]12345678901231[415]1234567890128|[8020]ABCDEFGHIJKLMNOPQRSTUVXWY", 0, "800112345678901294\03501123456789012314151234567890128|8020ABCDEFGHIJKLMNOPQRSTUVXWY", "" },
/* 61*/ { BARCODE_GS1_128, -1, "[8001]12345678901294[01]12345678901231|[415]1234567890128[8020]ABCDEFGHIJKLMNOPQRSTUVXWY", 0, "800112345678901294\0350112345678901231|41512345678901288020ABCDEFGHIJKLMNOPQRSTUVXWY", "" },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
@@ -536,7 +546,7 @@ static void test_gs1_verify(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, BARCODE_GS1_128, data[i].input_mode, -1 /*eci*/, length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/, -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, -1, debug); data[i].data, -1, debug);
symbol->input_mode |= GS1SYNTAXENGINE_MODE; symbol->input_mode |= GS1SYNTAXENGINE_MODE;
@@ -544,8 +554,8 @@ static void test_gs1_verify(const testCtx *const p_ctx) {
ret = zint_gs1_verify(symbol, ZUCP(data[i].data), length, ZUCP(reduced), &reduced_length); ret = zint_gs1_verify(symbol, ZUCP(data[i].data), length, ZUCP(reduced), &reduced_length);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, \"%s\", %s, \"%s\", \"%s\" },\n", printf(" /*%3d*/ { %s, %s, \"%s\", %s, \"%s\", \"%s\" },\n",
i, testUtilInputModeName(data[i].input_mode), i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(ret), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(ret),
data[i].expected, symbol->errtxt); data[i].expected, symbol->errtxt);
} else { } else {