diff options
Diffstat (limited to 'test')
140 files changed, 2432 insertions, 1331 deletions
diff --git a/test/Test-Order b/test/Test-Order index 16eeaf8e..05742ac0 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -27,6 +27,8 @@ pamcrater.test ppmpat.test ppmforge-parameters.test +pamstereogram.test + # Generators with random components pbmnoise1.test @@ -37,6 +39,7 @@ pgmnoise-parameters.test ppmpat-random.test ppmforge.test ppmrough.test +ppmrough-parameters.test # Analyzer tests @@ -134,6 +137,10 @@ pnmcrop-blank.test ppmmix.test pammixmulti-identity.test +pamaddnoise-parameters.test + +pamstack.test + # Symmetry test symmetry.test @@ -158,14 +165,18 @@ pbm-misc-converters.test # Format converter tests pamtopdbimg.test +pamtosvg.test pbmtog3.test ppmtoapplevol.test +ppmtomitsu.test 411toppm.test eyuvtoppm.test rawtoppm.test gif-transparent1.test +pnmtojpeg-scans.test + # Miscellaneous utility tests ppmdfont.test @@ -255,6 +266,7 @@ xbm-roundtrip.test xpm-roundtrip.test xv-roundtrip.test xwd-roundtrip.test +ybm-roundtrip.test # Round-trip tests : lossy converters diff --git a/test/cis-roundtrip.ok b/test/cis-roundtrip.ok index 1bb50cb7..8cac8da6 100644 --- a/test/cis-roundtrip.ok +++ b/test/cis-roundtrip.ok @@ -1,5 +1,8 @@ Test 1. Should print 2631579683 1546 twice 2631579683 1546 2631579683 1546 -Test 2. Should print 281226646 481, cksum of maze.pbm +Test 2. Should print 281226646 481, cksum of maze.pbm four times +281226646 481 +281226646 481 +281226646 481 281226646 481 diff --git a/test/cis-roundtrip.test b/test/cis-roundtrip.test index ad34173e..3316868c 100755 --- a/test/cis-roundtrip.test +++ b/test/cis-roundtrip.test @@ -1,6 +1,6 @@ #! /bin/sh # This script tests: pbmtocis cistopbm -# Also requires: pbmmake pamcut pamfile +# Also requires: pbmmake pamcut pamfile pnmcrop tmpdir=${tmpdir:-/tmp} test_pbm=${tmpdir}/test.pbm @@ -13,8 +13,11 @@ echo "Test 1. Should print 2631579683 1546 twice" pbmmake -g 128 96 | tee ${test_pbm} | cksum pbmtocis ${test_pbm} | cistopbm | cksum -echo "Test 2. Should print 281226646 481, cksum of maze.pbm" -size=$(pamfile -size maze.pbm | awk '{print "-width="$1,"-height="$2}') -pbmtocis maze.pbm | cistopbm | pamcut -left=0 -top=0 ${size} | cksum +rm ${test_pbm} -rm ${test_pbm} \ No newline at end of file +echo "Test 2. Should print 281226646 481, cksum of maze.pbm four times" +size=$(pamfile -size maze.pbm | awk '{print "-width="$1,"-height="$2}') +pbmtocis maze.pbm | cistopbm | pamcut -left=0 -top=0 ${size} | cksum +pbmtocis -i maze.pbm | cistopbm -i | pamcut -left=0 -top=0 ${size} | cksum +pbmtocis maze.pbm | cistopbm | pnmcrop -black -right -bottom | cksum +pbmtocis -w maze.pbm | cistopbm | pnmcrop -white -right -bottom | cksum diff --git a/test/pamaddnoise-parameters.ok b/test/pamaddnoise-parameters.ok new file mode 100644 index 00000000..e86632cf --- /dev/null +++ b/test/pamaddnoise-parameters.ok @@ -0,0 +1,62 @@ +Test Invalid +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) +Expected failure 12 (no output) +Expected failure 13 (no output) +Expected failure 14 (no output) +Expected failure 15 (no output) +Expected failure 16 (no output) +Expected failure 17 (no output) +Expected failure 18 (no output) +Expected failure 19 (no output) +Expected failure 20 (no output) +Expected failure 21 (no output) +Expected failure 22 (no output) +Expected failure 23 (no output) +Expected failure 24 (no output) +Expected failure 25 (no output) +Expected failure 26 (no output) +Expected failure 27 (no output) +Expected failure 28 (no output) +Expected failure 29 (no output) +Expected failure 30 (no output) +Expected failure 31 (no output) +Expected failure 32 (no output) +Expected failure 33 (no output) +Expected failure 34 (no output) +Expected failure 35 (no output) +Expected failure 36 (no output) +Expected failure 37 (no output) +Expected failure 38 (no output) +Expected failure 39 (no output) +Expected failure 40 (no output) +Expected failure 41 (no output) +Expected failure 42 (no output) +Expected failure 43 (no output) +Expected failure 44 (no output) +Expected failure 45 (no output) +Expected failure 46 (no output) +Expected failure 47 (no output) +Expected failure 48 (no output) +Expected failure 49 (no output) +Expected failure 50 (no output) +Expected failure 51 (no output) +Expected failure 52 (no output) +Expected failure 53 (no output) +Expected failure 54 (no output) +Expected failure 55 (no output) +Expected failure 56 (no output) +Expected failure 57 (no output) +Expected failure 58 (no output) +Expected failure 59 (no output) +Expected failure 60 (no output) +Expected failure 61 (no output) diff --git a/test/pamaddnoise-parameters.test b/test/pamaddnoise-parameters.test new file mode 100755 index 00000000..098d4946 --- /dev/null +++ b/test/pamaddnoise-parameters.test @@ -0,0 +1,337 @@ +#! /bin/sh +# This script tests: pamaddnoise +# Also requires: + +tmpdir=${tmpdir:-/tmp} +test_out=/${tmpdir}/test.out + +# Test Invalid +echo "Test Invalid" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +# type gaussian implied + +pamaddnoise -sigma1=-4.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -sigma2=-20.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -mgsigma=0.5 testgrid.pbm > ${test_out} || \ + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -lsigma=10.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -tolerance=0.10 testgrid.pbm > ${test_out} || \ + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -salt=0.50 testgrid.pbm > ${test_out} || \ + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -lambda=12.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +# type gaussian explicitly stated + +pamaddnoise -type gaussian -sigma1=-0.01 testgrid.pbm > ${test_out} || \ + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type gaussian -sigma2=-0.01 testgrid.pbm > ${test_out} || \ + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type gaussian -mgsigma=0.5 testgrid.pbm > ${test_out} || \ + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type gaussian -lsigma=10.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type gaussian -tolerance=0.10 testgrid.pbm > ${test_out} || \ + printf "Expected failure 12 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type gaussian -salt=0.50 testgrid.pbm > ${test_out} || \ + printf "Expected failure 13 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type gaussian -lambda=12.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 14 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +# type multiplicative gaussian + +pamaddnoise -type multiplicative_gaussian -sigma1=4.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 15 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type multiplicative_gaussian -sigma2=20.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 16 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type multiplicative_gaussian -mgsigma=-0.5 testgrid.pbm > ${test_out} || \ + printf "Expected failure 17 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type multiplicative_gaussian -lsigma=10.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 18 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type multiplicative_gaussian -tolerance=0.10 testgrid.pbm > ${test_out} || \ + printf "Expected failure 19 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type multiplicative_gaussian -salt=0.50 testgrid.pbm > ${test_out} || \ + printf "Expected failure 20 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type multiplicative_gaussian -lambda=12.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 21 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +# type laplacian + +pamaddnoise -type laplacian -sigma1=4.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 22 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type laplacian -sigma2=20.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 23 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type laplacian -mgsigma=0.5 testgrid.pbm > ${test_out} || \ + printf "Expected failure 24 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type laplacian -lsigma=-10.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 25 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type laplacian -tolerance=0.10 testgrid.pbm > ${test_out} || \ + printf "Expected failure 26 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type laplacian -salt=0.50 testgrid.pbm > ${test_out} || \ + printf "Expected failure 27 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type laplacian -lambda=12.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 28 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + + +# type impulse + +pamaddnoise -type impulse -sigma1=4.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 29 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impulse -sigma2=20.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 30 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impulse -mgsigma=0.5 testgrid.pbm > ${test_out} || \ + printf "Expected failure 31 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impulse -lsigma=10.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 32 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impulse -tolerance=-0.10 testgrid.pbm > ${test_out} || \ + printf "Expected failure 33 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impulse -tolerance=1.10 testgrid.pbm > ${test_out} || \ + printf "Expected failure 34 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impulse -salt=-0.10 testgrid.pbm > ${test_out} || \ + printf "Expected failure 35 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impulse -salt=+1.10 testgrid.pbm > ${test_out} || \ + printf "Expected failure 36 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impulse -lambda=12.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 37 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +# type poisson + +pamaddnoise -type poisson -sigma1=4.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 38 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type poisson -sigma2=20.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 39 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type poisson -mgsigma=0.5 testgrid.pbm > ${test_out} || \ + printf "Expected failure 40 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type poisson -lsigma=10.0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 41 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type poisson -tolerance=0.10 testgrid.pbm > ${test_out} || \ + printf "Expected failure 42 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type poisson -salt=0.50 testgrid.pbm > ${test_out} || \ + printf "Expected failure 43 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type poisson -lambda=0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 44 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +# Missing or invalid numerical parameters + +pamaddnoise -sigma1 testgrid.pbm > ${test_out} || \ + printf "Expected failure 45 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -sigma1 Z testgrid.pbm > ${test_out} || \ + printf "Expected failure 46 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type gaussian -sigma2 testgrid.pbm > ${test_out} || \ + printf "Expected failure 47 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type gaussian -sigma2 sigma testgrid.pbm > ${test_out} || \ + printf "Expected failure 48 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type mult -mgsigma testgrid.pbm > ${test_out} || \ + printf "Expected failure 49 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type mult -mgsigma 10,0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 50 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type lapl -lsigma 1..0 testgrid.pbm > ${test_out} || \ + printf "Expected failure 51 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type lapl -lsigma lsigma testgrid.pbm > ${test_out} || \ + printf "Expected failure 52 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impul -tolerance testgrid.pbm > ${test_out} || \ + printf "Expected failure 53 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impul -tolerance t testgrid.pbm > ${test_out} || \ + printf "Expected failure 54 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impul -salt testgrid.pbm > ${test_out} || \ + printf "Expected failure 55 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type impul -salt pepper testgrid.pbm > ${test_out} || \ + printf "Expected failure 56 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type pois -lambda testgrid.pbm > ${test_out} || \ + printf "Expected failure 57 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -type pois -lambda L testgrid.pbm > ${test_out} || \ + printf "Expected failure 58 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -seed -1 testgrid.pbm > ${test_out} || \ + printf "Expected failure 59 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamaddnoise -seed random testgrid.pbm > ${test_out} || \ + printf "Expected failure 60 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + + +# no type specified + +pamaddnoise -type testgrid.pbm > ${test_out} || \ + printf "Expected failure 61 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} diff --git a/test/pamarith.ok b/test/pamarith.ok index c2d34dea..a0942fb8 100644 --- a/test/pamarith.ok +++ b/test/pamarith.ok @@ -233,45 +233,45 @@ Prints 2247801875 481 three times, then 320101399 59 three times -xor 320101399 59 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 10 1 -Expected failure 11 1 -Expected failure 12 1 -Expected failure 13 1 -Expected failure 14 1 -Expected failure 15 1 -Expected failure 16 1 -Expected failure 17 1 -Expected failure 18 1 -Expected failure 19 1 -Expected failure 20 1 -Expected failure 21 1 -Expected failure 22 1 -Expected failure 23 1 -Expected failure 24 1 -Expected failure 25 1 -Expected failure 26 1 -Expected failure 27 1 -Expected failure 28 1 -Expected failure 29 1 -Expected failure 30 1 -Expected failure 31 1 -Expected failure 32 1 -Expected failure 33 1 -Expected failure 34 1 -Expected failure 35 1 -Expected failure 36 1 -Expected failure 37 1 -Expected failure 38 1 -Expected failure 39 1 -Expected failure 40 1 -Expected failure 41 1 -Expected failure 42 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) +Expected failure 12 (no output) +Expected failure 13 (no output) +Expected failure 14 (no output) +Expected failure 15 (no output) +Expected failure 16 (no output) +Expected failure 17 (no output) +Expected failure 18 (no output) +Expected failure 19 (no output) +Expected failure 20 (no output) +Expected failure 21 (no output) +Expected failure 22 (no output) +Expected failure 23 (no output) +Expected failure 24 (no output) +Expected failure 25 (no output) +Expected failure 26 (no output) +Expected failure 27 (no output) +Expected failure 28 (no output) +Expected failure 29 (no output) +Expected failure 30 (no output) +Expected failure 31 (no output) +Expected failure 32 (no output) +Expected failure 33 (no output) +Expected failure 34 (no output) +Expected failure 35 (no output) +Expected failure 36 (no output) +Expected failure 37 (no output) +Expected failure 38 (no output) +Expected failure 39 (no output) +Expected failure 40 (no output) +Expected failure 41 (no output) +Expected failure 42 (no output) diff --git a/test/pamarith.test b/test/pamarith.test index 061f9488..03ce7317 100755 --- a/test/pamarith.test +++ b/test/pamarith.test @@ -127,130 +127,130 @@ test_out=${tmpdir}/test_out # multiple functions pamarith -add -subtract testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -multiply -divide testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -difference -minimum testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -maximum -mean testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -compare -and testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -compare -equal testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -or -nand testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -nor -xor testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -shiftleft -shiftright testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # -add does not take a value pamarith -add=1 testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # No function pamarith -plain testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 11" - test -s ${test_out}; echo " "$? + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 12" - test -s ${test_out}; echo " "$? + printf "Expected failure 12 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # Just one input image file pamarith -add testimg.ppm > ${test_out} || \ - printf "Expected failure 13" - test -s ${test_out}; echo " "$? + printf "Expected failure 13 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # No input image file pamarith -add > ${test_out} || \ - printf "Expected failure 14" - test -s ${test_out}; echo " "$? + printf "Expected failure 14 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # Input images with different depth (number of planes) pamchannel -infile testimg.ppm 0 1 | \ pamarith -add testimg.ppm - > ${test_out} || \ - printf "Expected failure 15" - test -s ${test_out}; echo " "$? + printf "Expected failure 15 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # Input images with different x/y dimensions pamarith -add testimg.ppm testgrid.pbm > ${test_out} || \ - printf "Expected failure 16" - test -s ${test_out}; echo " "$? + printf "Expected failure 16 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamenlarge -xscale=2 testgrid.pbm | \ pamarith -add testgrid.pbm - > ${test_out} || \ - printf "Expected failure 17" - test -s ${test_out}; echo " "$? + printf "Expected failure 17 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamenlarge -yscale=3 testgrid.pbm | \ pamarith -add testgrid.pbm - > ${test_out} || \ - printf "Expected failure 18" - test -s ${test_out}; echo " "$? + printf "Expected failure 18 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # Invalid usage of -closeness pamarith -equal -closeness=100.1 testgrid.pbm > ${test_out} || \ - printf "Expected failure 19" - test -s ${test_out}; echo " "$? + printf "Expected failure 19 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -equal -closeness=-10 testgrid.pbm > ${test_out} || \ - printf "Expected failure 20" - test -s ${test_out}; echo " "$? + printf "Expected failure 20 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -closeness -equal testgrid.pbm > ${test_out} || \ - printf "Expected failure 21" - test -s ${test_out}; echo " "$? + printf "Expected failure 21 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -compare -closeness=10 testgrid.pbm > ${test_out} || \ - printf "Expected failure 22" - test -s ${test_out}; echo " "$? + printf "Expected failure 22 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # Bit string functions @@ -267,65 +267,65 @@ pgmmake -maxval=8191 1.0 3 1 > ${input5_pgm} # Bit string functions - Maxval must match pamarith -and ${input3_pgm} ${input5_pgm} > ${test_out} || \ - printf "Expected failure 23" - test -s ${test_out}; echo " "$? + printf "Expected failure 23 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -or ${input3_pgm} ${input5_pgm} > ${test_out} || \ - printf "Expected failure 24" - test -s ${test_out}; echo " "$? + printf "Expected failure 24 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -nand ${input3_pgm} ${input5_pgm} > ${test_out} || \ - printf "Expected failure 25" - test -s ${test_out}; echo " "$? + printf "Expected failure 25 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -nor ${input3_pgm} ${input5_pgm} > ${test_out} || \ - printf "Expected failure 26" - test -s ${test_out}; echo " "$? + printf "Expected failure 26 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -xor ${input3_pgm} ${input5_pgm} > ${test_out} || \ - printf "Expected failure 27" - test -s ${test_out}; echo " "$? + printf "Expected failure 27 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # Bit string functions - Maxval must be 2^n -1 pamarith -and ${input4_pgm} ${input4_pgm} > ${test_out} || \ - printf "Expected failure 28" - test -s ${test_out}; echo " "$? + printf "Expected failure 28 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -or ${input4_pgm} ${input4_pgm} > ${test_out} || \ - printf "Expected failure 29" - test -s ${test_out}; echo " "$? + printf "Expected failure 29 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -nand ${input4_pgm} ${input4_pgm} > ${test_out} || \ - printf "Expected failure 30" - test -s ${test_out}; echo " "$? + printf "Expected failure 30 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -nor ${input4_pgm} ${input4_pgm} > ${test_out} || \ - printf "Expected failure 31" - test -s ${test_out}; echo " "$? + printf "Expected failure 31 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -xor ${input4_pgm} ${input4_pgm} > ${test_out} || \ - printf "Expected failure 32" - test -s ${test_out}; echo " "$? + printf "Expected failure 32 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -shiftleft ${input4_pgm} ${input4_pgm} > ${test_out} || \ - printf "Expected failure 33" - test -s ${test_out}; echo " "$? + printf "Expected failure 33 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -shiftright ${input4_pgm} ${input4_pgm} > ${test_out} || \ - printf "Expected failure 34" - test -s ${test_out}; echo " "$? + printf "Expected failure 34 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} rm ${input3_pgm} ${input4_pgm} ${input5_pgm} @@ -335,44 +335,44 @@ rm ${input3_pgm} ${input4_pgm} ${input5_pgm} # three or more inputs. pamarith -subtract testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 35" - test -s ${test_out}; echo " "$? + printf "Expected failure 35 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -divide testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 36" - test -s ${test_out}; echo " "$? + printf "Expected failure 36 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -compare testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 37" - test -s ${test_out}; echo " "$? + printf "Expected failure 37 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -difference testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 38" - test -s ${test_out}; echo " "$? + printf "Expected failure 38 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -shiftleft testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 39" - test -s ${test_out}; echo " "$? + printf "Expected failure 39 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -shiftright testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - printf "Expected failure 40" - test -s ${test_out}; echo " "$? + printf "Expected failure 40 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # Currently -equal and -mean do not allow more than two input images. # These two cases should be removed once improvements are made. pamarith -equal testgrid.pbm testgrid.pbm testgrid.pbm > ${test_out} || \ - printf "Expected failure 41" - test -s ${test_out}; echo " "$? + printf "Expected failure 41 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamarith -mean testgrid.pbm testgrid.pbm testgrid.pbm > ${test_out} || \ - printf "Expected failure 42" - test -s ${test_out}; echo " "$? + printf "Expected failure 42 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamcat1.ok b/test/pamcat1.ok index 4e23666f..630b635f 100644 --- a/test/pamcat1.ok +++ b/test/pamcat1.ok @@ -134,17 +134,17 @@ Test 12. Should print 2773166369 245, 0 nine times, 1 once 0 1 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 10 1 -Expected failure 11 1 -Expected failure 12 1 -Expected failure 13 1 -Expected failure 14 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) +Expected failure 12 (no output) +Expected failure 13 (no output) +Expected failure 14 (no output) diff --git a/test/pamcat1.test b/test/pamcat1.test index 67d941cc..902ef6d7 100755 --- a/test/pamcat1.test +++ b/test/pamcat1.test @@ -196,76 +196,76 @@ echo "-----------------------------------------------------------" 1>&2 # direction not specified pamcat testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # both directions specified pamcat -topbottom -leftright testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # both pad colors specified pamcat -topbottom -white -black testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # justification parameters overspecified pamcat -lr -jtop -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcat -lr -jtop -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcat -lr -jcenter -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcat -tb -jleft -jright testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcat -tb -jleft -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcat -tb -jcenter -jright testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # justification parameter in the wrong direction pamcat -lr -jleft testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcat -lr -jright testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 11" - test -s ${test_out}; echo " "$? + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcat -tb -jtop testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 12" - test -s ${test_out}; echo " "$? + printf "Expected failure 12 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcat -tb -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 13" - test -s ${test_out}; echo " "$? + printf "Expected failure 13 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # more than one input image from standard input cat testgrid.pbm | pamcat -lr - - testimg.ppm > ${test_out} || \ - printf "Expected failure 14" - test -s ${test_out}; echo " "$? + printf "Expected failure 14 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamcat3.ok b/test/pamcat3.ok index 5dbb2cbc..768f6f1e 100644 --- a/test/pamcat3.ok +++ b/test/pamcat3.ok @@ -8,12 +8,12 @@ Test 2. Should print 1331083756 152559 three times 1331083756 152559 1331083756 152559 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) diff --git a/test/pamcat3.test b/test/pamcat3.test index 3aed0131..fb89c3f6 100755 --- a/test/pamcat3.test +++ b/test/pamcat3.test @@ -36,59 +36,59 @@ echo "-----------------------------------------------------------" 1>&2 # listfile not specified pamcat -lr -listfile > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # listfile does not exist pamcat -lr -listfile=`mktemp -u` > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # listfile empty pamcat -lr -listfile=/dev/null > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # listfile from stdin, empty cat /dev/null | pamcat -lr -listfile=- > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # Files provided from command line in addition to listfile pamcat -lr -listfile=${list} testgrid.pbm testgrid.pbm > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # "-" (stdin) provided from command line in addition to listfile pamcat -lr -listfile=${list} - > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # listfile has nothing but blank lines sed 's/^.*$//' ${list3} > ${liste1} pamcat -lr -listfile=${liste1} > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ${liste1} # Non-existing file in listfile ( cat ${list} ; mktemp -u ) > ${liste2} pamcat -lr -listfile=${liste2} > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ${liste2} # Multiple instances of "-" in listfile ( echo "-"; cat ${list}; echo "-"; echo "-" ) > ${liste3} pamcat -lr -listfile=${liste3} > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ${liste3} diff --git a/test/pamchannel.ok b/test/pamchannel.ok index 91629202..72b84354 100644 --- a/test/pamchannel.ok +++ b/test/pamchannel.ok @@ -7,6 +7,6 @@ Test 3:blue-channel Should produce 3164158573 33838 Test 4:single-channel Should produce 281226646 481 281226646 481 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) diff --git a/test/pamchannel.test b/test/pamchannel.test index f2662706..2f772bf9 100755 --- a/test/pamchannel.test +++ b/test/pamchannel.test @@ -42,17 +42,16 @@ test_out=${tmpdir}/test_out echo "Test Invalid" pamchannel -infile testgrid.pbm 1 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamchannel -infile testimg.ppm 3 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamtopam testimg.ppm | pamchannel -infile=- 4 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} - diff --git a/test/pamcrater.ok b/test/pamcrater.ok index a5571f35..53faebf2 100644 --- a/test/pamcrater.ok +++ b/test/pamcrater.ok @@ -7,7 +7,7 @@ Test 2. 2 2 Test Invalid. -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) diff --git a/test/pamcrater.test b/test/pamcrater.test index e0c98afb..1b4ffd54 100755 --- a/test/pamcrater.test +++ b/test/pamcrater.test @@ -64,21 +64,21 @@ echo "Error messages should appear below the line." 1>&2 echo "------------------------------" 1>&2 pamcrater -width 0 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcrater -height 0 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcrater -number 0 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcrater -test -radius=10 | pamshadedrelief -gamma 0 > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamcut.ok b/test/pamcut.ok index fc4dc3de..60919865 100644 --- a/test/pamcut.ok +++ b/test/pamcut.ok @@ -19,18 +19,18 @@ Test 5. Should print 281226646 481 five times Test 6. Should print 3412257956 129 3412257956 129 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 6 1 -Expected failure 10 1 -Expected failure 11 1 -Expected failure 12 1 -Expected failure 13 1 -Expected failure 14 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 6 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) +Expected failure 12 (no output) +Expected failure 13 (no output) +Expected failure 14 (no output) diff --git a/test/pamcut.test b/test/pamcut.test index a489635a..7cda5bce 100755 --- a/test/pamcut.test +++ b/test/pamcut.test @@ -56,79 +56,79 @@ echo "-----------------------------------------------------------" 1>&2 # overspecification pamcut -left=1 -right=1 -width=14 testgrid.pbm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcut -top=1 -bottom=1 -height=16 testgrid.pbm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcut -right=1 -cropright=1 testgrid.pbm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcut -top=1 -croptop=1 testgrid.pbm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcut -bottom=1 -cropbottom=1 testgrid.pbm > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcut -left=1 -cropleft=1 testgrid.pbm > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # excessive cropping pamcut -cropleft=7 -cropright=8 testgrid.pbm > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcut -left=7 -right=6 testgrid.pbm > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcut -croptop=8 -cropbottom=8 testgrid.pbm > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcut -top=10 -bottom=9 testgrid.pbm > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # pad absent pamcut -cropleft=1 -width=14 testgrid.pbm > ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcut -croptop=1 -height=16 testgrid.pbm > ${test_out} || \ - printf "Expected failure 11" - test -s ${test_out}; echo " "$? + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # legacy style: insufficient number of positional parameters pamcut 5 testimg.ppm > ${test_out} || \ - printf "Expected failure 12" - test -s ${test_out}; echo " "$? + printf "Expected failure 12 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcut 5 4 testimg.ppm > ${test_out} || \ - printf "Expected failure 13" - test -s ${test_out}; echo " "$? + printf "Expected failure 13 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamcut 5 5 30 testimg.ppm > ${test_out} || \ - printf "Expected failure 14" - test -s ${test_out}; echo " "$? + printf "Expected failure 14 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamdepth.ok b/test/pamdepth.ok index 1bd897ac..fefcc14f 100644 --- a/test/pamdepth.ok +++ b/test/pamdepth.ok @@ -10,5 +10,5 @@ stdin: PAM RAW 14 16 1 1 GRAYSCALE Test 2 0 0 : 0 Test Invalid -Expected failure 1 1 -Expected failure 2 1 +Expected failure 1 (no output) +Expected failure 2 (no output) diff --git a/test/pamdepth.test b/test/pamdepth.test index 7ff73f41..d97992a1 100755 --- a/test/pamdepth.test +++ b/test/pamdepth.test @@ -30,11 +30,11 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamdepth 0 testgrid.pbm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamdepth 65536 testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamditherbw-random.ok b/test/pamditherbw-random.ok index d21e3613..d21e3613 100755..100644 --- a/test/pamditherbw-random.ok +++ b/test/pamditherbw-random.ok diff --git a/test/pamditherbw.ok b/test/pamditherbw.ok index 02200d0f..da3f6e8b 100644 --- a/test/pamditherbw.ok +++ b/test/pamditherbw.ok @@ -14,15 +14,15 @@ Test: Cluster-4 Test: Cluster-8 3493215477 33894 Test: Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 10 1 -Expected failure 11 1 -Expected failure 12 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) +Expected failure 12 (no output) diff --git a/test/pamditherbw.test b/test/pamditherbw.test index be560089..ea3e803f 100755 --- a/test/pamditherbw.test +++ b/test/pamditherbw.test @@ -47,63 +47,63 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamditherbw -fs -atkinson ${test_red} > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamditherbw -floyd -atkinson ${test_red} > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamditherbw -dither8 -cluster3 ${test_red} > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamditherbw -cluster3 -cluster4 ${test_red} > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamditherbw -cluster3 -cluster8 ${test_red} > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamditherbw -cluster4 -cluster8 ${test_red} > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamditherbw -hilbert -threshold ${test_red} > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamditherbw -clump=8 ${test_red} > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamditherbw -fs -clump=8 ${test_red} > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamditherbw -hilbert -clump=1 ${test_red} > ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamditherbw -th -value=-1 ${test_red} > ${test_out} || \ - printf "Expected failure 11" - test -s ${test_out}; echo " "$? + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamditherbw -th -value=1.1 ${test_red} > ${test_out} || \ - printf "Expected failure 12" - test -s ${test_out}; echo " "$? + printf "Expected failure 12 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} rm ${test_red} diff --git a/test/pamfile.ok b/test/pamfile.ok index e222592c..91beec60 100644 --- a/test/pamfile.ok +++ b/test/pamfile.ok @@ -14,6 +14,6 @@ Test 3 testimg.ppm: PPM RAW 227 149 3 255 RGB stdin: PBM RAW 14 16 1 1 BLACKANDWHITE Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) diff --git a/test/pamfile.test b/test/pamfile.test index 260d0b27..7be061ef 100755 --- a/test/pamfile.test +++ b/test/pamfile.test @@ -31,16 +31,16 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamfile -size -machine testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfile -count -machine testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} head -n1 testimg.ppm | pamfile > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamfind.ok b/test/pamfind.ok index de53166e..7776ba37 100644 --- a/test/pamfind.ok +++ b/test/pamfind.ok @@ -258,7 +258,7 @@ Test 3 okay okay Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) diff --git a/test/pamfind.test b/test/pamfind.test index 9165fbdf..e7c9707f 100755 --- a/test/pamfind.test +++ b/test/pamfind.test @@ -44,21 +44,21 @@ echo "-----------------------------------------------------------" 1>&2 echo "Test Invalid" pamfind -color=black -target=1,1,1 testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfind -target=0,0 testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfind -target=0,0,0,0 testimg.ppm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfind testimg.ppm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamfix.ok b/test/pamfix.ok index 7302f91e..ba1c678a 100644 --- a/test/pamfix.ok +++ b/test/pamfix.ok @@ -62,7 +62,7 @@ P2 0 1 2 3 4 7 0 0 0 -Test invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 +Test Invalid +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) diff --git a/test/pamfix.test b/test/pamfix.test index a18cae10..c274de86 100755 --- a/test/pamfix.test +++ b/test/pamfix.test @@ -44,7 +44,7 @@ printf "P2\n3 3\n7\n0 1 2\n3 4 8\n0 0 0\n" |\ # Test Invalid -echo "Test invalid" +echo "Test Invalid" test_out=${tmpdir}/test_out @@ -54,16 +54,16 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 printf "P2\n3 2\n7\n0 1 2\n6 7 8\n" | pamfix -change -clip > ${test_out} || \ - printf "Expected failure 1"; - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} printf "P1\n5 5\n" | pamfix -truncate -plain > ${test_out} || \ - printf "Expected failure 2"; - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} printf "P2\n3 3\255\n" | pamfix -truncate -plain > ${test_out} || \ - printf "Expected failure 3"; - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamfunc.ok b/test/pamfunc.ok index d358355b..0010476e 100644 --- a/test/pamfunc.ok +++ b/test/pamfunc.ok @@ -44,27 +44,27 @@ Test 5: Should print 281226646 481 six times 281226646 481 281226646 481 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 10 1 -Expected failure 11 1 -Expected failure 12 1 -Expected failure 13 1 -Expected failure 14 1 -Expected failure 15 1 -Expected failure 16 1 -Expected failure 17 1 -Expected failure 18 1 -Expected failure 19 1 -Expected failure 20 1 -Expected failure 21 1 -Expected failure 22 1 -Expected failure 23 1 -Expected failure 24 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) +Expected failure 12 (no output) +Expected failure 13 (no output) +Expected failure 14 (no output) +Expected failure 15 (no output) +Expected failure 16 (no output) +Expected failure 17 (no output) +Expected failure 18 (no output) +Expected failure 19 (no output) +Expected failure 20 (no output) +Expected failure 21 (no output) +Expected failure 22 (no output) +Expected failure 23 (no output) +Expected failure 24 (no output) diff --git a/test/pamfunc.test b/test/pamfunc.test index fe142be7..21f69247 100755 --- a/test/pamfunc.test +++ b/test/pamfunc.test @@ -93,121 +93,121 @@ echo "Test Invalid" test_out=${tmpdir}/test_out pamfunc -multiplier testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -multiplier=-1 testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -divisor testimg.ppm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -divisor=-20 testimg.ppm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -adder testimg.ppm > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -adder 0.5 testimg.ppm > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -subtractor testimg.ppm > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -subtractor 0.1 testimg.ppm > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -multiplier=1 -divisor=2 testimg.ppm > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -adder=2 -subtractor=3 testimg.ppm > ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -min testimg.ppm > ${test_out} || \ - printf "Expected failure 11" - test -s ${test_out}; echo " "$? + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -max testimg.ppm > ${test_out} || \ - printf "Expected failure 12" - test -s ${test_out}; echo " "$? + printf "Expected failure 12 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -andmask testimg.ppm > ${test_out} || \ - printf "Expected failure 13" - test -s ${test_out}; echo " "$? + printf "Expected failure 13 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -ormask testimg.ppm > ${test_out} || \ - printf "Expected failure 14" - test -s ${test_out}; echo " "$? + printf "Expected failure 14 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -xormask testimg.ppm > ${test_out} || \ - printf "Expected failure 15" - test -s ${test_out}; echo " "$? + printf "Expected failure 15 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -not 1 testimg.ppm > ${test_out} || \ - printf "Expected failure 16" - test -s ${test_out}; echo " "$? + printf "Expected failure 16 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -min=1 -max=2 testimg.ppm > ${test_out} || \ - printf "Expected failure 17" - test -s ${test_out}; echo " "$? + printf "Expected failure 17 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -andmask=1 -ormask=0 testimg.ppm > ${test_out} || \ - printf "Expected failure 18" - test -s ${test_out}; echo " "$? + printf "Expected failure 18 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -andmask=0xffff testimg.ppm > ${test_out} || \ - printf "Expected failure 19" - test -s ${test_out}; echo " "$? + printf "Expected failure 19 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -shiftleft testimg.ppm > ${test_out} || \ - printf "Expected failure 20" - test -s ${test_out}; echo " "$? + printf "Expected failure 20 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -shiftright testimg.ppm > ${test_out} || \ - printf "Expected failure 21" - test -s ${test_out}; echo " "$? + printf "Expected failure 21 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -changemaxval testimg.ppm > ${test_out} || \ - printf "Expected failure 22" - test -s ${test_out}; echo " "$? + printf "Expected failure 22 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -shiftleft=1 -shiftright=1 testimg.ppm > ${test_out} || \ - printf "Expected failure 23" - test -s ${test_out}; echo " "$? + printf "Expected failure 23 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamfunc -multiplier=0.5 -changemaxval=65535 testimg.ppm > ${test_out} || \ - printf "Expected failure 24" - test -s ${test_out}; echo " "$? + printf "Expected failure 24 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamgauss.ok b/test/pamgauss.ok index e31a2ee8..cc4d1465 100644 --- a/test/pamgauss.ok +++ b/test/pamgauss.ok @@ -84,8 +84,8 @@ Test 2 stdin: PAM, 3 by 3 by 1 maxval 255 Tuple type: GRAYSCALE Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) diff --git a/test/pamgauss.test b/test/pamgauss.test index 9400e928..b15ccbf0 100755 --- a/test/pamgauss.test +++ b/test/pamgauss.test @@ -28,26 +28,26 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pamgauss 3 3 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamgauss 3 3 -sigma=0 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamgauss 3 3 -sigma=-1.5 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamgauss 3 -sigma=0.5 > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamgauss 3 3 3 -sigma=0.5 > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamhue.ok b/test/pamhue.ok index 5935cc5e..4bc4c385 100644 --- a/test/pamhue.ok +++ b/test/pamhue.ok @@ -33,4 +33,4 @@ Test 4 0 0 : 0 0 0 : 0 Test Invalid -Expected failure 1 1 +Expected failure 1 (no output) diff --git a/test/pamhue.test b/test/pamhue.test index 5979e414..ca7a7d82 100755 --- a/test/pamhue.test +++ b/test/pamhue.test @@ -43,6 +43,6 @@ echo "An error message should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamhue testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamrecolor.ok b/test/pamrecolor.ok index 0a6b5413..f1bd74fb 100755..100644 --- a/test/pamrecolor.ok +++ b/test/pamrecolor.ok @@ -3,9 +3,9 @@ Test 1. Should produce 3500040755 101532 Test 2. Should produce 3500040755 101532 twice 3500040755 101532 3500040755 101532 -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) diff --git a/test/pamrecolor.test b/test/pamrecolor.test index a5fecc1f..4d75f2cc 100755 --- a/test/pamrecolor.test +++ b/test/pamrecolor.test @@ -28,35 +28,35 @@ echo "-----------------------------------------------------------" 1>&2 pamrecolor --targetcolor=rgb:00/11/22 \ --colorfile=${base1_pgm} testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamrecolor --rmult=0.3 --gmult=0.3 --bmult=0.3 \ --colorfile=${base1_pgm} testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamrecolor --colorspace=void \ --targetcolor=rgb:80/80/80 testimg.ppm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamrecolor --targetcolor=vague testimg.ppm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamrecolor --colorfile=${truncated_file} testimg.ppm > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamrecolor --rmult=0.2989 --gmult=0.5866 testimg.ppm > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} rm ${base_pgm} ${truncated_file} diff --git a/test/pamrestack.ok b/test/pamrestack.ok index 07552913..63f809e8 100644 --- a/test/pamrestack.ok +++ b/test/pamrestack.ok @@ -61,8 +61,8 @@ Test 4. Should produce 1768948962 101484 twice 1768948962 101484 1768948962 101484 Test Invalid. -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) diff --git a/test/pamrestack.test b/test/pamrestack.test index 2ebee49f..776fe91b 100755 --- a/test/pamrestack.test +++ b/test/pamrestack.test @@ -64,28 +64,28 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamrestack testgrid.pbm maze.pbm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamrestack -abort \ -width=$((pixels * 2 + 1 )) maze.pbm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamrestack -crop \ -width=$((pixels * 2 + 1)) maze.pbm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamrestack -width=0 maze.pbm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamrestack -width maze.pbm > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamscale-reportonly.ok b/test/pamscale-reportonly.ok index bf5cde99..a3ece300 100644 --- a/test/pamscale-reportonly.ok +++ b/test/pamscale-reportonly.ok @@ -12,9 +12,9 @@ Test 1 227 149 1.400881 2.684564 318 400 227 149 1.000000 1.000000 227 149 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) diff --git a/test/pamscale-reportonly.test b/test/pamscale-reportonly.test index 924fb7c2..2bf1030a 100755 --- a/test/pamscale-reportonly.test +++ b/test/pamscale-reportonly.test @@ -31,36 +31,36 @@ echo "-----------------------------------------------------------" 1>&2 pamscale -reportonly -xsize=640 -ysize=400 -xscale=2 testimg.ppm > \ ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamscale -reportonly -xsize=640 -xscale=2 -yscale=3 testimg.ppm > \ ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -pixels=200000 testimg.ppm \ > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -xysize 640 400 testimg.ppm \ > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -xyfit 640 400 testimg.ppm \ > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -xyfill 640 400 testimg.ppm \ > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamseq.ok b/test/pamseq.ok index 654596fb..a632de66 100644 --- a/test/pamseq.ok +++ b/test/pamseq.ok @@ -1,7 +1,7 @@ Test 1 3929266994 304 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) diff --git a/test/pamseq.test b/test/pamseq.test index ce3d4995..61fbfac7 100755 --- a/test/pamseq.test +++ b/test/pamseq.test @@ -17,18 +17,18 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pamseq 1 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamseq 0 255 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamseq 3 0 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} c64="0123456789012345678901234567890123456789012345678901234567890123" @@ -37,6 +37,6 @@ c256=${c64}${c64}${c64}${c64} # Tupletype string length=256 pamseq -tupletype="${c256}" 3 15 > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamshuffle.ok b/test/pamshuffle.ok index 4f829744..ec8c1a9c 100755..100644 --- a/test/pamshuffle.ok +++ b/test/pamshuffle.ok @@ -14,6 +14,6 @@ nomatch nomatch nomatch Test Invalid. -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) diff --git a/test/pamshuffle.test b/test/pamshuffle.test index 2941a9bc..700631cb 100755 --- a/test/pamshuffle.test +++ b/test/pamshuffle.test @@ -52,16 +52,16 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamshuffle testimg.ppm testgrid.pbm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamshuffle -randomseed -column testgrid.pbm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamshuffle -randomseed=null testgrid.pbm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamstack.ok b/test/pamstack.ok new file mode 100644 index 00000000..881cb6c5 --- /dev/null +++ b/test/pamstack.ok @@ -0,0 +1,38 @@ +test 0: Should print 1652911383 4046 +1652911383 4046 +test 1: Should print 1398841785 13544 three times +1398841785 13544 +1398841785 13544 +1398841785 13544 +test 2: Should print 210239904 3186 five times +210239904 3186 +210239904 3186 +210239904 3186 +210239904 3186 +210239904 3186 +test 3: maxval should be 65535 +stdin: PAM, 14 by 16 by 6 maxval 65535 + Tuple type: +stdin: PAM, 14 by 16 by 6 maxval 65535 + Tuple type: +stdin: PAM, 14 by 16 by 5 maxval 65535 + Tuple type: +stdin: PAM, 14 by 16 by 2 maxval 65535 + Tuple type: +test 4: maxval should be 255 then 767 +stdin: PAM, 14 by 16 by 2 maxval 255 + Tuple type: +stdin: PAM, 14 by 16 by 2 maxval 767 + Tuple type: +test 5: Should print 2741208386 719 twice +2741208386 719 +2741208386 719 +test 6: Should print true four times +true +true +true +true +Test Invalid +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) diff --git a/test/pamstack.test b/test/pamstack.test new file mode 100755 index 00000000..7c375b12 --- /dev/null +++ b/test/pamstack.test @@ -0,0 +1,125 @@ +#! /bin/sh +# This script tests: pamstack +# Also requires: pamdepth pgmmake pamfile + +tmpdir=${tmpdir:-/tmp} +i1_pgm=${tmpdir}/testimg_1.pnm +i2_pgm=${tmpdir}/testimg_2.pgm +i7_pgm=${tmpdir}/testimg_7.pgm +i31_pgm=${tmpdir}/testimg_31.pgm +std_pgm=${tmpdir}/testimg_255.pgm +max_pgm=${tmpdir}/testimg_max.pgm + +maze2_pbm=${tmpdir}/testimg_maze2.pgm +maze3_pbm=${tmpdir}/testimg_maze3.pgm + +pamdepth 1 testgrid.pbm > ${i1_pgm} +pgmmake -maxval=2 0 14 16 > ${i2_pgm} +pgmmake -maxval=7 0.5 14 16 > ${i7_pgm} +pgmmake -maxval=31 0.5 14 16 > ${i31_pgm} +pgmmake -maxval=255 0.5 14 16 > ${std_pgm} +pgmmake -maxval=65535 0.5 14 16 > ${max_pgm} +cat maze.pbm maze.pbm > ${maze2_pbm} +cat maze.pbm maze.pbm maze.pbm > ${maze3_pbm} + +# test 0 +echo test 0: Should print 1652911383 4046 + +# Test the integrity of the input files +cat ${i1_pgm} ${i2_pgm} ${i7_pgm} ${i31_pgm} ${std_pgm} ${max_pgm} \ + ${maze2_pbm} ${maze3_pbm}| cksum + +# test 1 +echo test 1: Should print 1398841785 13544 three times +pamstack ${maze2_pbm} ${maze2_pbm} | cksum +pamstack ${maze3_pbm} ${maze2_pbm} | cksum +pamstack ${maze2_pbm} ${maze3_pbm} | cksum + +rm ${maze2_pbm} ${maze3_pbm} + +# test 2 +echo test 2: Should print 210239904 3186 five times +pamstack -firstmaxval ${max_pgm} ${std_pgm} ${i31_pgm} \ + ${i7_pgm} ${i2_pgm} ${i1_pgm} ${i1_pgm} | cksum +pamstack -firstmaxval ${max_pgm} ${std_pgm} ${i31_pgm} \ + ${i7_pgm} ${i2_pgm} ${i1_pgm} testgrid.pbm | cksum + +pamstack -lcmmaxval ${max_pgm} ${std_pgm} ${i31_pgm} \ + ${i7_pgm} ${i2_pgm} ${i1_pgm} ${i1_pgm} | cksum +pamstack ${i1_pgm} ${i1_pgm} |\ + pamstack -firstmaxval ${max_pgm} ${std_pgm} ${i31_pgm} ${i7_pgm} ${i2_pgm} - | cksum +pamstack -firstmaxval ${i2_pgm} testgrid.pbm ${i1_pgm} |\ + pamstack -firstmaxval ${max_pgm} ${std_pgm} ${i31_pgm} ${i7_pgm} - | cksum + + +# test 3 +echo test 3: maxval should be 65535 +pamstack -firstmaxval ${max_pgm} ${std_pgm} ${i31_pgm} \ + ${i7_pgm} ${i2_pgm} ${i1_pgm} | pamfile + +pamstack -lcmmaxval ${max_pgm} ${std_pgm} ${i31_pgm} \ + ${i7_pgm} ${i2_pgm} ${i1_pgm} | pamfile + +pamstack -lcmmaxval ${max_pgm} ${std_pgm} ${i31_pgm} ${i7_pgm} ${i1_pgm} | pamfile + +pamstack -firstmaxval ${max_pgm} ${i2_pgm} | pamfile + + +# test 4 +echo test 4: maxval should be 255 then 767 +pamstack -firstmaxval ${std_pgm} ${i2_pgm} | pamfile +pamstack -lcmmaxval ${std_pgm} ${i2_pgm} | pamfile + +# test 5 +echo test 5: Should print 2741208386 719 twice + +pamstack -lcmmaxval ${i31_pgm} ${i1_pgm} ${i7_pgm} | cksum +pamstack -firstmaxval ${i31_pgm} ${i1_pgm} ${i7_pgm} | cksum + +# test 6 +echo test 6: Should print true four times + +s0=$(pamstack ${i1_pgm} | pamfile) +s1=$(pamstack -lcmmaxval ${i1_pgm} | pamfile) +s2=$(pamstack -firstmaxval ${i1_pgm} | pamfile) + +test "$s0" = "$s1" && echo "true" || echo "false" +test "$s0" = "$s2" && echo "true" || echo "false" + + +s0=$(pamstack ${std_pgm} | pamfile) +s1=$(pamstack -lcmmaxval ${std_pgm} | pamfile) +s2=$(pamstack -firstmaxval ${std_pgm} | pamfile) + +test "$s0" = "$s1" && echo "true" || echo "false" +test "$s0" = "$s2" && echo "true" || echo "false" + + +# Test Invalid +echo "Test Invalid" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +test_out=${tmpdir}/test_out + +pamstack testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamstack ${i1_pgm} ${std_pgm} > ${test_out} || \ + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +pamstack -lcmmaxval -firstmaxval testgrid.pbm testgrid.pbm > ${test_out} || \ + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + + +rm ${i1_pgm} ${i2_pgm} ${i7_pgm} ${i31_pgm} ${std_pgm} ${max_pgm} + diff --git a/test/pamstereogram.ok b/test/pamstereogram.ok new file mode 100644 index 00000000..265a4fc5 --- /dev/null +++ b/test/pamstereogram.ok @@ -0,0 +1,32 @@ +Test 00. Should print 729348909 237 +729348909 237 +Test 01. Should print 3308667841 293 +3308667841 293 +Test 02. Should print 3308667841 293 +3308667841 293 +Test 03. Should print 748200469 170 +748200469 170 +Test 04. Should print 1538641408 1070 +1538641408 1070 +Test 10. Should print 1266273778 293 +1266273778 293 +Test 11. Should print 55276708 1070 +55276708 1070 +Test 20. Should print 1920539795 289 +1920539795 289 +Test 21. Should print 4069109690 4068 +4069109690 4068 +Test 22. Should print 1163376052 4068 +1163376052 4068 +Test 30. Should print 2127252909 731 +2127252909 731 +Test 31. Should print 858421050 12062 +858421050 12062 +Test 40. Should print 1236679620 660 +1236679620 660 +Test 41. Should print 1022068930 5014 +1022068930 5014 +Test 51. Should print 3784833098 11071 +3784833098 11071 +Test 52. Should print 1419662425 1441 +1419662425 1441 diff --git a/test/pamstereogram.test b/test/pamstereogram.test new file mode 100755 index 00000000..02da9724 --- /dev/null +++ b/test/pamstereogram.test @@ -0,0 +1,80 @@ +#! /bin/sh +# This script tests: pamstereogram +# Also requires: pamdepth + +tmpdir=${tmpdir:-/tmp} +testgrid_pgm=${tmpdir}/testgrid.pgm + +# Make input file + +echo "Test 00. Should print 729348909 237" +pamdepth -quiet 255 testgrid.pbm | tee ${testgrid_pgm} | cksum + + +# Random pattern + +echo "Test 01. Should print 3308667841 293" +pamstereogram -randomseed=1 testgrid.pbm | cksum +echo "Test 02. Should print 3308667841 293" +pamstereogram -randomseed=1 -blackandwhite testgrid.pbm | cksum +echo "Test 03. Should print 748200469 170" +pamseq -tupletype=GRAYSCALE 1 100 | pamstereogram -randomseed=1 | cksum +echo "Test 04. Should print 1538641408 1070" +pamgauss 100 10 -maxval=10000 -sigma 20 | pamfunc -multiplier=500 | \ + pamstereogram -randomseed=1 -dpi=10 | cksum + +# Makemask + +echo "Test 10. Should print 1266273778 293" +pamstereogram -randomseed=1 -makemask testgrid.pbm | cksum + +echo "Test 11. Should print 55276708 1070" +pamgauss 100 10 -maxval=10000 -sigma 20 | pamfunc -multiplier=500 | \ + pamstereogram -randomseed=1 -dpi=10 -makemask | cksum + +# Grayscale + +echo "Test 20. Should print 1920539795 289" +pamstereogram -randomseed=1 -grayscale testgrid.pbm | cksum +echo "Test 21. Should print 4069109690 4068" +pamseq 1 100 | pnmtile 200 20 | \ + pamstereogram -randomseed=1 -dpi=10 -grayscale | \ + cksum +echo "Test 22. Should print 1163376052 4068" +pamseq 1 100 | pnmtile 200 20 | \ + pamstereogram -randomseed=1 -dpi=10 -grayscale -maxval 255 | \ + cksum + +# Color + +echo "Test 30. Should print 2127252909 731" +pamstereogram -randomseed=1 -color testgrid.pbm | cksum +echo "Test 31. Should print 858421050 12062" +pamseq 1 100 | pnmtile 200 20 | \ + pamstereogram -randomseed=1 -dpi=10 -color | \ + cksum + +# Pattern file + +echo "Test 40. Should print 1236679620 660" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -patfile testgrid.pbm -eyesep=.1 -crosseyed | cksum + +echo "Test 41. Should print 1022068930 5014" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -patfile ${testgrid_pgm} -eyesep=.1 -crosseyed | cksum + +# drawguides + +echo "Test 51. Should print 3784833098 11071" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -randomseed=1 -dpi 10 -guidesize=20 -guidetop | cksum + +echo "Test 52. Should print 1419662425 1441" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -patfile=testgrid.pbm -dpi 10 -guidesize=20 -guidetop | cksum + + +# Clean up files we created +rm ${testgrid_pgm} + diff --git a/test/pamsumm.ok b/test/pamsumm.ok index b9ce0269..5524e7b5 100644 --- a/test/pamsumm.ok +++ b/test/pamsumm.ok @@ -14,7 +14,7 @@ Test 3. Should print in order: 10772432, 15, 255, 106.164760 255 106.164760 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) diff --git a/test/pamsumm.test b/test/pamsumm.test index f482911a..6fef5972 100755 --- a/test/pamsumm.test +++ b/test/pamsumm.test @@ -35,21 +35,21 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamsumm -sum -min testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamsumm -sum -max testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamsumm -mean -max testimg.ppm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pamsumm testimg.ppm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamtable.ok b/test/pamtable.ok index d63c7720..5d69ffb7 100644 --- a/test/pamtable.ok +++ b/test/pamtable.ok @@ -122,5 +122,5 @@ Test 8 65535 0 0| 0 0 65535| 0 0 65535| 0 65535 0 Test Invalid -Should print: Expected failure 1 -Expected failure 1 +Should print: Expected failure (no output) +Expected failure (no output) diff --git a/test/pamtable.test b/test/pamtable.test index e948ad0c..740b2199 100755 --- a/test/pamtable.test +++ b/test/pamtable.test @@ -53,10 +53,10 @@ echo "Invalid command-line argument combinations." 1>&2 echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 -echo "Should print: Expected failure 1" +echo "Should print: Expected failure (no output)" pamseq -tupletype="void" 1 1 | pamtable -tuple -hex > \ ${test_out} || \ - printf "Expected failure" - test -s ${test_out}; echo " "$? + printf "Expected failure " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pamtosvg.ok b/test/pamtosvg.ok new file mode 100644 index 00000000..918555e0 --- /dev/null +++ b/test/pamtosvg.ok @@ -0,0 +1,4 @@ +Test 1. Should print match +match +Test 2. Should print match +match diff --git a/test/pamtosvg.test b/test/pamtosvg.test new file mode 100755 index 00000000..332040ea --- /dev/null +++ b/test/pamtosvg.test @@ -0,0 +1,45 @@ +#! /bin/sh +# This script tests: pamtosvg +# Also requires: ppmmake ppmdraw + +tmpdir=${tmpdir:-/tmp} +testline_svg=${tmpdir}/testline.svg +testgrid_svg=${tmpdir}/testgrid.svg + +cat > ${testline_svg} << EOF +<?xml version="1.0" standalone="yes"?> +<svg width="20" height="20"> +<path style="fill:#000000; stroke:none;" d="M0 0L0 20L20 20L20 0L0 0z"/> +<path style="fill:#ffffff; stroke:none;" d="M5 2L15 18L16 18L5 2z"/> +</svg> +EOF + +echo "Test 1. Should print match" + +ppmmake black 20 20 | ppmdraw -script="line 5 2 15 17" | pamtosvg |\ + cmp -s ${testline_svg} - && echo "match" || echo "no match" +rm ${testline_svg} + +cat > ${testgrid_svg} << EOF +<?xml version="1.0" standalone="yes"?> +<svg width="14" height="16"> +<path style="fill:#000000; stroke:none;" d="M0 0L0 16L14 16L14 1L13 0L0 0z"/> +<path style="fill:#ffffff; stroke:none;" d="M1 0L2 1L1 0M3 0L4 1L3 0M5 0L6 \ +1L5 0M7 0L8 1L7 0M9 0L10 1L9 0M11 0L12 1L11 0M13 0L14 1L13 0M1 2L2 3L1 2M3 \ +2L4 3L3 2M5 2L6 3L5 2M7 2L8 3L7 2M9 2L10 3L9 2M11 2L12 3L11 2M13 2L14 3L13 \ +2M1 4L2 5L1 4M3 4L4 5L3 4M5 4L6 5L5 4M7 4L8 5L7 4M9 4L10 5L9 4M11 4L12 5L11 \ +4M13 4L14 5L13 4M1 6L2 7L1 6M3 6L4 7L3 6M5 6L6 7L5 6M7 6L8 7L7 6M9 6L10 7L9 \ +6M11 6L12 7L11 6M13 6L14 7L13 6M1 8L2 9L1 8M3 8L4 9L3 8M5 8L6 9L5 8M7 8L8 9L7 \ +8M9 8L10 9L9 8M11 8L12 9L11 8M13 8L14 9L13 8M1 10L2 11L1 10M3 10L4 11L3 10M5 \ +10L6 11L5 10M7 10L8 11L7 10M9 10L10 11L9 10M11 10L12 11L11 10M13 10L14 11L13 \ +10M1 12L2 13L1 12M3 12L4 13L3 12M5 12L6 13L5 12M7 12L8 13L7 12M9 12L10 13L9 \ +12M11 12L12 13L11 12M13 12L14 13L13 12M1 14L2 15L1 14M3 14L4 15L3 14M5 14L6 \ +15L5 14M7 14L8 15L7 14M9 14L10 15L9 14M11 14L12 15L11 14M13 14L14 15L13 14z"/> +</svg> +EOF + +echo "Test 2. Should print match" + +pamtosvg testgrid.pbm | tee /tmp/a2 |\ + cmp -s ${testgrid_svg} - && echo "match" || echo "no match" +rm ${testgrid_svg} diff --git a/test/pamundice.ok b/test/pamundice.ok index 1234431d..9c869609 100644 --- a/test/pamundice.ok +++ b/test/pamundice.ok @@ -13,15 +13,15 @@ Test 4. Should print 2434390296 4436 four times 2434390296 4436 2434390296 4436 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 10 1 -Expected failure 11 1 -Expected failure 12 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) +Expected failure 12 (no output) diff --git a/test/pamundice.test b/test/pamundice.test index ba532c30..1190fbdc 100755 --- a/test/pamundice.test +++ b/test/pamundice.test @@ -123,64 +123,64 @@ echo "-----------------------------------------------------------" 1>&2 # No input file pattern specified pamundice -down=5 -across=2 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # -down=0 pamundice -down=0 -across=2 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # -across=0 pamundice -down=5 -across=0 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # -down too large pamundice -down=6 -across=2 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # -across too large pamundice -down=5 -across=3 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # precision does not match pamundice -down=5 -across=2 ${fname_stem}_"%2d"_"%2a".pbm > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # precision set to zero pamundice -down=5 -across=2 ${fname_stem}_"%0d"_"%0a".pbm > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # no precision pamundice -down=5 -across=2 ${fname_stem}_"%d"_"%a".pbm > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # -hoverlap too large pamundice -down=5 -across=2 -hoverlap=$((${mw}+1)) \ ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # -voverlap too large pamundice -down=5 -across=2 -voverlap=$((${mh}+1)) \ ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # corrupt listfile : file names do not exist @@ -188,15 +188,15 @@ for i in 0 1 2 3 4 5 6 7 8 9 do mktemp -u XXXXXXXXXX.${i} || echo ":::::::::::"${i}":::::::::::" done | pamundice -down=5 -across=2 -listfile=- > ${test_out} || \ - printf "Expected failure 11" - test -s ${test_out}; echo " "$? + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # listfile with insufficient lines (insufficient file entries) ls ${fname_stem}_*_*.pbm | head -n 9 | \ pamundice -down=5 -across=2 -listfile=- > ${test_out} || \ - printf "Expected failure 12" - test -s ${test_out}; echo " "$? + printf "Expected failure 12 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} rm ${fname_stem}*.pbm diff --git a/test/pbmclean.ok b/test/pbmclean.ok index 17ee0338..5fc9a2d5 100644 --- a/test/pbmclean.ok +++ b/test/pbmclean.ok @@ -85,4 +85,4 @@ Test 3 436062787 5051 4188415575 5051 Test Invalid -Expected failure 1 1 +Expected failure 1 (no output) diff --git a/test/pbmclean.test b/test/pbmclean.test index 5eba68e0..9d59a5a6 100755 --- a/test/pbmclean.test +++ b/test/pbmclean.test @@ -46,8 +46,8 @@ echo "-----------------------------------------------------------" 1>&2 # overspecification pbmclean -black -white -min=1 -extended testgrid.pbm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # note that without -extended the above is valid. diff --git a/test/pbmlife.ok b/test/pbmlife.ok index bd214dfb..bd214dfb 100755..100644 --- a/test/pbmlife.ok +++ b/test/pbmlife.ok diff --git a/test/pbmmake.ok b/test/pbmmake.ok index e39f4cf8..4b13cf54 100644 --- a/test/pbmmake.ok +++ b/test/pbmmake.ok @@ -44,11 +44,11 @@ Test 2 3651864954 3375 3302595397 3849 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) diff --git a/test/pbmmake.test b/test/pbmmake.test index 1d1c682b..52765747 100755 --- a/test/pbmmake.test +++ b/test/pbmmake.test @@ -33,41 +33,41 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pbmmake -b -w -plain 1 1 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmmake -b -g -plain 1 1 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmmake -white -gray -plain 1 1 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmmake -white -plain > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmmake -white -plain 1 > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmmake -white -plain 1 0 > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmmake -white -plain 0 1 > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmmake -white -plain 1 1 1 > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pbmnoise-parameters.ok b/test/pbmnoise-parameters.ok index c2a61c37..d430f0f1 100644 --- a/test/pbmnoise-parameters.ok +++ b/test/pbmnoise-parameters.ok @@ -1,26 +1,26 @@ Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 10 1 -Expected failure 11 1 -Expected failure 12 1 -Expected failure 13 1 -Expected failure 14 1 -Expected failure 15 1 -Expected failure 16 1 -Expected failure 17 1 -Expected failure 17 1 -Expected failure 18 1 -Expected failure 19 1 -Expected failure 20 1 -Expected failure 21 1 -Expected failure 22 1 -Expected failure 23 1 -Expected failure 24 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) +Expected failure 12 (no output) +Expected failure 13 (no output) +Expected failure 14 (no output) +Expected failure 15 (no output) +Expected failure 16 (no output) +Expected failure 17 (no output) +Expected failure 17 (no output) +Expected failure 18 (no output) +Expected failure 19 (no output) +Expected failure 20 (no output) +Expected failure 21 (no output) +Expected failure 22 (no output) +Expected failure 23 (no output) +Expected failure 24 (no output) diff --git a/test/pbmnoise-parameters.test b/test/pbmnoise-parameters.test index 17d2c76b..0d9319cc 100755 --- a/test/pbmnoise-parameters.test +++ b/test/pbmnoise-parameters.test @@ -13,131 +13,131 @@ test_out=${tmpdir}/test_out # Invalid -ratio arguments pbmnoise -ratio 100 100 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio 0 1 100 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=1.1 100 100 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=-1 100 100 > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=half 100 100 > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=0/1/1 100 100 > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=-1/2 100 100 > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=1/0 100 100 > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=/2 100 100 > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=4/2 100 100 > ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=6/ 100 100 > ${test_out} || \ - printf "Expected failure 11" - test -s ${test_out}; echo " "$? + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=1.0/2.0 100 100 > ${test_out} || \ - printf "Expected failure 12" - test -s ${test_out}; echo " "$? + printf "Expected failure 12 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # denominator must be power of 2 pbmnoise -ratio=3/9 100 100 > ${test_out} || \ - printf "Expected failure 13" - test -s ${test_out}; echo " "$? + printf "Expected failure 13 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=a/2 100 100 > ${test_out} || \ - printf "Expected failure 14" - test -s ${test_out}; echo " "$? + printf "Expected failure 14 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=2/a 100 100 > ${test_out} || \ - printf "Expected failure 15" - test -s ${test_out}; echo " "$? + printf "Expected failure 15 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=1/-2 100 100 > ${test_out} || \ - printf "Expected failure 16" - test -s ${test_out}; echo " "$? + printf "Expected failure 16 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # Denominator must be 65536 or less pbmnoise -ratio=1/65537 100 100 > ${test_out} || \ - printf "Expected failure 17" - test -s ${test_out}; echo " "$? + printf "Expected failure 17 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -ratio=1/131072 100 100 > ${test_out} || \ - printf "Expected failure 17" - test -s ${test_out}; echo " "$? + printf "Expected failure 17 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -endian=large 100 100 > ${test_out} || \ - printf "Expected failure 18" - test -s ${test_out}; echo " "$? + printf "Expected failure 18 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -randomseed 100 100 > ${test_out} || \ - printf "Expected failure 19" - test -s ${test_out}; echo " "$? + printf "Expected failure 19 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -randomseed=-1 100 100 > ${test_out} || \ - printf "Expected failure 20" - test -s ${test_out}; echo " "$? + printf "Expected failure 20 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise -randomseed=0.1 100 100 > ${test_out} || \ - printf "Expected failure 21" - test -s ${test_out}; echo " "$? + printf "Expected failure 21 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise > ${test_out} || \ - printf "Expected failure 22" - test -s ${test_out}; echo " "$? + printf "Expected failure 22 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise 100 > ${test_out} || \ - printf "Expected failure 23" - test -s ${test_out}; echo " "$? + printf "Expected failure 23 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmnoise 100 200 300 > ${test_out} || \ - printf "Expected failure 24" - test -s ${test_out}; echo " "$? + printf "Expected failure 24 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pbmpage.ok b/test/pbmpage.ok index 8013f2f2..21731b08 100644 --- a/test/pbmpage.ok +++ b/test/pbmpage.ok @@ -4,6 +4,6 @@ Test 1 2347597649 4210813 3453559794 4349933 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) diff --git a/test/pbmpage.test b/test/pbmpage.test index 4f15452d..ee3dc25c 100755 --- a/test/pbmpage.test +++ b/test/pbmpage.test @@ -20,16 +20,16 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pbmpage -a3 1 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmpage 0 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmpage 4 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pbmpscale.ok b/test/pbmpscale.ok index 9ea594d8..25552343 100644 --- a/test/pbmpscale.ok +++ b/test/pbmpscale.ok @@ -173,6 +173,6 @@ Test 9. Should print 146160766 820 Test 10. Should print 3327221668 2111 3327221668 2111 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) diff --git a/test/pbmpscale.test b/test/pbmpscale.test index efa5bfb5..65ab6467 100755 --- a/test/pbmpscale.test +++ b/test/pbmpscale.test @@ -36,16 +36,16 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pbmpscale testgrid.pbm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmpscale 0 testgrid.pbm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmpscale 2 3 testgrid.pbm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pbmtext-iso88591.test b/test/pbmtext-iso88591.test index 6df296dd..e8dec8d2 100755 --- a/test/pbmtext-iso88591.test +++ b/test/pbmtext-iso88591.test @@ -3,7 +3,7 @@ # Also requires: # This test requires an iso-8859-1 locale -# Skip this test if it is not available +# Skip this test if none are available LANG=C LC_ALL=C @@ -12,26 +12,29 @@ export LANG LC_ALL tmpdir=${tmpdir:-/tmp} iso88591_locale_list=${tmpdir}/iso88591_locale_list - -locale_to_test="en_US.iso88591" # Initial value +locale_to_test="en_US.iso88591" # Initial value; this +# does not have to be present in # Edit the above value if necessary - + # Make a list of available locales which end in "iso88591" -locale -a | grep "\.iso88591$" > ${iso88591_locale_list} +# If none are found, abort test -# Hunt for a valid iso-8859-1 locale +locale -a | grep "\.iso88591$" > ${iso88591_locale_list} ||\ + locale_to_test="" + +# Hunt for a valid iso-8859-1 locale # Submit each candidate to a trial pbmtext run until one that works is # encountered -i=0 until [ -z ${locale_to_test} ] || \ echo "A" | LC_ALL=${locale_to_test} pbmtext -wchar > /dev/null do - let i=$(($i+1)); - locale_to_test=`sed "$i"p -n ${iso88591_locale_list}`; + # Read first line of file + locale_to_test=`head -n 1 ${iso88591_locale_list}`; + # then erase the line + sed -i 1d ${iso88591_locale_list}; done; -rm ${iso88591_locale_list}; if [ -z ${locale_to_test} ] then echo "No iso-8859-1 locale available." 1>&2 echo "Skipping." 1>&2 @@ -42,7 +45,6 @@ fi; locale_for_test=${locale_to_test}; - # Two rows # Should print 2066913605 5110 twice echo "Test 1" diff --git a/test/pbmtext-utf8.ok b/test/pbmtext-utf8.ok index 84743a09..0d40adde 100644 --- a/test/pbmtext-utf8.ok +++ b/test/pbmtext-utf8.ok @@ -13,12 +13,12 @@ Test 5 Invalid 9998 989454365 52512 9999 -Expected failure 1 1 -Expected failure 2 1 +Expected failure 1 (no output) +Expected failure 2 (no output) Test 6 Invalid -6-1: 0 1 : 1 1 -6-2: 0 1 : 1 1 -6-3: 0 1 : 1 1 -6-4: 0 1 : 1 1 -6-5: 0 1 : 1 1 -6-6: 0 1 : 1 1 +6-1: 0 1 : 1 (no output) +6-2: 0 1 : 1 (no output) +6-3: 0 1 : 1 (no output) +6-4: 0 1 : 1 (no output) +6-5: 0 1 : 1 (no output) +6-6: 0 1 : 1 (no output) diff --git a/test/pbmtext-utf8.test b/test/pbmtext-utf8.test index 9203607f..a10b3d33 100755 --- a/test/pbmtext-utf8.test +++ b/test/pbmtext-utf8.test @@ -6,9 +6,8 @@ LANG=C LC_ALL=C export LANG LC_ALL - # This test requires a working UTF-8 locale -# Skip this test if it is are not available +# Skip this test if none are available iconv /dev/null if [ $? -ne 0 ] @@ -20,25 +19,29 @@ fi tmpdir=${tmpdir:-/tmp} utf_locale_list=${tmpdir}/utf_locale_list -locale_to_test="en_US.utf8" # Initial value +locale_to_test="en_US.utf8" # Initial value; this +# does not have to be present in following list # Edit the above value if necessary # Make a list of available locales which end in "utf8" -locale -a | grep "\.utf8$" > ${utf_locale_list} +# If none are found, abort test + +locale -a | grep "\.utf8$" > ${utf_locale_list} ||\ + locale_to_test="" # Hunt for a valid utf8 locale # Submit each candidate to a trial pbmtext run until one that works is # encountered -i=0 until [ -z ${locale_to_test} ] || \ echo "A" | LC_ALL=${locale_to_test} pbmtext -wchar > /dev/null do - let i=$(($i+1)); - locale_to_test=`sed "$i"p -n ${utf_locale_list}`; + # Read first line of file + locale_to_test=`head -n 1 ${utf_locale_list}`; + # then erase the line + sed -i 1d ${utf_locale_list}; done; -rm ${utf_locale_list}; if [ -z ${locale_to_test} ] then echo "No utf-8 locale available." 1>&2 echo "Skipping." 1>&2 @@ -115,10 +118,10 @@ awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print "" } ' awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""}' | \ LC_ALL=${locale_for_test} pbmtext -builtin bdf -wchar -text-dump + # Test 5. # Long input text - echo "Test 5 Invalid" long_txt=${tmpdir}/long.txt @@ -141,15 +144,15 @@ cat ${long_txt} | wc -c | tr -d ' ' cat ${long_txt} | \ LC_ALL=${locale_for_test} \ pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \ - printf "Expected failure 1"; - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} cat ${long_txt} | \ LC_ALL=${locale_for_test} \ pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \ - printf "Expected failure 2"; - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} rm ${long_txt} @@ -169,41 +172,41 @@ echo "Test 6 Invalid" awk 'BEGIN { printf("%c%c",128,129); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - printf "6-1: ${PIPESTATUS[*]} : $?" - test -s ${test_out}; echo " "$? + printf "6-1: ${PIPESTATUS[*]} : $? " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} awk 'BEGIN { printf("ABC%c%c",192, 193); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - printf "6-2: ${PIPESTATUS[*]} : $?" - test -s ${test_out}; echo " "$? + printf "6-2: ${PIPESTATUS[*]} : $? " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} awk 'BEGIN { printf("abcde%c%c", 254, 253); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - printf "6-3: ${PIPESTATUS[*]} : $?" - test -s ${test_out}; echo " "$? + printf "6-3: ${PIPESTATUS[*]} : $? " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} awk 'BEGIN { printf("abcdefg%c%c", 195, 15); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - printf "6-4: ${PIPESTATUS[*]} : $?" - test -s ${test_out}; echo " "$? + printf "6-4: ${PIPESTATUS[*]} : $? " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} awk 'BEGIN { printf("123456789%c%c%c", 224, 143 ,0); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - printf "6-5: ${PIPESTATUS[*]} : $?" - test -s ${test_out}; echo " "$? + printf "6-5: ${PIPESTATUS[*]} : $? " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} awk 'BEGIN { printf("abcdefg123ABCDEFG%c%c%c%c",247, 135, 135, 7); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - printf "6-6: ${PIPESTATUS[*]} : $?" - test -s ${test_out}; echo " "$? + printf "6-6: ${PIPESTATUS[*]} : $? " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pbmtext.ok b/test/pbmtext.ok index 68ed40d8..975911f2 100644 --- a/test/pbmtext.ok +++ b/test/pbmtext.ok @@ -20,20 +20,20 @@ Test 5 2547645687 4564 1174281741 5741 Test 6 Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) Test 7 text length: 4999 1854691667 52512 1854691667 52512 Test 8 Invalid text length: 5000 -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) diff --git a/test/pbmtext.test b/test/pbmtext.test index 247f76c5..d4ab027e 100755 --- a/test/pbmtext.test +++ b/test/pbmtext.test @@ -112,43 +112,43 @@ echo "Test 6 Invalid" test_out=${tmpdir}/test_out pbmtext -font=testgrid.pbm foo > ${test_out} || \ - printf "Expected failure 1"; - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmtext -font=testimg.ppm foo > ${test_out} || \ - printf "Expected failure 2"; - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmtext -builtin=void foo > ${test_out} || \ - printf "Expected failure 3"; - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmtext -font=${font_pbm} -builtin=fixed foo > ${test_out} || \ - printf "Expected failure 4"; - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmtext -dry-run -text-dump foo > ${test_out} || \ - printf "Expected failure 5"; - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmtext -dump-sheet -text-dump foo > ${test_out} || \ - printf "Expected failure 6"; - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmtext -dry-run -dump-sheet foo > ${test_out} || \ - printf "Expected failure 7"; - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmtext -wchar foo > ${test_out} || \ - printf "Expected failure 8"; - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} rm ${font_pbm} @@ -177,19 +177,19 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pbmtext -nomargins -builtin fixed `cat ${long_txt}` > ${test_out} || \ - printf "Expected failure 1"; - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} cat ${long_txt} | pbmtext -nomargins -builtin fixed > ${test_out} || \ - printf "Expected failure 2"; - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} cat ${long_txt} | \ LC_ALL=C pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \ - printf "Expected failure 3"; - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} rm ${long_txt} diff --git a/test/pbmtextps-dump.ok b/test/pbmtextps-dump.ok index 11a4c5fd..71b2d2a2 100644 --- a/test/pbmtextps-dump.ok +++ b/test/pbmtextps-dump.ok @@ -51,38 +51,38 @@ Test 2 <303132 20 414243 2d 78797a 2e> 1 Test Invalid -Expected failure 1 (-fontsize) 1 -Expected failure 2 (-fontsize 0) 1 -Expected failure 3 (-resolution) 1 -Expected failure 4 (-resolution=0) 1 -Expected failure 5 (-leftmargin) 1 -Expected failure 6 (-leftmargin -1) 1 -Expected failure 7 (-rightmargin) 1 -Expected failure 8 (-rightmargin -1) 1 -Expected failure 9 (-topmargin) 1 -Expected failure 10 (-topmargin -1) 1 -Expected failure 11 (-bottommargin) 1 -Expected failure 12 (-bottommargin -1) 1 -Expected failure 13 (-ascent) 1 -Expected failure 14 (-ascent -1) 1 -Expected failure 15 (-descent) 1 -Expected failure 16 (-descent -1) 1 -Expected failure 17 (-stroke=A) 1 -Expected failure 18 (-pad -crop) 1 -Expected failure 19 (-asciihex <a>) 1 -Expected failure 20 (-asciihex ) 1 -Expected failure 21 (-asciihex <53756c667572) 1 -Expected failure 22 (-asciihex 53756c667572>) 1 -Expected failure 23 (-asciihex <5375<6c667572>) 1 -Expected failure 24 (-asciihex <53756c>667572>) 1 -Expected failure 25 (-ascii85 <~@<6O!FD5W(~) 1 -Expected failure 26 (-ascii85 ~@<6O!FD5W(~>) 1 -Expected failure 27 (-ascii85 <~@<6O<~!FD5W(~>) 1 -Expected failure 28 (-ascii85 <~@<6O~>!FD5W(~>) 1 -Expected failure 29 (-ascii85 <~@<6O!FD5W(~~>) 1 -Expected failure 30 (-ascii85 v) 1 -Expected failure 31 (-ascii85 y) 1 -Expected failure 32 (-ascii85 1z) 1 -Expected failure 33 (-ascii85 z1z) 1 -Expected failure 34 (-ascii85 <~0123z~>) 1 -Expected failure 35 (-font="") 1 +Expected failure 1 (-fontsize) (no output) +Expected failure 2 (-fontsize 0) (no output) +Expected failure 3 (-resolution) (no output) +Expected failure 4 (-resolution=0) (no output) +Expected failure 5 (-leftmargin) (no output) +Expected failure 6 (-leftmargin -1) (no output) +Expected failure 7 (-rightmargin) (no output) +Expected failure 8 (-rightmargin -1) (no output) +Expected failure 9 (-topmargin) (no output) +Expected failure 10 (-topmargin -1) (no output) +Expected failure 11 (-bottommargin) (no output) +Expected failure 12 (-bottommargin -1) (no output) +Expected failure 13 (-ascent) (no output) +Expected failure 14 (-ascent -1) (no output) +Expected failure 15 (-descent) (no output) +Expected failure 16 (-descent -1) (no output) +Expected failure 17 (-stroke=A) (no output) +Expected failure 18 (-pad -crop) (no output) +Expected failure 19 (-asciihex <a>) (no output) +Expected failure 20 (-asciihex ) (no output) +Expected failure 21 (-asciihex <53756c667572) (no output) +Expected failure 22 (-asciihex 53756c667572>) (no output) +Expected failure 23 (-asciihex <5375<6c667572>) (no output) +Expected failure 24 (-asciihex <53756c>667572>) (no output) +Expected failure 25 (-ascii85 <~@<6O!FD5W(~) (no output) +Expected failure 26 (-ascii85 ~@<6O!FD5W(~>) (no output) +Expected failure 27 (-ascii85 <~@<6O<~!FD5W(~>) (no output) +Expected failure 28 (-ascii85 <~@<6O~>!FD5W(~>) (no output) +Expected failure 29 (-ascii85 <~@<6O!FD5W(~~>) (no output) +Expected failure 30 (-ascii85 v) (no output) +Expected failure 31 (-ascii85 y) (no output) +Expected failure 32 (-ascii85 1z) (no output) +Expected failure 33 (-ascii85 z1z) (no output) +Expected failure 34 (-ascii85 <~0123z~>) (no output) +Expected failure 35 (-font="") (no output) diff --git a/test/pbmtextps-dump.test b/test/pbmtextps-dump.test index 82856f7e..fd68667d 100755 --- a/test/pbmtextps-dump.test +++ b/test/pbmtextps-dump.test @@ -90,8 +90,8 @@ for error_flag in \ "-pad -crop" do pbmtextps ${error_flag} -dump-ps ${text} >${test_out} || \ - printf "Expected failure $n (${error_flag})"; - test -s ${test_out}; echo " "$? + printf "Expected failure $n (${error_flag}) " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} n=$((n + 1)) done @@ -105,8 +105,8 @@ for asciihex_string in \ "<53756c>667572>" do pbmtextps -dump-ps -asciihex ${asciihex_string} >${test_out} || \ - printf "Expected failure $n (-asciihex ${asciihex_string})"; - test -s ${test_out}; echo " "$? + printf "Expected failure $n (-asciihex ${asciihex_string}) " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} n=$((n + 1)) done @@ -124,13 +124,13 @@ for ascii85_string in \ "<~0123z~>" do pbmtextps -dump-ps -ascii85 ${ascii85_string} >${test_out} || \ - printf "Expected failure $n (-ascii85 ${ascii85_string})"; - test -s ${test_out}; echo " "$? + printf "Expected failure $n (-ascii85 ${ascii85_string}) " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} n=$((n + 1)) done pbmtextps -font="" -dump-ps ${text} >${test_out} || \ - printf "Expected failure $n (-font=\"\")"; - test -s ${test_out}; echo " "$? + printf "Expected failure $n (-font=\"\") " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pbmtopgm.ok b/test/pbmtopgm.ok index 6ccf9c64..11242259 100644 --- a/test/pbmtopgm.ok +++ b/test/pbmtopgm.ok @@ -19,7 +19,7 @@ P2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) diff --git a/test/pbmtopgm.test b/test/pbmtopgm.test index 02f2bb21..f2c5cf1f 100755 --- a/test/pbmtopgm.test +++ b/test/pbmtopgm.test @@ -18,21 +18,21 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pbmtopgm 5 0 testgrid.pbm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmtopgm 0 9 testgrid.pbm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmtopgm 15 5 testgrid.pbm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmtopgm 5 17 testgrid.pbm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pbmupc.ok b/test/pbmupc.ok index f1b91e99..4f2fd0ae 100644 --- a/test/pbmupc.ok +++ b/test/pbmupc.ok @@ -1,12 +1,12 @@ Test 1 2619309127 10172 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) diff --git a/test/pbmupc.test b/test/pbmupc.test index f8343dd7..74bd54d9 100755 --- a/test/pbmupc.test +++ b/test/pbmupc.test @@ -20,46 +20,46 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pbmupc -s3 0 72890 00011 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmupc -s1 72890 00011 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmupc -s1 0 72890 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmupc -s1 10 72890 00011 > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmupc -s1 0 172890 00011 > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmupc -s1 0 2890 00011 > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmupc -s1 0 72890 100011 > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmupc -s1 0 72890 0011 > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmupc -s1 0 72890 100011 1 > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pgmhist.ok b/test/pgmhist.ok index 3be73ff9..f9184828 100644 --- a/test/pgmhist.ok +++ b/test/pgmhist.ok @@ -30,7 +30,7 @@ Test 2 230 255 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) diff --git a/test/pgmhist.test b/test/pgmhist.test index c141627d..a47ab71e 100755 --- a/test/pgmhist.test +++ b/test/pgmhist.test @@ -35,21 +35,21 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pgmhist -median -quartile testgrid.pbm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmhist -median -decile testgrid.pbm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmhist -quartile -decile testgrid.pbm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmhist testimg.ppm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pgmmake.ok b/test/pgmmake.ok index 8b242822..ac9b968c 100644 --- a/test/pgmmake.ok +++ b/test/pgmmake.ok @@ -2,11 +2,11 @@ Test 1 3662611538 2513 3109612402 5012 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) diff --git a/test/pgmmake.test b/test/pgmmake.test index 3c96d99e..80997d07 100755 --- a/test/pgmmake.test +++ b/test/pgmmake.test @@ -19,41 +19,41 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pgmmake 100 5 5 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmmake 1.01 5 5 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmmake .5 5 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmmake .5 > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmmake -maxval=5 5 5 > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmmake -maxval=0 .5 5 5 > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmmake -maxval=-1 .5 5 5 > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmmake -maxval=65536 .5 5 5 > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pgmnoise-parameters.ok b/test/pgmnoise-parameters.ok index 1bb1cd59..10a05cfa 100644 --- a/test/pgmnoise-parameters.ok +++ b/test/pgmnoise-parameters.ok @@ -1,5 +1,5 @@ -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) diff --git a/test/pgmnoise-parameters.test b/test/pgmnoise-parameters.test index c5e6ada5..79c068d8 100755 --- a/test/pgmnoise-parameters.test +++ b/test/pgmnoise-parameters.test @@ -11,26 +11,26 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pgmnoise -maxval=255 -randomseed=1 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise 100 -randomseed=1 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise 100 0 -randomseed=1 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise 0 100 -randomseed=1 > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise 100 100 100 -randomseed=1 > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pgmnoise.ok b/test/pgmnoise.ok index d98ee053..2a2db565 100644 --- a/test/pgmnoise.ok +++ b/test/pgmnoise.ok @@ -90,13 +90,13 @@ First column should be 2^n - 1. Last column should be 'pool'. 1023 pgmnoise: method: pool 65535 pgmnoise: method: pool Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 10 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) diff --git a/test/pgmnoise.test b/test/pgmnoise.test index 6141121a..ed41622f 100755 --- a/test/pgmnoise.test +++ b/test/pgmnoise.test @@ -78,51 +78,51 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pgmnoise 0 0 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise 0 1 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise 1 0 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise 1 > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise 100 -1 > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise -randomseed=-1 100 100 > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise -maxval=-1 100 100 > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise -maxval=0 100 100 > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmnoise -maxval=$((256 * 256 * 256 * 256)) 10 10 > ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pgmramp.ok b/test/pgmramp.ok index de0d9206..69e3a6e5 100644 --- a/test/pgmramp.ok +++ b/test/pgmramp.ok @@ -42,8 +42,8 @@ Test 2 Test 3 886972785 131087 Test Invalid -Expected failure: -lr -tb 1 -Expected failure: -lr -rectangle 1 -Expected failure: -rectangle -ellipse 1 -Expected failure: insufficient parameters 1 -Expected failure: excessive parameters 1 +Expected failure: -lr -tb (no output) +Expected failure: -lr -rectangle (no output) +Expected failure: -rectangle -ellipse (no output) +Expected failure: insufficient parameters (no output) +Expected failure: excessive parameters (no output) diff --git a/test/pgmramp.test b/test/pgmramp.test index b4dbb3cd..d2e34885 100755 --- a/test/pgmramp.test +++ b/test/pgmramp.test @@ -31,17 +31,17 @@ test_out=${tmpdir}/test_out for combination in "-lr -tb" "-lr -rectangle" "-rectangle -ellipse" do pgmramp $combination 10 10 > ${test_out} || \ - printf "Expected failure: $combination" - test -s ${test_out}; echo " "$? + printf "Expected failure: $combination " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} done pgmramp -lr 1 > ${test_out} || \ - printf "Expected failure: insufficient parameters"; \ - test -s ${test_out}; echo " "$? + printf "Expected failure: insufficient parameters " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmramp -tb 1 1 1 > ${test_out} || \ - printf "Expected failure: excessive parameters"; \ - test -s ${test_out}; echo " "$? + printf "Expected failure: excessive parameters " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pgmtoppm.ok b/test/pgmtoppm.ok index 2484c487..4a2114ab 100644 --- a/test/pgmtoppm.ok +++ b/test/pgmtoppm.ok @@ -26,14 +26,14 @@ Test 6. Should print 3083028153 685 three times 3083028153 685 3083028153 685 Test 7 Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 10 1 -Expected failure 11 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) diff --git a/test/pgmtoppm.test b/test/pgmtoppm.test index 36f63de7..6054fc03 100755 --- a/test/pgmtoppm.test +++ b/test/pgmtoppm.test @@ -66,74 +66,74 @@ echo "-----------------------------------------------------------" 1>&2 pgmtoppm white testimg.ppm > \ ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmtoppm -map=/dev/null testgrid.pbm > \ ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmtoppm black white testgrid.pbm > \ ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmtoppm hwite testgrid.pbm > \ ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmtoppm off-color testgrid.pbm > \ ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmtoppm rgb-255:7/7/7 testgrid.pbm > \ ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmtoppm -black=black -white=white white testgrid.pbm > \ ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmtoppm -black=rgb:0/0/0 -map=${palette_ppm} testgrid.pbm > \ ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmtoppm -white=rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmtoppm rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pgmtoppm rgb:00/00/00-rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ ${test_out} || \ - printf "Expected failure 11" - test -s ${test_out}; echo " "$? + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} #pgmtoppm rgb-255:7/7/7 testgrid.pbm > \ # ${test_out} || \ -# printf "Expected failure 12" -# test -s ${test_out}; echo " "$? +# printf "Expected failure 12 " +# test -s ${test_out} && echo "unexpected output" || echo "(no output)" # rm -f ${test_out} rm -f ${palette_ppm} diff --git a/test/pnmcat.ok b/test/pnmcat.ok index 96e2b884..9958ad62 100644 --- a/test/pnmcat.ok +++ b/test/pnmcat.ok @@ -82,17 +82,17 @@ Test 15. Should print 3948141157 107742 Test 16. Should print 3910239002 107742 3910239002 107742 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 10 1 -Expected failure 11 1 -Expected failure 12 1 -Expected failure 13 1 -Expected failure 14 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) +Expected failure 12 (no output) +Expected failure 13 (no output) +Expected failure 14 (no output) diff --git a/test/pnmcat.test b/test/pnmcat.test index bf40ada2..02fefd38 100755 --- a/test/pnmcat.test +++ b/test/pnmcat.test @@ -109,76 +109,76 @@ echo "-----------------------------------------------------------" 1>&2 # direction not specified pnmcat testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # both directions specified pnmcat -topbottom -leftright testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # both pad colors specified pnmcat -topbottom -white -black testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # justification parameters overspecified pnmcat -lr -jtop -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcat -lr -jtop -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcat -lr -jcenter -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcat -tb -jleft -jright testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcat -tb -jleft -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcat -tb -jcenter -jright testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # justification parameter in the wrong direction pnmcat -lr -jleft testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcat -lr -jright testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 11" - test -s ${test_out}; echo " "$? + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcat -tb -jtop testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 12" - test -s ${test_out}; echo " "$? + printf "Expected failure 12 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcat -tb -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ - printf "Expected failure 13" - test -s ${test_out}; echo " "$? + printf "Expected failure 13 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # more than one input image from standard input cat testgrid.pbm | pnmcat -lr - - testimg.ppm > ${test_out} || \ - printf "Expected failure 14" - test -s ${test_out}; echo " "$? + printf "Expected failure 14 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pnmcolormap.ok b/test/pnmcolormap.ok index 0c6f0d71..8918cf25 100644 --- a/test/pnmcolormap.ok +++ b/test/pnmcolormap.ok @@ -31,10 +31,10 @@ ok ok Test Invalid. -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) diff --git a/test/pnmcolormap.test b/test/pnmcolormap.test index 11d47385..b34a0360 100755 --- a/test/pnmcolormap.test +++ b/test/pnmcolormap.test @@ -44,37 +44,37 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pnmcolormap 0 testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcolormap -1 testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcolormap 0.1 testimg.ppm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcolormap -center -meancolor 16 testimg.ppm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcolormap -center -meanpixel 16 testimg.ppm > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcolormap -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmcolormap -spreadbrightness -spreadluminosity 16 \ testimg.ppm > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pnmcrop1.ok b/test/pnmcrop1.ok index d979d2db..35852c8c 100644 --- a/test/pnmcrop1.ok +++ b/test/pnmcrop1.ok @@ -69,14 +69,14 @@ file: rose.ppm option: -white file: rose.ppm option: -top 0 Test Invalid -Expected failure: -reportfull -reportsize 1 -Expected failure: -reportfull -borderfile=testgrid.pbm 1 -Expected failure: -reportsize -borderfile=testgrid.pbm 1 -Expected failure: -black -white 1 -Expected failure: -black -sides 1 -Expected failure: -white -bg-color=red 1 -Expected failure: -white -bg-corner=topleft 1 -Expected failure: -white -bg-corner=top 1 -Expected failure: -blank-image=pasturize 1 -Expected failure: -bg-color=black -closeness=-1 1 -Expected failure: -bg-color=black -closeness=101 1 +Expected failure: -reportfull -reportsize (no output) +Expected failure: -reportfull -borderfile=testgrid.pbm (no output) +Expected failure: -reportsize -borderfile=testgrid.pbm (no output) +Expected failure: -black -white (no output) +Expected failure: -black -sides (no output) +Expected failure: -white -bg-color=red (no output) +Expected failure: -white -bg-corner=topleft (no output) +Expected failure: -white -bg-corner=top (no output) +Expected failure: -blank-image=pasturize (no output) +Expected failure: -bg-color=black -closeness=-1 (no output) +Expected failure: -bg-color=black -closeness=101 (no output) diff --git a/test/pnmcrop1.test b/test/pnmcrop1.test index 3c86efd7..811b36d8 100755 --- a/test/pnmcrop1.test +++ b/test/pnmcrop1.test @@ -1,4 +1,4 @@ - #! /bin/sh +#! /bin/sh # This script tests: pnmcrop # Also requires: pnmpad pnmmargin pamcut @@ -78,7 +78,7 @@ for option in "-reportfull -reportsize" \ "-bg-color=black -closeness=101" do pnmcrop -reportfull ${option} testgrid.pbm > ${test_out} || \ - printf "Expected failure: %s" "${option}" - test -s ${test_out}; echo " "$? + printf "Expected failure: %s" "${option} " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm ${test_out} done diff --git a/test/pnmcrop3.ok b/test/pnmcrop3.ok index 5a86139c..4b096940 100644 --- a/test/pnmcrop3.ok +++ b/test/pnmcrop3.ok @@ -86,5 +86,5 @@ P1 1111111111111 -3 -1 -1 -1 9 13 544280424 101484 -Expected failure 1 1 -Expected failure 2 1 +Expected failure 1 (no output) +Expected failure 2 (no output) diff --git a/test/pnmcrop3.test b/test/pnmcrop3.test index 1e8da345..3d32ca21 100755 --- a/test/pnmcrop3.test +++ b/test/pnmcrop3.test @@ -68,13 +68,13 @@ echo "Error messages should appear below the line." 1>&2 echo "--------------------------------------------" 1>&2 pnmcrop -borderfile=${border_ppm} ${test_pbm} > ${test_out} || \ - printf "Expected failure 1"; - test -s ${test_out}; echo " "$? - rm ${test_out} + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm ${test_out} pnmcrop -borderfile=${border_pbm} ${test_ppm} > ${test_out} || \ - printf "Expected failure 2"; - test -s ${test_out}; echo " "$? - rm ${test_out} + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm ${test_out} rm ${test_pbm} ${test_ppm} ${border_pbm} ${border_ppm} ${gray_pgm} diff --git a/test/pnmpsnr.ok b/test/pnmpsnr.ok index 7042f86c..38bed0f3 100644 --- a/test/pnmpsnr.ok +++ b/test/pnmpsnr.ok @@ -8,7 +8,7 @@ Test 2 match match Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test index ae6ba3cc..efabe9aa 100755 --- a/test/pnmpsnr.test +++ b/test/pnmpsnr.test @@ -36,23 +36,23 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pnmpsnr ${b_pbm} ${w_pbm} ${b_pbm} > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmpsnr ${b_pbm} > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmpsnr ${b_pbm} ${w_pbm} -target1=100 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmpsnr -machine > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} rm ${b_pbm} ${w_pbm} diff --git a/test/pnmquant.ok b/test/pnmquant.ok index 407d42a3..f4229601 100644 --- a/test/pnmquant.ok +++ b/test/pnmquant.ok @@ -8,11 +8,11 @@ Test 1 1 1 1 1 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) diff --git a/test/pnmquant.test b/test/pnmquant.test index cbe69f5c..4baff9a8 100755 --- a/test/pnmquant.test +++ b/test/pnmquant.test @@ -42,41 +42,41 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pnmquant 0 testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmquant testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmquant 10.5 testimg.ppm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmquant -center -meancolor 16 testimg.ppm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmquant -center -meanpixel 16 testimg.ppm > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmquant -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmquant -spreadbrightness -spreadluminosity 16 testimg.ppm > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmquant -randomseed 1 -norandom 10 testimg.ppm > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pnmremap1.ok b/test/pnmremap1.ok index 23a9dddd..0f511754 100644 --- a/test/pnmremap1.ok +++ b/test/pnmremap1.ok @@ -1,7 +1,7 @@ 3602410851 101482 -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) diff --git a/test/pnmremap1.test b/test/pnmremap1.test index 8626c50f..9c60460b 100755 --- a/test/pnmremap1.test +++ b/test/pnmremap1.test @@ -33,32 +33,32 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pnmremap -mapfile=/dev/null testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmremap -mapfile=/dev/zero testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmremap testimg.ppm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmremap -fs -nofs testimg.ppm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmremap -mapfile=testgrid.pbm -missingcolor=rgb:00/ff/00 testimg.ppm \ > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmremap -mapfile=testgrid.pbm -firstisdefault testimg.ppm > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pnmtile.ok b/test/pnmtile.ok index d28fafa3..572893df 100644 --- a/test/pnmtile.ok +++ b/test/pnmtile.ok @@ -1,6 +1,6 @@ 4228632379 259 0 0 0 : 0 -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) diff --git a/test/pnmtile.test b/test/pnmtile.test index b72ef946..74bae013 100755 --- a/test/pnmtile.test +++ b/test/pnmtile.test @@ -29,21 +29,21 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pnmtile 100 testgrid.pbm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmtile 100 0 testgrid.pbm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmtile 0 100 testgrid.pbm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pnmtile 100 100 100 testgrid.pbm > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/pnmtojpeg-scans.ok b/test/pnmtojpeg-scans.ok new file mode 100644 index 00000000..089dfebf --- /dev/null +++ b/test/pnmtojpeg-scans.ok @@ -0,0 +1,20 @@ +success +pnmtojpeg: Input file has format P6. +It has 149 rows of 227 columns of pixels with max sample value of 255. +pnmtojpeg: A scan script with 7 entries is being used: +pnmtojpeg: Scan 0: Ss= 0 Se= 0 Ah= 0 Al= 0 3 components +pnmtojpeg: Color component 0 index: 0 +pnmtojpeg: Color component 1 index: 1 +pnmtojpeg: Color component 2 index: 2 +pnmtojpeg: Scan 1: Ss= 1 Se= 2 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 0 +pnmtojpeg: Scan 2: Ss= 3 Se= 5 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 0 +pnmtojpeg: Scan 3: Ss= 1 Se=63 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 1 +pnmtojpeg: Scan 4: Ss= 1 Se=63 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 2 +pnmtojpeg: Scan 5: Ss= 6 Se= 9 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 0 +pnmtojpeg: Scan 6: Ss=10 Se=63 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 0 diff --git a/test/pnmtojpeg-scans.test b/test/pnmtojpeg-scans.test new file mode 100755 index 00000000..ea17c8c0 --- /dev/null +++ b/test/pnmtojpeg-scans.test @@ -0,0 +1,32 @@ +#! /bin/bash +# This script tests: pnmtojpeg +# Also requires: + +tmpdir=${tmpdir:-/tmp} +test_jpegscan=${tmpdir}/test.jpegscan +err_out=${tmpdir}/err.out + +cat > ${test_jpegscan} << EOF +# This is a example of a scan script to be used by 'pnmtojpeg' with -scan . +# It should work with any color image. + +#Interleaved DC scan for Y, Cb, Cr: +0, 1, 2: 0-0, 0, 0 ; + +# AC scans: +0: 1- 2, 0, 0 ; +0: 3- 5, 0, 0 ; +1: 1-63, 0, 0 ; +2: 1-63, 0, 0 ; +0: 6- 9, 0, 0 ; +0: 10-63, 0, 0 ; +EOF + +pnmtojpeg testimg.ppm -scans=${test_jpegscan} -verbose \ + > /dev/null 2> ${err_out} && echo "success" || echo "failure" + +cat ${err_out} + +rm ${err_out} ${test_jpegscan} + +# TODO test invalid scan script diff --git a/test/ppmforge-parameters.ok b/test/ppmforge-parameters.ok index c8edc5dd..afb3e855 100644 --- a/test/ppmforge-parameters.ok +++ b/test/ppmforge-parameters.ok @@ -5,10 +5,10 @@ Test 2: Should print 40 30 Test 3: Should print 90 90 90 90 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) diff --git a/test/ppmforge-parameters.test b/test/ppmforge-parameters.test index e5822673..ba436bf0 100755 --- a/test/ppmforge-parameters.test +++ b/test/ppmforge-parameters.test @@ -30,36 +30,36 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 ppmforge -night -dimension=0 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmforge -dimension=10 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmforge -dimension=-1 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmforge -clouds -mesh=1.99 > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmforge -clouds -power=0 > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmforge -ice=-1 > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmforge -glaciers=-1 > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/ppmhist.ok b/test/ppmhist.ok index 468bd317..a78540f1 100644 --- a/test/ppmhist.ok +++ b/test/ppmhist.ok @@ -20,6 +20,6 @@ Test 2 Summary: 6 colors: 1 black, 0 white, 0 gray, 5 color Summary: 6 colors: 1 black, 1 white, 1 gray, 3 color Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) diff --git a/test/ppmhist.test b/test/ppmhist.test index 8c2eedbc..27ae9cea 100755 --- a/test/ppmhist.test +++ b/test/ppmhist.test @@ -36,16 +36,16 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 ppmhist -hexcolor -float testimg.ppm > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmhist -hexcolor -map testimg.ppm > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmhist -float -map testimg.ppm > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/ppmmake.ok b/test/ppmmake.ok index 6d559c8d..0231874f 100644 --- a/test/ppmmake.ok +++ b/test/ppmmake.ok @@ -3,13 +3,13 @@ Test 1 4294967295 0 2378991101 7513 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 10 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) diff --git a/test/ppmmake.test b/test/ppmmake.test index 30eb596a..fb7bf74a 100755 --- a/test/ppmmake.test +++ b/test/ppmmake.test @@ -19,51 +19,51 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 ppmmake rgb:gg/00/00 2 2 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmmake rgb:ff/ff/00 2 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmmake rgbi:1.1/0/0 2 2 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmmake rgbi:1.0/.5 2 2 > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmmake rainbow 2 2 > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmmake 2 2 > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmmake blue -maxval=0 2 2 > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmmake blue -maxval=-1 2 2 > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmmake blue -maxval=65536 2 2 > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} RGBDEF=/dev/null ppmmake red 2 2 > ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/ppmpat-random.ok b/test/ppmpat-random.ok index 71f631e5..71f631e5 100755..100644 --- a/test/ppmpat-random.ok +++ b/test/ppmpat-random.ok diff --git a/test/ppmpat.ok b/test/ppmpat.ok index f2b355a9..dc7922ed 100644 --- a/test/ppmpat.ok +++ b/test/ppmpat.ok @@ -19,29 +19,29 @@ Test 9. Should print: 3057513592 661 Test 10. Should print: 1861389287 661 1861389287 661 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 -Expected failure 9 1 -Expected failure 10 1 -Expected failure 11 1 -Expected failure 12 1 -Expected failure 13 1 -Expected failure 14 1 -Expected failure 15 1 -Expected failure 16 1 -Expected failure 17 1 -Expected failure 18 1 -Expected failure 19 1 -Expected failure 20 1 -Expected failure 21 1 -Expected failure 22 1 -Expected failure 23 1 -Expected failure 24 1 -Expected failure 25 1 -Expected failure 26 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) +Expected failure 12 (no output) +Expected failure 13 (no output) +Expected failure 14 (no output) +Expected failure 15 (no output) +Expected failure 16 (no output) +Expected failure 17 (no output) +Expected failure 18 (no output) +Expected failure 19 (no output) +Expected failure 20 (no output) +Expected failure 21 (no output) +Expected failure 22 (no output) +Expected failure 23 (no output) +Expected failure 24 (no output) +Expected failure 25 (no output) +Expected failure 26 (no output) diff --git a/test/ppmpat.test b/test/ppmpat.test index ced2e64a..48c2460f 100755 --- a/test/ppmpat.test +++ b/test/ppmpat.test @@ -50,48 +50,48 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 ppmpat -g2 -g3 10 10 > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -madras -tartan 10 10 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -poles -squig 10 10 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -camo -anticamo 10 10 > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -argyle1 -argyle2 10 10 > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat 10 10 > ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -g2 10 > ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -g2 10 10 10 > ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -g2 10 > ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} clist1="-color=rgb:00/00/00" @@ -101,89 +101,89 @@ clist4="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff,rgb:ff/ff/ff" # These patterns require exactly 2 colors ppmpat -gingham2 ${clist1} 10 10 > ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -argyle1 ${clist1} 10 10 > ${test_out} || \ - printf "Expected failure 11" - test -s ${test_out}; echo " "$? + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -gingham2 ${clist3} 10 10 > ${test_out} || \ - printf "Expected failure 12" - test -s ${test_out}; echo " "$? + printf "Expected failure 12 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -argyle1 ${clist3} 10 10 > ${test_out} || \ - printf "Expected failure 13" - test -s ${test_out}; echo " "$? + printf "Expected failure 13 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # These require exactly 3 colors ppmpat -gingham3 ${clist2} 10 10 > ${test_out} || \ - printf "Expected failure 14" - test -s ${test_out}; echo " "$? + printf "Expected failure 14 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -argyle2 ${clist2} 10 10 > ${test_out} || \ - printf "Expected failure 15" - test -s ${test_out}; echo " "$? + printf "Expected failure 15 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -madras ${clist2} 10 10 > ${test_out} || \ - printf "Expected failure 16" - test -s ${test_out}; echo " "$? + printf "Expected failure 16 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -tartan ${clist2} 10 10 > ${test_out} || \ - printf "Expected failure 17" - test -s ${test_out}; echo " "$? + printf "Expected failure 17 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -gingham3 ${clist4} 10 10 > ${test_out} || \ - printf "Expected failure 18" - test -s ${test_out}; echo " "$? + printf "Expected failure 18 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -argyle2 ${clist4} 10 10 > ${test_out} || \ - printf "Expected failure 19" - test -s ${test_out}; echo " "$? + printf "Expected failure 19 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -madras ${clist4} 10 10 > ${test_out} || \ - printf "Expected failure 20" - test -s ${test_out}; echo " "$? + printf "Expected failure 20 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -tartan ${clist4} 10 10 > ${test_out} || \ - printf "Expected failure 21" - test -s ${test_out}; echo " "$? + printf "Expected failure 21 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # These require at least 3 colors ppmpat -squig ${clist2} 10 10 > ${test_out} || \ - printf "Expected failure 22" - test -s ${test_out}; echo " "$? + printf "Expected failure 22 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -camo ${clist2} 10 10 > ${test_out} || \ - printf "Expected failure 23" - test -s ${test_out}; echo " "$? + printf "Expected failure 23 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -anticamo ${clist2} 10 10 > ${test_out} || \ - printf "Expected failure 24" - test -s ${test_out}; echo " "$? + printf "Expected failure 24 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # The squig pattern has an aspect ratio restriction ppmpat -squig ${clist3} 10 250 > ${test_out} || \ - printf "Expected failure 25" - test -s ${test_out}; echo " "$? + printf "Expected failure 25 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmpat -squig ${clist3} 500 20 > ${test_out} || \ - printf "Expected failure 26" - test -s ${test_out}; echo " "$? + printf "Expected failure 26 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/ppmrough-parameters.ok b/test/ppmrough-parameters.ok new file mode 100644 index 00000000..473ace05 --- /dev/null +++ b/test/ppmrough-parameters.ok @@ -0,0 +1,25 @@ +Test Invalid +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) +Expected failure 10 (no output) +Expected failure 11 (no output) +Expected failure 12 (no output) +Expected failure 13 (no output) +Expected failure 14 (no output) +Expected failure 15 (no output) +Expected failure 16 (no output) +Expected failure 17 (no output) +Expected failure 20 (no output) +Expected failure 18 (no output) +Expected failure 19 (no output) +Expected failure 20 (no output) +Expected failure 21 (no output) +Expected failure 22 (no output) +Expected failure 23 (no output) diff --git a/test/ppmrough-parameters.test b/test/ppmrough-parameters.test new file mode 100755 index 00000000..fb67424e --- /dev/null +++ b/test/ppmrough-parameters.test @@ -0,0 +1,145 @@ +#! /bin/sh +# This script tests: ppmrough +# Also requires: + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + + +# Test Invalid +echo "Test Invalid" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +ppmrough -h 10 -w 10 -top -1 > ${test_out} || \ + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -h 10 -w 100 -top 11 > ${test_out} || \ + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + + +ppmrough -h 10 -w 10 -bottom -1 > ${test_out} || \ + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -h 10 -w 1000 -bottom 11 > ${test_out} || \ + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -h 10 -w 10 -left -1 > ${test_out} || \ + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -h 10 -w 100 -left 101 > ${test_out} || \ + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + + +ppmrough -h 10 -w 10 -right -1 > ${test_out} || \ + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -h 10 -w 1000 -right 1001 > ${test_out} || \ + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + + +ppmrough -width 0.1 > ${test_out} || \ + printf "Expected failure 9 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -width -1 > ${test_out} || \ + printf "Expected failure 10 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -width > ${test_out} || \ + printf "Expected failure 11 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + + +ppmrough -height 0.1 > ${test_out} || \ + printf "Expected failure 12 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -height -1 > ${test_out} || \ + printf "Expected failure 13 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -height > ${test_out} || \ + printf "Expected failure 14 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + + +ppmrough -randomseed 0.1 > ${test_out} || \ + printf "Expected failure 15 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -randomseed -1 > ${test_out} || \ + printf "Expected failure 16 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -randomseed > ${test_out} || \ + printf "Expected failure 17 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + + + +ppmrough -var A > ${test_out} || \ + printf "Expected failure 20 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -var -1 > ${test_out} || \ + printf "Expected failure 18 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -var > ${test_out} || \ + printf "Expected failure 19 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + + +ppmrough -bg redmint > ${test_out} || \ + printf "Expected failure 20 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -bg > ${test_out} || \ + printf "Expected failure 21 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + + +ppmrough -fg redmint > ${test_out} || \ + printf "Expected failure 22 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + +ppmrough -fg > ${test_out} || \ + printf "Expected failure 23 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + diff --git a/test/ppmrough.ok b/test/ppmrough.ok index 83643849..4beff006 100755..100644 --- a/test/ppmrough.ok +++ b/test/ppmrough.ok @@ -1 +1,24 @@ +Test 1. Should print 378403602 30015 378403602 30015 +Test 2. Should print 378403602 30015 +378403602 30015 +Test 3. Should print 535171440 30015 +535171440 30015 +Test 4. Should print 937167683 30015 +937167683 30015 +Test 5. Should print 1927474861 30015 +1927474861 30015 +Test 6. Should print 3596045345 30015 +3596045345 30015 +Test 7. Should print 198510149 30015 +198510149 30015 +Test 8. Should print 1128371780 30015 +1128371780 30015 +Test 9. Should print 2909877411 30015 +2909877411 30015 +Test 10. Should print 2820370592 30015 +2820370592 30015 +Test 11. Should print 2028409204 30015 +2028409204 30015 +Test 12. Should print 4234304830 30015 +4234304830 30015 diff --git a/test/ppmrough.test b/test/ppmrough.test index b10ba941..e1d720d5 100755 --- a/test/ppmrough.test +++ b/test/ppmrough.test @@ -2,5 +2,47 @@ # This script tests: ppmrough # Also requires: -# Should print: 378403602 30015 (Glibc and MAC OS) -ppmrough -randomseed 1 | cksum +defaultopts="-randomseed 1 -bg rgb:00/ff/ff -fg rgb:ff/ff/00 -w 100 -h 100" + +# No border + +echo "Test 1. Should print 378403602 30015" +ppmrough -randomseed 1 | cksum + +echo "Test 2. Should print 378403602 30015" +ppmrough -randomseed 1 -var 0 | cksum + +# Vertical border + +echo "Test 3. Should print 535171440 30015" +ppmrough ${defaultopts} -left 20 | cksum + +echo "Test 4. Should print 937167683 30015" +ppmrough ${defaultopts} -right 20 | cksum + +echo "Test 5. Should print 1927474861 30015" +ppmrough ${defaultopts} -left 50 | cksum + +echo "Test 6. Should print 3596045345 30015" +ppmrough ${defaultopts} -right 50 | cksum + +echo "Test 7. Should print 198510149 30015" +ppmrough ${defaultopts} -right 20 -var 0 | cksum + +# Horizontal border + +echo "Test 8. Should print 1128371780 30015" +ppmrough ${defaultopts} -top 30 | cksum + +echo "Test 9. Should print 2909877411 30015" +ppmrough ${defaultopts} -bottom 25 | cksum + +echo "Test 10. Should print 2820370592 30015" +ppmrough ${defaultopts} -top 50 | cksum + +echo "Test 11. Should print 2028409204 30015" +ppmrough ${defaultopts} -bottom 50 | cksum + +echo "Test 12. Should print 4234304830 30015" +ppmrough ${defaultopts} -bottom 10 -var 0 | cksum + diff --git a/test/ppmshift.ok b/test/ppmshift.ok index 735ac445..735ac445 100755..100644 --- a/test/ppmshift.ok +++ b/test/ppmshift.ok diff --git a/test/ppmspread.ok b/test/ppmspread.ok index 40f44465..40f44465 100755..100644 --- a/test/ppmspread.ok +++ b/test/ppmspread.ok diff --git a/test/ppmtoapplevol.ok b/test/ppmtoapplevol.ok index 46acda60..daed172c 100644 --- a/test/ppmtoapplevol.ok +++ b/test/ppmtoapplevol.ok @@ -1,6 +1,6 @@ Test: should print 1518149010 3065 1518149010 3065 Test Invalid -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) diff --git a/test/ppmtoapplevol.test b/test/ppmtoapplevol.test index 4964ede8..a11e6aa6 100755 --- a/test/ppmtoapplevol.test +++ b/test/ppmtoapplevol.test @@ -15,16 +15,16 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pbmmake 10 11 | ppmtoapplevol > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmmake 10 13 | ppmtoapplevol > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} pbmmake 256 12 | ppmtoapplevol > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/ppmtomitsu.ok b/test/ppmtomitsu.ok new file mode 100644 index 00000000..951189d4 --- /dev/null +++ b/test/ppmtomitsu.ok @@ -0,0 +1,14 @@ +Test 0. Should print 458455366 101484 +458455366 101484 +Test 1. Should print 3110813682 101562 +3110813682 101562 +Test 2. Should print 4168174994 34399 +4168174994 34399 +Test 3. Should print 3201293405 310 +3201293405 310 +Test 4. Should print 3354679572 752 +3354679572 752 +Test 5. Should print 3999654426 101549 +3999654426 101549 +Test 6. Should print 4201246884 101549 +4201246884 101549 diff --git a/test/ppmtomitsu.test b/test/ppmtomitsu.test new file mode 100755 index 00000000..ce4bbf56 --- /dev/null +++ b/test/ppmtomitsu.test @@ -0,0 +1,31 @@ +#! /bin/sh +# This script tests: ppmtomitsu +# Also requires: pnmcolormap pnmremap + +tmpdir=${tmpdir:-/tmp} +testimg100_ppm=${tmpdir}/testimg100.ppm + +echo "Test 0. Should print 458455366 101484" +# equivalent to: Pnmquant 100 testimg.ppm +pnmcolormap 100 testimg.ppm | pnmremap -nofloyd -mapfile=- testimg.ppm |\ + tee ${testimg100_ppm} | cksum + +echo "Test 1. Should print 3110813682 101562" +ppmtomitsu testimg.ppm | cksum + +echo "Test 2. Should print 4168174994 34399" +ppmtomitsu ${testimg100_ppm} | cksum + +echo "Test 3. Should print 3201293405 310" +ppmtomitsu testgrid.pbm | cksum + +echo "Test 4. Should print 3354679572 752" +ppmtomitsu -tiny testgrid.pbm | cksum + +echo "Test 5. Should print 3999654426 101549" +ppmtomitsu -tiny testimg.ppm | cksum + +echo "Test 6. Should print 4201246884 101549" +ppmtomitsu -tiny ${testimg100_ppm} | cksum + +rm ${testimg100_ppm} diff --git a/test/ppmwheel.ok b/test/ppmwheel.ok index 790a19cb..525bee2c 100644 --- a/test/ppmwheel.ok +++ b/test/ppmwheel.ok @@ -2,8 +2,8 @@ Test 1. 1537578995 59 875938089 86 Test Invalid. -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) diff --git a/test/ppmwheel.test b/test/ppmwheel.test index c6583f97..ca439bea 100755 --- a/test/ppmwheel.test +++ b/test/ppmwheel.test @@ -122,26 +122,26 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 ppmwheel 10 -huevalue -huesaturation > ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmwheel 0 > ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmwheel 3 > ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmwheel > ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ppmwheel 10 10 > ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} diff --git a/test/qoi-roundtrip.ok b/test/qoi-roundtrip.ok index faa7601f..66e25bd8 100644 --- a/test/qoi-roundtrip.ok +++ b/test/qoi-roundtrip.ok @@ -17,18 +17,18 @@ Test 3. Should print 3.N 0 0 3.3 0 0 3.4 0 0 Test Invalid -Should print: Expected failure N 1 -Expected failure 1 1 -Expected failure 2 1 -Expected failure 3 1 -Expected failure 4 1 -Expected failure 5 1 -Expected failure 6 1 -Expected failure 7 1 -Expected failure 8 1 +Should print: Expected failure N (no output) +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) ------------------------------ -Should print: Expected failure N 0 -Expected failure 9 0 -Expected failure 10 0 -Expected failure 11 0 -Expected failure 12 0 +Should print: Expected failure N (output produced) +Expected failure 9 (output produced) +Expected failure 10 (output produced) +Expected failure 11 (output produced) +Expected failure 12 (output produced) diff --git a/test/qoi-roundtrip.test b/test/qoi-roundtrip.test index f758abcc..52396e39 100755 --- a/test/qoi-roundtrip.test +++ b/test/qoi-roundtrip.test @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # This script tests: qoitopam pamtoqoi # Also requires: pamdepth pamfile pamseq pamstack pamtopnm pbmmake # Also requires: pgmnoise ppmpat ppmtopgm @@ -155,19 +155,19 @@ echo "Invalid command-line argument combinations." 1>&2 echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 -echo "Should print: Expected failure N 1" +echo "Should print: Expected failure N (no output)" pamseq -tupletype="void" 1 1 | pamtoqoi > \ ${test_out} || \ - printf "Expected failure 1" - test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ( echo "P1"; echo "400000001 1" ; head -c 400000001 /dev/zero ) | pamtoqoi > \ ${test_out} || \ - printf "Expected failure 2" - test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # Replace fields in the qoi file header with invalid values @@ -175,24 +175,24 @@ pamseq -tupletype="void" 1 1 | pamtoqoi > \ ( printf "qojf" tail -c +5 ${maze_qoi} ) | qoitopam > \ ${test_out} || \ - printf "Expected failure 3" - test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ( head -c 4 ${maze_qoi} head -c 4 /dev/zero tail -c +9 ${maze_qoi} ) | qoitopam > \ ${test_out} || \ - printf "Expected failure 4" - test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ( head -c 8 ${maze_qoi} head -c 4 /dev/zero tail -c +13 ${maze_qoi} ) | qoitopam > \ ${test_out} || \ - printf "Expected failure 5" - test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} # Following sed construct means: "replace first 8 bytes of input @@ -204,51 +204,51 @@ pamseq -tupletype="void" 1 1 | pamtoqoi > \ tail -c +5 ${maze_qoi} | \ sed '1s/^......../\x00\x00\x4F\xFF\x00\x00\x4F\xFF/' ) | qoitopam > \ ${test_out} || \ - printf "Expected failure 6" - test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ( head -c 12 ${maze_qoi} tail -c +13 ${maze_qoi} | sed '1s/^./\x01/' ) | qoitopam > \ ${test_out} || \ - printf "Expected failure 7" - test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} ( head -c 13 ${maze_qoi} tail -c +14 ${maze_qoi} | sed '1s/^./\x02/' ) | qoitopam > \ ${test_out} || \ - printf "Expected failure 8" - test -s ${test_out}; echo " "$? + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" rm -f ${test_out} echo "------------------------------" -echo "Should print: Expected failure N 0" +echo "Should print: Expected failure N (output produced)" ( head -c $(( ${maze_qoi_size} - 9 )) ${maze_qoi} tail -c 9 ${maze_qoi} | sed '1s/^./\xfd/' ) | qoitopam > \ ${test_out} || \ - printf "Expected failure 9" - test -s ${test_out}; echo " "$? + printf "Expected failure 9 " + test -s ${test_out} && echo "(output produced)"|| echo "no output" rm -f ${test_out} head -c $(( ${maze_qoi_size} - 1 )) ${maze_qoi} | qoitopam > \ ${test_out} || \ - printf "Expected failure 10" - test -s ${test_out}; echo " "$? + printf "Expected failure 10 " + test -s ${test_out} && echo "(output produced)"|| echo "no output" rm -f ${test_out} ( head -c $(( ${maze_qoi_size} - 1 )) ${maze_qoi} printf '1' ) | qoitopam > \ ${test_out} || \ - printf "Expected failure 11" - test -s ${test_out}; echo " "$? + printf "Expected failure 11 " + test -s ${test_out} && echo "(output produced)"|| echo "no output" rm -f ${test_out} ( cat ${maze_qoi}; printf '1' ) | qoitopam > \ ${test_out} || \ - printf "Expected failure 12" - test -s ${test_out}; echo " "$? + printf "Expected failure 12 " + test -s ${test_out} && echo "(output produced)"|| echo "no output" rm -f ${test_out} rm ${maze_qoi} diff --git a/test/stdin-pam1.test b/test/stdin-pam1.test index 7cb15dfc..2ab7b11c 100755 --- a/test/stdin-pam1.test +++ b/test/stdin-pam1.test @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # This script tests: pamaddnoise pamaltsat pambackground pambayer # This script tests: pambrighten pamcat pamcut pamdeinterlace pamdepth pamditherbw # This script tests: pamedge pamexec pamfile pamfind pamfix pamflip diff --git a/test/stdin-pam2.test b/test/stdin-pam2.test index f47df604..10713c77 100755 --- a/test/stdin-pam2.test +++ b/test/stdin-pam2.test @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # This script tests: pammasksharpen pammixmulti pamdice # This script tests: pamlookup pamunlookup # Also requires: pbmmake diff --git a/test/stdin-ppm3.test b/test/stdin-ppm3.test index 064e3e22..1313ac40 100755 --- a/test/stdin-ppm3.test +++ b/test/stdin-ppm3.test @@ -1,4 +1,4 @@ -o#! /bin/sh +#! /bin/sh # This script tests: ppmtobmp bmptopnm # This script tests: ppmtoilbm ilbmtoppm # This script tests: ppmtoleaf leaftoppm diff --git a/test/xpm-roundtrip.ok b/test/xpm-roundtrip.ok index 5168378d..2083dc10 100644 --- a/test/xpm-roundtrip.ok +++ b/test/xpm-roundtrip.ok @@ -1 +1,4 @@ +Test 1. Should print 1926073387 101484 +1926073387 101484 +Test 2. Should print 281226646 481 281226646 481 diff --git a/test/xpm-roundtrip.test b/test/xpm-roundtrip.test index 6e3e415b..c016c8c3 100755 --- a/test/xpm-roundtrip.test +++ b/test/xpm-roundtrip.test @@ -2,8 +2,10 @@ # This script tests: ppmtoxpm xpmtoppm # Also requires: pgmtopbm ppmtopgm +echo "Test 1. Should print 1926073387 101484" +ppmtoxpm -hexonly testimg.ppm | \ + xpmtoppm | cksum -#ppmtoxpm -hexonly testimg.ppm | \ -# xpmtoppm | cksum +echo "Test 2. Should print 281226646 481" ppmtoxpm maze.pbm | xpmtoppm | \ ppmtopgm | pgmtopbm -th -value=0.5 | cksum diff --git a/test/xwd-roundtrip.ok b/test/xwd-roundtrip.ok index 864d737a..31dcba3e 100644 --- a/test/xwd-roundtrip.ok +++ b/test/xwd-roundtrip.ok @@ -1,6 +1,9 @@ -Test 1. Should produce 1571496937 33838, cksum of testimg.red +Test 1. Should produce 1571496937 33838, cksum of testimg.red twice +1571496937 33838 1571496937 33838 Test 2. Should produce 1926073387 101484 1926073387 101484 -Test 3. Should produce 281226646 481 +Test 3. Should produce 281226646 481 three times +281226646 481 +281226646 481 281226646 481 diff --git a/test/xwd-roundtrip.test b/test/xwd-roundtrip.test index 2d00971d..1583cd68 100755 --- a/test/xwd-roundtrip.test +++ b/test/xwd-roundtrip.test @@ -1,15 +1,22 @@ #! /bin/sh # This script tests: pnmtoxwd xwdtopnm -# Also requires: pamchannel pamtopnm pamdepth +# Also requires: pamchannel pamtopnm pamdepth ppmtopgm -echo "Test 1. Should produce 1571496937 33838, cksum of testimg.red" +echo "Test 1. Should produce 1571496937 33838, cksum of testimg.red twice" pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ pnmtoxwd | xwdtopnm | pamdepth 255 | cksum +pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ + pnmtoxwd -direct | xwdtopnm -quiet | pamdepth 255 | ppmtopgm | cksum + echo "Test 2. Should produce 1926073387 101484" pnmtoxwd --quiet testimg.ppm | \ xwdtopnm --quiet | pamdepth 255 | cksum -echo "Test 3. Should produce 281226646 481" -pnmtoxwd --quiet maze.pbm | \ - xwdtopnm | cksum +echo "Test 3. Should produce 281226646 481 three times" +pnmtoxwd --quiet maze.pbm | xwdtopnm | cksum + +pnmtoxwd --quiet -pseudodepth 1 maze.pbm | xwdtopnm | cksum + +pnmtoxwd --quiet -pseudodepth 16 maze.pbm | xwdtopnm | cksum + diff --git a/test/ybm-roundtrip.ok b/test/ybm-roundtrip.ok new file mode 100644 index 00000000..3873d097 --- /dev/null +++ b/test/ybm-roundtrip.ok @@ -0,0 +1,2 @@ +Test. Should print 281226646 481 +281226646 481 diff --git a/test/ybm-roundtrip.test b/test/ybm-roundtrip.test new file mode 100755 index 00000000..b53d2ba0 --- /dev/null +++ b/test/ybm-roundtrip.test @@ -0,0 +1,7 @@ +#! /bin/sh +# This script tests: pbmtoybm xbmtopbm +# Also requires: + +echo "Test. Should print 281226646 481" + +pbmtoybm maze.pbm | ybmtopbm | cksum |