diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-03-26 02:53:02 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-03-26 02:53:02 +0000 |
commit | b117a415aaf58c435805243a930e833f8cf62421 (patch) | |
tree | ca6cda4c24d37737a3942e534b95006bcd566c5a /test | |
parent | 34bb24c566c9d9fe3c4ae71fc4c6b53323fb1dd9 (diff) | |
download | netpbm-mirror-b117a415aaf58c435805243a930e833f8cf62421.tar.gz netpbm-mirror-b117a415aaf58c435805243a930e833f8cf62421.tar.xz netpbm-mirror-b117a415aaf58c435805243a930e833f8cf62421.zip |
Promote trunk (10.90.00) to advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3784 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
41 files changed, 935 insertions, 27 deletions
diff --git a/test/Test-Order b/test/Test-Order index 2548e501..a696529b 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -27,6 +27,7 @@ ppmforge-parameters.test # Generators with random components pgmnoise.test +pgmnoise-parameters.test ppmpat-random.test ppmforge.test ppmrough.test @@ -41,12 +42,14 @@ ppmhist.test pamsumm.test pnmpsnr.test pbmminkowski.test +pgmminkowski.test pnmcolormap.test # Basic (internal) converter tests pamtopam.test +pbmtopgm.test pgmtopgm.test ppmtoppm.test pgmtoppm.test @@ -55,12 +58,17 @@ pnmtopnm-plain.test # Editor tests +pamdepth.test + pamditherbw.test pamhue.test pbmclean.test pamcut.test pnmcat.test +pamdice.test +pamundice.test + pamflip1.test pamflip2.test pnminvert.test diff --git a/test/pamchannel.ok b/test/pamchannel.ok index 79317f03..41d3f890 100644 --- a/test/pamchannel.ok +++ b/test/pamchannel.ok @@ -1,3 +1,10 @@ +Test 1 1571496937 33838 +Test 2 394856971 33838 +Test 3 3164158573 33838 +Test Invalid +Expected failure 1 1 +Expected failure 2 1 +Expected failure 3 1 diff --git a/test/pamchannel.test b/test/pamchannel.test index 3529f4fe..2e017ef2 100755 --- a/test/pamchannel.test +++ b/test/pamchannel.test @@ -1,7 +1,6 @@ #! /bin/bash # This script tests: pamchannel -# Also requires: pamtopnm - +# Also requires: pamtopam pamtopnm # Extract planes one by one. # Convert output to pgm to make it identical to ppmtorgb3 output. @@ -15,18 +14,44 @@ # Test 1. red channel # Should produce 1571496937 33838 +echo "Test 1" pamchannel -infile testimg.ppm 0 | \ pamtopnm --assume | cksum # Test 2. green channel # Should produce 394856971 33838 +echo "Test 2" pamchannel -infile testimg.ppm -tupletype="GRAYSCALE" 1 | \ pamtopnm | cksum # Test 3. blue channel # Should produce 3164158573 33838 +echo "Test 3" pamchannel -infile testimg.ppm 2 | \ pamtopnm --assume | cksum + +# Test invalid: specified channel does not exist + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +echo "Test Invalid" + +pamchannel -infile testgrid.pbm 1 > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +pamchannel -infile testimg.ppm 3 > ${test_out} || \ + echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +pamtopam testimg.ppm | pamchannel -infile=- 4 > ${test_out} || \ + echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + +rm ${test_out} \ No newline at end of file diff --git a/test/pamcrater.ok b/test/pamcrater.ok index cfb186a6..a5571f35 100644 --- a/test/pamcrater.ok +++ b/test/pamcrater.ok @@ -1,6 +1,13 @@ +Test 1. 4 4 4 +Test 2. 2 2 2 +Test Invalid. +Expected failure 1 1 +Expected failure 2 1 +Expected failure 3 1 +Expected failure 4 1 diff --git a/test/pamcrater.test b/test/pamcrater.test index 4d3858b9..ba10ca24 100755 --- a/test/pamcrater.test +++ b/test/pamcrater.test @@ -3,8 +3,8 @@ # Also requires: pamstack pamvalidate pamcut pamflip -# We use the undocumented --test and --radius options of pamcrater. -# pamcrater --test --radius=N +# We use the undocumented -test and -radius options of pamcrater. +# pamcrater -test -radius=N # The above draws a single crater of radius N. # The resulting image should be symmetric. @@ -18,11 +18,12 @@ test100_pam=${tmpdir}/test100.pam test150_pam=${tmpdir}/test150.pam # Test 1. Should print 4 three times +echo "Test 1." -pamcrater --test --radius=10 > $test10_pam -pamcrater --test --radius=50 > $test50_pam -pamcrater --test --radius=100 > $test100_pam -pamcrater --test --radius=150 > $test150_pam +pamcrater -test -radius=10 > $test10_pam +pamcrater -test -radius=50 > $test50_pam +pamcrater -test -radius=100 > $test100_pam +pamcrater -test -radius=150 > $test150_pam pamstack ${test10_pam} ${test50_pam} ${test100_pam} ${test150_pam} | pamvalidate > ${test_pam} @@ -39,6 +40,7 @@ for i in 1 10 70 rm ${test_pam} ${test10_pam} ${test50_pam} # Test 2. Should print 2 three times +echo "Test 2." pamshadedrelief ${test100_pam} > ${testshaded_pam} @@ -51,3 +53,26 @@ pamshadedrelief ${test100_pam} > ${testshaded_pam} ) | uniq -c | awk '{print $1}' rm ${testshaded_pam} ${test100_pam} + +echo "Test Invalid." + +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "------------------------------" 1>&2 + +pamcrater -width 0 > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +pamcrater -height 0 > ${test_out} || \ + echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +pamcrater -number 0 > ${test_out} || \ + echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + +pamcrater -test -radius=10 | pamshadedrelief -gamma 0 > ${test_out} || \ + echo -n "Expected failure 4"; test -s ${test_out}; echo " "$? + +rm -f ${test_out} \ No newline at end of file diff --git a/test/pamcut.ok b/test/pamcut.ok index b08bc531..3d5c5a7f 100644 --- a/test/pamcut.ok +++ b/test/pamcut.ok @@ -15,5 +15,22 @@ Test 5. 2425386270 41 2425386270 41 2425386270 41 +2425386270 41 Test 6. 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 diff --git a/test/pamcut.test b/test/pamcut.test index 9971b1a5..e4d8c62f 100755 --- a/test/pamcut.test +++ b/test/pamcut.test @@ -31,7 +31,7 @@ pamcut -top 10 -left 10 -bottom -11 -right -11 testimg.ppm | cksum pamcut -top 10 -left 10 -width 207 -height 129 testimg.ppm | cksum -# Test 5. Should print 2425386270 41 four times +# Test 5. Should print 2425386270 41 five times echo Test 5. pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 testgrid.pbm | \ @@ -39,9 +39,71 @@ pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 testgrid.pbm | \ pamcut -top 0 -left 0 -bottom 15 -right 13 testgrid.pbm | cksum pamcut -top 0 -left 0 -bottom -1 -right -1 testgrid.pbm | cksum pamcut -top 0 -left 0 -width 14 -height 16 testgrid.pbm | cksum - +pamcut testgrid.pbm | cksum # Test 6. Should print 3412257956 129 echo Test 6. pbmmake -g 50 50 | pamcut 5 5 30 30 | cksum + + +echo "Test Invalid" + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +# overspecification +pamcut -left=1 -right=1 -width=14 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +pamcut -top=1 -bottom=1 -height=16 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +pamcut -right=1 -cropright=1 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + +pamcut -top=1 -croptop=1 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 4"; test -s ${test_out}; echo " "$? + +pamcut -bottom=1 -cropbottom=1 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 5"; test -s ${test_out}; echo " "$? + +pamcut -left=1 -cropleft=1 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 6"; test -s ${test_out}; echo " "$? + +# excessive cropping +pamcut -cropleft=7 -cropright=8 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 7"; test -s ${test_out}; echo " "$? + +pamcut -left=7 -right=6 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 8"; test -s ${test_out}; echo " "$? + +pamcut -croptop=8 -cropbottom=8 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 9"; test -s ${test_out}; echo " "$? + +pamcut -top=10 -bottom=9 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 6"; test -s ${test_out}; echo " "$? + +# pad absent +pamcut -cropleft=1 -width=14 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 10"; test -s ${test_out}; echo " "$? + +pamcut -croptop=1 -height=16 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 11"; test -s ${test_out}; echo " "$? + +# legacy style: insufficient number of positional parameters +pamcut 5 testimg.ppm > ${test_out} || \ + echo -n "Expected failure 12"; test -s ${test_out}; echo " "$? + +pamcut 5 4 testimg.ppm > ${test_out} || \ + echo -n "Expected failure 13"; test -s ${test_out}; echo " "$? + +pamcut 5 5 30 testimg.ppm > ${test_out} || \ + echo -n "Expected failure 14"; test -s ${test_out}; echo " "$? + +rm -f ${test_out} \ No newline at end of file diff --git a/test/pamdepth.ok b/test/pamdepth.ok new file mode 100644 index 00000000..1bd897ac --- /dev/null +++ b/test/pamdepth.ok @@ -0,0 +1,14 @@ +Test 1 +538848130 235 +stdin: PGM RAW 14 16 1 1 GRAYSCALE +538848130 235 +stdin: PGM RAW 14 16 1 1 GRAYSCALE +831461512 289 +stdin: PAM RAW 14 16 1 1 GRAYSCALE +831461512 289 +stdin: PAM RAW 14 16 1 1 GRAYSCALE +Test 2 +0 0 : 0 +Test Invalid +Expected failure 1 1 +Expected failure 2 1 diff --git a/test/pamdepth.test b/test/pamdepth.test new file mode 100755 index 00000000..da198973 --- /dev/null +++ b/test/pamdepth.test @@ -0,0 +1,38 @@ +#! /bin/bash +# This script tests: pamdepth +# Also requires: pbmtopgm pamtopam pamfile + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +# Test 1 +echo "Test 1" +pamdepth 1 testgrid.pbm | tee ${test_out} | cksum + cat ${test_out} | pamfile -machine +pbmtopgm 1 1 testgrid.pbm | pamdepth 1 | tee ${test_out} | cksum + cat ${test_out} | pamfile -machine +pamdepth 1 testgrid.pbm | pamtopam | tee ${test_out} | cksum + cat ${test_out} | pamfile -machine +pbmtopgm 1 1 testgrid.pbm | pamtopam | pamdepth 1 | tee ${test_out} | cksum + cat ${test_out} | pamfile -machine + +# Test 2 +echo "Test 2" +pamdepth 255 testimg.ppm | cmp -s - testimg.ppm + echo ${PIPESTATUS[@]} ":" $? + +# 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 + +pamdepth 0 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +pamdepth 65536 testimg.ppm > ${test_out} || \ + echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +rm ${test_out} \ No newline at end of file diff --git a/test/pamdice-roundtrip.ok b/test/pamdice-roundtrip.ok index 82eac5a8..4a850615 100644 --- a/test/pamdice-roundtrip.ok +++ b/test/pamdice-roundtrip.ok @@ -1 +1,18 @@ +test 1 +2425386270 41 +test 2 +2425386270 41 +test 3 +2425386270 41 +test 4. +1926073387 101484 +test 4.-hoverlap=0 +1926073387 101484 +test 4.-hoverlap=2 +1926073387 101484 +test 4.-voverlap=0 +1926073387 101484 +test 4.-voverlap=2 +1926073387 101484 +test 5 1926073387 101484 diff --git a/test/pamdice-roundtrip.test b/test/pamdice-roundtrip.test index 28997742..c5ccde66 100755 --- a/test/pamdice-roundtrip.test +++ b/test/pamdice-roundtrip.test @@ -4,9 +4,35 @@ tmpdir=${tmpdir:-/tmp} -fname_stem=${tmpdir}/a +fname_stem=${tmpdir}/pamdice_part -pamdice testimg.ppm -outstem=${fname_stem} -width=50 -height=40 -pamundice ${fname_stem}_%1d_%1a.ppm -down=4 -across=5 | cksum +echo test 1 -rm ${fname_stem}_?_?.ppm +pamdice testgrid.pbm -outstem=${fname_stem} +pamundice ${fname_stem}_%1d_%1a.pbm -down=1 -across=1 | cksum +rm ${fname_stem}_0_0.pbm + +echo test 2 + +pamdice testgrid.pbm -outstem=${fname_stem} -width=3 +pamundice ${fname_stem}_%1d_%1a.pbm -across=5 | cksum +rm ${fname_stem}_0_?.pbm + +echo test 3 + +pamdice testgrid.pbm -outstem=${fname_stem} -height=4 +pamundice ${fname_stem}_%1d_%1a.pbm -down=4 | cksum +rm ${fname_stem}_?_0.pbm + +for flags in "" "-hoverlap=0" "-hoverlap=2" "-voverlap=0" "-voverlap=2" + do + echo test 4.${flags} + pamdice testimg.ppm -outstem=${fname_stem} -width=50 -height=40 + pamundice ${fname_stem}_%1d_%1a.ppm -down=4 -across=5 | cksum + rm ${fname_stem}_?_?.ppm + done + +echo test 5 +pamdice testimg.ppm -outstem=${fname_stem} -width=20 -height=10 +ls ${fname_stem}*.ppm | pamundice -listfile=- -across=12 -down=15 | cksum +rm ${fname_stem}_??_??.ppm \ No newline at end of file diff --git a/test/pamdice.ok b/test/pamdice.ok new file mode 100644 index 00000000..83db2775 --- /dev/null +++ b/test/pamdice.ok @@ -0,0 +1,21 @@ +Test 1. + 10 P1@1 1@0@ +Test 2. +P1@1 1@0@ +P1@1 1@1@ +P1@1 1@1@ +P1@1 1@0@ +P1@1 1@0@ +P1@1 1@1@ +P1@1 1@1@ +P1@1 1@0@ +P1@1 1@0@ +P1@1 1@1@ +Test Invalid +Expected failure 1 +Expected failure 2 +Expected failure 3 +Expected failure 4 +Expected failure 5 +Expected failure 6 +Expected failure (output files) diff --git a/test/pamdice.test b/test/pamdice.test new file mode 100755 index 00000000..71a9d645 --- /dev/null +++ b/test/pamdice.test @@ -0,0 +1,68 @@ +#! /bin/bash +# This script tests: pamdice +# Also requires: pbmmake + +tmpdir=${tmpdir:-/tmp} +fname_stem=${tmpdir}/pamdice_part + +# Test 1. +echo "Test 1." + +pbmmake -w 2 5 | pamdice -height=1 -width=1 -outstem=${fname_stem} -plain +ls ${fname_stem}*.pbm | while read file + do + cat ${file} | tr '\n' '@' ; echo + done | sort | uniq -c + +rm ${fname_stem}*.pbm + +# Test 1. +echo "Test 2." + +pbmmake -g 2 5 | pamdice -height=1 -width=1 -outstem=${fname_stem} -plain +ls ${fname_stem}*.pbm | while read file + do + cat ${file} | tr '\n' '@' ; echo + done + +rm ${fname_stem}*.pbm + + +# 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 + +# No input file +pamdice -width=10 -height=10 -outstem=${fname_stem} /dev/null || \ +echo "Expected failure 1" + +# No -outstem +pamdice -width=10 -height=10 testgrid.pbm || \ +echo "Expected failure 2" + +# -width=0 +pamdice -width=0 -height=10 -outstem=${fname_stem} testgrid.pbm || \ +echo "Expected failure 3" + +# -height=0 +pamdice -width=10 -height=0 -outstem=${fname_stem} testgrid.pbm || \ +echo "Expected failure 4" + +# -hoverlap larger than width +pamdice -width=10 -height=10 -hoverlap=11 \ + -outstem=${fname_stem} testgrid.pbm || \ +echo "Expected failure 5" + +# -voverlap larger than height +pamdice -width=10 -height=10 -voverlap=11 \ + -outstem=${fname_stem} testgrid.pbm || \ +echo "Expected failure 6" + + +# Ensure that no output files are produced by the above +ls ${fname_stem}* || \ +echo "Expected failure (output files)" \ No newline at end of file diff --git a/test/pamditherbw.ok b/test/pamditherbw.ok index 156b9f07..02200d0f 100644 --- a/test/pamditherbw.ok +++ b/test/pamditherbw.ok @@ -3,7 +3,6 @@ Test: simple threshold Test: Hilbert 3342429190 33894 2905156049 33894 -4294967295 0 339841328 33894 1633267750 33894 Test: Dither-8 @@ -26,3 +25,4 @@ Expected failure 8 1 Expected failure 9 1 Expected failure 10 1 Expected failure 11 1 +Expected failure 12 1 diff --git a/test/pamditherbw.test b/test/pamditherbw.test index 76e175d7..40eb0a4d 100755 --- a/test/pamditherbw.test +++ b/test/pamditherbw.test @@ -17,7 +17,6 @@ pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ echo "Test: Hilbert" pamditherbw -hilbert ${test_red} | cksum pamditherbw -hilbert -clump=4 ${test_red} | cksum -pamditherbw -hilbert -clump=4 -threshold -value=0.5 ${test_red} | cksum pamditherbw -hilbert -clump=16 ${test_red} | cksum pamditherbw -hilbert -clump=100 ${test_red} | cksum @@ -59,15 +58,17 @@ pamditherbw -cluster3 -cluster8 ${test_red} > ${test_out} || \ echo -n "Expected failure 5"; test -s ${test_out}; echo " "$? pamditherbw -cluster4 -cluster8 ${test_red} > ${test_out} || \ echo -n "Expected failure 6"; test -s ${test_out}; echo " "$? -pamditherbw -clump=8 ${test_red} > ${test_out} || \ +pamditherbw -hilbert -threshold ${test_red} > ${test_out} || \ echo -n "Expected failure 7"; test -s ${test_out}; echo " "$? -pamditherbw -fs -clump=8 ${test_red} > ${test_out} || \ +pamditherbw -clump=8 ${test_red} > ${test_out} || \ echo -n "Expected failure 8"; test -s ${test_out}; echo " "$? -pamditherbw -hilbert -clump=1 ${test_red} > ${test_out} || \ +pamditherbw -fs -clump=8 ${test_red} > ${test_out} || \ echo -n "Expected failure 9"; test -s ${test_out}; echo " "$? -pamditherbw -th -value=-1 ${test_red} > ${test_out} || \ +pamditherbw -hilbert -clump=1 ${test_red} > ${test_out} || \ echo -n "Expected failure 10"; test -s ${test_out}; echo " "$? -pamditherbw -th -value=1.1 ${test_red} > ${test_out} || \ +pamditherbw -th -value=-1 ${test_red} > ${test_out} || \ echo -n "Expected failure 11"; test -s ${test_out}; echo " "$? +pamditherbw -th -value=1.1 ${test_red} > ${test_out} || \ + echo -n "Expected failure 12"; test -s ${test_out}; echo " "$? rm ${test_red} ${test_out} diff --git a/test/pamfind.test b/test/pamfind.test index 3b4ffb81..074dde5c 100755 --- a/test/pamfind.test +++ b/test/pamfind.test @@ -37,7 +37,7 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out echo 1>&2 -echo "Invalid command-line argument combination." 1>&2 +echo "Invalid command-line argument combinations." 1>&2 echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 diff --git a/test/pamhue.ok b/test/pamhue.ok index dbef973d..5935cc5e 100644 --- a/test/pamhue.ok +++ b/test/pamhue.ok @@ -1,4 +1,7 @@ +Test 1 1213482165 83 +1213482165 83 +Test 2 Summary: 8 colors: 1 black, 1 white, 0 gray, 6 color r g b lum count @@ -23,3 +26,11 @@ 255 0 255 105 1 255 255 0 226 1 255 255 255 255 1 +Test 3 +0 0 : 0 +0 0 : 0 +Test 4 +0 0 : 0 +0 0 : 0 +Test Invalid +Expected failure 1 1 diff --git a/test/pamhue.test b/test/pamhue.test index 18240959..d81a0acb 100755 --- a/test/pamhue.test +++ b/test/pamhue.test @@ -2,9 +2,47 @@ # This script tests: pamhue # Also requires: pamseq ppmhist pamdepth +echo "Test 1" +# Should print 1213482165 83 twice + pamseq -tupletype=RGB 3 1 | pamdepth 255 | pamhue -huechange=60 | cksum +pamseq -tupletype=RGB 3 1 | pamdepth 255 | pamhue -huechange=-300 | cksum + +echo "Test 2" pamseq -tupletype=RGB 3 1 | pamdepth 255 | ppmhist -sort=rgb -pamseq -tupletype=RGB 3 1 | pamdepth 255 | pamhue -huechange=60 | ppmhist -sort=rgb +pamseq -tupletype=RGB 3 1 | pamdepth 255 | pamhue -huechange=60 | \ + ppmhist -sort=rgb + +echo "Test 3" +# pamhue has no effect on monotone images +# Should print 2425386270 41 twice + +pamhue -huechange=45 testgrid.pbm | cmp -s - testgrid.pbm + echo ${PIPESTATUS[@]} ":" $? +pamhue -huechange=180 testgrid.pbm | cmp -s - testgrid.pbm + echo ${PIPESTATUS[@]} ":" $? + +echo "Test 4" +# spinning the color wheel by multiples of 360 leaves the image unchanged +# Should print 1926073387 101484 twice + +pamhue -huechange=0 testimg.ppm | cmp -s - testimg.ppm + echo ${PIPESTATUS[@]} ":" $? +pamhue -huechange=360 testimg.ppm | cmp -s - testimg.ppm + echo ${PIPESTATUS[@]} ":" $? + +echo "Test Invalid" + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Omission of mandatory argument." 1>&2 +echo "An error message should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 +pamhue testimg.ppm > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? +rm -f ${test_out} diff --git a/test/pamundice.ok b/test/pamundice.ok new file mode 100644 index 00000000..ef0f6e13 --- /dev/null +++ b/test/pamundice.ok @@ -0,0 +1,27 @@ +Test 1. +2096818803 2818 +2096818803 2818 +Test 2. +2096818803 2818 +2096818803 2818 +Test 3. +2096818803 2818 +2096818803 2818 +Test 4. +557392151 459 +557392151 459 +557392151 459 +557392151 459 +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 diff --git a/test/pamundice.test b/test/pamundice.test new file mode 100755 index 00000000..e8add587 --- /dev/null +++ b/test/pamundice.test @@ -0,0 +1,183 @@ +#! /bin/bash +# This script tests: pamundice +# Also requires: pgmmake pnmtile pnmcat pnmpad + +tmpdir=${tmpdir:-/tmp} +fname_stem=${tmpdir}/part + +# Test 1. +echo "Test 1." + +for ((x=0; x<3; ++x)) + do for ((y=0; y<5; ++y)) + do + pgmmake "."$(( x* 25 + y )) 11 17 > ${fname_stem}_${y}_${x}.pgm + done + done + +pamundice -across=3 -down=5 ${fname_stem}"_%1d_%1a".pgm | cksum + +ls ${fname_stem}_?_?.pgm | \ + pamundice -across=3 -down=5 -listfile=- | cksum + + +# Test 2. +echo "Test 2." + +tempfile=${tmpdir}/temp + +for ((y=0; y<5; ++y)) + do + pamundice -across=3 ${fname_stem}"_"$y"_%1a".pgm > ${tempfile}_"$y" + done + +pnmcat -tb ${tempfile}_[01234] | cksum +rm ${tempfile}_[01234] + +# Note: the following 2 are valid. There should not be warning messages. + +for ((x=0; x<3; ++x)) + do + pamundice -down=5 ${fname_stem}"_%1d_"$x.pgm > ${tempfile}"_"$x + done + +pnmcat -lr ${tempfile}_[012] | cksum +rm ${tempfile}_[012] + +rm ${fname_stem}_?_?.pgm + +# Test 3. +echo "Test 3." + +for ((x=0; x<2; ++x)) + do for ((y=0; y<5; ++y)) + do + pgmmake "."$(( x* 25 + y )) 12 17 > ${fname_stem}_${y}_${x}.pgm + done + done + +for ((x=2; x<3; ++x)) + do for ((y=0; y<5; ++y)) + do + pgmmake "."$(( x* 25 + y )) 11 17 > ${fname_stem}_${y}_${x}.pgm + done + done + +pamundice -across=3 -down=5 \ + -hoverlap=1 ${fname_stem}"_%1d_%1a".pgm | cksum + +rm ${fname_stem}_?_?.pgm + +for ((x=0; x<3; ++x)) + do for ((y=0; y<4; ++y)) + do + pgmmake "."$(( x* 25 + y )) 11 18 > ${fname_stem}_${y}_${x}.pgm + done + done + +for ((x=0; x<3; ++x)) + do for ((y=4; y<5; ++y)) + do + pgmmake "."$(( x* 25 + y )) 11 17 > ${fname_stem}_${y}_${x}.pgm + done + done + +pamundice -across=3 -down=5 \ + -voverlap=1 ${fname_stem}"_%1d_%1a".pgm | cksum + +rm ${fname_stem}_?_?.pgm + + +# Test 4. +echo "Test 4." + +# Add margins to testgrid.pbm + +testimg_pbm=${tmpdir}/testimg.pbm +pnmpad -top=2 -left=3 -black testgrid.pbm > ${testimg_pbm} + +for x in `seq 0 1` + do for y in `seq 0 4` + do cp ${testimg_pbm} ${fname_stem}_${y}_${x}.pbm; done + done + +for (( i=0 ; i<=9; ++i)) + do + echo ${testimg_pbm} + done | pamundice -down=5 -across=2 -listfile=- | cksum + +pamundice -down=5 -across=2 ${fname_stem}_"%1d"_"%1a".pbm | cksum + +echo "A warning message should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pamundice -down=5 -across=2 ${testimg_pbm} | cksum + +pnmtile 34 90 ${testimg_pbm} | cksum + +rm ${testimg_pbm} + +# Test Invalid. +echo "Test Invalid" + +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +# No input file pattern specified +pamundice -down=5 -across=2 > ${test_out} || \ +echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +# -down=0 +pamundice -down=0 -across=2 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ +echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +# -across=0 +pamundice -down=5 -across=0 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ +echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + +# -down too large +pamundice -down=6 -across=2 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ +echo -n "Expected failure 4"; test -s ${test_out}; echo " "$? + +# -across too large +pamundice -down=5 -across=3 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ +echo -n "Expected failure 5"; test -s ${test_out}; echo " "$? + +# precision does not match +pamundice -down=5 -across=2 ${fname_stem}_"%2d"_"%2a".pbm > ${test_out} || \ +echo -n "Expected failure 6"; test -s ${test_out}; echo " "$? + +# precision set to zero +pamundice -down=5 -across=2 ${fname_stem}_"%0d"_"%0a".pbm > ${test_out} || \ +echo -n "Expected failure 7"; test -s ${test_out}; echo " "$? + +# no precision +pamundice -down=5 -across=2 ${fname_stem}_"%d"_"%a".pbm > ${test_out} || \ +echo -n "Expected failure 8"; test -s ${test_out}; echo " "$? + +# -hoverlap too large +pamundice -down=5 -across=2 -hoverlap=18 \ + ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ +echo -n "Expected failure 9"; test -s ${test_out}; echo " "$? + +# -voverlap too large +pamundice -down=5 -across=2 -voverlap=19 \ + ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ +echo -n "Expected failure 10"; test -s ${test_out}; echo " "$? + +# corrupt listfile : file names do not exist +seq 10 | sed -e 's/^/::::::/' -e 's/$/::::::/' | \ + pamundice -down=5 -across=2 -listfile=- > ${test_out} || \ +echo -n "Expected failure 11"; test -s ${test_out}; echo " "$? + +# listfile with insufficient lines (insufficient file entries) +ls ${fname_stem}_*_*.pbm | head -n 9 | \ + pamundice -down=5 -across=2 -listfile=- > ${test_out} || \ +echo -n "Expected failure 12"; test -s ${test_out}; echo " "$? + +rm ${fname_stem}*.pbm + diff --git a/test/pbmclean.ok b/test/pbmclean.ok index 47d6c07d..17ee0338 100644 --- a/test/pbmclean.ok +++ b/test/pbmclean.ok @@ -84,3 +84,5 @@ Test 3 2571756059 5051 436062787 5051 4188415575 5051 +Test Invalid +Expected failure 1 1 diff --git a/test/pbmclean.test b/test/pbmclean.test index b9ea0937..c0c3a759 100755 --- a/test/pbmclean.test +++ b/test/pbmclean.test @@ -34,3 +34,20 @@ for n in 1 2 3 4 5 6 7 8 9 10 done rm ${sheet_pbm} + +echo "Test Invalid" + +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combination." 1>&2 +echo "An error message should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +# overspecification +pbmclean -black -white -min=1 -extended testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +# note that without -extended the above is valid. + +rm -f ${test_out} \ No newline at end of file diff --git a/test/pbmpscale.ok b/test/pbmpscale.ok index e25d4027..c26ffef3 100644 --- a/test/pbmpscale.ok +++ b/test/pbmpscale.ok @@ -48,3 +48,6 @@ P1 2150868536 457 3761734242 1065 3462719777 1803 +Expected failure 1 1 +Expected failure 2 1 +Expected failure 3 1 diff --git a/test/pbmpscale.test b/test/pbmpscale.test index 42046c74..9c34734a 100755 --- a/test/pbmpscale.test +++ b/test/pbmpscale.test @@ -10,3 +10,21 @@ do pamenlarge 2 testgrid.pbm | \ pbmpscale $i | cksum done + +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pbmpscale testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +pbmpscale 0 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +pbmpscale 2 3 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + +rm -f ${test_out} \ No newline at end of file diff --git a/test/pbmtext.test b/test/pbmtext.test index fdecf453..515711e4 100755 --- a/test/pbmtext.test +++ b/test/pbmtext.test @@ -53,7 +53,7 @@ done # Test 4: Should print 1647614653 2027 three times -# Note: backslashes inserted in 3 locations in the rectange to make +# Note: backslashes inserted in 3 locations in the rectangle to make # possible input as a here document. fontRectangle_txt=${tmpdir}/fontRectangle.txt diff --git a/test/pbmtopgm.ok b/test/pbmtopgm.ok new file mode 100644 index 00000000..6ccf9c64 --- /dev/null +++ b/test/pbmtopgm.ok @@ -0,0 +1,25 @@ +Test 1 +P2 +14 16 +1 +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 +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 +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 +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 +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 +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 +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 +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 diff --git a/test/pbmtopgm.test b/test/pbmtopgm.test new file mode 100755 index 00000000..a7ba6f7c --- /dev/null +++ b/test/pbmtopgm.test @@ -0,0 +1,32 @@ +#! /bin/bash +# This script tests: pbmtopgm +# Also requires: + +#Test 1 +echo "Test 1" + +pbmtopgm -plain 1 1 testgrid.pbm + +echo "Test Invalid" + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pbmtopgm 5 0 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +pbmtopgm 0 9 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +pbmtopgm 15 5 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + +pbmtopgm 5 17 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 4"; test -s ${test_out}; echo " "$? + +rm -f ${test_out} diff --git a/test/pgmminkowski.ok b/test/pgmminkowski.ok new file mode 100644 index 00000000..86f43207 --- /dev/null +++ b/test/pgmminkowski.ok @@ -0,0 +1,17 @@ +#threshold tiles x-edges y-edges vertices +#--------- ----- ------- ------- -------- +0.000000 9 12 12 16 1 1 1 +0.501961 1 2 2 4 0.111111 0.333333 1 +# check: 0 0 0 0 + +#threshold tiles x-edges y-edges vertices +#--------- ----- ------- ------- -------- +0.000000 9 12 12 16 1 1 1 +1.000000 5 10 10 16 0.555556 1.66667 1 +# check: 0 0 0 0 + +#threshold tiles x-edges y-edges vertices +#--------- ----- ------- ------- -------- +0.000000 224 240 238 255 1 1 1 +1.000000 56 112 112 224 0.25 3.73333 56 +# check: 0 0 0 0 diff --git a/test/pgmminkowski.test b/test/pgmminkowski.test new file mode 100755 index 00000000..52e02e19 --- /dev/null +++ b/test/pgmminkowski.test @@ -0,0 +1,10 @@ +#! /bin/bash +# This script tests: pgmminkowski +# Also requires: pbmmake pgmmake pnmmargin pnmpad + +pgmmake .5 1 1 | pnmmargin -b 1 | \ + pgmminkowski +echo +pbmmake -g 3 3 | pgmminkowski +echo +pgmminkowski testgrid.pbm diff --git a/test/pgmnoise-parameters.ok b/test/pgmnoise-parameters.ok new file mode 100644 index 00000000..1bb1cd59 --- /dev/null +++ b/test/pgmnoise-parameters.ok @@ -0,0 +1,5 @@ +Expected failure 1 1 +Expected failure 2 1 +Expected failure 3 1 +Expected failure 4 1 +Expected failure 5 1 diff --git a/test/pgmnoise-parameters.test b/test/pgmnoise-parameters.test new file mode 100755 index 00000000..1682afca --- /dev/null +++ b/test/pgmnoise-parameters.test @@ -0,0 +1,26 @@ +#! /bin/bash +# This script tests: pgmnoise +# Also requires: + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pgmnoise -maxval=255 -randomseed=1 > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +pgmnoise 100 -randomseed=1 > ${test_out} || \ + echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +pgmnoise 100 0 -randomseed=1 > ${test_out} || \ + echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + +pgmnoise 0 100 -randomseed=1 > ${test_out} || \ + echo -n "Expected failure 4"; test -s ${test_out}; echo " "$? + +pgmnoise 100 100 100 -randomseed=1 > ${test_out} || \ + echo -n "Expected failure 5"; test -s ${test_out}; echo " "$? diff --git a/test/pnmcat.ok b/test/pnmcat.ok index 68052957..b92a1420 100644 --- a/test/pnmcat.ok +++ b/test/pnmcat.ok @@ -1,4 +1,20 @@ +Test 1. 1704087873 73 4150323653 73 1522490272 202953 2862441566 202953 +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 diff --git a/test/pnmcat.test b/test/pnmcat.test index c643320d..40c29f50 100755 --- a/test/pnmcat.test +++ b/test/pnmcat.test @@ -2,9 +2,70 @@ # This script tests: pnmcat # Also requires: +echo "Test 1." pnmcat -lr testgrid.pbm testgrid.pbm | cksum pnmcat -tb testgrid.pbm testgrid.pbm | cksum pnmcat -lr testimg.ppm testimg.ppm | cksum pnmcat -tb testimg.ppm testimg.ppm | cksum + +echo "Test Invalid" + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +# direction not specified +pnmcat testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +# both directions specified +pnmcat -topbottom -leftright testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +# both pad colors specified +pnmcat -topbottom -white -black testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + +# justification parameters overspecified +pnmcat -lr -jtop -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 4"; test -s ${test_out}; echo " "$? + +pnmcat -lr -jtop -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 5"; test -s ${test_out}; echo " "$? + +pnmcat -lr -jcenter -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 6"; test -s ${test_out}; echo " "$? + +pnmcat -tb -jleft -jright testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 7"; test -s ${test_out}; echo " "$? + +pnmcat -tb -jleft -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 8"; test -s ${test_out}; echo " "$? + +pnmcat -tb -jcenter -jright testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 9"; test -s ${test_out}; echo " "$? + +# justification parameter in the wrong direction +pnmcat -lr -jleft testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 10"; test -s ${test_out}; echo " "$? + +pnmcat -lr -jright testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 11"; test -s ${test_out}; echo " "$? + +pnmcat -tb -jtop testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 12"; test -s ${test_out}; echo " "$? + +pnmcat -tb -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ + echo -n "Expected failure 13"; test -s ${test_out}; echo " "$? + +# more than one input image from standard input +cat testgrid.pbm | pnmcat -lr - - testimg.ppm > ${test_out} || \ + echo -n "Expected failure 14"; test -s ${test_out}; echo " "$? + +rm -f ${test_out} diff --git a/test/pnmquantall.ok b/test/pnmquantall.ok index 172eb0aa..5885d370 100644 --- a/test/pnmquantall.ok +++ b/test/pnmquantall.ok @@ -1,5 +1,9 @@ -got color map 2373957371 33838 3892560659 33838 1383839923 33838 1 +Expected failure 1 +Expected failure 1.rm +Expected failure 2 +Expected failure 2.rm +Expected failure 3 diff --git a/test/pnmquantall.test b/test/pnmquantall.test index b735b623..4c1bb77f 100755 --- a/test/pnmquantall.test +++ b/test/pnmquantall.test @@ -24,4 +24,24 @@ done pnmcat ${test_red} ${test_grn} ${test_blu} -tb | \ pgmhist -m | awk '$2>0 {s++}; END { print (s<=20) }' + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pnmquantall -ext xx 0 ${test_red} ${test_grn} ${test_blu} || \ + echo "Expected failure 1" +rm ${test_red}xx ${test_grn}xx ${test_blu}xx || \ + echo "Expected failure 1.rm" +pnmquantall -ext xx 1 ${test_red} ${test_grn} ${test_blu} || \ + echo "Expected failure 2" +rm ${test_red}xx ${test_grn}xx ${test_blu}xx || \ + echo "Expected failure 2.rm" +pnmquantall -ext xx 2 || \ + echo "Expected failure 3" + rm ${test_red} ${test_grn} ${test_blu} ${test_ppm} \ No newline at end of file diff --git a/test/pnmtile.ok b/test/pnmtile.ok index 4a29e0dc..279251b8 100644 --- a/test/pnmtile.ok +++ b/test/pnmtile.ok @@ -1,2 +1,6 @@ 4228632379 259 0 0 : 0 +Expected failure 1 1 +Expected failure 2 1 +Expected failure 3 1 +Expected failure 4 1 diff --git a/test/pnmtile.test b/test/pnmtile.test index e297da66..11f576bd 100755 --- a/test/pnmtile.test +++ b/test/pnmtile.test @@ -20,3 +20,24 @@ cmp -s - ${testimg4_ppm} echo ${PIPESTATUS[@]} ":" $? rm ${testimg2_ppm} ${testimg4_ppm} + +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pnmtile 100 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +pnmtile 100 0 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +pnmtile 0 100 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + +pnmtile 100 100 100 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 4"; test -s ${test_out}; echo " "$? + +rm -f ${test_out} \ No newline at end of file diff --git a/test/ppmwheel.ok b/test/ppmwheel.ok index 24756d1e..0b0a7746 100644 --- a/test/ppmwheel.ok +++ b/test/ppmwheel.ok @@ -1,2 +1,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 diff --git a/test/ppmwheel.test b/test/ppmwheel.test index f528e209..fd401951 100755 --- a/test/ppmwheel.test +++ b/test/ppmwheel.test @@ -6,6 +6,8 @@ # For values 6 and above, x86(-32) and x86-64 produce different output. # SSE floating-point math is the probable cause. +echo "Test 1." + for i in 4 5 do ppmwheel $i | cksum @@ -108,3 +110,27 @@ done # 98: 4086203619 28825 1961862620 28825 # 99: 3656777902 29416 2475351252 29416 # 100: 2246720411 30015 4055518595 30015 + +echo "Test Invalid." + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +ppmwheel 10 -huevalue -huesaturation > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +ppmwheel 0 > ${test_out} || \ + echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +ppmwheel > ${test_out} || \ + echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + +ppmwheel 10 10 > ${test_out} || \ + echo -n "Expected failure 4"; test -s ${test_out}; echo " "$? + +rm -f ${test_out} \ No newline at end of file diff --git a/test/ps-alt-roundtrip.test b/test/ps-alt-roundtrip.test index af7f7222..8fc08f2b 100755 --- a/test/ps-alt-roundtrip.test +++ b/test/ps-alt-roundtrip.test @@ -5,7 +5,7 @@ # This script is for testing alternative (or minor) utilities that # read/write Postscript and encapsulated Postscript: -# pbmtoepsi, pbmtopsg3, pbmtolps and psidtopgm. +# pbmtoepsi, pbmtopsg3 and psidtopgm. # # We keep these tests separate from those for pnmtops and pstopnm # which are far more popular. diff --git a/test/ps-flate-roundtrip.test b/test/ps-flate-roundtrip.test index de1105f0..08d1500c 100755 --- a/test/ps-flate-roundtrip.test +++ b/test/ps-flate-roundtrip.test @@ -5,7 +5,7 @@ # This script tests the optional flate (zlib) compression feature of # pstopnm. # Flate compression allows you to make smaller output (.ps) files: -# it is useful, but not essential. Flate compression is not neccessary for +# it is useful, but not essential. Flate compression is not necessary for # printing pages with postscript printers - which is why many people need # pnmtops on their systems. |