Skip to content

Commit bae0611

Browse files
committed
Tests: More error tests for various encoders
1 parent 1c9f348 commit bae0611

38 files changed

Lines changed: 571 additions & 16 deletions

tests/ps_tests/auspost.ps.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%
44
% vim: set sw=4 sts=4 et:
55
%
6-
% Copyright (c) 2004-2024 Terry Burton
6+
% Copyright (c) 2004-2026 Terry Burton
77
%
88

99
% https://auspost.com.au/content/dam/auspost_corp/media/documents/customer-barcode-technical-specifications-aug2012.pdf
@@ -71,6 +71,9 @@
7171
{ (621234567890123456789012A) (dontdraw) auspost
7272
} /bwipp.auspostTooLong isError
7373

74+
{ (5912345678A) (custinfoenc=numeric dontdraw) auspost
75+
} /bwipp.auspostInvalidCustinfoDigit isError
76+
7477

7578
% Examples
7679

tests/ps_tests/channelcode.ps.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,13 @@
1010

1111
{ (3493) (dontdraw) channelcode /sbs get
1212
} [ 1 1 1 1 1 1 1 1 1 5 4 1 1 1 2 1 1 1 1 ] debugIsEqual
13+
14+
15+
%
16+
% Error tests
17+
%
18+
19+
{ (1) (dontdraw) channelcode } /bwipp.channelcodeBadLength isError
20+
{ (12345678) (dontdraw) channelcode } /bwipp.channelcodeBadLength isError
21+
{ (12A4) (dontdraw) channelcode } /bwipp.channelcodeBadCharacter isError
22+
{ (7742863) (dontdraw) channelcode } /bwipp.channelcodeTooBig isError

tests/ps_tests/code32.ps.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,13 @@
1010

1111
{ (01234567) (dontdraw) code32 /sbs get
1212
} [ 1 3 1 1 3 1 3 1 1 1 1 1 1 3 3 1 3 1 1 1 3 1 3 1 1 3 1 1 1 1 1 1 3 1 1 1 3 3 1 1 1 1 3 1 1 1 3 3 1 1 1 1 3 1 1 3 1 1 3 1 1 1 1 1 3 3 1 1 3 1 1 3 1 1 3 1 3 1 1 1 ] debugIsEqual
13+
14+
15+
%
16+
% Error tests
17+
%
18+
19+
{ (1234567) (dontdraw) code32 } /bwipp.code32badLength isError
20+
{ (1234567890) (dontdraw) code32 } /bwipp.code32badLength isError
21+
{ (0123456A) (dontdraw) code32 } /bwipp.code32badCharacter isError
22+
{ (012345670) (dontdraw) code32 } /bwipp.code32badCheckDigit isError

tests/ps_tests/code93.ps.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,10 @@
2121

2222
($/+%)
2323
[1 1 1 1 4 1 3 2 1 1 1 1 1 1 2 1 3 1 1 1 3 1 2 1 2 1 1 1 3 1 1 2 1 1 2 2 1 1 1 2 2 2 1 1 1 1 4 1 1] eq_tmpl
24+
25+
26+
%
27+
% Error tests
28+
%
29+
30+
{ (abc) (dontdraw) code93 } /bwipp.code93BadCharacter isError

tests/ps_tests/code93ext.ps.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,10 @@
3030

3131
(CODE^01393) % Figure B1, same
3232
[1 1 1 1 4 1 2 1 1 3 1 1 1 2 1 1 2 2 2 2 1 1 1 2 2 2 1 2 1 1 1 2 1 2 2 1 1 1 1 2 2 2 1 4 1 1 1 1 1 1 1 4 1 1 2 2 1 1 1 2 1 3 1 1 2 1 1 1 1 1 4 1 1] eq_tmpl
33+
34+
35+
%
36+
% Error tests
37+
%
38+
39+
{ (ABC^200) (dontdraw parse) code93ext } /bwipp.code93extbadCharacter isError

tests/ps_tests/databarexpanded.ps.test

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%
44
% vim: set sw=4 sts=4 et:
55
%
6-
% Copyright (c) 2004-2024 Terry Burton
6+
% Copyright (c) 2004-2026 Terry Burton
77
%
88

99
% ISO/IEC 24724:2011
@@ -58,3 +58,20 @@
5858
((01)90012345678908(3103)012233(15)000000) % Encoding method "0111100" prospect but invalid date so encoding method "1"
5959
[1 1 4 2 2 2 1 3 2 1 8 4 1 1 1 2 1 3 5 2 2 1 1 1 4 2 2 1 5 1 1 1 5 6 2 3 1 1 2 4 2 1 3 3 4 1 2 1 1 1 4 3 6 4 1 1 1 2 1 1 2 3 3 4 1 5 1 2 2 3 2 1 1 1 8 2 3 2 2 1 5 1 4 1 1 1 4 1 3 4 1 2 1 3 2 8 1 1 1 1 2 4 1 6 1 1 1 1 1 1 4 1 6 2 1 1 9 2 2 1 1]
6060
eq_tmpl_dontlint
61+
62+
63+
%
64+
% Error tests
65+
%
66+
67+
{ ((01)00012345678905) (format=invalid dontdraw) databarexpanded
68+
} /bwipp.databarexpandedBadFormat isError
69+
70+
{ ((01)00012345678905) (format=expandedstacked segments=3 dontdraw) databarexpanded
71+
} /bwipp.gs1databarexpandedBadSegments isError
72+
73+
{ ((01)00012345678905) (format=expandedstacked segments=24 dontdraw) databarexpanded
74+
} /bwipp.gs1databarexpandedBadSegments isError
75+
76+
{ ((01)00012345678905(10)ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ) (dontdraw dontlint) databarexpanded
77+
} /bwipp.gs1databarexpandedTooLong isError

tests/ps_tests/databarexpandedcomposite.ps.test

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%
44
% vim: set sw=4 sts=4 et:
55
%
6-
% Copyright (c) 2004-2024 Terry Burton
6+
% Copyright (c) 2004-2026 Terry Burton
77
%
88

99
% ISO/IEC 24723:2010
@@ -163,3 +163,11 @@
163163
0 1 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1 1 1 1 1 1 1 1 0 0 0 0 1 0 1 1 0 0 0 1 1 1 0 0 1 1 0 1 1 0 0 1 1 0 1 1 1 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 0 0 0 0 1 0 1 1 1 0 1
164164
0 1 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1 1 1 1 1 1 1 1 0 0 0 0 1 0 1 1 0 0 0 1 1 1 0 0 1 1 0 1 1 0 0 1 1 0 1 1 1 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 0 0 0 0 1 0 1 1 1 0 1
165165
] eq_tmpl
166+
167+
168+
%
169+
% Error tests
170+
%
171+
172+
% Missing composite component (no pipe character)
173+
{ ((01)93712345678904) (dontdraw) databarexpandedcomposite } /bwipp.missingCompositeComponent isError

tests/ps_tests/databarexpandedstacked.ps.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%
44
% vim: set sw=4 sts=4 et:
55
%
6-
% Copyright (c) 2004-2025 Terry Burton
6+
% Copyright (c) 2004-2026 Terry Burton
77
%
88

99
/databarexpandedstacked dup /uk.co.terryburton.bwipp findresource cvx def
@@ -21,6 +21,7 @@
2121
((01)00628176379104(17)500723(10)103) (dontdraw segments=1) /bwipp.gs1databarexpandedBadSegments er_tmpl_opts % Too few
2222
((01)00628176379104(17)500723(10)103) (dontdraw segments=23) /bwipp.gs1databarexpandedBadSegments er_tmpl_opts % Too many
2323
((01)00628176379104(17)500723(10)103) (dontdraw segments=3) /bwipp.gs1databarexpandedBadSegments er_tmpl_opts % Not even
24+
((01)00628176379104(17)500723(10)103) (dontdraw barxmult=33) /bwipp.databarStackedOmniBarXmult er_tmpl_opts % barxmult too small
2425

2526
((01)09521234543213(3103)000123) (dontdraw segments=4)
2627
[

tests/ps_tests/databaromni.ps.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%
44
% vim: set sw=4 sts=4 et:
55
%
6-
% Copyright (c) 2004-2024 Terry Burton
6+
% Copyright (c) 2004-2026 Terry Burton
77
%
88

99
% ISO/IEC 24724:2011
@@ -37,3 +37,6 @@
3737
((01)200123456789) /bwipp.databaromniBadLength er_tmpl
3838
((01)2001234567890A) /bwipp.databaromniBadCharacter er_tmpl
3939
((02)2001234567890) /bwipp.databaromniBadAI er_tmpl
40+
41+
{ ((01)20012345678909) (format=invalid dontdraw) databaromni
42+
} /bwipp.databaromniBadFormat isError

tests/ps_tests/databarstackedomni.ps.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%
44
% vim: set sw=4 sts=4 et:
55
%
6-
% Copyright (c) 2004-2024 Terry Burton
6+
% Copyright (c) 2004-2026 Terry Burton
77
%
88

99
% ISO/IEC 24724:2011
@@ -101,3 +101,6 @@
101101
((01)000345678901) /bwipp.databarstackedomniBadLength er_tmpl
102102
((01)0003456789012A) /bwipp.databarstackedomniBadCharacter er_tmpl
103103
((02)0003456789012) /bwipp.databarstackedomniBadAI er_tmpl
104+
105+
{ ((01)00034567890125) (barxmult=32 dontdraw) databarstackedomni
106+
} /bwipp.databarStackedOmniBarXmult isError

0 commit comments

Comments
 (0)