Skip to content

Commit 052265b

Browse files
author
giraffedata
committed
new tests for pnmindex, pnmpad
git-svn-id: https://svn.code.sf.net/p/netpbm/code/trunk@4807 9d0c8265-081b-0410-96cb-a4ca84ce46f8
1 parent 82e7e43 commit 052265b

15 files changed

+1695
-3
lines changed

test/Test-Order

+9-1
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,13 @@ pnminvert.test
8989
pamchannel.test
9090
ppmchange.test
9191
pambackground.test
92+
9293
pnmpad-reportonly.test
93-
pnmpaste-pbm.test
94+
pnmpad-flip.test
95+
pnmpad-extend-enlarge.test
96+
pnmpad-pnmmargin.test
97+
pnmpad-format.test
98+
pnmpad-color.test
9499

95100
pamrestack.test
96101
pamshuffle.test
@@ -113,6 +118,8 @@ ppmdim.test
113118
pnmshear.test
114119
pgmbentley.test
115120

121+
pnmindex.test
122+
116123
pamfunc.test
117124
pamarith.test
118125
pamarith-compare-equal.test
@@ -275,3 +282,4 @@ jpeg-roundtrip.test
275282
lps-roundtrip.test
276283
tiffcmyk-roundtrip.test
277284
yuv-roundtrip.test
285+

test/pnmindex.test

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#! /bin/sh
2+
# This script tests: pnmindex
3+
# Also requires:
4+
5+
pnmindex maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm | cksum
6+
7+
pnmindex -white -noquant maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm | cksum
8+
9+
pnmindex -black maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm | cksum
10+
11+
pnmindex -size 20 -accross=3 testgrid.pbm testgrid.pbm testgrid.pbm \
12+
testgrid.pbm testgrid.pbm testgrid.pbm | cksum
13+
14+
echo "Test Invalid"
15+
16+
test_out=${tmpdir}/test_out
17+
n=1
18+
19+
# define function
20+
invcmd $1 > ${test_out} || \
21+
printf "Expected failure $n "
22+
test -s ${test_out} && echo "unexpected output" || echo "(no output)"
23+
rm -f ${test_out}
24+
n=$(($n +1)); }
25+
26+
echo 1>&2
27+
echo "Invalid command-line arguments." 1>&2
28+
echo "Error messages should appear below the line." 1>&2
29+
echo "-----------------------------------------------------------" 1>&2
30+
31+
invcmd "pnmindex -size -1 testgrid.pbm"
32+
invcmd "pnmindex -size 0 testgrid.pbm"
33+
invcmd "pnmindex -size testgrid.pbm"
34+
invcmd "pnmindex -across -1 testgrid.pbm"
35+
invcmd "pnmindex -across 0 testgrid.pbm"
36+
invcmd "pnmindex -across testgrid.pbm"
37+
invcmd "pnmindex -quant -1 testgrid.pbm"
38+
invcmd "pnmindex -quant 0 testgrid.pbm"
39+
invcmd "pnmindex testgrid.pbm /dev/null"

test/pnmpad-color.ok

+222
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
Test 1. PBM white infile
2+
Should print match seven times
3+
match
4+
match
5+
match
6+
match
7+
match
8+
match
9+
match
10+
Should print match seven times
11+
match
12+
match
13+
match
14+
match
15+
match
16+
match
17+
match
18+
Should print match once
19+
match
20+
Should print match once
21+
match
22+
Should print match twice
23+
match
24+
match
25+
Should print match twice
26+
match
27+
match
28+
Should print match once
29+
match
30+
Should print match twice
31+
match
32+
match
33+
34+
Test 2. PBM black infile
35+
Should print match nine times
36+
match
37+
match
38+
match
39+
match
40+
match
41+
match
42+
match
43+
match
44+
match
45+
Should print match five times
46+
match
47+
match
48+
match
49+
match
50+
match
51+
52+
Test 3. PGM maxval 127 infile
53+
Should print match five times
54+
match
55+
match
56+
match
57+
match
58+
match
59+
Should print match four times
60+
match
61+
match
62+
match
63+
match
64+
Should print match twice
65+
match
66+
match
67+
Should print match twice
68+
match
69+
match
70+
Should print match twice
71+
match
72+
match
73+
Should print match once
74+
match
75+
Should print match twice
76+
match
77+
match
78+
Should print match twice
79+
match
80+
match
81+
Should print match once
82+
match
83+
Should print match twice
84+
match
85+
match
86+
87+
Test 4. PGM maxval 255 infile
88+
Should print match five times
89+
match
90+
match
91+
match
92+
match
93+
match
94+
Should print match four times
95+
match
96+
match
97+
match
98+
match
99+
Should print match twice
100+
match
101+
match
102+
Should print match twice
103+
match
104+
match
105+
Should print match twice
106+
match
107+
match
108+
Should print match once
109+
match
110+
Should print match four times
111+
match
112+
match
113+
match
114+
match
115+
Should print match four times
116+
match
117+
match
118+
match
119+
match
120+
Should print match three times
121+
match
122+
match
123+
match
124+
125+
Test 5. PGM maxval 511 infile
126+
Should print match five times
127+
match
128+
match
129+
match
130+
match
131+
match
132+
Should print match four times
133+
match
134+
match
135+
match
136+
match
137+
Should print match twice
138+
match
139+
match
140+
Should print match twice
141+
match
142+
match
143+
Should print match twice
144+
match
145+
match
146+
Should print match once
147+
match
148+
Should print match twice
149+
match
150+
match
151+
Should print match twice
152+
match
153+
match
154+
Should print match three times
155+
match
156+
match
157+
match
158+
159+
Test 6. PPM maxval 127 infile
160+
Should print match five times
161+
match
162+
match
163+
match
164+
match
165+
match
166+
Should print match four times
167+
match
168+
match
169+
match
170+
match
171+
Should print match twice
172+
match
173+
match
174+
Should print match twice
175+
match
176+
match
177+
Should print match twice
178+
match
179+
match
180+
Should print match once
181+
match
182+
Should print match twice
183+
match
184+
match
185+
Should print match twice
186+
match
187+
match
188+
Should print match twice
189+
match
190+
match
191+
192+
Test 7. PPM maxval 511 infile
193+
Should print match five times
194+
match
195+
match
196+
match
197+
match
198+
match
199+
Should print match four times
200+
match
201+
match
202+
match
203+
match
204+
Should print match six times
205+
match
206+
match
207+
match
208+
match
209+
match
210+
match
211+
Should print match twice
212+
match
213+
match
214+
Should print match twice
215+
match
216+
match
217+
Should print match twice
218+
match
219+
match
220+
Should print match twice
221+
match
222+
match

0 commit comments

Comments
 (0)