Skip to content

Commit ab90230

Browse files
author
giraffedata
committed
New stdin tests; test whether output is actually produced
git-svn-id: https://svn.code.sf.net/p/netpbm/code/trunk@4305 9d0c8265-081b-0410-96cb-a4ca84ce46f8
1 parent b8afd46 commit ab90230

25 files changed

+463
-292
lines changed

test/Test-Order

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ stdin-pnm1.test
143143
stdin-pnm2.test
144144
stdin-pam1.test
145145
stdin-pam2.test
146+
stdin-pam3.test
146147

147148
pbm-misc-converters.test
148149

test/stdin-pam1.ok

+41-42
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,41 @@
1-
pamaddnoise -seed=1: 0 0 0
2-
pamaltsat -strength=1: 0 0 0
3-
pambackground: 0 0 0
4-
pambayer -type=2: 0 0 0
5-
pambrighten: 0 0 0
6-
pamcut: 0 0 0
7-
pamdeinterlace: 0 0 0
8-
pamdepth 15: 0 0 0
9-
pamditherbw -threshold: 0 0 0
10-
pamedge: 0 0 0
11-
pamexec cat: 0 0 0
12-
pamfile -size: 0 0 0
13-
pamfind -target=1: 0 0 0
14-
pamfix: 0 0 0
15-
pamflip -lr: 0 0 0
16-
pamfunc -not: 0 0 0
17-
pamhomography -from 0,0,0,1,1,0,1,1: 0 0 0
18-
pamhue -huechange=60: 0 0 0
19-
pamlevels -f1 rgb:0/0/0 -t1 rgb:0/0/0 -f2 rgb:ff/ff/ff -t2 rgb:ff/ff/ff: 0 0 0
20-
pammixinterlace: 0 0 0
21-
pammosaicknit: 0 0 0
22-
pamoil: 0 0 0
23-
pamperspective 0 0 0 1 1 0 1 1: 0 0 0
24-
pamrecolor: 0 0 0
25-
pamrubber -quad 1 1 2 2: 0 0 0
26-
pamscale 2: 0 0 0
27-
pamshadedrelief: 0 0 0
28-
pamsharpness: 0 0 0
29-
pamsistoaglyph: 0 0 0
30-
pamslice -row=1: 0 0 0
31-
pamsplit: 0 0 0
32-
pamstack: 0 0 0
33-
pamstereogram -randomseed=1: 0 0 0
34-
pamstretch 1: 0 0 0
35-
pamstretch-gen 1: 0 0 0
36-
pamsumm -max: 0 0 0
37-
pamsummcol -mean: 0 0 0
38-
pamtable: 0 0 0
39-
pamthreshold: 0 0 0
40-
pamtilt: 0 0 0
41-
pamtopnm: 0 0 0
42-
pamwipeout -tb: 0 0 0
1+
pamaddnoise -seed=1: 0 0 0 0
2+
pamaltsat -strength=1: 0 0 0 0
3+
pambackground: 0 0 0 0
4+
pambayer -type=2: 0 0 0 0
5+
pambrighten: 0 0 0 0
6+
pamcut: 0 0 0 0
7+
pamdeinterlace: 0 0 0 0
8+
pamdepth 15: 0 0 0 0
9+
pamditherbw -threshold: 0 0 0 0
10+
pamedge: 0 0 0 0
11+
pamexec cat: 0 0 0 0
12+
pamfile -size: 0 0 0 0
13+
pamfind -target=1: 0 0 0 0
14+
pamfix: 0 0 0 0
15+
pamflip -lr: 0 0 0 0
16+
pamfunc -not: 0 0 0 0
17+
pamhomography -from 0,0,0,1,1,0,1,1: 0 0 0 0
18+
pamhue -huechange=60: 0 0 0 0
19+
pamlevels -f1 rgb:0/0/0 -t1 rgb:0/0/0 -f2 rgb:ff/ff/ff -t2 rgb:ff/ff/ff: 0 0 0 0
20+
pammixinterlace: 0 0 0 0
21+
pammosaicknit: 0 0 0 0
22+
pamoil: 0 0 0 0
23+
pamperspective 0 0 0 1 1 0 1 1: 0 0 0 0
24+
pamrecolor: 0 0 0 0
25+
pamrubber -quad 1 1 2 2: 0 0 0 0
26+
pamscale 2: 0 0 0 0
27+
pamshadedrelief: 0 0 0 0
28+
pamsharpness: 0 0 0 0
29+
pamsistoaglyph: 0 0 0 0
30+
pamslice -row=1: 0 0 0 0
31+
pamstack: 0 0 0 0
32+
pamstereogram -randomseed=1: 0 0 0 0
33+
pamstretch 1: 0 0 0 0
34+
pamstretch-gen 1: 0 0 0 0
35+
pamsumm -max: 0 0 0 0
36+
pamsummcol -mean: 0 0 0 0
37+
pamtable: 0 0 0 0
38+
pamthreshold: 0 0 0 0
39+
pamtilt: 0 0 0 0
40+
pamtopnm: 0 0 0 0
41+
pamwipeout -tb: 0 0 0 0

test/stdin-pam1.test

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# This script tests: pammixinterlace pammosaicknit pamoil
77
# This script tests: pamperspective pamrecolor pamrubber pamscale
88
# This script tests: pamshadedrelief pamsharpness pamsistoaglyph
9-
# This script tests: pamslice pamsplit pamstack pamstereogram pamstretch
9+
# This script tests: pamslice pamstack pamstereogram pamstretch
1010
# This script tests: pamstretch-gen pamsumm pamsummcol pamtable pamthreshold
1111
# This script tests: pamtilt pamtopnm pamwipeout
1212
# Also requires: pbmmake
@@ -49,7 +49,6 @@ for testprog in \
4949
pamsharpness \
5050
pamsistoaglyph \
5151
"pamslice -row=1" \
52-
pamsplit \
5352
pamstack \
5453
"pamstereogram -randomseed=1" \
5554
"pamstretch 1" \
@@ -60,12 +59,13 @@ for testprog in \
6059
pamthreshold \
6160
pamtilt \
6261
pamtopnm \
63-
"pamwipeout -tb"
62+
"pamwipeout -tb"
6463
do
6564
${testprog} ${small_pbm} > ${out1}; status1=$?
6665
${testprog} < ${small_pbm} > ${out2}; status2=$?
66+
test -s ${out1}; status3=$?
6767
cmp -s ${out1} ${out2}
68-
echo ${testprog}": "${status1} ${status2} $?
68+
echo ${testprog}": "${status1} ${status2} ${status3} $?
6969
rm ${out1} ${out2}
7070
done
7171

test/stdin-pam2.ok

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
pammasksharpen: 0 0 0
2-
pammixmulti: 0 0 0
3-
pamdice: 0 0 0
4-
pamlookup: 0 0 0
5-
pamunlookup: 0 0 0
1+
pammasksharpen: 0 0 0 0
2+
pammixmulti: 0 0 0 0
3+
pamdice: 0 0 0 0
4+
pamlookup: 0 0 0 0
5+
pamunlookup: 0 0 0 0

test/stdin-pam2.test

+13-6
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,27 @@ for testprog in \
1818
do
1919
${testprog} ${small_pbm} ${small_pbm} > ${out1}; status1=$?
2020
${testprog} ${small_pbm} < ${small_pbm} > ${out2}; status2=$?
21+
test -s ${out1}; status3=$?
2122
cmp -s ${out1} ${out2}
22-
echo ${testprog}": "${status1} ${status2} $?
23+
echo ${testprog}": "${status1} ${status2} ${status3} $?
2324
rm ${out1} ${out2}
24-
done
25+
done
26+
2527

2628
dicestem=${tmpdir}/dice
2729

2830
testprog="pamdice -outstem=${dicestem}"
29-
${testprog} ${small_pbm}; status1=$?
31+
${testprog} ${small_pbm}; status1=$?
3032
cat ${dicestem}_*_*.pbm > ${out1}
3133
rm ${dicestem}_*_*.pbm
3234
${testprog} < ${small_pbm}; status2=$?
3335
cat ${dicestem}_*_*.pbm > ${out2}
3436
rm ${dicestem}_*_*.pbm
37+
test -s ${out1}; status3=$?
3538
cmp -s ${out1} ${out2}
36-
echo pamdice: ${status1} ${status2} $?
39+
echo pamdice: ${status1} ${status2} ${status3} $?
40+
# Do not use testprog, which contains a variable, in the above
41+
# Same for pamlookup, pamunlookup
3742
rm ${out1} ${out2}
3843

3944
lookup_ppm=${tmpdir}/lookup.ppm
@@ -49,15 +54,17 @@ EOF
4954
testprog="pamlookup -lookupfile=${lookup_ppm}"
5055
${testprog} ${small_pbm} > ${out1}; status1=$?
5156
${testprog} < ${small_pbm} > ${out2}; status2=$?
57+
test -s ${out1}; status3=$?
5258
cmp -s ${out1} ${out2}
53-
echo pamlookup": "${status1} ${status2} $?
59+
echo pamlookup": "${status1} ${status2} ${status3} $?
5460
rm ${out2}
5561

5662
testprog="pamunlookup -lookupfile=${lookup_ppm}"
5763
${testprog} ${out1} > ${out3}; status1=$?
5864
${testprog} < ${out1} > ${out4}; status2=$?
65+
test -s ${out1}; status3=$?
5966
cmp -s ${out3} ${out4}
60-
echo pamunlookup": "${status1} ${status2} $?
67+
echo pamunlookup": "${status1} ${status2} ${status3} $?
6168
rm ${out1} ${out3} ${out4}
6269

6370
rm ${lookup_ppm} ${small_pbm}

test/stdin-pam3.ok

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Test. Should print (command): 0 0 0 0
2+
The following are exceptions: should print (command): 0 0 0 1
3+
pamtotga, pamtotiff
4+
5+
pamtoavs: 0 0 0 0
6+
avstopam: 0 0 0 0
7+
pamtohdiff: 0 0 0 0
8+
hdifftopam: 0 0 0 0
9+
pamtojpeg2k: 0 0 0 0
10+
jpeg2ktopam: 0 0 0 0
11+
pamtopdbimg -fixedtime: 0 0 0 0
12+
pdbimgtopam: 0 0 0 0
13+
pamtopfm: 0 0 0 0
14+
pfmtopam: 0 0 0 0
15+
pamtopng: 0 0 0 0
16+
pngtopam: 0 0 0 0
17+
pamtosrf: 0 0 0 0
18+
srftopam: 0 0 0 0
19+
pamtosvg: 0 0 0 0
20+
svgtopam: 0 0 0 0
21+
pamtowinicon: 0 0 0 0
22+
winicontopam: 0 0 0 0
23+
pamtotga: 0 0 0 1
24+
tgatoppm: 0 0 0 0
25+
pamtoxvmini: 0 0 0 0
26+
xvminitoppm: 0 0 0 0
27+
pamtofits: 0 0 0 0
28+
fitstopnm: 0 0 0 0
29+
pamtogif: 0 0 0 0
30+
giftopnm: 0 0 0 0
31+
pamtotiff: 0 0 0 1
32+
tifftopnm: 0 0 0 0

test/stdin-pam3.test

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#! /bin/sh
2+
# This script tests: pamtoavs avstopam
3+
# This script tests: pamtohdiff hdifftopam
4+
# This script tests: pamtojpeg2k jpeg2ktopam
5+
# This script tests: pamtopdbimg pdbimgtopam
6+
# This script tests: pamtopfm pfmtopam
7+
# This script tests: pamtopng pngtopam
8+
# This script tests: pamtosrf srftopam
9+
# This script tests: pamtosvg svgtopam
10+
# This script tests: pamtowinicon winicontopam
11+
# This script tests: pamtotga tgatoppm
12+
# This script tests: pamtoxvmini xvminitoppm
13+
# This script tests: pamtofits fitstopnm
14+
# This script tests: pamtogif giftopnm
15+
# This script tests: pamtotiff tifftopnm
16+
# Also requires: pgmmake
17+
18+
tmpdir=${tmpdir:-/tmp}
19+
test_pgm=${tmpdir}/test.ppm
20+
out1=${tmpdir}/out1
21+
out2=${tmpdir}/out2
22+
out3=${tmpdir}/out3
23+
out4=${tmpdir}/out4
24+
25+
pgmmake -maxval 3 0.25 32 32 > ${test_pgm}
26+
27+
echo "Test. Should print (command): 0 0 0 0"
28+
echo "The following are exceptions: should print (command): 0 0 0 1"
29+
echo "pamtotga, pamtotiff"
30+
echo
31+
32+
for fmt in \
33+
avs \
34+
hdiff \
35+
jpeg2k \
36+
pdbimg \
37+
pfm \
38+
png \
39+
srf \
40+
svg \
41+
winicon \
42+
tga \
43+
xvmini \
44+
fits \
45+
gif \
46+
tiff
47+
do
48+
49+
if [ ${fmt} = pdbimg ]
50+
then testprog1="pamtopdbimg -fixedtime";
51+
else testprog1="pamto"${fmt};
52+
fi
53+
54+
case $fmt in
55+
"tga" | "xvmini") testprog2=${fmt}"toppm";;
56+
"fits" | "gif" | "tiff") testprog2=${fmt}"topnm";;
57+
*) testprog2=${fmt}"topam";
58+
esac
59+
60+
${testprog1} ${test_pgm} > ${out1}; status1=$?
61+
${testprog1} < ${test_pgm} > ${out2}; status2=$?
62+
test -s ${out1}; status3=$?
63+
cmp -s ${out1} ${out2}
64+
echo ${testprog1}": "${status1} ${status2} ${status3} $?
65+
66+
${testprog2} ${out1} > ${out3}; status4=$?
67+
${testprog2} < ${out1} > ${out4}; status5=$?
68+
test -s ${out3}; status6=$?
69+
cmp -s ${out3} ${out4}
70+
echo ${testprog2}": "${status4} ${status5} ${status6} $?
71+
done
72+
73+
rm ${test_pgm}

test/stdin-pbm1.ok

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
pbmclean: 0 0 0
2-
pbmlife: 0 0 0
3-
pbmmask: 0 0 0
4-
pbmminkowski: 0 0 0
5-
pbmtoepsi: 0 0 0
6-
pbmtopsg3: 0 0 0
7-
pbmpscale 1 : 0 0 0
8-
pbmreduce -threshold 2 : 0 0 0
9-
pbmtopgm 2 2 : 0 0 0
1+
pbmclean: 0 0 0 0
2+
pbmlife: 0 0 0 0
3+
pbmmask: 0 0 0 0
4+
pbmminkowski: 0 0 0 0
5+
pbmtoepsi: 0 0 0 0
6+
pbmtopsg3: 0 0 0 0
7+
pbmpscale 1 : 0 0 0 0
8+
pbmreduce -threshold 2 : 0 0 0 0
9+
pbmtopgm 2 2 : 0 0 0 0

test/stdin-pbm1.test

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ for testprog in \
2929
do
3030
${testprog} ${small_pbm} > ${out1}; status1=$?
3131
${testprog} < ${small_pbm} > ${out2}; status2=$?
32+
test -s ${out1}; status3=$?
3233
cmp -s ${out1} ${out2}
33-
echo ${testprog}": "${status1} ${status2} $?
34+
echo ${testprog}": "${status1} ${status2} ${status3} $?
35+
rm ${out1} ${out2}
3436
done
3537

3638
rm ${small_pbm}
3739

3840
# For Pbm converters not tested here see pbm-misc-converters.test
3941

40-
# These programs do not have a converter in the opposite direction:
42+
# These programs do not have a converter in the opposite direction:
4143
# Brushtopbm
4244
# Ddbugtopbm
4345
# Thinkjettopbm (?)

test/stdin-pbm2.ok

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
pbmtoatk: 0 0 0
2-
atktopbm: 0 0 0
3-
pbmtocis: 0 0 0
4-
cistopbm: 0 0 0
5-
pbmtocmuwm: 0 0 0
6-
cmuwmtopbm: 0 0 0
7-
pbmtoescp2: 0 0 0
8-
escp2topbm: 0 0 0
9-
pbmtog3: 0 0 0
10-
g3topbm: 0 0 0
11-
pbmtogem: 0 0 0
12-
gemtopnm: 0 0 0
13-
pbmtomacp: 0 0 0
14-
macptopbm: 0 0 0
15-
pbmtomda: 0 0 0
16-
mdatopbm: 0 0 0
17-
pbmtomgr: 0 0 0
18-
mgrtopbm: 0 0 0
19-
pbmtomrf: 0 0 0
20-
mrftopbm: 0 0 0
21-
pbmtopi3: 0 0 0
22-
pi3topbm: 0 0 0
23-
pbmtosunicon: 0 0 0
24-
sunicontopnm: 0 0 0
25-
pbmtowbmp: 0 0 0
26-
wbmptopbm: 0 0 0
27-
pbmtoybm: 0 0 0
28-
ybmtopbm: 0 0 0
1+
pbmtoatk: 0 0 0 0
2+
atktopbm: 0 0 0 0
3+
pbmtocis: 0 0 0 0
4+
cistopbm: 0 0 0 0
5+
pbmtocmuwm: 0 0 0 0
6+
cmuwmtopbm: 0 0 0 0
7+
pbmtoescp2: 0 0 0 0
8+
escp2topbm: 0 0 0 0
9+
pbmtog3: 0 0 0 0
10+
g3topbm: 0 0 0 0
11+
pbmtogem: 0 0 0 0
12+
gemtopnm: 0 0 0 0
13+
pbmtomacp: 0 0 0 0
14+
macptopbm: 0 0 0 0
15+
pbmtomda: 0 0 0 0
16+
mdatopbm: 0 0 0 0
17+
pbmtomgr: 0 0 0 0
18+
mgrtopbm: 0 0 0 0
19+
pbmtomrf: 0 0 0 0
20+
mrftopbm: 0 0 0 0
21+
pbmtopi3: 0 0 0 0
22+
pi3topbm: 0 0 0 0
23+
pbmtosunicon: 0 0 0 0
24+
sunicontopnm: 0 0 0 0
25+
pbmtowbmp: 0 0 0 0
26+
wbmptopbm: 0 0 0 0
27+
pbmtoybm: 0 0 0 0
28+
ybmtopbm: 0 0 0 0

0 commit comments

Comments
 (0)