diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-06-08 16:41:37 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-06-08 16:41:37 +0000 |
commit | 7013617be07aa6cc9cb6a12d39e135bb59a8f75e (patch) | |
tree | d150d105530f064eafdd670dead19fc45b5449b6 /test | |
parent | 31bcb07d386170e7c65495b5c0b4ad173b74b911 (diff) | |
download | netpbm-mirror-7013617be07aa6cc9cb6a12d39e135bb59a8f75e.tar.gz netpbm-mirror-7013617be07aa6cc9cb6a12d39e135bb59a8f75e.tar.xz netpbm-mirror-7013617be07aa6cc9cb6a12d39e135bb59a8f75e.zip |
miscellaneous test updates, especially invalid command line option combinations
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3624 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
35 files changed, 570 insertions, 35 deletions
diff --git a/test/Test-Order b/test/Test-Order index 9721aa17..e9ea1b55 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -22,6 +22,7 @@ ppmcie.test ppmwheel.test pamcrater.test ppmpat.test +ppmforge-parameters.test # Generators with random components diff --git a/test/pamditherbw.ok b/test/pamditherbw.ok index e8186c24..eba3c44c 100644 --- a/test/pamditherbw.ok +++ b/test/pamditherbw.ok @@ -1,4 +1,28 @@ +Test: simple threshold 1316122660 33894 +Test: Hilbert 3342429190 33894 +2905156049 33894 +4294967295 0 +339841328 33894 +1633267750 33894 +Test: Dither-8 3325147568 33894 +Test: Cluster-3 4124728025 33894 +Test: Cluster-4 +4124728025 33894 +Test: Cluster-8 +3493215477 33894 +Test: Invalid +Expected failure 1 +Expected failure 2 +Expected failure 3 +Expected failure 4 +Expected failure 5 +Expected failure 6 +Expected failure 7 +Expected failure 8 +Expected failure 9 +Expected failure 10 +Expected failure 11 diff --git a/test/pamditherbw.test b/test/pamditherbw.test index 3f377f81..7b646a88 100755 --- a/test/pamditherbw.test +++ b/test/pamditherbw.test @@ -2,31 +2,59 @@ # This script tests: pamditherbw # Also requires: pamchannel pamtopnm - tmpdir=${tmpdir:-/tmp} test_red=${tmpdir}/testimg.red # Test 1. Simple threshold +echo "Test: simple threshold" + pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ tee ${test_red} | \ pamditherbw -threshold -val=0.5 | cksum -# Test 2. Floyd-Steinberg -#pamditherbw -floyd -val=0.5 ${test_red} | cksum - -# Test 3. Atkinson -#pamditherbw -atkinson -val=0.5 ${test_red} | cksum -# Test 4. Hilbert +# Test 2. Hilbert +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 -# Test 5. Dither-8 +# Test 3. Dither-8 +echo "Test: Dither-8" pamditherbw -dither8 ${test_red} | cksum -# Test 6. Cluster4 +# Test 4. Cluster-3 +echo "Test: Cluster-3" +pamditherbw -cluster4 ${test_red} | cksum + +# Test 5. Cluster-4 +echo "Test: Cluster-4" pamditherbw -cluster4 ${test_red} | cksum -# Test 7. Atkinson -#pamditherbw -atkinson -val=0.5 ${test_red} | cksum +# Test 6. Cluster-8 +echo "Test: Cluster-8" +pamditherbw -cluster8 ${test_red} | cksum + + +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 + +pamditherbw -fs -atkinson ${test_red} || echo "Expected failure 1" +pamditherbw -floyd -atkinson ${test_red} || echo "Expected failure 2" +pamditherbw -dither8 -cluster3 ${test_red} || echo "Expected failure 3" +pamditherbw -cluster3 -cluster4 ${test_red} || echo "Expected failure 4" +pamditherbw -cluster3 -cluster8 ${test_red} || echo "Expected failure 5" +pamditherbw -cluster4 -cluster8 ${test_red} || echo "Expected failure 6" +pamditherbw -clump=8 ${test_red} || echo "Expected failure 7" +pamditherbw -fs -clump=8 ${test_red} || echo "Expected failure 8" +pamditherbw -hilbert -clump=1 ${test_red} || echo "Expected failure 9" +pamditherbw -th -value=-1 ${test_red} || echo "Expected failure 10" +pamditherbw -th -value=1.1 ${test_red} || echo "Expected failure 11" -rm ${test_red} +rm ${test_red} \ No newline at end of file diff --git a/test/pamfile.ok b/test/pamfile.ok index c0d80c28..b1d68ae1 100644 --- a/test/pamfile.ok +++ b/test/pamfile.ok @@ -1,12 +1,19 @@ +Test 1 testimg.ppm: PPM raw, 227 by 149 maxval 255 testgrid.pbm: PBM raw, 14 by 16 stdin: PGM raw, 227 by 149 maxval 255 stdin: PAM, 227 by 149 by 1 maxval 255 Tuple type: GRAYSCALE +Test 2 stdin: 3 images stdin: Image 0: PBM raw, 14 by 16 stdin: Image 1: PBM raw, 14 by 16 stdin: Image 2: PBM raw, 14 by 16 +Test 3 227 149 testimg.ppm: PPM RAW 227 149 3 255 RGB stdin: PBM RAW 14 16 1 1 BLACKANDWHITE +Test 4 +Expected failure 1 +Expected failure 2 +Expected failure 3 diff --git a/test/pamfile.test b/test/pamfile.test index 545a2289..32771bfe 100755 --- a/test/pamfile.test +++ b/test/pamfile.test @@ -2,15 +2,31 @@ # This script tests: pamfile # Also requires: pamchannel pamtopnm +echo "Test 1" pamfile testimg.ppm pamfile testgrid.pbm pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | pamfile pamchannel -tupletype="GRAYSCALE" -infile=testimg.ppm 0 | pamfile +echo "Test 2" + cat testgrid.pbm testgrid.pbm testgrid.pbm | pamfile -count cat testgrid.pbm testgrid.pbm testgrid.pbm | pamfile -allimages +echo "Test 3" + pamfile -size testimg.ppm pamfile -machine testimg.ppm cat testgrid.pbm testimg.ppm testgrid.pbm | pamfile -machine + +echo "Test 4" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pamfile -size -machine testimg.ppm || echo "Expected failure 1" +pamfile -count -machine testimg.ppm || echo "Expected failure 2" +head -n1 testimg.ppm | pamfile || echo "Expected failure 3" \ No newline at end of file diff --git a/test/pamgauss.ok b/test/pamgauss.ok index 153d4f6e..eaef2570 100644 --- a/test/pamgauss.ok +++ b/test/pamgauss.ok @@ -1,3 +1,4 @@ +Test 1 3712518499 55 3712518499 55 1147844094 55 @@ -79,3 +80,12 @@ 4102007360 169 3022719594 169 1769176609 169 +Test 2 +stdin: PAM, 3 by 3 by 1 maxval 255 + Tuple type: GRAYSCALE +Test 3. +Expected error 1 +Expected error 2 +Expected error 3 +Expected error 4 +Expected error 5 diff --git a/test/pamgauss.test b/test/pamgauss.test index b48517c4..392b5179 100755 --- a/test/pamgauss.test +++ b/test/pamgauss.test @@ -1,7 +1,8 @@ #! /bin/bash # This script tests: pamgauss -# Also requires: +# Also requires: pamfile +echo "Test 1" for i in `seq 3 11` do @@ -10,3 +11,21 @@ do pamgauss $i $i -oversample=1 -sigma=.$s | cksum done done + +echo "Test 2" + +pamgauss 3 3 -sigma=0.5 -tupletype="GRAYSCALE" | pamfile + + +echo "Test 3." + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pamgauss 3 3 | echo "Expected error 1" +pamgauss 3 3 -sigma=0 | echo "Expected error 2" +pamgauss 3 3 -sigma=-1.5 | echo "Expected error 3" +pamgauss 3 -sigma=0.5 | echo "Expected error 4" +pamgauss 3 3 3 -sigma=0.5 | echo "Expected error 5" diff --git a/test/pamseq.ok b/test/pamseq.ok index 52bb3dd8..b0455449 100644 --- a/test/pamseq.ok +++ b/test/pamseq.ok @@ -1 +1,7 @@ +Test 1 3929266994 304 +Test 2 +Expected error 1 +Expected error 2 +Expected error 3 +Expected error 4 diff --git a/test/pamseq.test b/test/pamseq.test index e7b8060d..ea19013b 100755 --- a/test/pamseq.test +++ b/test/pamseq.test @@ -2,5 +2,24 @@ # This script tests: pamseq # Also requires: +echo "Test 1" pamseq 1 255 | cksum + +echo "Test 2" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pamseq 1 || echo "Expected error 1" +pamseq 0 255 || echo "Expected error 2" +pamseq 3 0 || echo "Expected error 3" + +c64="0123456789012345678901234567890123456789012345678901234567890123" +c256=${c64}${c64}${c64}${c64} + +# Tupletype string length=256 + +pamseq -tupletype="${c256}" 3 15 || echo "Expected error 4" diff --git a/test/pamsumm.ok b/test/pamsumm.ok index 0643081b..24ae23d2 100644 --- a/test/pamsumm.ok +++ b/test/pamsumm.ok @@ -1,8 +1,15 @@ +Test 1 56 0 1 0.250000 +Test 2 10772432 15 255 106.164760 +Test 3 +Expected failure 1 +Expected failure 2 +the mean of all samples is 106.164760 +Expected failure 4 diff --git a/test/pamsumm.test b/test/pamsumm.test index a99dea0e..882b1b14 100755 --- a/test/pamsumm.test +++ b/test/pamsumm.test @@ -2,13 +2,29 @@ # This script tests: pamsumm # Also requires: +echo "Test 1" for type in -sum -min -max -mean do pamsumm -brief $type testgrid.pbm done +echo "Test 2" + for type in -sum -min -max -mean do pamsumm -brief $type testimg.ppm done + + +echo "Test 3" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pamsumm -sum -min testimg.ppm || echo "Expected failure 1" +pamsumm -sum -max testimg.ppm || echo "Expected failure 2" +pamsumm -mean -max testimg.ppm || echo "Expected failure 3" +pamsumm testimg.ppm || echo "Expected failure 4" diff --git a/test/pbmclean.ok b/test/pbmclean.ok index 71b622d0..47d6c07d 100644 --- a/test/pbmclean.ok +++ b/test/pbmclean.ok @@ -1,3 +1,4 @@ +Test 1 P1 7 7 1111111 @@ -70,4 +71,16 @@ P1 0000000 0000000 0000000 +Test 2 760076056 4210813 +Test 3 +2096087149 5051 +2096087149 5051 +3762787431 5051 +1966718 5051 +544084261 5051 +2970762900 5051 +2571756059 5051 +2571756059 5051 +436062787 5051 +4188415575 5051 diff --git a/test/pbmclean.test b/test/pbmclean.test index a8e469b1..b9ea0937 100755 --- a/test/pbmclean.test +++ b/test/pbmclean.test @@ -1,19 +1,36 @@ #! /bin/bash # This script tests: pbmclean -# Also requires: pbmmake pbmpage pnmmargin pnmpad +# Also requires: pbmmake pbmpage pbmtext pnmmargin pnmpad tmpdir=${tmpdir:-/tmp} test_pbm=${tmpdir}/test.pbm +sheet_pbm=${tmpdir}/sheet.pbm + +echo "Test 1" pbmmake -g 3 3 | pnmmargin -black 2 > ${test_pbm} for n in 1 2 3 4 5 6 7 8 -do -pbmclean -min=$n -black -plain ${test_pbm} -done + do + pbmclean -min=${n} -black -plain ${test_pbm} + done rm ${test_pbm} + +echo "Test 2" + # Should print 760076056 4210813 pbmpage 1 | pbmclean -black | cksum + + +echo "Test 3" + +pbmtext -dump-sheet > ${sheet_pbm} +for n in 1 2 3 4 5 6 7 8 9 10 + do + pbmclean -min=${n} -extended ${sheet_pbm} | cksum + done + +rm ${sheet_pbm} diff --git a/test/pbmmake.ok b/test/pbmmake.ok index 754eefdf..354106f0 100644 --- a/test/pbmmake.ok +++ b/test/pbmmake.ok @@ -1,27 +1,36 @@ +Test 1. P11 10 P11 11 P11 10 +Test 2. P12 20000 P12 21111 P12 20110 +Test 2. P13 3000000000 P13 3111111111 P13 3010101010 +Test 2. P14 40000000000000000 P14 41111111111111111 P14 40101101001011010 +Test 2. P15 50000000000000000000000000 P15 51111111111111111111111111 P15 50101010101010101010101010 +Test 2. P16 6000000000000000000000000000000000000 P16 6111111111111111111111111111111111111 P16 6010101101010010101101010010101101010 +Test 2. P17 70000000000000000000000000000000000000000000000000 P17 71111111111111111111111111111111111111111111111111 P17 70101010101010101010101010101010101010101010101010 +Test 2. P18 80000000000000000000000000000000000000000000000000000000000000000 P18 81111111111111111111111111111111111111111111111111111111111111111 P18 80101010110101010010101011010101001010101101010100101010110101010 +Test 2. 4058563256 45 3969089344 105 702117756 189 @@ -41,3 +50,15 @@ P18 80101010110101010010101011010101001010101101010100101010110101010 1824232358 2931 3651864954 3375 3302595397 3849 +Test 3. +Expected error 1 +Expected error 2 +Expected error 3 +Expected error 4 +Expected error 5 +Expected error 6 +Expected error 7 +Expected error 8 +P1 +1 1 +0 diff --git a/test/pbmmake.test b/test/pbmmake.test index 4b18e3ea..eb4be6ea 100755 --- a/test/pbmmake.test +++ b/test/pbmmake.test @@ -2,13 +2,17 @@ # This script tests: pbmmake # Also requires: +echo "Test 1." for i in `seq 1 8` do -for color in -w -b -g +for color in -white -black -gray do pbmmake -plain $color $i $i | tr -d '\n'; echo done + +echo "Test 2." + done for i in `seq 8 5 98` do @@ -16,3 +20,20 @@ do pbmmake -b $i $i ; pbmmake -g $i $i ) | cksum done + +echo "Test 3." + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pbmmake -b -w -plain 1 1 || echo "Expected error 1" +pbmmake -b -g -plain 1 1 || echo "Expected error 2" +pbmmake -white -gray -plain 1 1 || echo "Expected error 3" +pbmmake -white -plain || echo "Expected error 4" +pbmmake -white -plain 1 || echo "Expected error 5" +pbmmake -white -plain 1 0 || echo "Expected error 6" +pbmmake -white -plain 0 1 || echo "Expected error 7" +pbmmake -white -plain 1 1 1 || echo "Expected error 8" +pbmmake -plain 1 1 || echo "Expected error 9" diff --git a/test/pbmpage.ok b/test/pbmpage.ok index 7f68da74..b41d7cf3 100644 --- a/test/pbmpage.ok +++ b/test/pbmpage.ok @@ -1,3 +1,9 @@ +Test 1 550172004 4210813 4142746975 4210813 2347597649 4210813 +3453559794 4349933 +Test 2 +Expected error 1 +Expected error 2 +Expected error 3 diff --git a/test/pbmpage.test b/test/pbmpage.test index e9bfe352..7cabcc7f 100755 --- a/test/pbmpage.test +++ b/test/pbmpage.test @@ -2,7 +2,20 @@ # This script tests: pbmpage # Also requires: +echo "Test 1" -pbmpage 1 | cksum -pbmpage 2 | cksum -pbmpage 3 | cksum +pbmpage 1 | cksum +pbmpage 2 | cksum +pbmpage 3 | cksum +pbmpage -a4 2 | cksum + +echo "Test 2" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pbmpage -a3 1 || echo "Expected error 1" +pbmpage 0 || echo "Expected error 2" +pbmpage 4 || echo "Expected error 3" diff --git a/test/pbmupc.ok b/test/pbmupc.ok index 3e58f409..c5753609 100644 --- a/test/pbmupc.ok +++ b/test/pbmupc.ok @@ -1 +1,12 @@ +Test 1 2619309127 10172 +Test 2 +Exptected error 1 +Exptected error 2 +Exptected error 3 +Exptected error 4 +Exptected error 5 +Exptected error 6 +Exptected error 7 +Exptected error 8 +Exptected error 9 diff --git a/test/pbmupc.test b/test/pbmupc.test index 275117d5..aee380b0 100755 --- a/test/pbmupc.test +++ b/test/pbmupc.test @@ -2,8 +2,26 @@ # This script tests: pbmupc # Also requires: +echo "Test 1" for type in -s1 -s2 do pbmupc $type 0 72890 00011 done | cksum + +echo "Test 2" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pbmupc -s3 0 72890 00011 || echo "Exptected error 1" +pbmupc -s1 72890 00011 || echo "Exptected error 2" +pbmupc -s1 0 72890 || echo "Exptected error 3" +pbmupc -s1 10 72890 00011 || echo "Exptected error 4" +pbmupc -s1 0 172890 00011 || echo "Exptected error 5" +pbmupc -s1 0 2890 00011 || echo "Exptected error 6" +pbmupc -s1 0 72890 100011 || echo "Exptected error 7" +pbmupc -s1 0 72890 0011 || echo "Exptected error 8" +pbmupc -s1 0 72890 100011 1 || echo "Exptected error 9" diff --git a/test/pgmhist.ok b/test/pgmhist.ok index 7d89bb33..6d9dfbe5 100644 --- a/test/pgmhist.ok +++ b/test/pgmhist.ok @@ -1,3 +1,4 @@ +Test 1 value count b% w% ----- ----- ------ ------ 0 2 12.5% 100% @@ -12,3 +13,24 @@ value count b% w% ----- ----- ------ ------ 0 168 75% 100% 255 56 100% 25% +Test 2 +127 +63 +127 +191 +255 +25 +51 +76 +102 +127 +153 +179 +204 +230 +255 +Test 3 +Expected failure 1 +Expected failure 2 +Expected failure 3 +Expected failure 4 diff --git a/test/pgmhist.test b/test/pgmhist.test index 42666fbf..c566c5cb 100755 --- a/test/pgmhist.test +++ b/test/pgmhist.test @@ -5,8 +5,33 @@ # Ignore differences in spaces. +echo "Test 1" + pgmramp -maxval=8 -lr 8 2 | pgmhist | \ sed -e 's/ */ /g' -e 's/ *$//' pgmhist testgrid.pbm | \ sed -e 's/ */ /g' -e 's/ *$//' + +echo "Test 2" + +pgmramp -lr 256 1 | pgmhist -machine -median | \ + sed -e 's/ */ /g' -e 's/ *$//' + +pgmramp -lr 256 1 | pgmhist -machine -quartile | \ + sed -e 's/ */ /g' -e 's/ *$//' + +pgmramp -lr 256 1 | pgmhist -machine -decile | \ + sed -e 's/ */ /g' -e 's/ *$//' + +echo "Test 3" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pgmhist -median -quartile testgrid.pbm || echo "Expected failure 1" +pgmhist -median -decile testgrid.pbm || echo "Expected failure 2" +pgmhist -quartile -decile testgrid.pbm || echo "Expected failure 3" +pgmhist testimg.ppm || echo "Expected failure 4" diff --git a/test/pgmmake.ok b/test/pgmmake.ok index b9a03af2..9a88b9a6 100644 --- a/test/pgmmake.ok +++ b/test/pgmmake.ok @@ -1,2 +1,12 @@ +Test 1. 3662611538 2513 3109612402 5012 +Test 2. +Expected error 1 +Expected error 2 +Expected error 3 +Expected error 4 +Expected error 5 +Expected error 6 +Expected error 7 +Expected error 8 diff --git a/test/pgmmake.test b/test/pgmmake.test index 4a3c4842..3823e36f 100755 --- a/test/pgmmake.test +++ b/test/pgmmake.test @@ -2,6 +2,25 @@ # This script tests: pgmmake # Also requires: +echo "Test 1." pgmmake 1 50 50 | cksum pgmmake .2 50 100 -maxval=5 | cksum + + +echo "Test 2." + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pgmmake 100 5 5 || echo "Expected error 1" +pgmmake 1.01 5 5 || echo "Expected error 2" +pgmmake .5 5 || echo "Expected error 3" +pgmmake .5 || echo "Expected error 4" +pgmmake -maxval=5 5 5 || echo "Expected error 5" +pgmmake -maxval=0 .5 5 5 || echo "Expected error 6" +pgmmake -maxval=-1 .5 5 5 || echo "Expected error 7" +pgmmake -maxval=65536 .5 5 5 || echo "Expected error 8" + diff --git a/test/pgmramp.ok b/test/pgmramp.ok index 989ef7d4..309f5773 100644 --- a/test/pgmramp.ok +++ b/test/pgmramp.ok @@ -1,3 +1,4 @@ +Test 1 P2 4 4 6 @@ -33,8 +34,16 @@ P2 1 2 3 4 2 3 4 5 3 4 5 6 +Test 2 1777787286 65551 2046889993 65551 1975520432 65551 807973067 65551 +Test 3 886972785 131087 +Test 4 +Expected error: -lr -tb +Expected error: -lr -rectangle +Expected error: -rectangle -ellipse +Expected error: insufficient parameters +Expected error: excessive parameters diff --git a/test/pgmramp.test b/test/pgmramp.test index f6f770fe..bd63e10d 100755 --- a/test/pgmramp.test +++ b/test/pgmramp.test @@ -2,14 +2,33 @@ # This script tests: pgmramp # Also requires: +echo "Test 1" for type in -lr -tb -rectangle -ellipse -diagonal do pgmramp -maxval=6 $type 4 4 -plain done +echo "Test 2" + for type in -lr -tb -rectangle -ellipse do pgmramp $type 256 256 | cksum done +echo "Test 3" + pgmramp -diagonal -maxval=510 256 256 | cksum + +echo "Test 4" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +for combination in "-lr -tb" "-lr -rectangle" "-rectangle -ellipse" +do pgmramp $combination 10 10 || echo "Expected error: $combination" +done + +pgmramp -lr 1 || echo "Expected error: insufficient parameters" +pgmramp -tb 1 1 1 || echo "Expected error: excessive parameters" diff --git a/test/pnmcrop1.ok b/test/pnmcrop1.ok index 09714bc7..25bc52ce 100644 --- a/test/pnmcrop1.ok +++ b/test/pnmcrop1.ok @@ -95,13 +95,7 @@ expected failure expected failure -white -bg-corner=top expected failure --bg-color=black -bg-color=white -expected failure --bg-corner=topleft -bg-corner=bottomright -expected failure --blank-image=maxcrop --1 0 0 -1 13 15 rgb-1:0/0/0 0.000000 --blank-image=past +-blank-image=pasturize expected failure -bg-color=black -closeness=-1 expected failure diff --git a/test/pnmcrop1.test b/test/pnmcrop1.test index 088ecf46..6b37da23 100755 --- a/test/pnmcrop1.test +++ b/test/pnmcrop1.test @@ -66,10 +66,7 @@ for option in "-reportfull -reportsize" \ "-white -bg-color=red" \ "-white -bg-corner=topleft" \ "-white -bg-corner=top" \ - "-bg-color=black -bg-color=white" \ - "-bg-corner=topleft -bg-corner=bottomright" \ - "-blank-image=maxcrop" \ - "-blank-image=past" \ + "-blank-image=pasturize" \ "-bg-color=black -closeness=-1" \ "-bg-color=black -closeness=101" do diff --git a/test/pnmpsnr.ok b/test/pnmpsnr.ok index 3469f836..e8b5ebc2 100644 --- a/test/pnmpsnr.ok +++ b/test/pnmpsnr.ok @@ -1,7 +1,14 @@ +Test 1 0.00 inf 1000.00 match +Test 2 300.00 300.00 300.00 match match +Test 3 +Expected failure 1 +Expected failure 2 +Expected failure 3 +Expected failure 4 diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test index f24c08aa..c6520002 100755 --- a/test/pnmpsnr.test +++ b/test/pnmpsnr.test @@ -5,19 +5,36 @@ tmpdir=${tmpdir:-/tmp} - w_pbm=${tmpdir}/w.pbm b_pbm=${tmpdir}/b.pbm pbmmake -w 10 10 > ${w_pbm} pbmmake -b 10 10 > ${b_pbm} +echo "Test 1" + pnmpsnr ${w_pbm} ${b_pbm} -machine pnmpsnr ${w_pbm} ${w_pbm} -machine pnmpsnr ${w_pbm} ${w_pbm} -machine -max=1000 pnmpsnr ${w_pbm} ${w_pbm} -target=1000 + +echo "Test 2" + pnmpsnr testimg.ppm testimg.ppm -machine -max=300 pnmpsnr testimg.ppm testimg.ppm -target=1000 pnmpsnr testimg.ppm testimg.ppm -target1=1000 -target2=1000 -target3=1000 -rm ${b_pbm} ${w_pbm} + +echo "Test 3" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pnmpsnr ${b_pbm} ${w_pbm} ${b_pbm} || echo "Expected failure 1" +pnmpsnr ${b_pbm} || echo "Expected failure 2" +pnmpsnr ${b_pbm} ${w_pbm} -target1=100 || echo "Expected failure 3" +pnmpsnr -machine || echo "Expected failure 4" + +rm ${b_pbm} ${w_pbm} \ No newline at end of file diff --git a/test/ppmhist.ok b/test/ppmhist.ok index f2ba637b..38b7770f 100644 --- a/test/ppmhist.ok +++ b/test/ppmhist.ok @@ -1,3 +1,4 @@ +Test 1 0 0 0 0 2 1 1 1 1 2 2 2 2 2 2 @@ -7,6 +8,7 @@ 6 6 6 6 2 8 8 8 8 2 3081591280 60957 +Test 2 Summary: 1 colors: 1 black, 0 white, 0 gray, 0 color Summary: 1 colors: 0 black, 1 white, 0 gray, 0 color Summary: 2 colors: 1 black, 1 white, 0 gray, 0 color @@ -17,3 +19,7 @@ Summary: 6 colors: 0 black, 0 white, 0 gray, 6 color Summary: 6 colors: 1 black, 0 white, 0 gray, 5 color Summary: 6 colors: 1 black, 1 white, 1 gray, 3 color +Test 3 +Expected failure 1 +Expected failure 2 +Expected failure 3 diff --git a/test/ppmhist.test b/test/ppmhist.test index 27d31562..c17bab5a 100755 --- a/test/ppmhist.test +++ b/test/ppmhist.test @@ -2,11 +2,15 @@ # This script tests: ppmhist # Also requires: pgmramp pamtopnm pbmmake pamseq ppmpat +echo "Test 1" + pgmramp -maxval=8 -lr 8 2 | ppmhist -sort=rgb -noheader ppmhist -map -sort=rgb -noheader testimg.ppm | pamtopnm | cksum # Test summary header +echo "Test 2" + pbmmake -b 2 1 | ppmhist | head -n1 pbmmake -w 2 1 | ppmhist | head -n1 pbmmake -g 2 1 | ppmhist | head -n1 @@ -19,4 +23,16 @@ ppmpat -madras --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 25 25 | \ ppmpat -madras --color=rgb:00/00/00,rgb:31/58/a3,rgb:e9/5e/d4 25 25 | \ ppmhist | head -n1 ppmpat -madras --color=rgb:00/00/00,rgb:31/58/a3,rgb:ff/ff/ff 25 25 | \ - ppmhist | head -n1 \ No newline at end of file + ppmhist | head -n1 + +echo "Test 3" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +ppmhist -hexcolor -float testimg.ppm || echo "Expected failure 1" +ppmhist -hexcolor -map testimg.ppm || echo "Expected failure 2" +ppmhist -float -map testimg.ppm || echo "Expected failure 3" + diff --git a/test/ppmmake.ok b/test/ppmmake.ok index 0e871732..8a2bedc7 100644 --- a/test/ppmmake.ok +++ b/test/ppmmake.ok @@ -1,2 +1,15 @@ +Test 1. 2477651508 15012 +4294967295 0 2378991101 7513 +Test 2. +Expected error 1 +Expected error 2 +Expected error 3 +Expected error 4 +Expected error 5 +Expected error 6 +Expected error 7 +Expected error 8 +Expected error 9 +Expected error 10 diff --git a/test/ppmmake.test b/test/ppmmake.test index 879a367e..edd6f251 100755 --- a/test/ppmmake.test +++ b/test/ppmmake.test @@ -2,6 +2,26 @@ # This script tests: ppmmake # Also requires: +echo "Test 1." ppmmake rgb:ff/80/80 50 100 -maxval=5 | cksum +ppmmake rgbi:0.5/1.0/0 2 | cksum ppmmake red 50 50 | cksum + +echo "Test 2." + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +ppmmake rgb:gg/00/00 2 2 || echo "Expected error 1" +ppmmake rgb:ff/ff/00 2 || echo "Expected error 2" +ppmmake rgbi:1.1/0/0 2 2 || echo "Expected error 3" +ppmmake rgbi:1.0/.5 2 2 || echo "Expected error 4" +ppmmake rainbow 2 2 || echo "Expected error 5" +ppmmake 2 2 || echo "Expected error 6" +ppmmake blue -maxval=0 2 2 || echo "Expected error 7" +ppmmake blue -maxval=-1 2 2 || echo "Expected error 8" +ppmmake blue -maxval=65536 2 2 || echo "Expected error 9" +RGBDEF=/dev/null ppmmake red 2 2 || echo "Expected error 10" diff --git a/test/ppmpat.ok b/test/ppmpat.ok index bb940aee..5493ba53 100644 --- a/test/ppmpat.ok +++ b/test/ppmpat.ok @@ -1,6 +1,39 @@ +Test 1 4008533639 781 +Test 2 3805937800 9613 +Test 3 2698433077 1549 +Test 4 3705929501 781 +Test 5 3057513592 661 +Test 6 1861389287 661 +Test 7 +Expected failure 1 +Expected failure 2 +Expected failure 3 +Expected failure 4 +Expected failure 5 +Expected failure 6 +Expected failure 7 +Expected failure 8 +Expected failure 9 +Expected failure 10 +Expected failure 11 +Expected failure 12 +Expected failure 13 +Expected failure 14 +Expected failure 15 +Expected failure 16 +Expected failure 17 +Expected failure 18 +Expected failure 19 +Expected failure 20 +Expected failure 21 +Expected failure 22 +Expected failure 23 +Expected failure 24 +Expected failure 25 +Expected failure 26 diff --git a/test/ppmpat.test b/test/ppmpat.test index cd00c0f1..c6647328 100755 --- a/test/ppmpat.test +++ b/test/ppmpat.test @@ -3,19 +3,74 @@ # Also requires: # Test 1. Should print: 4008533639 781 +echo "Test 1" ppmpat -g2 --color=rgb:32/0d/b7,rgb:31/58/a3 16 16 | cksum # Test 2. Should print: 3805937800 9613 +echo "Test 2" ppmpat -g3 --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 64 50 | cksum # Test 3. Should print: 2698433077 1549 +echo "Test 3" ppmpat -madras --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 32 16 | cksum # Test 4. Should print: 3705929501 781 +echo "Test 4" ppmpat -tartan --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 16 16 | cksum # Test 5. Should print: 3057513592 661 +echo "Test 5" ppmpat -argyle1 --color=rgb:ff/ff/ff,rgb:ff/0/0 12 18 | cksum # Test 6. Should print: 1861389287 661 +echo "Test 6" ppmpat -argyle2 --color=rgb:00/00/00,rgb:ff/80/80,rgb:e0/e0/e0 12 18 | cksum + +# Test 7. +echo "Test 7" + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +ppmpat -g2 -g3 10 10 || echo "Expected failure 1" +ppmpat -madras -tartan 10 10 || echo "Expected failure 2" +ppmpat -poles -squig 10 10 || echo "Expected failure 3" +ppmpat -camo -anticamo 10 10 || echo "Expected failure 4" +ppmpat -argyle1 -argyle2 10 10 || echo "Expected failure 5" + +ppmpat 10 10 || echo "Expected failure 6" +ppmpat -g2 10 || echo "Expected failure 7" +ppmpat -g2 10 10 10 || echo "Expected failure 8" +ppmpat -g2 10 || echo "Expected failure 9" + +clist1="-color=rgb:00/00/00" +clist2="-color=rgb:00/00/00,rgb:00/00/ff" +clist3="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff" +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 || echo "Expected failure 10" +ppmpat -argyle1 ${clist1} 10 10 || echo "Expected failure 11" +ppmpat -gingham2 ${clist3} 10 10 || echo "Expected failure 12" +ppmpat -argyle1 ${clist3} 10 10 || echo "Expected failure 13" + +# These require exactly 3 colors +ppmpat -gingham3 ${clist2} 10 10 || echo "Expected failure 14" +ppmpat -argyle2 ${clist2} 10 10 || echo "Expected failure 15" +ppmpat -madras ${clist2} 10 10 || echo "Expected failure 16" +ppmpat -tartan ${clist2} 10 10 || echo "Expected failure 17" +ppmpat -gingham3 ${clist4} 10 10 || echo "Expected failure 18" +ppmpat -argyle2 ${clist4} 10 10 || echo "Expected failure 19" +ppmpat -madras ${clist4} 10 10 || echo "Expected failure 20" +ppmpat -tartan ${clist4} 10 10 || echo "Expected failure 21" + +# These require at least 3 colors +ppmpat -squig ${clist2} 10 10 || echo "Expected failure 22" +ppmpat -camo ${clist2} 10 10 || echo "Expected failure 23" +ppmpat -anticamo ${clist2} 10 10 || echo "Expected failure 24" + +# The squig pattern has an aspect ratio restriction +ppmpat -squig ${clist3} 10 250 || echo "Expected failure 25" +ppmpat -squig ${clist3} 500 20 || echo "Expected failure 26" |