mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-25 20:44:29 -04:00
CODEONE/ULTRA overrun fixes; TELEPEN fixes; CODEONE/LOGMARS/VIN/CODABAR options; GUI updates; tests
This commit is contained in:
parent
8131471573
commit
6242e02638
80 changed files with 6393 additions and 2179 deletions
|
@ -100,7 +100,7 @@ static void test_binary_div_modulo_divisor(int index, int generate, int debug) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
// Replicate examples from GS1 General Specifications 19.1 and ISO/IEC 24724:2011
|
||||
// Replicate examples from GS1 General Specifications 20.0 and ISO/IEC 24724:2011
|
||||
static void test_examples(int index, int generate, int debug) {
|
||||
|
||||
testStart("");
|
||||
|
@ -108,6 +108,7 @@ static void test_examples(int index, int generate, int debug) {
|
|||
int ret;
|
||||
struct item {
|
||||
int symbology;
|
||||
int option_2;
|
||||
unsigned char *data;
|
||||
int ret;
|
||||
|
||||
|
@ -116,79 +117,102 @@ static void test_examples(int index, int generate, int debug) {
|
|||
char *comment;
|
||||
unsigned char *expected;
|
||||
};
|
||||
// Verified manually against GS1 General Specifications 19.1 and ISO/IEC 24724:2011
|
||||
// Verified manually against GS1 General Specifications 20.0 and ISO/IEC 24724:2011
|
||||
struct item data[] = {
|
||||
/* 0*/ { BARCODE_RSS14, "0950110153001", 0, 1, 96, "Figure 5.5.2.1.1-1. GS1 DataBar Omnidirectional",
|
||||
/* 0*/ { BARCODE_RSS14, -1, "0950110153001", 0, 1, 96, "Figure 5.5.2.1.1-1. GS1 DataBar Omnidirectional",
|
||||
"010000010100000101000111110000010111101101011100100011011101000101100000000111001110110111001101"
|
||||
},
|
||||
/* 1*/ { BARCODE_RSS_EXP, "[01]90614141000015[3202]000150", 0, 1, 151, "Figure 5.5.2.3.1-1. GS1 DataBar Expanded",
|
||||
/* 1*/ { BARCODE_RSS_EXP, -1, "[01]90614141000015[3202]000150", 0, 1, 151, "Figure 5.5.2.3.1-1. GS1 DataBar Expanded",
|
||||
"0101100011001100001011111111000010100100010000111101110011100010100010111100000011100111010111111011010100000100000110001111110000101000000100011010010"
|
||||
},
|
||||
/* 2*/ { BARCODE_RSS_EXPSTACK, "[01]90614141000015[3202]000150", 0, 5, 102, "Figure 5.5.2.3.2-1. GS1 DataBar Expanded Stacked",
|
||||
/* 2*/ { BARCODE_RSS_EXPSTACK, -1, "[01]90614141000015[3202]000150", 0, 5, 102, "Figure 5.5.2.3.2-1. GS1 DataBar Expanded Stacked",
|
||||
"010110001100110000101111111100001010010001000011110111001110001010001011110000001110011101011111101101"
|
||||
"000001110011001111010000000010100101101110111100001000110001110101100100001010100001100010100000010000"
|
||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||
"000001011111011111001010000001010010111111011100100000000000000000000000000000000000000000000000000000"
|
||||
"001010100000100000110001111110000101000000100011010010000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
/* 3*/ { BARCODE_RSS14, "2001234567890", 0, 1, 96, "24724:2011 Figure 1 — GS1 DataBar Omnidirectional",
|
||||
/* 3*/ { BARCODE_RSS14, -1, "2001234567890", 0, 1, 96, "24724:2011 Figure 1 — GS1 DataBar Omnidirectional",
|
||||
"010100011101000001001111111000010100110110111110110000010010100101100000000111000110110110001101"
|
||||
},
|
||||
/* 4*/ { BARCODE_RSS14, "0441234567890", 0, 1, 96, "24724:2011 Figure 2 — GS1 DataBar Omnidirectional",
|
||||
/* 4*/ { BARCODE_RSS14, -1, "0441234567890", 0, 1, 96, "24724:2011 Figure 2 — GS1 DataBar Omnidirectional",
|
||||
"010010001000010001000111000000010101000001100110101100100100000101111110000011000010100011100101"
|
||||
},
|
||||
/* 5*/ { BARCODE_RSS14, "0001234567890", 0, 1, 96, "24724:2011 Figure 4 — GS1 DataBar Truncated",
|
||||
/* 5*/ { BARCODE_RSS14, -1, "0001234567890", 0, 1, 96, "24724:2011 Figure 4 — GS1 DataBar Truncated",
|
||||
"010101001000000001001111111000010111001011011110111001010110000101111111000111001100111101110101"
|
||||
},
|
||||
/* 6*/ { BARCODE_RSS14STACK, "0001234567890", 0, 3, 50, "24724:2011 Figure 5 — GS1 DataBar Stacked",
|
||||
/* 6*/ { BARCODE_RSS14STACK, -1, "0001234567890", 0, 3, 50, "24724:2011 Figure 5 — GS1 DataBar Stacked",
|
||||
"01010100100000000100111111100001011100101101111010"
|
||||
"00001010101011111010000000111010100011010010000000"
|
||||
"10111001010110000101111111000111001100111101110101"
|
||||
},
|
||||
/* 7*/ { BARCODE_RSS14STACK_OMNI, "0003456789012", 0, 5, 50, "24724:2011 Figure 6 — GS1 DataBar Stacked Omnidirectional",
|
||||
/* 7*/ { BARCODE_RSS14STACK_OMNI, -1, "0003456789012", 0, 5, 50, "24724:2011 Figure 6 — GS1 DataBar Stacked Omnidirectional",
|
||||
"01010100100000000100111110000001010011100110011010"
|
||||
"00001011011111111010000001010100101100011001100000"
|
||||
"00000101010101010101010101010101010101010101010000"
|
||||
"00001000100010111010010101010000111101001101110000"
|
||||
"10110111011101000101100000000111000010110010001101"
|
||||
},
|
||||
/* 8*/ { BARCODE_RSS_LTD, "1501234567890", 0, 1, 74, "24724:2011 Figure 7 — GS1 DataBar Limited",
|
||||
/* 8*/ { BARCODE_RSS_LTD, -1, "1501234567890", 0, 1, 74, "24724:2011 Figure 7 — GS1 DataBar Limited",
|
||||
"01000110011000110110101001110100101011010011010010010110001101110011001101"
|
||||
},
|
||||
/* 9*/ { BARCODE_RSS_LTD, "0031234567890", 0, 1, 74, "24724:2011 Figure 8 — (a) GS1 DataBar Limited",
|
||||
/* 9*/ { BARCODE_RSS_LTD, -1, "0031234567890", 0, 1, 74, "24724:2011 Figure 8 — (a) GS1 DataBar Limited",
|
||||
"01010100000100100010000101110010101101101001010110000010100100101100000101"
|
||||
},
|
||||
/*10*/ { BARCODE_RSS_EXP, "[01]98898765432106[3202]012345[15]991231", 0, 1, 200, "24724:2011 Figure 10 — GS1 DataBar Expanded",
|
||||
/*10*/ { BARCODE_RSS_EXP, -1, "[01]98898765432106[3202]012345[15]991231", 0, 1, 200, "24724:2011 Figure 10 — GS1 DataBar Expanded",
|
||||
"01001000011000110110111111110000101110000110010100011010000001100010101111110000111010011100000010010100111110111001100011111100001011101100000100100100011110010110001011111111001110001101111010000101"
|
||||
},
|
||||
/*11*/ { BARCODE_RSS_EXP, "[01]90012345678908[3103]001750", 0, 1, 151, "24724:2011 Figure 11 — GS1 DataBar Expanded",
|
||||
/*11*/ { BARCODE_RSS_EXP, -1, "[01]90012345678908[3103]001750", 0, 1, 151, "24724:2011 Figure 11 — GS1 DataBar Expanded",
|
||||
"0101110010000010011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110101111000110001111110000101011000010011111010"
|
||||
},
|
||||
/*12*/ { BARCODE_RSS_EXPSTACK, "[01]98898765432106[3202]012345[15]991231", 0, 5, 102, "24724:2011 Figure 12 — GS1 DataBar Expanded Stacked symbol",
|
||||
/*12*/ { BARCODE_RSS_EXPSTACK, -1, "[01]98898765432106[3202]012345[15]991231", 0, 5, 102, "24724:2011 Figure 12 — GS1 DataBar Expanded Stacked symbol",
|
||||
"010010000110001101101111111100001011100001100101000110100000011000101011111100001110100111000000100101"
|
||||
"000001111001110010010000000010100100011110011010111001011111100111010100000010100001011000111111010000"
|
||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||
"000011101000010011100001000000001011100101100001110110110111110010001001010000001010011000100000110000"
|
||||
"101000010111101100011100111111110100011010011110001001001000001101110100001111110001100111011111001010"
|
||||
},
|
||||
/*13*/ { BARCODE_RSS_EXPSTACK, "[01]95012345678903[3103]000123", 0, 5, 102, "24724:2011 Figure 13 — GS1 DataBar Expanded Stacked",
|
||||
/*13*/ { BARCODE_RSS_EXPSTACK, -1, "[01]95012345678903[3103]000123", 0, 5, 102, "24724:2011 Figure 13 — GS1 DataBar Expanded Stacked",
|
||||
"010100010001111000101111111100001010111000001100010111000110001001101011110000001110010111000111011101"
|
||||
"000011101110000111010000000010100101000111110011101000111001110110010100001010100001101000111000100000"
|
||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||
"000000001010000111001010000001010010111011011111100000000000000000000000000000000000000000000000000000"
|
||||
"001011110101111000110001111110000101000100100000011010000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
/*14*/ { BARCODE_RSS_LTD, "0009876543210", 0, 1, 74, "24724:2011 Figure F.2 — GS1 DataBar Limited",
|
||||
/*14*/ { BARCODE_RSS_LTD, -1, "0009876543210", 0, 1, 74, "24724:2011 Figure F.2 — GS1 DataBar Limited",
|
||||
"01010100100100110000110000010101101001011001010001000101000100000100100101"
|
||||
},
|
||||
/*15*/ { BARCODE_RSS_EXP, "[10]12A", 0, 1, 102, "24724:2011 Figure F.3 — GS1 DataBar Expanded",
|
||||
/*15*/ { BARCODE_RSS_EXP, -1, "[10]12A", 0, 1, 102, "24724:2011 Figure F.3 — GS1 DataBar Expanded",
|
||||
"010100000110100000101111111100001010001000000010110101111100100111001011110000000010011101111111010101"
|
||||
},
|
||||
/*16*/ { BARCODE_RSS14STACK, "0000000000000", 0, 3, 50, "#183 GS1 DataBar Stacked separator alternation; verified manually against tec-it.com (bwipp differs)",
|
||||
/*16*/ { BARCODE_RSS14STACK, -1, "0000000000000", 0, 3, 50, "#183 GS1 DataBar Stacked separator alternation; verified manually against tec-it.com (bwipp differs)",
|
||||
"01010100100000000100011111111001011111110010101010"
|
||||
"00000101011111111010100000001010100000001101010000"
|
||||
"10101010110000000101111111110111011111111011010101"
|
||||
},
|
||||
/*17*/ { BARCODE_RSS_EXP, -1, "[255]95011015340010123456789", 0, 1, 232, "2.6.2.1 Example 1",
|
||||
"0100011000110001011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011110000001010"
|
||||
},
|
||||
/*18*/ { BARCODE_RSS_EXP, -1, "[255]95011015340010123456789[3900]000", 0, 1, 298, "2.6.2.1 Example 2",
|
||||
"0101100011111010001011111111000010100001000001001101100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011000000001010111111011101000100001000110001101011111111100110011110010010001101"
|
||||
},
|
||||
/*19*/ { BARCODE_RSS_EXP, -1, "[255]9501101534001[17]160531[3902]050", 0, 1, 281, "2.6.2.1 Example 3",
|
||||
"01011001000110011110111111110000101000000101011000011000011001110010101111100000011001000011101000010010000110111110100011111100001010010111111001110111000010010100001011111111001110000100001100110100010000001101001000110000000010111010011110011101110010110001100010111111111001101"
|
||||
},
|
||||
/*20*/ { BARCODE_RSS_EXPSTACK, 3, "[255]9501101534001012345[8111]0500", 0, 5, 151, "2.6.2.1 Example 4 **NOT SAME** separator bar differs TODO: investigate",
|
||||
"0101100111100011001011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010"
|
||||
"0000011000011100110100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000"
|
||||
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||
"0000110111000011010010000000010000100000100111011001100001100100010010100101010100101110110001111001011101100011101100100000000010000000000000000000000"
|
||||
"1011001000111100100101111111100111011111011000100110011110011011101100011000000001010001001110000110100010011100010001011111111100110100000000000000000"
|
||||
},
|
||||
/*21*/ { BARCODE_RSS_EXPSTACK, 3, "[255]9501101534001[3941]0035", 0, 5, 151, "2.6.2.1 Example 5 **NOT SAME** separator bar differs TODO: investigate",
|
||||
"0100001101011000011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010"
|
||||
"0000110010100111100100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000"
|
||||
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||
"0000011011111011110010000000010000111100101011111001000100011100111010100001010100000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"1010100100000100000101111111100111000011010100000110111011100011000100011110000001010000000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
};
|
||||
int data_size = sizeof(data) / sizeof(struct item);
|
||||
|
||||
|
@ -199,18 +223,15 @@ static void test_examples(int index, int generate, int debug) {
|
|||
struct zint_symbol *symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
symbol->symbology = data[i].symbology;
|
||||
symbol->debug |= debug;
|
||||
|
||||
int length = strlen(data[i].data);
|
||||
int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, data[i].data, length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (generate) {
|
||||
if (ret == 0) {
|
||||
printf(" /*%2d*/ { %s, \"%s\", %d, %d, %d, \"%s\",\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), data[i].data, ret, symbol->rows, symbol->width, data[i].comment);
|
||||
printf(" /*%2d*/ { %s, %d, \"%s\", %d, %d, %d, \"%s\",\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), data[i].option_2, data[i].data, ret, symbol->rows, symbol->width, data[i].comment);
|
||||
testUtilModulesDump(symbol, " ", "\n");
|
||||
printf(" },\n");
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue