HANXIN: 0xFFE terminator; reedsol/AZTEC: stack-based; AZTEC/HANXIN/QR/GRIDMATRIX speedups; #209

This commit is contained in:
gitlost 2020-11-27 12:54:44 +00:00
parent ab379a233d
commit cd214addba
70 changed files with 5703 additions and 2907 deletions

View file

@ -115,6 +115,7 @@ zint_add_test(print, test_print)
zint_add_test(ps, test_ps)
zint_add_test(qr, test_qr)
zint_add_test(raster, test_raster)
zint_add_test(reedsol, test_reedsol)
zint_add_test(rss, test_rss)
zint_add_test(sjis, test_sjis)
zint_add_test(svg, test_svg)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 398 B

Before After
Before After

View file

@ -17,7 +17,7 @@ TE
0.00 0.00 0.00 setrgbcolor
2.00 40.00 TB 0.00 14.00 TR
TE
2.00 40.00 TB 18.00 2.00 TR
2.00 40.00 TB 20.00 2.00 TR
TE
2.00 40.00 TB 24.00 2.00 TR
TE
@ -27,155 +27,147 @@ TE
TE
10.00 30.00 TB 12.00 2.00 TR
TE
2.00 38.00 TB 16.00 2.00 TR
TE
2.00 38.00 TB 22.00 4.00 TR
TE
10.00 30.00 TB 28.00 2.00 TR
TE
10.00 30.00 TB 40.00 2.00 TR
TE
6.00 32.00 TB 4.00 6.00 TR
TE
2.00 36.00 TB 18.00 2.00 TR
10.00 28.00 TB 16.00 2.00 TR
TE
2.00 36.00 TB 20.00 2.00 TR
TE
6.00 32.00 TB 32.00 6.00 TR
TE
8.00 28.00 TB 24.00 2.00 TR
2.00 34.00 TB 22.00 2.00 TR
TE
2.00 32.00 TB 16.00 4.00 TR
2.00 32.00 TB 20.00 2.00 TR
TE
2.00 32.00 TB 24.00 2.00 TR
TE
2.00 30.00 TB 22.00 2.00 TR
TE
2.00 28.00 TB 0.00 14.00 TR
TE
2.00 28.00 TB 16.00 2.00 TR
TE
2.00 28.00 TB 20.00 2.00 TR
TE
2.00 28.00 TB 24.00 2.00 TR
TE
2.00 28.00 TB 28.00 14.00 TR
TE
2.00 26.00 TB 18.00 2.00 TR
TE
2.00 26.00 TB 22.00 4.00 TR
2.00 26.00 TB 16.00 4.00 TR
TE
2.00 24.00 TB 0.00 2.00 TR
TE
2.00 24.00 TB 4.00 2.00 TR
2.00 24.00 TB 4.00 10.00 TR
TE
2.00 24.00 TB 8.00 2.00 TR
2.00 24.00 TB 22.00 2.00 TR
TE
2.00 24.00 TB 12.00 2.00 TR
2.00 24.00 TB 28.00 10.00 TR
TE
2.00 24.00 TB 18.00 6.00 TR
2.00 22.00 TB 4.00 6.00 TR
TE
2.00 24.00 TB 32.00 2.00 TR
2.00 22.00 TB 16.00 2.00 TR
TE
2.00 24.00 TB 38.00 2.00 TR
2.00 22.00 TB 20.00 10.00 TR
TE
2.00 22.00 TB 0.00 12.00 TR
2.00 22.00 TB 34.00 8.00 TR
TE
2.00 22.00 TB 14.00 4.00 TR
2.00 20.00 TB 0.00 2.00 TR
TE
2.00 22.00 TB 20.00 2.00 TR
2.00 20.00 TB 10.00 6.00 TR
TE
2.00 22.00 TB 28.00 2.00 TR
TE
2.00 22.00 TB 40.00 2.00 TR
TE
6.00 16.00 TB 0.00 2.00 TR
TE
2.00 20.00 TB 4.00 14.00 TR
2.00 20.00 TB 18.00 4.00 TR
TE
2.00 20.00 TB 24.00 2.00 TR
TE
2.00 20.00 TB 32.00 4.00 TR
2.00 20.00 TB 28.00 4.00 TR
TE
4.00 16.00 TB 8.00 2.00 TR
2.00 20.00 TB 34.00 2.00 TR
TE
4.00 16.00 TB 28.00 2.00 TR
2.00 20.00 TB 40.00 2.00 TR
TE
2.00 18.00 TB 34.00 2.00 TR
2.00 18.00 TB 2.00 2.00 TR
TE
2.00 18.00 TB 40.00 2.00 TR
2.00 18.00 TB 8.00 4.00 TR
TE
2.00 18.00 TB 14.00 2.00 TR
TE
2.00 18.00 TB 22.00 8.00 TR
TE
2.00 18.00 TB 36.00 6.00 TR
TE
2.00 16.00 TB 0.00 2.00 TR
TE
2.00 16.00 TB 4.00 4.00 TR
TE
2.00 16.00 TB 12.00 2.00 TR
TE
2.00 16.00 TB 24.00 2.00 TR
4.00 14.00 TB 16.00 6.00 TR
TE
2.00 16.00 TB 32.00 2.00 TR
4.00 14.00 TB 24.00 2.00 TR
TE
2.00 16.00 TB 38.00 4.00 TR
4.00 14.00 TB 30.00 2.00 TR
TE
2.00 14.00 TB 16.00 8.00 TR
2.00 16.00 TB 38.00 2.00 TR
TE
2.00 14.00 TB 26.00 2.00 TR
TE
2.00 14.00 TB 30.00 2.00 TR
TE
4.00 12.00 TB 34.00 2.00 TR
TE
2.00 14.00 TB 38.00 2.00 TR
2.00 14.00 TB 36.00 2.00 TR
TE
2.00 12.00 TB 0.00 14.00 TR
TE
2.00 12.00 TB 20.00 4.00 TR
2.00 12.00 TB 18.00 2.00 TR
TE
2.00 12.00 TB 26.00 6.00 TR
2.00 12.00 TB 22.00 2.00 TR
TE
2.00 12.00 TB 26.00 2.00 TR
TE
2.00 12.00 TB 32.00 4.00 TR
TE
4.00 10.00 TB 40.00 2.00 TR
TE
10.00 2.00 TB 0.00 2.00 TR
TE
10.00 2.00 TB 12.00 2.00 TR
TE
2.00 10.00 TB 18.00 2.00 TR
4.00 8.00 TB 16.00 4.00 TR
TE
2.00 10.00 TB 22.00 6.00 TR
2.00 10.00 TB 30.00 4.00 TR
TE
2.00 10.00 TB 30.00 6.00 TR
TE
2.00 10.00 TB 38.00 4.00 TR
2.00 10.00 TB 36.00 2.00 TR
TE
6.00 4.00 TB 4.00 6.00 TR
TE
2.00 8.00 TB 16.00 2.00 TR
2.00 8.00 TB 22.00 2.00 TR
TE
2.00 8.00 TB 20.00 4.00 TR
2.00 8.00 TB 26.00 2.00 TR
TE
2.00 8.00 TB 26.00 6.00 TR
2.00 8.00 TB 32.00 6.00 TR
TE
2.00 8.00 TB 34.00 4.00 TR
2.00 6.00 TB 16.00 2.00 TR
TE
2.00 8.00 TB 40.00 2.00 TR
2.00 6.00 TB 20.00 12.00 TR
TE
2.00 6.00 TB 20.00 2.00 TR
4.00 4.00 TB 34.00 4.00 TR
TE
2.00 6.00 TB 28.00 4.00 TR
TE
2.00 6.00 TB 38.00 2.00 TR
TE
2.00 4.00 TB 16.00 2.00 TR
2.00 4.00 TB 16.00 6.00 TR
TE
2.00 4.00 TB 24.00 2.00 TR
TE
2.00 4.00 TB 32.00 6.00 TR
TE
2.00 4.00 TB 40.00 2.00 TR
2.00 4.00 TB 28.00 4.00 TR
TE
2.00 2.00 TB 18.00 2.00 TR
TE
2.00 2.00 TB 28.00 4.00 TR
2.00 2.00 TB 22.00 10.00 TR
TE
2.00 2.00 TB 34.00 2.00 TR
2.00 2.00 TB 36.00 4.00 TR
TE
2.00 0.00 TB 0.00 14.00 TR
TE
2.00 0.00 TB 16.00 6.00 TR
2.00 0.00 TB 16.00 2.00 TR
TE
2.00 0.00 TB 24.00 2.00 TR
TE
2.00 0.00 TB 28.00 2.00 TR
TE
2.00 0.00 TB 32.00 2.00 TR
2.00 0.00 TB 30.00 2.00 TR
TE
2.00 0.00 TB 36.00 2.00 TR
TE
2.00 0.00 TB 40.00 2.00 TR
TE

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 247 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 287 B

Before After
Before After

View file

@ -9,86 +9,82 @@
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="42" height="42" fill="#FFFFFF" />
<rect x="0.00" y="0.00" width="14.00" height="2.00" />
<rect x="18.00" y="0.00" width="2.00" height="2.00" />
<rect x="20.00" y="0.00" width="2.00" height="2.00" />
<rect x="24.00" y="0.00" width="2.00" height="2.00" />
<rect x="28.00" y="0.00" width="14.00" height="2.00" />
<rect x="0.00" y="2.00" width="2.00" height="10.00" />
<rect x="12.00" y="2.00" width="2.00" height="10.00" />
<rect x="16.00" y="2.00" width="2.00" height="2.00" />
<rect x="22.00" y="2.00" width="4.00" height="2.00" />
<rect x="28.00" y="2.00" width="2.00" height="10.00" />
<rect x="40.00" y="2.00" width="2.00" height="10.00" />
<rect x="4.00" y="4.00" width="6.00" height="6.00" />
<rect x="18.00" y="4.00" width="2.00" height="2.00" />
<rect x="16.00" y="4.00" width="2.00" height="10.00" />
<rect x="20.00" y="4.00" width="2.00" height="2.00" />
<rect x="32.00" y="4.00" width="6.00" height="6.00" />
<rect x="24.00" y="6.00" width="2.00" height="8.00" />
<rect x="16.00" y="8.00" width="4.00" height="2.00" />
<rect x="22.00" y="6.00" width="2.00" height="2.00" />
<rect x="20.00" y="8.00" width="2.00" height="2.00" />
<rect x="24.00" y="8.00" width="2.00" height="2.00" />
<rect x="22.00" y="10.00" width="2.00" height="2.00" />
<rect x="0.00" y="12.00" width="14.00" height="2.00" />
<rect x="16.00" y="12.00" width="2.00" height="2.00" />
<rect x="20.00" y="12.00" width="2.00" height="2.00" />
<rect x="24.00" y="12.00" width="2.00" height="2.00" />
<rect x="28.00" y="12.00" width="14.00" height="2.00" />
<rect x="18.00" y="14.00" width="2.00" height="2.00" />
<rect x="22.00" y="14.00" width="4.00" height="2.00" />
<rect x="16.00" y="14.00" width="4.00" height="2.00" />
<rect x="0.00" y="16.00" width="2.00" height="2.00" />
<rect x="4.00" y="16.00" width="2.00" height="2.00" />
<rect x="8.00" y="16.00" width="2.00" height="2.00" />
<rect x="12.00" y="16.00" width="2.00" height="2.00" />
<rect x="18.00" y="16.00" width="6.00" height="2.00" />
<rect x="32.00" y="16.00" width="2.00" height="2.00" />
<rect x="38.00" y="16.00" width="2.00" height="2.00" />
<rect x="0.00" y="18.00" width="12.00" height="2.00" />
<rect x="14.00" y="18.00" width="4.00" height="2.00" />
<rect x="20.00" y="18.00" width="2.00" height="2.00" />
<rect x="28.00" y="18.00" width="2.00" height="2.00" />
<rect x="40.00" y="18.00" width="2.00" height="2.00" />
<rect x="0.00" y="20.00" width="2.00" height="6.00" />
<rect x="4.00" y="20.00" width="14.00" height="2.00" />
<rect x="4.00" y="16.00" width="10.00" height="2.00" />
<rect x="22.00" y="16.00" width="2.00" height="2.00" />
<rect x="28.00" y="16.00" width="10.00" height="2.00" />
<rect x="4.00" y="18.00" width="6.00" height="2.00" />
<rect x="16.00" y="18.00" width="2.00" height="2.00" />
<rect x="20.00" y="18.00" width="10.00" height="2.00" />
<rect x="34.00" y="18.00" width="8.00" height="2.00" />
<rect x="0.00" y="20.00" width="2.00" height="2.00" />
<rect x="10.00" y="20.00" width="6.00" height="2.00" />
<rect x="18.00" y="20.00" width="4.00" height="2.00" />
<rect x="24.00" y="20.00" width="2.00" height="2.00" />
<rect x="32.00" y="20.00" width="4.00" height="2.00" />
<rect x="8.00" y="22.00" width="2.00" height="4.00" />
<rect x="28.00" y="22.00" width="2.00" height="4.00" />
<rect x="34.00" y="22.00" width="2.00" height="2.00" />
<rect x="40.00" y="22.00" width="2.00" height="2.00" />
<rect x="28.00" y="20.00" width="4.00" height="2.00" />
<rect x="34.00" y="20.00" width="2.00" height="2.00" />
<rect x="40.00" y="20.00" width="2.00" height="2.00" />
<rect x="2.00" y="22.00" width="2.00" height="2.00" />
<rect x="8.00" y="22.00" width="4.00" height="2.00" />
<rect x="14.00" y="22.00" width="2.00" height="2.00" />
<rect x="22.00" y="22.00" width="8.00" height="2.00" />
<rect x="36.00" y="22.00" width="6.00" height="2.00" />
<rect x="0.00" y="24.00" width="2.00" height="2.00" />
<rect x="4.00" y="24.00" width="4.00" height="2.00" />
<rect x="12.00" y="24.00" width="2.00" height="2.00" />
<rect x="24.00" y="24.00" width="2.00" height="2.00" />
<rect x="32.00" y="24.00" width="2.00" height="2.00" />
<rect x="38.00" y="24.00" width="4.00" height="2.00" />
<rect x="16.00" y="26.00" width="8.00" height="2.00" />
<rect x="26.00" y="26.00" width="2.00" height="2.00" />
<rect x="30.00" y="26.00" width="2.00" height="2.00" />
<rect x="34.00" y="26.00" width="2.00" height="4.00" />
<rect x="38.00" y="26.00" width="2.00" height="2.00" />
<rect x="16.00" y="24.00" width="6.00" height="4.00" />
<rect x="24.00" y="24.00" width="2.00" height="4.00" />
<rect x="30.00" y="24.00" width="2.00" height="4.00" />
<rect x="38.00" y="24.00" width="2.00" height="2.00" />
<rect x="36.00" y="26.00" width="2.00" height="2.00" />
<rect x="0.00" y="28.00" width="14.00" height="2.00" />
<rect x="20.00" y="28.00" width="4.00" height="2.00" />
<rect x="26.00" y="28.00" width="6.00" height="2.00" />
<rect x="18.00" y="28.00" width="2.00" height="2.00" />
<rect x="22.00" y="28.00" width="2.00" height="2.00" />
<rect x="26.00" y="28.00" width="2.00" height="2.00" />
<rect x="32.00" y="28.00" width="4.00" height="2.00" />
<rect x="40.00" y="28.00" width="2.00" height="4.00" />
<rect x="0.00" y="30.00" width="2.00" height="10.00" />
<rect x="12.00" y="30.00" width="2.00" height="10.00" />
<rect x="18.00" y="30.00" width="2.00" height="2.00" />
<rect x="22.00" y="30.00" width="6.00" height="2.00" />
<rect x="30.00" y="30.00" width="6.00" height="2.00" />
<rect x="38.00" y="30.00" width="4.00" height="2.00" />
<rect x="16.00" y="30.00" width="4.00" height="4.00" />
<rect x="30.00" y="30.00" width="4.00" height="2.00" />
<rect x="36.00" y="30.00" width="2.00" height="2.00" />
<rect x="4.00" y="32.00" width="6.00" height="6.00" />
<rect x="16.00" y="32.00" width="2.00" height="2.00" />
<rect x="20.00" y="32.00" width="4.00" height="2.00" />
<rect x="26.00" y="32.00" width="6.00" height="2.00" />
<rect x="34.00" y="32.00" width="4.00" height="2.00" />
<rect x="40.00" y="32.00" width="2.00" height="2.00" />
<rect x="20.00" y="34.00" width="2.00" height="2.00" />
<rect x="28.00" y="34.00" width="4.00" height="2.00" />
<rect x="38.00" y="34.00" width="2.00" height="2.00" />
<rect x="16.00" y="36.00" width="2.00" height="2.00" />
<rect x="22.00" y="32.00" width="2.00" height="2.00" />
<rect x="26.00" y="32.00" width="2.00" height="2.00" />
<rect x="32.00" y="32.00" width="6.00" height="2.00" />
<rect x="16.00" y="34.00" width="2.00" height="2.00" />
<rect x="20.00" y="34.00" width="12.00" height="2.00" />
<rect x="34.00" y="34.00" width="4.00" height="4.00" />
<rect x="16.00" y="36.00" width="6.00" height="2.00" />
<rect x="24.00" y="36.00" width="2.00" height="2.00" />
<rect x="32.00" y="36.00" width="6.00" height="2.00" />
<rect x="40.00" y="36.00" width="2.00" height="2.00" />
<rect x="28.00" y="36.00" width="4.00" height="2.00" />
<rect x="18.00" y="38.00" width="2.00" height="2.00" />
<rect x="28.00" y="38.00" width="4.00" height="2.00" />
<rect x="34.00" y="38.00" width="2.00" height="2.00" />
<rect x="22.00" y="38.00" width="10.00" height="2.00" />
<rect x="36.00" y="38.00" width="4.00" height="2.00" />
<rect x="0.00" y="40.00" width="14.00" height="2.00" />
<rect x="16.00" y="40.00" width="6.00" height="2.00" />
<rect x="16.00" y="40.00" width="2.00" height="2.00" />
<rect x="24.00" y="40.00" width="2.00" height="2.00" />
<rect x="28.00" y="40.00" width="2.00" height="2.00" />
<rect x="32.00" y="40.00" width="2.00" height="2.00" />
<rect x="30.00" y="40.00" width="2.00" height="2.00" />
<rect x="36.00" y="40.00" width="2.00" height="2.00" />
<rect x="40.00" y="40.00" width="2.00" height="2.00" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Before After
Before After

View file

@ -1,21 +1,21 @@
FE 4B F8
82 9A 08
BA 42 E8
BA 0A E8
BA CA E8
82 0A 08
FE 2B F8
82 02 08
BA A2 E8
BA 92 E8
BA AA E8
82 92 08
FE AB F8
00 58 00
AA 70 90
FD A2 08
BF 88 C0
88 02 48
8A 0A 98
00 F5 50
FE 37 40
82 5D D8
BA B7 68
BA 23 10
BA 88 E8
82 43 40
FE EA A8
00 C0 00
BE 13 E0
38 BE 78
87 6B 48
4D 1E 38
B2 E9 10
00 E9 20
FE 54 C8
82 C1 A8
BA D4 E0
BA BF 60
BA EB 60
82 5F 30
FE 89 20

View file

@ -775,7 +775,28 @@ static void test_encode(int index, int generate, int debug) {
"110110000101100"
"010001010010110"
},
/* 20*/ { BARCODE_AZTEC, DATA_MODE, 3, -1, -1, -1, "\101\300", -1, 0, 15, 15, 1, "",
/* 20*/ { BARCODE_AZTEC, UNICODE_MODE, -1, -1, -1, 2, "121212121abcd", -1, 0, 19, 19, 1, "#210",
"1101101111001101010"
"1101111011110110000"
"0001111101100010000"
"0100011111001001001"
"1010110100101010010"
"1000111111111111101"
"0001110000000111110"
"0111010111110110100"
"1001010100010101010"
"1001010101010101100"
"0010010100010101100"
"0110110111110111011"
"1001110000000111010"
"1011011111111110010"
"0011000011111001100"
"0110100001100101011"
"1001001010110011011"
"0011111001001010011"
"1001101000100100001"
},
/* 21*/ { BARCODE_AZTEC, DATA_MODE, 3, -1, -1, -1, "\101\300", -1, 0, 15, 15, 1, "",
"000000101011100"
"000100010100111"
"001100000110110"
@ -792,7 +813,7 @@ static void test_encode(int index, int generate, int debug) {
"110001000111110"
"111001100011011"
},
/* 21*/ { BARCODE_AZTEC, UNICODE_MODE, 26, -1, -1, -1, "", -1, 0, 15, 15, 1, "",
/* 22*/ { BARCODE_AZTEC, UNICODE_MODE, 26, -1, -1, -1, "", -1, 0, 15, 15, 1, "",
"001111011000101"
"000110100011000"
"001100001000111"
@ -809,7 +830,291 @@ static void test_encode(int index, int generate, int debug) {
"001100010010010"
"011110110011000"
},
/* 22*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "0", -1, 0, 11, 11, 1, "ISO/IEC 24778:2008 Figure A.1 (1st)",
/* 23*/ { BARCODE_AZTEC, UNICODE_MODE, 100, -1, -1, -1, "A", -1, 0, 15, 15, 1, "FLG(3)",
"001101001111101"
"000000111011100"
"001100000100101"
"011111111111110"
"001100000001111"
"000101111101001"
"011101000101001"
"010101010101001"
"100101000101101"
"011101111101010"
"100100000001100"
"010111111111111"
"000011011110011"
"100011101111100"
"000111110001110"
},
/* 24*/ { BARCODE_AZTEC, UNICODE_MODE, 1000, -1, -1, -1, "A", -1, 0, 15, 15, 1, "FLG(4)",
"001010100011011"
"001000100000101"
"001100000100111"
"011111111111110"
"001100000001110"
"000101111101000"
"011101000101010"
"100101010101001"
"000101000101101"
"011101111101011"
"100100000001101"
"010111111111100"
"000011011110011"
"101000000111010"
"000001110101111"
},
/* 25*/ { BARCODE_AZTEC, UNICODE_MODE, 10000, -1, -1, -1, "A", -1, 0, 15, 15, 1, "FLG(5)",
"000100110110010"
"000001000010111"
"001100000110101"
"011111111111111"
"000100000001010"
"001101111101101"
"011101000101110"
"100101010101100"
"100101000101101"
"010101111101100"
"101100000001011"
"010111111111111"
"000011110110011"
"101010001110110"
"000000011000101"
},
/* 26*/ { BARCODE_AZTEC, UNICODE_MODE, 100000, -1, -1, -1, "A", -1, 0, 15, 15, 1, "FLG(6)",
"000010010000010"
"001101000100110"
"001100000110111"
"011111111111111"
"001100000001110"
"001101111101010"
"011101000101111"
"110101010101011"
"000101000101001"
"011101111101101"
"101100000001110"
"010111111111101"
"000011000110011"
"101010100011011"
"000000000111010"
},
/* 27*/ { BARCODE_AZTEC, UNICODE_MODE, -1, -1, -1, -1, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", -1, 0, 61, 61, 0, "Zint website example gui3.png NOTE now ends with CTRL_DL . instead of CTRL_PS .; BWIPP different encodation (doesn't use CTRL_PS doubles)",
"0010110111101110101100000101001101110100010000100111011100001"
"0001100000000000001101110010000100010101110011000001000011110"
"0001111110101010100101000110101101000110011000101111011100110"
"0011000000001001101011010000010110111000011110000000010001001"
"0111001010111110010111100000001111101100011100100000001000000"
"1001100111000000001000011101000000001011001100000111100110000"
"1101101000101111010010010000101100010100100100111011011100000"
"1100100110001001100001110100100101001100011000001010110010000"
"0000101001000010000101001001101011110000000000100000001011111"
"1011100100011001100110101001100001100011110111010110110101001"
"0001101000110010111010000000001010111101010000100001001000100"
"0110100010001101000100011011100011000110000011011111001010010"
"0010000010110011001111011110101001010101001010100110000010000"
"1110001010110000110011000100010001111110110000011011001111001"
"1010101010101010101010101010101010101010101010101010101010101"
"0010110110101001010101000111110011001011000111000011100111001"
"1100110100101111110010000000111011110100100011101100110001100"
"0001001001100101000010011100000111100000111010011000000001101"
"1101000001000011101100000010011100001110110010101001000010010"
"1010110011000101100001111000100001001111100010001100111001100"
"0010011111000011101101000010101100001001000100100110000100001"
"0000100101100001111110111011010011101000011010000100000011101"
"1010011010011110110000000000011010110110101001111101010001000"
"1000100001011000111011111010100000110100010111010001010001110"
"1001100110000011001011011111111111111110011010101011001000000"
"1011110010100101000001001000000000001100001001011011001000000"
"0000011111110010010001111011111111101000000001110010001110100"
"1100000001001100110101011010000000101000010110011110010011110"
"0110010000111011111010111010111110101010111010111111001000010"
"0001001001111101111000011010100010101011100000000000000001010"
"1010101010101010101010101010101010101010101010101010101010101"
"1010111000100000110011111010100010101011100001000111100001010"
"1101101000101111100010101010111110101001110111100010010101110"
"0010000101101001111100101010000000101101111100011110110111110"
"1100101110001111000000111011111111101101000101101000010100011"
"1000011000011101111101111000000000001111100100010100010011000"
"0010000010010111001010001111111111111110000100101110110111011"
"0001000100011000011111100010110001100011001101000000010000100"
"1010001010001110100101011010001101011111010011111000011001110"
"0110000110110101011111001110000010010001010111000101000010100"
"0110101001110010110010011100001010001100000111111100011000000"
"1010110110000001111100011001000011011001111100010110000100000"
"0000011010001010000011011001101001110010001100101000111011010"
"0001001010100100010010000010110110101110101100010101010001011"
"1100010000010110110110101101101011111001101111110100011000011"
"0110001101000001111010001100110011001111011111010010100011000"
"1010101010101010101010101010101010101010101010101010101010101"
"1011000001100100011100000111010101011110110011001000100000010"
"0000111101110110001110101001001101000011110010100000101001010"
"0100100001011000000001000100000010001011110101010011110110000"
"0001001110010110101001011101101010001101000000100001101000010"
"1110010011010000011001010010010101000100110100011010001101100"
"0011001010010010011100110100011000111011100100110001001001001"
"0000111010110000100100000001110011001110001101010100001010101"
"1100010010110111011011111100001011001011001011100011100000101"
"0110111000011101110110010111100000010000011101011010001110101"
"0001000000111010000000001100001010101111100010100000010011101"
"0101000010010000110000000010000001110010000111000111100011000"
"0110100111000110011010010101111110001000000011101100000100101"
"1110000011010000000000100001100001000111011110011010000000001"
"0000010101001111100010001001111100101000010001110010010101101"
},
/* 28*/ { BARCODE_AZTEC, UNICODE_MODE, -1, -1, -1, 36, "Lorem ipsum dolor sit amet.", -1, 0, 151, 151, 1, "Max version 151x151",
"0110011000001101111010100010010110101010100001110111111001101101010000111100111111111001000011100001010000101001010001001010101001000111101011111001101"
"1011011111111000001111111001010101111011100101110110001011011000101000010101101100000110011110100000010100110111100111111011011110001000110100111100100"
"1110001110001111110101011110010010011011001011001000001010000010000110101010101011111110110010000010000111000010000011011110001111111001000010000000111"
"1111111110111100000010100111101000111010110101100001000110010111110111110011110100111110101100011000001010110110100001111101110111001101001101011100001"
"0001111011000111110101010100010001011101110011011100001110100100111111001010100000010111000001100010110011100000111110011000101100011011000010100100001"
"1010011111011100100000000001110110111000110110010101110001011100100001101101111010100110101101111101111101011101101111001001010010011000011110010111000"
"0010100000000010010111100000011001110011011011101010011101101010000010010110110100010010010001000100001011100011011010101010001000010011001010110111111"
"0111111001111100110000010101000101011011100110110110010011011110101110111011000100111001101100111001011011110101000100101111101001100011010100010101110"
"0010010101101010010100100100110010111100100010111001000100000101000110110000110110100000011010001001101010100010011110101100110010010100011010001011011"
"1110101000010010000001001011111110111011001110110000111011111010110010001011111101011101110100100000010101110001010101101001101101101110011110100001110"
"0001011111001011100101100010111101000010011010000010010100000111011111100010110101100000101011011101001000000011000001011110001001001011101001101001000"
"0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"
"1110101001101000000110000100110101010101001011110010001100001111110110010000101011100011011001000110101100100110110100001010001011101111011000001110110"
"0000111010111110110101010011100110100110111101010000011001110011001101100011100001000000100100110101110111010011010110011101110111100101011110001001001"
"1110100110100000100100001010111100110000001000000100001010000010010110001010001111111010111001010110111100100001110110011000100011100011011001100001000"
"1001000111111111011011001111011110111000011110101110011100011101110001010111001111001010100110010010000101011100110010001001011100010010111100110111101"
"0001001001001100010001111110010110001101000011010111000011001000111110011110000100111111100010011001100111001001110111110000110101110001100010001000010"
"0000000100011110100100000011010101101011010111110000000110110010011111110111010110100001111110011000010001110100101110000101011100001000111101100000010"
"1001000010101000000001001000101000111110010000110111000111100111111010100100111101101001101010100010010010101001110011001100010001110001000000101001111"
"1011010010111100010011100001111110100001100100010001001010110101111101010101111101010101011101110101011111110110011011101101001110000101110111010010110"
"1000010000000110100010011000100011000000100000011111111101100001010111000010000101100110101011011010000100000100100111100010000010110100010011100010110"
"1010110100110111101010110101000000001111001111011001111000010011010111001111110000111011000101000110010011011100110111101001111001000001110100001101001"
"0001100110001110101110000010000000111100000011111000101110101111100111001110011001000110001011100101001100101110010000000000011111101011011011001010110"
"1110001000010100000011010011011100011000010111101010111111010011001010011101010110011010001111101001100101011101100100011111111111000001010101011001011"
"0100110011100111100111010110010011000001010011001100110010101000101001001010100111100110000001001101011101101000111001100100011010011000001001100111110"
"0011001110110110101100000101000111010001110110010110101000010111111110100001101011000110011111000000101011011000110001010001101111000111000101000101101"
"1001000100101010110101111010011011011101101000011000001011001000000011110000011110100111100011100001011001001011011100111010010100101110000000111011110"
"0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"
"1101101101100010000110100110000001010101011010111011011010101100010100000100100110011100011000100111010110100100111011101010110111100011011000011011101"
"0010011010011111011100111101111001010010101100001000011000111101010100111001011100010101011100110001001100110001101111101111000110110000010111001011111"
"1101000110001011110100100110010100000011000000010000111010001001010100000010110101000010000000001010000001100011101011001110011011000111101011111001000"
"1001000010110011011110000111100001100001111100111111001100010111011101101111111101011101110110101110111011011100111101110001110010110001000101011011000"
"0000000100100000011011001110011011001010000011110000101001100000011100110010101010010010001010010011101100100100001001101000110111000000010010011111000"
"0010111110111010010000100001111110010010100111100010001100110000100111011011010111010101100110110010000010011010111011010111011111111000000101110101110"
"1010101111000010110010011010101001101010111000010010010001001110010111111100110111010110111001101100000000001010101100100000101011100101100011100100101"
"0110101110110100101100111001111000011000001101000011100011011010110011010011001100011101011101011100110001110110000000100011011111011100101110111100110"
"0111110110101000001001001000100101011000100001110011100000000000111111100100010101001100010010011101010011000110111100010000111000000111011000100100001"
"1010010111111010001001100001001101111100100110101101011000011110010111001101101001101000000101111000010010010111001100111101110110010001101101010100000"
"0011100010101101110010100010101000010011001000100000010110100110110010001100001100111100001010101101001010101000011110010110110101100101001000110000001"
"0000001010011110010101110111001100001101011110000011110111111010101111001101111000110000110100110001101000111100010111010011001000001010100100010111110"
"1100110111001001100100000000100000000001001000011001011011100000001111100110001110001111000011111001010111100111000111111110101011100101011000000100001"
"0101110000110100000101101001001011011110110101011010110110010110000001101001011001110110000101101000000011111000101100101101001100101001001110010010001"
"1000000100101010101110001010101010000110100000000010010101100100001000000000100110010100001011010001110100000111110110111010011110000000000011101100001"
"0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"
"0010101101101101000001101000100111100101010000110001010010101000010000000000000010111010100010010000000010101111100001010010001101001110001001101000001"
"0111010100111101011001001101101001000011000111111111110011010101000000010011101010101010010100000100110001011000100110100011110000110110000111111001101"
"0001001101101100100010100000100110100000011001110010000110001011100100010010101011011000011000101011011110101011100100101000111001010001100011011100100"
"1101011011011101000110100111100100011011110110101010011010011100101010000101000101000110101110001011000100110100101001011001000100011000011101000010101"
"0011100100101001100001000100011011110010100000000110010100100101001000010000100111101100001011010010001101100111111000010010110000110110011001000001011"
"0011100010111011110010111101010001000110110100110011101011110011111100101101011001101011001111000110111111010100100100101001111110010000100111000001010"
"1100101101000011110101001110110011011100100011000011101101001001100011011000000111101011110010001100111101101100011000111100001010110100100011100100010"
"0100110010010111110000101011101111111101111110000001010011111011111111101001110110001001011101100101110000111111101110000101101010010010010111110101010"
"0011001100000011000111111000101001000010011011000010001111100001111011010100100110000100101000110010010011001110000100011100010111011101101001011111001"
"0111110110010111010011000001010110110101010100011101001111011010001000011101100000001101101110000011000111010010100110010001110110100010010110001101100"
"0110011111100110111111101000111110100100011001100010100101001100110100100010001010101110101010000110011111000001010101101100100011011100000001001110000"
"0111110101010110000101100011100010010110000100110000001111110001111010010101010101100111001100011100001010010001001000101111110101001011111101001100001"
"0111011010000001000101011010110010110011100010110110010011001101110011011100011110010000011001100100011001101101000110001000001000101010101010111000000"
"0100000101011111110001001011011111000101011111101011101100011111001001110111110001010101011101101010110011111101100110100011001101010000000101001011001"
"0011001010101111100011001010010011100001001011100111111111101111010011011100011110000110101001001101101100000100010001101010100101100001111011101001010"
"0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"
"0000011100101011001000111110011011101100011010001011010010001110111011101000101001011111010011001010100011001000000000101110010010010111010010001111010"
"1001100110011100011111000101000000100000011101110101110011111000000100011011000001110011100110001001101110010011001110101101100100100100001101000010111"
"0001010010100000011111001110101010100111011011000111110100000010111111101010111001000001110000111000001111101011000010100000111000001000111001111000000"
"1011111100010010110100100101010100010010001110100000101001011111110011110101101110000000110101001011100011111001111101111111111010110101010110100100001"
"0101111011100000110101111100110110000000000011011101110011101111000101111100011101111000111010110110100100001111101110000010101011110010110011011010011"
"1110100100110011000110110101000010010011000110110100011000010010111011000111010100110100010111111100110000010011101011000011010001011100000110000100001"
"0001111101001000101110001100100001011100011010101000001111100000111100111110010100011101011001010101101001001010101101001110110110001100100010000100011"
"0101010000110101111110010101100100001101101101111000101000110011100101001011001111101001001110100001101111111101111011100101111001001000010101011001110"
"1001010000001111111000000010011001010011100000010111101101100101010111111110000000111010000010100111010010000100000110010010011110110111110001011100100"
"1010111001010011111110000101000100010101001110101101111110110101101111111111111111100100110101111001010000111001101101110001111110111010110101110011111"
"1000000100100010010101011110110111100111011011101000111111001110001001000000000001010110010000000110100001100000101111001000001010100101101000010001001"
"1110011000111101010011001111011010010011001100101100101110010101101111011111111101010101011110111001010001110000000010000001011110101110010111001100111"
"1100100000000011110001110010001100000011001011011000111101101001001001010000000101110011010010000011011100000000101100000010000101100110111010011101000"
"1001001010110111111111010011010101111010101111000101110111011011110101010111110101001000001111111111010100111001111110010101001100110100000100110000000"
"1110010000000011010111110000001010000110010011100111111100000001000011010100010101101111011010110000010000000010000110111100010001001011100000000101110"
"0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"
"0111000010101100001110010100000100001100111001111010010011001110111001010100010101100001010000111111001010101010100010100010100001110101010001001110000"
"1100010110010000110000100101001011111100111100101100001001111101011001010111110101000101010100111111001101011000111000010111000001011100000110000010011"
"0000100111000001011000100110100010111000001010011101111100001111000101010000000101010101000011100110100101000011101100010110001001110001010000111000100"
"1111110010010110011010100111010110000100111101111101111110110100000001011111111101000010010110101000010101010111010010100111010110011101110110000100011"
"1100111010101111110010110100100110100010101010111111101010001101100011000000000001100010001000011110100001000001010010010000110011000001000010100011001"
"1010111010010000101001111001111011111011001100101100000011010101100001111111111111111101001100110010010001110010100010010011000011100111011100110001110"
"0101101101000000010100101000000111000000011011001000110000001110011000100110100010000101100000101011010110101110111111101100010111111000100001000100000"
"0001101001011101010111101101111101011000001111111110000100010111011101101011010000101000110100010100100001010011111101011101110010001011101100000100100"
"1101101111100101000111111110111010110101100010101010001101100000011001000110000010011001100011001101000100100111101000001100110101110101011011011010100"
"1110001010010010110101010011011100000111101101111100001011111111001001010101010101001001111100010000010101011101101101001001011011110000110101101101000"
"1110001011100111101011001100111010010111000001100111110001101110001101111010000011011000111010100001101011100010110010111100110111111010101000000010101"
"0010100101111110111110001111000001101110100100100110011111010001001010010101000001111100100111110100001110110011111001011111010001100100101100010000001"
"1010001010100100110110111010011010100010101001010101010101000011011000011110110111010010101000110101101111101011110110011100101000101101111011011011110"
"0110000100010000100101110101101010010101010100001111011000111101011010110101010101101100001110011001001010111110001101100101000111011101000101101101000"
"0111011011000001110010111100100001111100000011000000011010000101101010100010100101010000010001011001101101000100111100101110001100111001101001000111000"
"0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"
"1001000110000001010110111110000011111101101010010001111000101001010100010010100110001100100001001000000000000100111101111110001001000111000000000010101"
"1101000100010100111100010111111111001010011111100111101011111010101110110011101010010101100101111111001100011111111111110101011000110101001110001110000"
"1100010101100000000000111000000001011101010011010111000100000011100111100010010001000011101001000100010101001001110101011010010011100001010011101000000"
"1011100010110110110000100101100000000010010111010101100111110101001110000101111011100110101111100010101011110011110100101111101111011011101101111111110"
"1001101001000101000101000110110101001110111000011011110000100000110101110010011011100111111011100101111001001100101011000000011100010111111011010110100"
"1110100111010111100010100011100000010001101101110101000001111011010000000011000110100100110101101000110000110010101001101101110100100111110111000111001"
"1110011001100100010111011010001010010100001001110101001101000001101100001010110111000010001010011010100111101100000101010100001011101110001001101110111"
"0011001000011100100111111111000111111100110100100100001011010101011110101101110100101101101101110111101110011101001101100111100111001101100100010110111"
"1101011110001110111110100110001001000111111010011001010000100011110110110100000001101101000010010010111011101010100111101100001000100011010011111111011"
"1001100111010000100111100111010110111100010110111000010011110100110010011101100110101101010111001101100100111101001011001101010110100010111110010100010"
"1010100000100101000100111010101101000101011010000010011101001100110101001010001001010011010010111101000111101011011001101000001011111011010001111010011"
"0001111010010010001100110101111111101100001101101001000101111111111101010001111011001011101111111010011101010110111111001111100110001101100101001100110"
"0101000000101011000000010000101001011110111011111101001101000010101100101100011000000100000000001011100101001101111100110100010010100010111010011110011"
"1100010010110101000101011011110100001011100101001011011101111101000111101011000000100011001111100110011010111111101001010001001100000101011101001001010"
"1011111100100010001111101100010001011011001010000111110000101010000100010100101010000000011000101001100011100111010111010110010100010101111010110011000"
"0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"
"1010011001001000111101011100011010101000111000111111111111001001110110001010010101100001011010110111010101101100011101111100010111101001010011100001111"
"1010000001011110101000101111001000110010000110001010111000011010110010111111110111100011001111111010001000110001111100010001100110100110100110110111100"
"1110100110001001111000011110010110101001100000011010010010101110100011100110011100000010000000100100001000100101100001000000100110100011101010101110101"
"0010111110010111100101011001100101010001010101101001001101011111011010011011000110001011101111001111011111011001010100010001110011101101011111101010010"
"0110111010101110011111101100101011000110011011101001110100101101101100010010111101000111010010010010111100001100101010011000001000000111100010011000100"
"1111111100011101110010111001000110010000101100101011101011011100110111000111010100001101001101111001001100011010111011110111111000010111010101000010100"
"0101111000101010101001011010011111101111011011010010100110001110010010101010000010101111011010100000011100001101000001111110110111000100011011100111100"
"0110000000011011110101001001011010100001010110010100011100111011000010000101010000001011110111111111100001010111010001110011001101010100110110000000000"
"1100110001000100110100011010110011110110000011010100111010100100011000000000010000110000110000111100010001100101101101111110101110011110000010101111011"
"1100110111110000010100001011001000001111001111101101010000011111001011100101110100100011110101110101011111111100001100100101100100111111010110011010110"
"0110110011000111100000011110111001110001101011101000100010101101101101110100100011100110010011100111101111100101100111011110001100111011010001110001101"
"0111001010110101011001001011000101101001001100110000000001111101011010001101001000010010011110101101111110011111101110100011101111001001011100101111101"
"0010011101101010100111100010011100010011000011010101101000001010100011101010111111100110001000000001101100100110110000000110011001011001111011101100001"
"1000110111011110100100110001000010010000100111011010001000011010111100010101001100011111101100010110000011011111101000001011111100110001101110110101011"
"1101011001101010111110000110100101010000100001001110101110000100010110001110010001010011100010110101010110001100000001101000010011101010000000111101011"
"0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"
"0001001110100100001101000110101001111011101001011011001100101100111110000010101011101111010000000000100110101101001101011100000100000011011000010011101"
"1000010101110010110001111011101111111001101111011011101101011110001011110101010101011011010101100011101101010100111001111001100100010000001101111001011"
"1001110110000010011011111000101000110010000010000111001101100100100101110000101010011110111011010000001010101111011110100110011011100000111001100111011"
"0110000100011001011000111101110001111001000101000011111110011110110101000001111101111101100111110010101010110001011011000101011001101111110100110101011"
"1010100111100111101110010100001010110011000000010110011000000010100001000010101000111011100001001001010111001101010100100000110001011100011001100100100"
"1101011100111100110101110101001111100100010100110111011000010110100000000101001001001100011100101011110011110101001100110011010011111011010100100011100"
"0001111101101100011000100010110100110011100011011110110011101000101010010100110110010000011010100100101001100100011011111100101100101000110001100000010"
"0110110101010101011000000011101100110000010110111001001100111011011100000111110110111110110111101011000010010111010101110001110101110010111101011011101"
"1011010000100001101110101100011101011001000010110111111001000111101101011010110010010111010011000111101000100000110000011000010010110001011011110111110"
"0011101110011110110100001101100111100101101110100010001100011100001001001001000111001000000100100110001100111011100100001101101000011101010101100000010"
"0101000110101100011100101110101011111000001000010101011000000011001100101000110010100000101010110001111101101011010010010100011000001010001010010100111"
"1000100000111011001011000011100010110110100111011111001000111111111110011101010011100001010100111010011011011001001001011001010001011001011101011111110"
"0111110000100111111101001110011000101101110000010010101111101101000010000010000011100101011000101000011110101111100010000110010010100100110011011110010"
"0110100111111100001111000011010011010101101110001001110101111011000001000001001000100010001110100100001110010010010110100011001101000001100111110101001"
"0010011011100100101100011110010110011010001010001110111000101011100101001000101001001001101000010110000110101000011110110010101110101000011000000010110"
"0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"
"0000111011001011101000110110100010010000000011011011011101001010110100101110110100001010100000001000101100000100011011001100001001101011011000111010100"
"1011101011110000100011110101010110111100011110111001011001010000001011111111010111001100010111110011111000110011001011111111010010110100111101001111101"
"0111100100101010000001010010000101011001000001001101110000101010110000111110010110010101000010000011001011101001000110010010000011101010110001100111100"
"1000101111010011001101110101000110000001001100111110010110010010010001011001010111100110110111001001001001111101101101010001011111100101110100011110100"
"1101000111101110010011001110111100100110010000000110001101001001110000111100010101011100010011001101111100101110111100001000001111100000101011110110100"
"0110111110110001100101011101000011111001001111010100100101110011010000111111101100100111010111000101000001010011110011100011010001111011100111001101100"
"0101010101101010010000110100111010110010110001110011110011101100011111110000000101010001000011001011111100000111101000010010111111011111101000110010001"
"1100111000010101000011100001001001101000111101110011001001010111011111001001011011100001101100100010000001111100101001001111110000000110101111001100111"
"1001101001000001000111111110110101001101010000110110110011101100000101011010111100101000001011001101101010000010101000010110001101101011110001110010001"
"1000000100011011110011111011110000011111110111001111111010110101100011000111010100100010001111000101110110110100000111000011101011011101111111000011111"
"1000110110001001001111110010011100000100011010101101101101101001001001011110101010011110010011011110100111100111110111111110000101100111110000101010011"
},
/* 29*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "0", -1, 0, 11, 11, 1, "ISO/IEC 24778:2008 Figure A.1 (1st)",
"11101010101"
"11111111111"
"01000000010"
@ -822,7 +1127,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00101010100"
},
/* 23*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "25", -1, 0, 11, 11, 1, "ISO/IEC 24778:2008 Figure A.1 (2nd)",
/* 30*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "25", -1, 0, 11, 11, 1, "ISO/IEC 24778:2008 Figure A.1 (2nd)",
"11101100101"
"11111111111"
"01000000011"
@ -835,7 +1140,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00100100000"
},
/* 24*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "125", -1, 0, 11, 11, 1, "ISO/IEC 24778:2008 Figure A.1 (3rd)",
/* 31*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "125", -1, 0, 11, 11, 1, "ISO/IEC 24778:2008 Figure A.1 (3rd)",
"11110101101"
"11111111111"
"11000000011"
@ -848,7 +1153,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00111101000"
},
/* 25*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "255", -1, 0, 11, 11, 1, "ISO/IEC 24778:2008 Figure A.1 (4th)",
/* 32*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "255", -1, 0, 11, 11, 1, "ISO/IEC 24778:2008 Figure A.1 (4th)",
"11010101001"
"11111111111"
"01000000011"
@ -861,7 +1166,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00110011100"
},
/* 26*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "1", -1, 0, 11, 11, 1, "",
/* 33*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "1", -1, 0, 11, 11, 1, "",
"11101010101"
"11111111111"
"11000000011"
@ -874,7 +1179,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00100110100"
},
/* 27*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "15", -1, 0, 11, 11, 1, "",
/* 34*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "15", -1, 0, 11, 11, 1, "",
"11101001001"
"11111111111"
"11000000011"
@ -887,7 +1192,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00001111100"
},
/* 28*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "16", -1, 0, 11, 11, 1, "",
/* 35*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "16", -1, 0, 11, 11, 1, "",
"11101110101"
"11111111111"
"11000000010"
@ -900,7 +1205,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00111100100"
},
/* 29*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "63", -1, 0, 11, 11, 1, "",
/* 36*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "63", -1, 0, 11, 11, 1, "",
"11100101001"
"11111111111"
"11000000011"
@ -913,7 +1218,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00101010000"
},
/* 30*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "64", -1, 0, 11, 11, 1, "",
/* 37*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "64", -1, 0, 11, 11, 1, "",
"11111010101"
"11111111111"
"01000000010"
@ -926,7 +1231,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00111011100"
},
/* 31*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "65", -1, 0, 11, 11, 1, "",
/* 38*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "65", -1, 0, 11, 11, 1, "",
"11111010101"
"11111111111"
"11000000011"
@ -939,7 +1244,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00110111100"
},
/* 32*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "126", -1, 0, 11, 11, 1, "",
/* 39*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "126", -1, 0, 11, 11, 1, "",
"11110101001"
"11111111111"
"01000000010"
@ -952,7 +1257,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00110111000"
},
/* 33*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "127", -1, 0, 11, 11, 1, "",
/* 40*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "127", -1, 0, 11, 11, 1, "",
"11110101001"
"11111111111"
"11000000011"
@ -965,7 +1270,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00111011000"
},
/* 34*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "128", -1, 0, 11, 11, 1, "",
/* 41*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "128", -1, 0, 11, 11, 1, "",
"11001010101"
"11111111111"
"11000000010"
@ -978,7 +1283,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00100010000"
},
/* 35*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "191", -1, 0, 11, 11, 1, "",
/* 42*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "191", -1, 0, 11, 11, 1, "",
"11000101001"
"11111111111"
"01000000011"
@ -991,7 +1296,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00100010100"
},
/* 36*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "192", -1, 0, 11, 11, 1, "",
/* 43*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "192", -1, 0, 11, 11, 1, "",
"11011010101"
"11111111111"
"11000000010"
@ -1004,7 +1309,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00110011000"
},
/* 37*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "225", -1, 0, 11, 11, 1, "",
/* 44*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "225", -1, 0, 11, 11, 1, "",
"11010010101"
"11111111111"
"11000000011"
@ -1017,7 +1322,7 @@ static void test_encode(int index, int generate, int debug) {
"01111111111"
"00001100100"
},
/* 38*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "254", -1, 0, 11, 11, 1, "",
/* 45*/ { BARCODE_AZRUNE, UNICODE_MODE, -1, -1, -1, -1, "254", -1, 0, 11, 11, 1, "",
"11010101001"
"11111111111"
"11000000010"
@ -1034,7 +1339,7 @@ static void test_encode(int index, int generate, int debug) {
int data_size = ARRAY_SIZE(data);
char escaped[1024];
char bwipp_buf[16384];
char bwipp_buf[32768];
char bwipp_msg[1024];
for (int i = 0; i < data_size; i++) {
@ -1524,12 +1829,116 @@ static void test_fuzz(int index, int debug) {
testFinish();
}
#include <time.h>
#define TEST_PERF_ITERATIONS 1000
// Not a real test, just performance indicator
static void test_perf(int index, int debug) {
if (!(debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */
return;
}
int ret;
struct item {
int symbology;
int input_mode;
int option_1;
int option_2;
char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
};
struct item data[] = {
/* 0*/ { BARCODE_AZTEC, -1, -1, -1,
"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
0, 49, 49, "286 chars, 8-bit words, upper" },
/* 1*/ { BARCODE_AZTEC, -1, -1, -1,
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
0, 79, 79, "900 chars, 10-bit words, numeric" },
/* 2*/ { BARCODE_AZTEC, -1, -1, -1,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377",
0, 91, 91, "980 chars, 10-bit words, mixed" },
/* 3*/ { BARCODE_AZTEC, -1, -1, -1,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377",
0, 113, 113, "1540 chars, 12-bit words, mixed" },
};
int data_size = ARRAY_SIZE(data);
clock_t start, total_encode = 0, total_buffer = 0, diff_encode, diff_buffer;
for (int i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
diff_encode = diff_buffer = 0;
for (int j = 0; j < TEST_PERF_ITERATIONS; j++) {
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
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);
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);
start = clock();
ret = ZBarcode_Buffer(symbol, 0 /*rotate_angle*/);
diff_buffer += clock() - start;
assert_zero(ret, "i:%d ZBarcode_Buffer ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
ZBarcode_Delete(symbol);
}
printf("%s: diff_encode %gms, diff_buffer %gms\n", data[i].comment, diff_encode * 1000.0 / CLOCKS_PER_SEC, diff_buffer * 1000.0 / CLOCKS_PER_SEC);
total_encode += diff_encode;
total_buffer += diff_buffer;
}
if (index != -1) {
printf("totals: encode %gms, buffer %gms\n", total_encode * 1000.0 / CLOCKS_PER_SEC, total_buffer * 1000.0 / CLOCKS_PER_SEC);
}
}
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
{ "test_options", test_options, 1, 0, 1 },
{ "test_encode", test_encode, 1, 1, 1 },
{ "test_fuzz", test_fuzz, 1, 0, 1 },
{ "test_perf", test_perf, 1, 0, 1 },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));

View file

@ -178,11 +178,12 @@ static void test_encode(int index, int generate, int debug) {
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
};
struct item data[] = {
/* 0*/ { -1, "123456789012", -1, 0, 16, 18, "",
/* 0*/ { -1, "123456789012", -1, 0, 16, 18, 1, "",
"100011101010111101"
"111010010010100000"
"110110100010001000"
@ -200,6 +201,54 @@ static void test_encode(int index, int generate, int debug) {
"010111110100100111"
"100010001101111100"
},
/* 1*/ { -1, "Code One", -1, 0, 16, 18, 1, "BWIPP example",
"010011011101100110"
"010010000001010110"
"001010010101100110"
"000110000011110110"
"100010100000111001"
"000010000000100000"
"111111111111111111"
"000000000000000000"
"011111111111111110"
"010000000000000010"
"011111111111111110"
"000100011110101101"
"101101000111101011"
"010100001110101100"
"100001100111100100"
"100000111000111000"
},
/* 2*/ { 3, "1234567890ABCDEF", -1, 0, 28, 32, 0, "https://fr.wikipedia.org/wiki/Liste_des_symbologies, same; BWIPP **NOT SAME**, has unlatch to ASCII at end, no doc so don't know if necessary",
"10001110101011110111011110110101"
"11101001001010000011000110101001"
"11101001100010100010001000101000"
"10011011010100000100010001100001"
"10001010001000100010001000101000"
"00011000010001000100010001100001"
"10001010001000100010001000101000"
"00011000010001000100010001100001"
"10001010001000100010001000101000"
"00011000010001000100010001100001"
"00001000000000000000000000100000"
"11111111111111111111111111111111"
"00000000000000000000000000100000"
"11111111111111111111111111111111"
"00000000000000000000000000000000"
"01111111111111111111111111111110"
"01000000000000000000000000000010"
"01111111111111111111111111111110"
"10001010001000100010001000101000"
"00011000010001000100010001100001"
"10001010000101011110001101100110"
"00011000010010101010111011100100"
"11101011011100101001000110101100"
"01111000000000010001000111101111"
"00001010100010111100100100101100"
"10001000101110100001010011100110"
"00001011001001010100010001101111"
"00101101111001111011011001111010"
},
};
int data_size = ARRAY_SIZE(data);
@ -220,9 +269,9 @@ static void test_encode(int index, int generate, int debug) {
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (generate) {
printf(" /*%3d*/ { %d, \"%s\", %d, %s, %d, %d, \"%s\",\n",
printf(" /*%3d*/ { %d, \"%s\", %d, %s, %d, %d, %d, \"%s\",\n",
i, data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
testUtilModulesDump(symbol, " ", "\n");
printf(" },\n");
} else {
@ -235,12 +284,16 @@ static void test_encode(int index, int generate, int debug) {
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) {
ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
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));
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);
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);
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);
}
}
}
}

View file

@ -41,7 +41,7 @@ static void test_utf8_to_unicode(int index, int debug) {
int length;
int disallow_4byte;
int ret;
size_t ret_length;
int ret_length;
unsigned int expected_vals[20];
char *comment;
};
@ -64,14 +64,14 @@ static void test_utf8_to_unicode(int index, int debug) {
if (index != -1 && i != index) continue;
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
size_t ret_length = length;
int ret_length = length;
ret = utf8_to_unicode(&symbol, (unsigned char *) data[i].data, vals, &ret_length, data[i].disallow_4byte);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
if (ret == 0) {
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %ld != %ld\n", i, ret_length, data[i].ret_length);
for (size_t j = 0; j < ret_length; j++) {
assert_equal(vals[j], data[i].expected_vals[j], "i:%d vals[%zu] %04X != %04X\n", i, j, vals[j], data[i].expected_vals[j]);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < ret_length; j++) {
assert_equal(vals[j], data[i].expected_vals[j], "i:%d vals[%d] %04X != %04X\n", i, j, vals[j], data[i].expected_vals[j]);
}
}
}
@ -103,8 +103,8 @@ static void test_debug_test_codeword_dump_int(int index, int debug) {
if (index != -1 && i != index) continue;
debug_test_codeword_dump_int(&symbol, data[i].codewords, data[i].length);
assert_nonzero(strlen(symbol.errtxt) < 92, "i:%d strlen(%s) >= 92 (%zu)\n", i, symbol.errtxt, strlen(symbol.errtxt));
assert_zero(strcmp(symbol.errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0 (%zu, %zu)\n", i, symbol.errtxt, data[i].expected, strlen(symbol.errtxt), strlen(data[i].expected));
assert_nonzero(strlen(symbol.errtxt) < 92, "i:%d strlen(%s) >= 92 (%d)\n", i, symbol.errtxt, (int) strlen(symbol.errtxt));
assert_zero(strcmp(symbol.errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0 (%d, %d)\n", i, symbol.errtxt, data[i].expected, (int) strlen(symbol.errtxt), (int) strlen(data[i].expected));
}
testFinish();

View file

@ -42,6 +42,7 @@ static void test_bom(int debug) {
symbol->input_mode = UNICODE_MODE;
symbol->option_1 = 4;
symbol->option_2 = 1;
symbol->option_3 = 5 << 8; // Mask 100 (instead of automatic 010)
symbol->debug |= debug;
char data[] = "\xEF\xBB\xBF"; // U+FEFF BOM, with U+2039 (only in Windows pages)

View file

@ -32,69 +32,6 @@
#include "testcommon.h"
#include <sys/stat.h>
static void test_emf(int index, int debug) {
testStart("");
if (!testUtilHaveLibreOffice()) {
testSkip("LibreOffice not available");
return;
}
int ret;
struct item {
int symbology;
int option_1;
int option_2;
char *fgcolour;
char *bgcolour;
float scale;
char *data;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_EANX, -1, -1, "", "", 0, "210987654321+54321" }, // #185 Byte count, font data, HeaderExtension1/2
/* 1*/ { BARCODE_MAXICODE, -1, 20, "E0E0E0", "700070", 0, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL..." }, // #185 Maxicode scaling
};
int data_size = ARRAY_SIZE(data);
for (int i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
if (*data[i].fgcolour) {
strcpy(symbol->fgcolour, data[i].fgcolour);
}
if (*data[i].bgcolour) {
strcpy(symbol->bgcolour, data[i].bgcolour);
}
if (data[i].scale != 0) {
symbol->scale = data[i].scale;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
char *filename = "out.emf";
strcpy(symbol->outfile, filename);
ret = ZBarcode_Print(symbol, 0);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
ret = testUtilVerifyLibreOffice(symbol->outfile, debug); // Slow
assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile);
ZBarcode_Delete(symbol);
}
testFinish();
}
static void test_print(int index, int generate, int debug) {
testStart("");
@ -115,26 +52,29 @@ static void test_print(int index, int generate, int debug) {
char *fgcolour;
char *bgcolour;
int rotate_angle;
char* data;
char* expected_file;
char *data;
char *expected_file;
char *comment;
};
struct item data[] = {
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, BOLD_TEXT, -1, -1, -1, "", "", 0, "Égjpqy", "../data/emf/code128_egrave_bold.emf" },
/* 1*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, "147AD0", "FC9630", 0, "123", "../data/emf/telenum_fg_bg.emf" },
/* 2*/ { BARCODE_ULTRA, -1, -1, 5, -1, -1, "147AD0", "FC9630", 0, "123", "../data/emf/ultracode_fg_bg.emf" },
/* 3*/ { BARCODE_EANX, -1, -1, -1, -1, -1, "", "", 0, "9780877799306+54321", "../data/emf/ean13_5addon_ggs_5.2.2.5.2-2.emf" },
/* 4*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, "", "", 0, "012345678905+24", "../data/emf/upca_2addon_ggs_5.2.6.6-5.emf" },
/* 5*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, "", "", 0, "0123456+12", "../data/emf/upce_2addon.emf" },
/* 6*/ { BARCODE_UPCE, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, "", "", 0, "0123456+12", "../data/emf/upce_2addon_small_bold.emf" },
/* 7*/ { BARCODE_ITF14, -1, BOLD_TEXT, -1, -1, -1, "", "", 0, "123", "../data/emf/itf14_bold.emf" },
/* 8*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, "", "", 90, "123", "../data/emf/code39_rotate_90.emf" },
/* 9*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, "", "", 180, "123", "../data/emf/code39_rotate_180.emf" },
/* 10*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, "", "", 270, "123", "../data/emf/code39_rotate_270.emf" },
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, BOLD_TEXT, -1, -1, -1, "", "", 0, "Égjpqy", "../data/emf/code128_egrave_bold.emf", "" },
/* 1*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, "147AD0", "FC9630", 0, "123", "../data/emf/telenum_fg_bg.emf", "" },
/* 2*/ { BARCODE_ULTRA, -1, -1, 5, -1, -1, "147AD0", "FC9630", 0, "123", "../data/emf/ultracode_fg_bg.emf", "" },
/* 3*/ { BARCODE_EANX, -1, -1, -1, -1, -1, "", "", 0, "9780877799306+54321", "../data/emf/ean13_5addon_ggs_5.2.2.5.2-2.emf", "" },
/* 4*/ { BARCODE_EANX, -1, -1, -1, -1, -1, "", "", 0, "210987654321+54321", "../data/emf/ean13_5addon_#185.emf", "#185 Byte count, font data, HeaderExtension1/2" },
/* 5*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, "", "", 0, "012345678905+24", "../data/emf/upca_2addon_ggs_5.2.6.6-5.emf", "" },
/* 6*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, "", "", 0, "0123456+12", "../data/emf/upce_2addon.emf", "" },
/* 7*/ { BARCODE_UPCE, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, "", "", 0, "0123456+12", "../data/emf/upce_2addon_small_bold.emf", "" },
/* 8*/ { BARCODE_ITF14, -1, BOLD_TEXT, -1, -1, -1, "", "", 0, "123", "../data/emf/itf14_bold.emf", "" },
/* 9*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, "", "", 90, "123", "../data/emf/code39_rotate_90.emf", "" },
/* 10*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, "", "", 180, "123", "../data/emf/code39_rotate_180.emf", "" },
/* 11*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, "", "", 270, "123", "../data/emf/code39_rotate_270.emf", "" },
/* 12*/ { BARCODE_MAXICODE, -1, -1, -1, -1, 20, "E0E0E0", "700070", 0, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", "../data/emf/maxicode_#185.emf", "#185 Maxicode scaling" },
};
int data_size = ARRAY_SIZE(data);
char* data_dir = "../data/emf";
char* emf = "out.emf";
char *data_dir = "../data/emf";
char *emf = "out.emf";
char escaped[1024];
int escaped_size = 1024;
@ -171,12 +111,16 @@ static void test_print(int index, int generate, int debug) {
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
if (generate) {
printf(" /*%3d*/ { %s, %s, %s, %d, %d, %d, \"%s\", \"%s\", %d, \"%s\", \"%s\"},\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width,
data[i].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file);
printf(" /*%3d*/ { %s, %s, %s, %d, %d, %d, \"%s\", \"%s\", %d, \"%s\", \"%s\" \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode),
testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width,
data[i].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file, data[i].comment);
ret = rename(symbol->outfile, data[i].expected_file);
assert_zero(ret, "i:%d rename(%s, %s) ret %d != 0\n", i, symbol->outfile, data[i].expected_file, ret);
if (have_libreoffice) {
// Note this will fail (on Ubuntu anyway) if LibreOffice Base/Calc/Impress/Writer running (i.e. anything but LibreOffice Draw)
// Doesn't seem to be a way to force Draw invocation through the command line
ret = testUtilVerifyLibreOffice(data[i].expected_file, debug);
assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), data[i].expected_file, ret);
}
@ -198,7 +142,6 @@ static void test_print(int index, int generate, int debug) {
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
{ "test_emf", test_emf, 1, 0, 1 },
{ "test_print", test_print, 1, 1, 1 },
};

View file

@ -155,7 +155,7 @@ static void test_gb18030_utf8tomb(int index) {
char *data;
int length;
int ret;
size_t ret_length;
int ret_length;
unsigned int expected_gbdata[30];
char *comment;
};
@ -190,12 +190,12 @@ static void test_gb18030_utf8tomb(int index) {
if (index != -1 && i != index) continue;
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
size_t ret_length = length;
int ret_length = length;
ret = gb18030_utf8tomb(&symbol, (unsigned char *) data[i].data, &ret_length, gbdata);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol.errtxt);
if (ret == 0) {
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < (int) ret_length; j++) {
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] 0x%04X != 0x%04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
}
@ -216,7 +216,7 @@ static void test_gb18030_utf8tosb(int index) {
char *data;
int length;
int ret;
size_t ret_length;
int ret_length;
unsigned int expected_gbdata[30];
char *comment;
};
@ -265,12 +265,12 @@ static void test_gb18030_utf8tosb(int index) {
if (index != -1 && i != index) continue;
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
size_t ret_length = length;
int ret_length = length;
ret = gb18030_utf8tosb(data[i].eci, (unsigned char *) data[i].data, &ret_length, gbdata, data[i].full_multibyte);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
if (ret == 0) {
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < (int) ret_length; j++) {
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] %04X != %04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
}
@ -289,7 +289,7 @@ static void test_gb18030_cpy(int index) {
char *data;
int length;
int ret;
size_t ret_length;
int ret_length;
unsigned int expected_gbdata[30];
char *comment;
};
@ -316,10 +316,10 @@ static void test_gb18030_cpy(int index) {
if (index != -1 && i != index) continue;
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
size_t ret_length = length;
int ret_length = length;
gb18030_cpy((unsigned char *) data[i].data, &ret_length, gbdata, data[i].full_multibyte);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < (int) ret_length; j++) {
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] %04X != %04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
}

View file

@ -95,7 +95,7 @@ static void test_gb2312_utf8tomb(int index) {
char *data;
int length;
int ret;
size_t ret_length;
int ret_length;
unsigned int expected_gbdata[20];
char *comment;
};
@ -130,12 +130,12 @@ static void test_gb2312_utf8tomb(int index) {
if (index != -1 && i != index) continue;
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
size_t ret_length = length;
int ret_length = length;
ret = gb2312_utf8tomb(&symbol, (unsigned char *) data[i].data, &ret_length, gbdata);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol.errtxt);
if (ret == 0) {
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < (int) ret_length; j++) {
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] %04X != %04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
}
@ -156,7 +156,7 @@ static void test_gb2312_utf8tosb(int index) {
char *data;
int length;
int ret;
size_t ret_length;
int ret_length;
unsigned int expected_gbdata[20];
char *comment;
};
@ -203,12 +203,12 @@ static void test_gb2312_utf8tosb(int index) {
if (index != -1 && i != index) continue;
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
size_t ret_length = length;
int ret_length = length;
ret = gb2312_utf8tosb(data[i].eci, (unsigned char *) data[i].data, &ret_length, gbdata, data[i].full_multibyte);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
if (ret == 0) {
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < (int) ret_length; j++) {
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] %04X != %04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
}
@ -227,7 +227,7 @@ static void test_gb2312_cpy(int index) {
char *data;
int length;
int ret;
size_t ret_length;
int ret_length;
unsigned int expected_gbdata[20];
char *comment;
};
@ -254,10 +254,10 @@ static void test_gb2312_cpy(int index) {
if (index != -1 && i != index) continue;
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
size_t ret_length = length;
int ret_length = length;
gb2312_cpy((unsigned char *) data[i].data, &ret_length, gbdata, data[i].full_multibyte);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < (int) ret_length; j++) {
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] %04X != %04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
}

View file

@ -210,7 +210,7 @@ static void test_input(int index, int generate, int debug) {
/* 44*/ { UNICODE_MODE, 0, -1, " 200mA至", 0, 0, "2F 60 40 00 60 2B 78 63 41 7F 40", "M6 H1 (GB 2312)" },
/* 45*/ { UNICODE_MODE, 0, -1, "2A tel:86 019 82512738", 0, 0, "28 22 5F 4F 29 48 5F 6D 7E 6F 55 57 1F 28 63 0F 5A 11 64 0F 74", "M2 L5(with control) N15 (ASCII)" },
/* 46*/ { UNICODE_MODE, 0, -1, "至2A tel:86 019 82512738", 0, 0, "30 07 56 60 4C 48 13 6A 32 17 7B 3F 5B 75 35 67 6A 18 63 76 44 39 03 7D 00", "B4 L5(with control) N15 (GB 2312)" },
/* 47*/ { UNICODE_MODE, 0, -1, "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", 0, 0, "(62) 29 22 22 1C 4E 41 42 7E 0A 40 14 00 37 7E 6F 00 62 7E 2C 00 1C 7E 4B 00 41 7E 18 00", "M8 H11 M6 B4 L5(with control) N15 (GB 2312) (*NOT SAME* as D3 example, M8 H11 M6 H1 M3 L4(with control) N15, which uses a few more bits)" },
/* 47*/ { UNICODE_MODE, 0, -1, "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", 0, 0, "(62) 29 22 22 1C 4E 41 42 7E 0A 40 14 00 37 7E 6F 00 62 7E 2C 00 1C 7E 4B 00 41 7E 18 00", "M8 H11 M6 B4 L5(with control) N15 (GB 2312) (*NOT SAME* as D3 example Figure D.1, M8 H11 M6 H1 M3 L4(with control) N15, which uses a few more bits)" },
/* 48*/ { UNICODE_MODE, 0, -1, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::", 0, 0, "(588) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B512 (ASCII)" },
/* 49*/ { UNICODE_MODE, 0, -1, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\177", 0, 0, "(591) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B513 (ASCII)" },
/* 50*/ { UNICODE_MODE, 0, -1, ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::至", 0, 0, "(591) 37 68 68 68 68 68 74 7C 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B511 H1 (GB 2312)" },
@ -297,7 +297,7 @@ static void test_encode(int index, int generate, int debug) {
"111111000000100001"
"111111000000111111"
},
/* 1*/ { "Grid Matrix", UNICODE_MODE, 5, -1, 0, 30, 30, "",
/* 1*/ { "Grid Matrix", UNICODE_MODE, 5, -1, 0, 30, 30, "AIMD014 Figure 1 **NOT SAME** different encodation, uses Upper and Lower whereas figure uses Mixed and Lower",
"111111000000111111000000111111"
"110111010110110111010110110011"
"100011011110111111011110111111"
@ -329,7 +329,7 @@ static void test_encode(int index, int generate, int debug) {
"101111010010100001010010110111"
"111111000000111111000000111111"
},
/* 2*/ { "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", UNICODE_MODE, 3, 3, 0, 42, 42, "",
/* 2*/ { "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", UNICODE_MODE, 3, 3, 0, 42, 42, "AIMD014 Figure D.1 **NOT SAME** different encodation, see test_input dataset",
"111111000000111111000000111111000000111111"
"101101001100101111001010101011001100101101"
"110001011010110101010000100011000000100001"
@ -423,6 +423,89 @@ static void test_encode(int index, int generate, int debug) {
testFinish();
}
#include <time.h>
#define TEST_PERF_ITERATIONS 1000
// Not a real test, just performance indicator
static void test_perf(int index, int debug) {
if (!(debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */
return;
}
int ret;
struct item {
int symbology;
int input_mode;
int option_1;
int option_2;
char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
};
struct item data[] = {
/* 0*/ { BARCODE_GRIDMATRIX, UNICODE_MODE, -1, -1,
"AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738",
0, 66, 66, "97 chars, mixed modes" },
/* 1*/ { BARCODE_GRIDMATRIX, UNICODE_MODE, -1, -1,
"AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738"
"AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738"
"AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738"
"AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738"
"AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738"
"AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738"
"AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738"
"AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738"
"AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738"
"AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738",
0, 162, 162, "970 chars, mixed modes" },
};
int data_size = ARRAY_SIZE(data);
clock_t start, total_encode = 0, total_buffer = 0, diff_encode, diff_buffer;
for (int i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
diff_encode = diff_buffer = 0;
for (int j = 0; j < TEST_PERF_ITERATIONS; j++) {
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
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);
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);
start = clock();
ret = ZBarcode_Buffer(symbol, 0 /*rotate_angle*/);
diff_buffer += clock() - start;
assert_zero(ret, "i:%d ZBarcode_Buffer ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
ZBarcode_Delete(symbol);
}
printf("%s: diff_encode %gms, diff_buffer %gms\n", data[i].comment, diff_encode * 1000.0 / CLOCKS_PER_SEC, diff_buffer * 1000.0 / CLOCKS_PER_SEC);
total_encode += diff_encode;
total_buffer += diff_buffer;
}
if (index != -1) {
printf("totals: encode %gms, buffer %gms\n", total_encode * 1000.0 / CLOCKS_PER_SEC, total_buffer * 1000.0 / CLOCKS_PER_SEC);
}
}
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
@ -430,6 +513,7 @@ int main(int argc, char *argv[]) {
{ "test_options", test_options, 1, 0, 1 },
{ "test_input", test_input, 1, 1, 1 },
{ "test_encode", test_encode, 1, 1, 1 },
{ "test_perf", test_perf, 1, 0, 1 },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));

File diff suppressed because it is too large Load diff

View file

@ -241,11 +241,11 @@ static void test_cap(int index) {
/* 0*/ { BARCODE_CODE128, ZINT_CAP_HRT, ZINT_CAP_HRT },
/* 1*/ { BARCODE_CODE128, ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_GS1, ZINT_CAP_HRT | ZINT_CAP_STACKABLE },
/* 2*/ { BARCODE_PDF417, ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE, ZINT_CAP_ECI | ZINT_CAP_READER_INIT },
/* 3*/ { BARCODE_QRCODE, ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE, ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FULL_MULTIBYTE },
/* 3*/ { BARCODE_QRCODE, ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK, ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK },
/* 4*/ { BARCODE_EANX_CC, ZINT_CAP_HRT | ZINT_CAP_COMPOSITE | ZINT_CAP_EXTENDABLE | ZINT_CAP_ECI | ZINT_CAP_GS1, ZINT_CAP_HRT | ZINT_CAP_COMPOSITE | ZINT_CAP_EXTENDABLE | ZINT_CAP_GS1 },
/* 5*/ { BARCODE_HANXIN, ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FULL_MULTIBYTE, ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FULL_MULTIBYTE },
/* 5*/ { BARCODE_HANXIN, ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK, ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK },
/* 6*/ { BARCODE_CODE11, ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE, 0 },
/* 7*/ { BARCODE_POSTNET, ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | ZINT_CAP_COMPOSITE | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE, 0 },
/* 7*/ { BARCODE_POSTNET, ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | ZINT_CAP_COMPOSITE | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK, 0 },
/* 8*/ { 0, 0, 0 },
};
int data_size = ARRAY_SIZE(data);

View file

@ -168,8 +168,8 @@ static void test_print(int index, int generate, int debug) {
};
int data_size = ARRAY_SIZE(data);
char* data_dir = "../data/png";
char* png = "out.png";
char *data_dir = "../data/png";
char *png = "out.png";
char escaped[1024];
int escaped_size = 1024;
char *text;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,227 @@
/*
libzint - the open source barcode library
Copyright (C) 2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
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"
#include "../reedsol.h"
// Print out the log/alog tables for "backend/reedsol_logs.h"
static void print_logs(const char *name, int logmod, unsigned int *logt, unsigned int *alog, int u16, int last) {
int i;
const char *type = u16 ? "short" : "char";
const char *format = u16 ? " 0x%04X," : " 0x%02X,";
printf("static const unsigned %s logt_%s[%d] = {", type, name, logmod + 1);
for (i = 0; i < logmod + 1; i++) {
if (i % 16 == 0) printf("\n ");
printf(format, i ? logt[i] : 0);
}
printf("\n};\n");
printf("static const unsigned %s alog_%s[%d] = {", type, name, logmod * 2);
for (i = 0; i < logmod; i++) {
if (i % 16 == 0) printf("\n ");
printf(format, alog[i]);
}
// Double antilog table
for (i = 0; i < logmod; i++) {
if (i % 16 == 0) printf("\n ");
printf(format, alog[i]);
}
printf("\n};\n");
if (!last) {
printf("\n");
}
}
static void gen_logs(const unsigned int prime_poly, int logmod, unsigned int *logt, unsigned int *alog) {
int b, p, v;
b = logmod + 1;
// Calculate the log/alog tables
for (p = 1, v = 0; v < logmod; v++) {
alog[v] = p;
logt[p] = v;
p <<= 1;
if (p & b)
p ^= prime_poly;
}
}
// Dummy to generate static log/antilog tables for "backend/reedsol_logs.h"
static void test_generate(int generate) {
if (!generate) {
return;
}
struct item {
const char *name;
int logmod;
unsigned int prime_poly;
int u16;
};
struct item data[] = {
{ "0x13", 15, 0x13, 0 },
{ "0x25", 31, 0x25, 0 },
{ "0x43", 63, 0x43, 0 },
{ "0x89", 127, 0x89, 0 },
{ "0x11d", 255, 0x11d, 0 },
{ "0x12d", 255, 0x12d, 0 },
{ "0x163", 255, 0x163, 0 },
};
int data_size = ARRAY_SIZE(data);
unsigned int logt[4096];
unsigned int alog[8192];
for (int i = 0; i < data_size; i++) {
gen_logs(data[i].prime_poly, data[i].logmod, logt, alog);
print_logs(data[i].name, data[i].logmod, logt, alog, data[i].u16, i + 1 == data_size);
}
}
static void test_encoding(int index) {
testStart("");
struct item {
unsigned int prime_poly;
int nsym;
int index;
int datalen;
unsigned char data[256];
unsigned char expected[256];
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { 0x43, 4, 1, 7, { 4, 20, 49, 37, 49, 38, 23 }, { 54, 17, 53, 58 } }, // AUSPOST Australia Post Customer Barcoding Technical Specifications Diagram 10
/* 1*/ { 0x43, 7, 1, 10, { 9, 50, 1, 41, 47, 2, 39, 37, 1, 27 }, { 38, 50, 8, 16, 10, 20, 40 } }, // AZTEC ISO/IEC 24778:2008 Section G.4
/* 2*/ { 0x13, 5, 1, 2, { 0, 9 }, { 12, 2, 3, 1, 9 } }, // AZTEC ISO/IEC 24778:2008 Section G.4 Mode Message
/* 3*/ { 0x12d, 5, 1, 3, { 142, 164, 186 }, { 114, 25, 5, 88, 102 } }, // DATAMATRIX ISO/IEC 16022:2006 Annex O
/* 4*/ { 0x89, 25, 1, 25, { 42, 13, 54, 39, 124, 91, 121, 65, 28, 40, 95, 48, 0, 126, 0, 126, 0, 126, 0, 126, 0, 126, 0, 126, 0 }, { 123, 47, 2, 20, 54, 112, 35, 23, 100, 89, 55, 17, 101, 4, 14, 33, 48, 62, 98, 52, 2, 79, 92, 70, 102 } }, // GRIDMATRIX AIMD014 Section 6.8
/* 5*/ { 0x163, 4, 1, 21, { 0x11, 0xED, 0xC8, 0xC5, 0x40, 0x0F, 0xF4 }, { 0xEB, 0xB4, 0x68, 0x1D } }, // HANXIN ISO/IEC DIS 20830:2019 Annex K.1
/* 6*/ { 0x163, 24, 1, 27, { 0x11, 0xED, 0xC8, 0xC5, 0x40, 0x0F, 0xF4, 0x8A, 0x2C, 0xC3, 0x4E, 0x3D, 0x09, 0x25, 0x9A, 0x7A, 0x29, 0xAB, 0xEA, 0x3E, 0x46, 0x4C, 0x7E, 0x73, 0xE8, 0x6C, 0xC7 }, { 0x08, 0x57, 0x0C, 0xE0, 0x7A, 0xA5, 0xDD, 0xA2, 0x99, 0xCF, 0xA4, 0x82, 0xAD, 0x11, 0xB0, 0x84, 0x74, 0x5D, 0x9A, 0x99, 0x0B, 0xCD, 0x49, 0x77 } }, // HANXIN ISO/IEC DIS 20830:2019 Annex K.2 1st block
/* 7*/ { 0x163, 24, 1, 27, { 0xE7, 0x3E, 0x33, 0x29, 0xE8, 0xFC, }, { 0xA2, 0xA7, 0x68, 0x8A, 0x5F, 0xE6, 0xAA, 0x11, 0xA6, 0x69, 0x4A, 0xCF, 0xCF, 0x20, 0x5D, 0x00, 0x1B, 0x79, 0xA1, 0xFE, 0xB7, 0x94, 0x03, 0x9B } }, // HANXIN ISO/IEC DIS 20830:2019 Annex K.2 2nd block
/* 8*/ { 0x163, 24, 1, 29, { 0x00 }, { 0x00 } }, // HANXIN ISO/IEC DIS 20830:2019 Annex K.2 3rd block
/* 9*/ { 0x25, 6, 1, 16, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4 }, { 14, 7, 23, 3, 23, 15 } }, // MAILMARK Royal Mail Mailmark barcode C encoding and decoding Example 2.3.1
/* 10*/ { 0x25, 6, 1, 16, { 15, 22, 3, 25, 23, 26, 7, 3, 20, 14, 1, 4, 16, 3, 9, 28 }, { 27, 22, 24, 16, 6, 24 } }, // MAILMARK Royal Mail Mailmark barcode C encoding and decoding Example 2.3.2
/* 11*/ { 0x25, 7, 1, 19, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4 }, { 20, 1, 20, 7, 14, 11, 18 } }, // MAILMARK Royal Mail Mailmark barcode L encoding and decoding Example 2.3.1
/* 12*/ { 0x25, 7, 1, 19, { 0, 8, 21, 10, 29, 1, 29, 21, 2, 24, 15, 2, 19, 1, 4, 15, 11, 4, 16 }, { 19, 7, 9, 8, 6, 16, 16 } }, // MAILMARK Royal Mail Mailmark barcode L encoding and decoding Example 2.3.2
/* 13*/ { 0x43, 10, 1, 10, { 4, 13, 63, 1, 24, 9, 59, 3, 15, 4 }, { 50, 2, 42, 51, 53, 34, 22, 20, 5, 16 } }, // MAXICODE Annex H Primary
/* 14*/ { 0x43, 20, 1, 42, { 5, 57, 49, 47, 8, 18, 59, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33 }, { 31, 2, 58, 6, 6, 39, 13, 63, 2, 30, 19, 19, 14, 19, 23, 17, 62, 8, 2, 23 } }, // MAXICODE Annex H Secondary odd
/* 15*/ { 0x43, 20, 1, 42, { 47, 40, 57, 3, 1, 19, 41, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33 }, { 1, 15, 22, 28, 39, 17, 60, 5, 35, 35, 4, 8, 0, 32, 51, 45, 63, 53, 61, 14 } }, // MAXICODE Annex H Secondary even
/* 16*/ { 0x11d, 10, 0, 16, { 0x10, 0x20, 0x0C, 0x56, 0x61, 0x80, 0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11 }, { 0xA5, 0x24, 0xD4, 0xC1, 0xED, 0x36, 0xC7, 0x87, 0x2C, 0x55 } }, // QRCODE Annex I.2
/* 17*/ { 0x11d, 5, 0, 5, { 0x40, 0x18, 0xAC, 0xC3, 0x00 }, { 0x86, 0x0D, 0x22, 0xAE, 0x30 } }, // QRCODE Annex I.3
};
int data_size = ARRAY_SIZE(data);
for (int i = 0; i < data_size; i++) {
rs_t rs;
unsigned char res[1024];
if (index != -1 && i != index) continue;
rs_init_gf(&rs, data[i].prime_poly);
rs_init_code(&rs, data[i].nsym, data[i].index);
rs_encode(&rs, data[i].datalen, data[i].data, res);
//fprintf(stderr, "res "); for (int j = data[i].nsym - 1; j >= 0; j--) fprintf(stderr, "%d ", res[j]); fprintf(stderr, "\n");
//fprintf(stderr, "exp "); for (int j = 0; j < data[i].nsym; j++) fprintf(stderr, "%d ", data[i].expected[j]); fprintf(stderr, "\n");
for (int j = 0; j < data[i].nsym; j++) {
int k = data[i].nsym - 1 - j;
assert_equal(res[k], data[i].expected[j], "i:%d res[%d] %d != expected[%d] %d\n", i, k, res[k], j, data[i].expected[j]);
}
}
testFinish();
}
static void test_encoding_uint(int index) {
testStart("");
struct item {
unsigned int prime_poly;
int logmod;
int nsym;
int index;
int datalen;
unsigned int data[256];
unsigned int expected[256];
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { 0x409, 1023, 4, 1, 7, { 0x3FF, 0x000, 0x100, 0x1FF, 0x3FF, 0x000, 0x123 }, { 229, 153, 993, 674 } },
/* 1*/ { 0x1069, 4095, 4, 1, 7, { 0xFFF, 0x000, 0x700, 0x7FF, 0xFFF, 0x000, 0x123 }, { 3472, 2350, 3494, 575 } },
};
int data_size = ARRAY_SIZE(data);
for (int i = 0; i < data_size; i++) {
rs_uint_t rs_uint;
unsigned int res[1024];
if (index != -1 && i != index) continue;
rs_uint_init_gf(&rs_uint, data[i].prime_poly, data[i].logmod);
rs_uint_init_code(&rs_uint, data[i].nsym, data[i].index);
rs_uint_encode(&rs_uint, data[i].datalen, data[i].data, res);
rs_uint_free(&rs_uint);
//fprintf(stderr, "res "); for (int j = data[i].nsym - 1; j >= 0; j--) fprintf(stderr, "%d ", res[j]); fprintf(stderr, "\n");
//fprintf(stderr, "exp "); for (int j = 0; j < data[i].nsym; j++) fprintf(stderr, "%d ", data[i].expected[j]); fprintf(stderr, "\n");
for (int j = 0; j < data[i].nsym; j++) {
int k = data[i].nsym - 1 - j;
assert_equal(res[k], data[i].expected[j], "i:%d res[%d] %d != expected[%d] %d\n", i, k, res[k], j, data[i].expected[j]);
}
}
testFinish();
}
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
{ "test_generate", test_generate, 0, 1, 0 },
{ "test_encoding", test_encoding, 1, 0, 0 },
{ "test_encoding_uint", test_encoding_uint, 1, 0, 0 },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
testReport();
return 0;
}

View file

@ -115,7 +115,7 @@ static void test_sjis_utf8tomb(int index) {
char *data;
int length;
int ret;
size_t ret_length;
int ret_length;
unsigned int expected_jisdata[20];
char *comment;
};
@ -149,12 +149,12 @@ static void test_sjis_utf8tomb(int index) {
if (index != -1 && i != index) continue;
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
size_t ret_length = length;
int ret_length = length;
ret = sjis_utf8tomb(&symbol, (unsigned char *) data[i].data, &ret_length, jisdata);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol.errtxt);
if (ret == 0) {
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < (int) ret_length; j++) {
assert_equal(jisdata[j], data[i].expected_jisdata[j], "i:%d jisdata[%d] %04X != %04X\n", i, j, jisdata[j], data[i].expected_jisdata[j]);
}
@ -175,7 +175,7 @@ static void test_sjis_utf8tosb(int index) {
char *data;
int length;
int ret;
size_t ret_length;
int ret_length;
unsigned int expected_jisdata[20];
char *comment;
};
@ -215,12 +215,12 @@ static void test_sjis_utf8tosb(int index) {
if (index != -1 && i != index) continue;
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
size_t ret_length = length;
int ret_length = length;
ret = sjis_utf8tosb(data[i].eci, (unsigned char *) data[i].data, &ret_length, jisdata, data[i].full_multibyte);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
if (ret == 0) {
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < (int) ret_length; j++) {
assert_equal(jisdata[j], data[i].expected_jisdata[j], "i:%d jisdata[%d] %04X != %04X\n", i, j, jisdata[j], data[i].expected_jisdata[j]);
}
@ -239,7 +239,7 @@ static void test_sjis_cpy(int index) {
char *data;
int length;
int ret;
size_t ret_length;
int ret_length;
unsigned int expected_jisdata[20];
char *comment;
};
@ -265,10 +265,10 @@ static void test_sjis_cpy(int index) {
if (index != -1 && i != index) continue;
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
size_t ret_length = length;
int ret_length = length;
sjis_cpy((unsigned char *) data[i].data, &ret_length, jisdata, data[i].full_multibyte);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length);
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
for (int j = 0; j < (int) ret_length; j++) {
assert_equal(jisdata[j], data[i].expected_jisdata[j], "i:%d jisdata[%d] %04X != %04X\n", i, j, jisdata[j], data[i].expected_jisdata[j]);
}

View file

@ -622,8 +622,8 @@ static void test_output_options(int index, int debug) {
/* 12*/ { BARCODE_QRCODE, -1, -1, -1, "A123", 0, 21, 21, 21, 42, 42, 0, 0, 6 },
/* 13*/ { BARCODE_QRCODE, -1, 3, -1, "A123", 0, 21, 21, 21, 42, 42, 0, 0, 6 },
/* 14*/ { BARCODE_QRCODE, -1, 3, BARCODE_BIND, "A123", 0, 21, 21, 21, 42, 54, 1, 0, 6 },
/* 15*/ { BARCODE_QRCODE, -1, 3, BARCODE_BIND, "A123", 0, 21, 21, 21, 42, 54, 0, 22, 6 },
/* 16*/ { BARCODE_QRCODE, -1, 3, BARCODE_BOX, "A123", 0, 21, 21, 21, 54, 54, 1, 22, 6 },
/* 15*/ { BARCODE_QRCODE, -1, 3, BARCODE_BIND, "A123", 0, 21, 21, 21, 42, 54, 0, 22, 8 },
/* 16*/ { BARCODE_QRCODE, -1, 3, BARCODE_BOX, "A123", 0, 21, 21, 21, 54, 54, 1, 22, 8 },
/* 17*/ { BARCODE_QRCODE, -1, -1, -1, "A123", 0, 21, 21, 21, 42, 42, 0, 10, 12 },
/* 18*/ { BARCODE_QRCODE, 5, 6, BARCODE_BIND, "A123", 0, 21, 21, 21, 62, 66, 1, 10, 12 },
/* 19*/ { BARCODE_QRCODE, 5, 6, BARCODE_BIND, "A123", 0, 21, 21, 21, 62, 66, 0, 22, 12 },

View file

@ -65,7 +65,7 @@ void testStartReal(const char *func, const char *name) {
}
void testEnd(int result) {
if (testName[0]) {
if (testName && testName[0]) {
printf(".....%d: %s: %s ", tests, testFunc, testName);
} else {
printf(".....%d: %s: ", tests, testFunc);
@ -79,7 +79,7 @@ void testEnd(int result) {
}
void testFinish(void) {
if (testName[0]) {
if (testName && testName[0]) {
printf(".....%d: %s: %s ", tests, testFunc, testName);
} else {
printf(".....%d: %s: ", tests, testFunc);
@ -94,7 +94,7 @@ void testFinish(void) {
void testSkip(const char *msg) {
skipped++;
if (testName[0]) {
if (testName && testName[0]) {
printf(".....%d: %s: %s ", tests, testFunc, testName);
} else {
printf(".....%d: %s: ", tests, testFunc);
@ -486,17 +486,43 @@ const char *testUtilInputModeName(int input_mode) {
}
const char *testUtilOption3Name(int option_3) {
switch (option_3) {
case DM_SQUARE: return "DM_SQUARE";
case DM_DMRE: return "DM_DMRE";
case ZINT_FULL_MULTIBYTE: return "ZINT_FULL_MULTIBYTE";
case ULTRA_COMPRESSION: return "ULTRA_COMPRESSION";
static char buffer[64];
const char *name = NULL;
unsigned int high_byte = option_3 == -1 ? 0 : (option_3 >> 8) & 0xFF;
switch (option_3 & 0xFF) {
case DM_SQUARE:
name = "DM_SQUARE";
break;
case DM_DMRE:
name = "DM_DMRE";
break;
case ZINT_FULL_MULTIBYTE:
name = "ZINT_FULL_MULTIBYTE";
break;
case ULTRA_COMPRESSION:
name = "ULTRA_COMPRESSION";
break;
default:
if (option_3 != -1 && (option_3 & 0xFF) != 0) {
fprintf(stderr, "testUtilOption3Name: unknown value (%d)\n", option_3);
abort();
}
name = (option_3 & 0xFF) ? "-1" : "0";
break;
}
if (option_3 != -1 && option_3 != 0) {
fprintf(stderr, "testUtilOption3Name: unknown value (%d)\n", option_3);
abort();
if (high_byte) {
if (option_3 & 0xFF) {
sprintf(buffer, "%s | (%d << 8)", name, high_byte);
} else {
sprintf(buffer, "%d << 8", high_byte);
}
return buffer;
}
return option_3 ? "-1" : "0";
return name;
}
const char *testUtilOutputOptionsName(int output_options) {
@ -1805,7 +1831,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
{ "databarstackedomnicomposite", BARCODE_DBAR_OMNSTK_CC, 138, 1, 0, 0, 33 /*linear_row_height*/, 1, },
{ "databarexpandedstackedcomposite", BARCODE_DBAR_EXPSTK_CC, 139, 1, 1, 0, 34 /*linear_row_height*/, 1, },
{ "channelcode", BARCODE_CHANNEL, 140, 0, 0, 0, 0, 0, },
{ "codeone", BARCODE_CODEONE, 141, 0, 0, 0, 0, 0, },
{ "codeone", BARCODE_CODEONE, 141, 0, 1, 0, 0, 0, },
{ "", BARCODE_GRIDMATRIX, 142, 0, 0, 0, 0, 0, },
{ "", BARCODE_UPNQR, 143, 0, 0, 0, 0, 0, },
{ "ultracode", BARCODE_ULTRA, 144, 0, 0, 0, 0, 0, },
@ -2237,6 +2263,12 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sformat=compact", strlen(bwipp_opts_buf) ? " " : "");
bwipp_opts = bwipp_opts_buf;
}
} else if (symbology == BARCODE_CODEONE) {
if (option_2 >= 1 && option_2 <= 10) {
static char codeone_versions[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'S', 'T' };
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sversion=%c", strlen(bwipp_opts_buf) ? " " : "", codeone_versions[option_2 - 1]);
bwipp_opts = bwipp_opts_buf;
}
}
}