From 31ecf1aa1bda4fb076186b0dbb6dbdc4499a3fce Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 18 Sep 2022 14:33:03 +0000 Subject: New tests for pamcat padding, -tuple, -hex, use pamcat instead of pnmcat in pnmquantall test git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4434 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- test/Test-Order | 1 + test/pamcat2.ok | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++ test/pamcat2.test | 56 +++++++++++++++++++++++++++++++ test/pamtable.ok | 60 +++++++++++++++++++++++++++++++++ test/pamtable.test | 43 +++++++++++++++++++++++- test/pnmquantall.test | 6 ++-- 6 files changed, 255 insertions(+), 4 deletions(-) create mode 100644 test/pamcat2.ok create mode 100755 test/pamcat2.test (limited to 'test') diff --git a/test/Test-Order b/test/Test-Order index 7f9d0184..214cf4ba 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -73,6 +73,7 @@ pamhue.test pbmclean.test pamcut.test pamcat1.test +pamcat2.test pnmcat.test pamdice.test pamundice.test diff --git a/test/pamcat2.ok b/test/pamcat2.ok new file mode 100644 index 00000000..549fe97a --- /dev/null +++ b/test/pamcat2.ok @@ -0,0 +1,93 @@ +Test 1. +P1 +1 1 +0 +P1 +1 1 +0 +P1 +1 1 +1 +P1 +1 1 +0 +Test 2. +P1 +7 5 +0000000 +1000001 +1000001 +1000001 +1000001 +P1 +7 5 +1000001 +1000001 +0000000 +1000001 +1000001 +P1 +7 5 +1000001 +1000001 +1000001 +1000001 +0000000 +P1 +7 5 +1000001 +1000001 +0000000 +1000001 +1000001 +P1 +5 7 +01111 +00000 +00000 +00000 +00000 +00000 +01111 +P1 +5 7 +11011 +00000 +00000 +00000 +00000 +00000 +11011 +P1 +5 7 +11110 +00000 +00000 +00000 +00000 +00000 +11110 +P1 +5 7 +11011 +00000 +00000 +00000 +00000 +00000 +11011 +Test 3. +1715060535 12 +1715060535 12 +3621575043 12 +3621575043 12 +Test 4. +1972597727 14 +1972597727 14 +Test 5. +2175144709 10456 +2175144709 10456 +2175144709 10456 +609107534 10444 +609107534 10444 +609107534 10444 diff --git a/test/pamcat2.test b/test/pamcat2.test new file mode 100755 index 00000000..6c76568d --- /dev/null +++ b/test/pamcat2.test @@ -0,0 +1,56 @@ +#! /bin/sh +# This script tests: pamcat +# Also requires: pbmmake pamflip + +tmpdir=${tmpdir:-/tmp} +dotw_pbm=${tmpdir}/dotw.pbm +dotb_pbm=${tmpdir}/dotb.pbm +check5x5_pbm=${tmpdir}/check5x5.pbm +dot_ppm=${tmpdir}/dot.ppm + +echo "Test 1." +pbmmake -w 1 1 | tee ${dotw_pbm} | pamcat -tb -plain +pamcat -lr -plain ${dotw_pbm} +pbmmake -b 1 1 | tee ${dotb_pbm} | pamcat -tb -plain +pamcat -tb -plain ${dotw_pbm} + +echo "Test 2." + +pbmmake -w 5 5 > ${check5x5_pbm} + +pamcat -lr -jt -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -lr -jc -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -lr -jb -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -lr -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain + +pamcat -tb -jl -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -tb -jc -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -tb -jr -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -tb -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain + +echo "Test 3." +pbmmake -b 1 1 > ${dotb_pbm} + +pamcat -lr -jt -white ${dotb_pbm} ${check5x5_pbm} ${dotb_pbm} | cksum +pamcat -lr -jb -white ${dotb_pbm} ${check5x5_pbm} ${dotb_pbm} |\ + pamflip -tb | cksum +pamcat -tb -jl -white ${dotb_pbm} ${check5x5_pbm} ${dotb_pbm} |\ + pamflip -ccw | cksum +pamcat -tb -jr -white ${dotb_pbm} ${check5x5_pbm} ${dotb_pbm} |\ + pamflip -cw | cksum + +echo "Test 4." +ppmmake rgb:20/40/d0 1 1 | tee ${dot_ppm} | pamcat -lr | cksum +pamcat -tb ${dot_ppm} | cksum + +echo "Test 5." +for just in -jtop -jcenter -jbottom +do +pamcat -lr ${just} ${dot_ppm} maze.pbm ${dot_ppm} | cksum +done + +for just in -jleft -jcenter -jright +do +pamcat -tb ${just} ${dot_ppm} maze.pbm ${dot_ppm} | cksum +done + \ No newline at end of file diff --git a/test/pamtable.ok b/test/pamtable.ok index c8db6002..d63c7720 100644 --- a/test/pamtable.ok +++ b/test/pamtable.ok @@ -1,3 +1,4 @@ +Test 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 @@ -15,10 +16,66 @@ 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 2 0 0 0|0 0 1|0 0 2|0 1 0|0 1 1|0 1 2|0 2 0|0 2 1|0 2 2|1 0 0|1 0 1|1 0 2|1 1 0|1 1 1|1 1 2|1 2 0|1 2 1|1 2 2|2 0 0|2 0 1|2 0 2|2 1 0|2 1 1|2 1 2|2 2 0|2 2 1|2 2 2 +Test 3 0 0 0 0|0 0 0 1|0 0 1 0|0 0 1 1|0 1 0 0|0 1 0 1|0 1 1 0|0 1 1 1|1 0 0 0|1 0 0 1|1 0 1 0|1 0 1 1|1 1 0 0|1 1 0 1|1 1 1 0|1 1 1 1 +Test 4 +(1) (0) (1) (0) (1) + +Test 5 +(1) +(0) +(1) +(0) +(1) +(0) +(1) +(0) +(1) +(0) + +Test 6 +(0,0,0) (0,0,1) (0,0,2) +(0,0,3) (0,1,0) (0,1,1) +(0,1,2) (0,1,3) (0,2,0) +(0,2,1) (0,2,2) (0,2,3) +(0,3,0) (0,3,1) (0,3,2) +(0,3,3) (1,0,0) (1,0,1) +(1,0,2) (1,0,3) (1,1,0) +(1,1,1) (1,1,2) (1,1,3) +(1,2,0) (1,2,1) (1,2,2) +(1,2,3) (1,3,0) (1,3,1) +(1,3,2) (1,3,3) (2,0,0) +(2,0,1) (2,0,2) (2,0,3) +(2,1,0) (2,1,1) (2,1,2) +(2,1,3) (2,2,0) (2,2,1) +(2,2,2) (2,2,3) (2,3,0) +(2,3,1) (2,3,2) (2,3,3) +(3,0,0) (3,0,1) (3,0,2) +(3,0,3) (3,1,0) (3,1,1) +(3,1,2) (3,1,3) (3,2,0) +(3,2,1) (3,2,2) (3,2,3) +(3,3,0) (3,3,1) (3,3,2) +(3,3,3) (0,0,0) (0,0,0) + +Test 7 +00 00|00 11|00 22|00 33|00 44|00 55|00 66|00 77 +00 88|00 99|00 aa|00 bb|00 cc|00 dd|00 ee|00 ff +0a 00|0a 11|0a 22|0a 33|0a 44|0a 55|0a 66|0a 77 +0a 88|0a 99|0a aa|0a bb|0a cc|0a dd|0a ee|0a ff +14 00|14 11|14 22|14 33|14 44|14 55|14 66|14 77 +14 88|14 99|14 aa|14 bb|14 cc|14 dd|14 ee|14 ff +1e 00|1e 11|1e 22|1e 33|1e 44|1e 55|1e 66|1e 77 +1e 88|1e 99|1e aa|1e bb|1e cc|1e dd|1e ee|1e ff +28 00|28 11|28 22|28 33|28 44|28 55|28 66|28 77 +28 88|28 99|28 aa|28 bb|28 cc|28 dd|28 ee|28 ff +32 00|32 11|32 22|32 33|32 44|32 55|32 66|32 77 +32 88|32 99|32 aa|32 bb|32 cc|32 dd|32 ee|32 ff + +Test 8 9 0 0 9 @@ -64,3 +121,6 @@ 65535 0 0| 0 0 65535| 0 0 65535| 0 65535 0 65535 0 0| 0 0 65535| 0 0 65535| 0 65535 0 +Test Invalid +Should print: Expected failure 1 +Expected failure 1 diff --git a/test/pamtable.test b/test/pamtable.test index 037d3b07..e948ad0c 100755 --- a/test/pamtable.test +++ b/test/pamtable.test @@ -1,13 +1,37 @@ #! /bin/sh # This script tests: pamtable -# Also requires: pamseq pamdepth pbmmake ppmrainbow +# Also requires: pamseq pamrestack pamdepth pbmmake ppmrainbow +echo "Test 1" pamtable testgrid.pbm + echo +echo "Test 2" pamseq 3 2 -tupletype=RGB | pamtable + echo +echo "Test 3" pamseq 4 1 -tupletype=RGBA | pamtable + +echo +echo "Test 4" +pbmmake -gray 5 1 | pamtable -tuple + +echo +echo "Test 5" +pbmmake -gray 1 10 | pamtable -tuple + +echo +echo "Test 6" +pamseq 3 3 -tupletype=RGB | pamrestack -width=3 | pamtable -tuple + +echo +echo "Test 7" +pamseq 2 255 -max=50,255 -step=10,17 | pamrestack -width=8 | \ + pamtable -hex + echo +echo "Test 8" for maxval in 9 10 9999 10000 65535 do pbmmake -g 2 2 | pamdepth ${maxval} | pamtable @@ -19,3 +43,20 @@ for maxval in 9 10 9999 10000 65535 pamdepth ${maxval} | pamtable echo done + +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 + +echo "Should print: Expected failure 1" + +pamseq -tupletype="void" 1 1 | pamtable -tuple -hex > \ + ${test_out} || \ + printf "Expected failure" + test -s ${test_out}; echo " "$? + rm -f ${test_out} diff --git a/test/pnmquantall.test b/test/pnmquantall.test index f3594c0f..f047e856 100755 --- a/test/pnmquantall.test +++ b/test/pnmquantall.test @@ -1,6 +1,6 @@ #! /bin/sh # This script tests: pnmquantall -# Also requires: ppmtorgb3 pgmhist pnmcat +# Also requires: ppmtorgb3 pgmhist pamcat tmpdir=${tmpdir:-/tmp} rose_ppm=${tmpdir}/rose.ppm @@ -21,7 +21,7 @@ done # Should print 1 -pnmcat ${rose_red} ${rose_grn} ${rose_blu} -tb | \ +pamcat ${rose_red} ${rose_grn} ${rose_blu} -tb | \ pgmhist -m | awk '$2>0 {s++}; END { print (s<=20) }' @@ -44,4 +44,4 @@ rm ${rose_red}xx ${rose_grn}xx ${rose_blu}xx || \ pnmquantall -ext xx 2 || \ echo "Expected failure 3" -rm ${rose_red} ${rose_grn} ${rose_blu} ${rose_ppm} \ No newline at end of file +rm ${rose_red} ${rose_grn} ${rose_blu} ${rose_ppm} -- cgit 1.4.1