diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2021-12-27 17:33:56 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2021-12-27 17:33:56 +0000 |
commit | 6e629f983aa205c3eaa5f339f1c71bb5e7938049 (patch) | |
tree | a89f594443ac2330138f0bd0f19ee59135c2213f /test | |
parent | ec52f41aabc9de9aac203c2f462252e403c7374a (diff) | |
download | netpbm-mirror-6e629f983aa205c3eaa5f339f1c71bb5e7938049.tar.gz netpbm-mirror-6e629f983aa205c3eaa5f339f1c71bb5e7938049.tar.xz netpbm-mirror-6e629f983aa205c3eaa5f339f1c71bb5e7938049.zip |
Promote Development to Advanced to make Release 10.97.00
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@4222 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
179 files changed, 2906 insertions, 1204 deletions
diff --git a/test/Execute-Tests b/test/Execute-Tests index 7a02fdef..da4504a4 100755 --- a/test/Execute-Tests +++ b/test/Execute-Tests @@ -103,6 +103,10 @@ if [ ! -f ./testgrid.pbm ] then cp -v ${srcdir}/testgrid.pbm ./testgrid.pbm fi +if [ ! -f ./maze.pbm ] + then cp -v ${srcdir}/maze.pbm ./maze.pbm +fi + if [ ! -f ./testimg.ppm ] then cp -v ${srcdir}/testimg.ppm ./testimg.ppm fi @@ -181,7 +185,7 @@ elif [ $VALGRIND_TESTS = "on" ] # You may want to add --track-origins=yes to the above. for i in awk basename cat cksum cmp comm cp cut date dirname \ - egrep fgrep file grep gs head iconv mkdir mktemp perl rm \ + egrep fgrep file grep gs head iconv ls mkdir mktemp perl rm \ sed seq sh sort tee tr uniq wc \ testrandom Available-Testprog @@ -248,6 +252,7 @@ fi if [ ! -s ${srcdir}/${tname%.test}.ok ] then + echo "${tname%.test}.ok does not exist" let result=4; else ${srcdir}/Available-Testprog \ @@ -299,7 +304,7 @@ fi # (Do not erase them if we are working from the source directory.) if [ ! $PWD -ef ${srcdir} ] - then rm ./testimg.ppm ./testgrid.pbm + then rm ./testimg.ppm ./testgrid.pbm ./maze.pbm fi diff --git a/test/Test-Order b/test/Test-Order index 6f4334af..c21f892d 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -27,6 +27,9 @@ ppmforge-parameters.test # Generators with random components +pbmnoise1.test +pbmnoise2.test +pbmnoise-parameters.test pgmnoise.test pgmnoise-parameters.test ppmpat-random.test @@ -136,6 +139,8 @@ rawtoppm.test pbm-misc-converters.test +gif-transparent1.test + # Miscellaneous utility tests ppmdfont.test @@ -152,6 +157,7 @@ pnminvert-roundtrip.test pamflip-roundtrip.test pamdepth-roundtrip.test pad-crop-roundtrip.test +pbm-ppm-roundtrip.test cut-paste-roundtrip.test rgb3-roundtrip.test ppmchange-roundtrip.test diff --git a/test/all-in-place.ok b/test/all-in-place.ok index 88626e3d..e50efc8c 100644 --- a/test/all-in-place.ok +++ b/test/all-in-place.ok @@ -125,6 +125,7 @@ pbmlife: ok pbmmake: ok pbmmask: ok pbmminkowski: ok +pbmnoise: ok pbmpage: ok pbmpscale: ok pbmreduce: ok diff --git a/test/all-in-place.test b/test/all-in-place.test index e21c2ad8..d154dba4 100755 --- a/test/all-in-place.test +++ b/test/all-in-place.test @@ -167,6 +167,7 @@ ordinary_testprogs="\ pbmmake \ pbmmask \ pbmminkowski \ + pbmnoise \ pbmpage \ pbmpscale \ pbmreduce \ diff --git a/test/atk-roundtrip.ok b/test/atk-roundtrip.ok index 845be5fb..b9437e7d 100644 --- a/test/atk-roundtrip.ok +++ b/test/atk-roundtrip.ok @@ -1 +1,7 @@ -2425386270 41 +Test 1. Should print 281226646 481 +281226646 481 +Test 2. Should print 1824220442 125013 twice, then 2146497872 1000013 twice +241513515 125013 +241513515 125013 +2146497872 1000013 +2146497872 1000013 diff --git a/test/atk-roundtrip.test b/test/atk-roundtrip.test index 6db3df6d..f87c2e78 100755 --- a/test/atk-roundtrip.test +++ b/test/atk-roundtrip.test @@ -1,7 +1,23 @@ #! /bin/bash # This script tests: pbmtoatk atktopbm -# Also requires: +# Also requires: pbmmake +echo "Test 1. Should print 281226646 481" +# cksum of maze.pbm -# Should print 2425386270 41, cksum of testgrid.pbm -pbmtoatk testgrid.pbm | atktopbm | cksum +pbmtoatk maze.pbm | atktopbm | cksum + +tmpdir=${tmpdir:-/tmp} +maxwidth_pbm=${tmpdir}/maxwidth.pbm +maxheight_pbm=${tmpdir}/maxheight.pbm + +echo \ + "Test 2. Should print 1824220442 125013 twice, then 2146497872 1000013 twice" + +pbmmake -g 1000000 1 | tee ${maxwidth_pbm} | cksum +pbmtoatk ${maxwidth_pbm} | atktopbm | cksum + +pbmmake -b 1 1000000 | tee ${maxheight_pbm} | cksum +pbmtoatk ${maxheight_pbm} | atktopbm | cksum + +rm ${maxwidth_pbm} ${maxheight_pbm} diff --git a/test/bmp-roundtrip.ok b/test/bmp-roundtrip.ok index 4f4f8367..217a54aa 100644 --- a/test/bmp-roundtrip.ok +++ b/test/bmp-roundtrip.ok @@ -1,14 +1,14 @@ -PBM -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -PPM +Test 1 PBM. Should print 281226646 481 four times +281226646 481 +281226646 481 +281226646 481 +281226646 481 +Test 2 PPM. Should print 1926073387 101484 four times 1926073387 101484 1926073387 101484 1926073387 101484 1926073387 101484 -PGM +Test 3 PGM. Should print 1571496937 33838 nine times 1571496937 33838 1571496937 33838 1571496937 33838 diff --git a/test/bmp-roundtrip.test b/test/bmp-roundtrip.test index c9ef363a..df858a09 100755 --- a/test/bmp-roundtrip.test +++ b/test/bmp-roundtrip.test @@ -4,27 +4,21 @@ tmpdir=${tmpdir:-/tmp} -# Test 1. Should print 2425386270 41 four times - -echo PBM +echo "Test 1 PBM. Should print 281226646 481 four times" for mode in "" "-bpp=1" "-windows" "-os2" do - ppmtobmp ${mode} testgrid.pbm | bmptopnm | cksum + ppmtobmp ${mode} maze.pbm | bmptopnm | cksum done -# Test 2. Should print 1926073387 101484 four times - -echo PPM +echo "Test 2 PPM. Should print 1926073387 101484 four times" for mode in "" "-bpp=24" "-windows" "-os2" do ppmtobmp ${mode} testimg.ppm | bmptopnm | cksum done -# Test 3. Should print 1571496937 33838 nine times - -echo PGM +echo "Test 3 PGM. Should print 1571496937 33838 nine times" red_pgm=${tmpdir}/red.pgm mapfile_pgm=${tmpdir}/mapfile.pgm diff --git a/test/cis-roundtrip.ok b/test/cis-roundtrip.ok index da90078b..1bb50cb7 100644 --- a/test/cis-roundtrip.ok +++ b/test/cis-roundtrip.ok @@ -1,2 +1,5 @@ +Test 1. Should print 2631579683 1546 twice 2631579683 1546 -2425386270 41 +2631579683 1546 +Test 2. Should print 281226646 481, cksum of maze.pbm +281226646 481 diff --git a/test/cis-roundtrip.test b/test/cis-roundtrip.test index 62fcc3b9..4ad1a5e4 100755 --- a/test/cis-roundtrip.test +++ b/test/cis-roundtrip.test @@ -1,14 +1,20 @@ #! /bin/bash # This script tests: pbmtocis cistopbm -# Also requires: pbmmake pamcut +# Also requires: pbmmake pamcut pamfile +tmpdir=${tmpdir:-/tmp} +test_pbm=${tmpdir}/test.pbm # Output images produced by pbmtocis are of fixed size, # either 128x96 or 256x192. # Smaller input images are padded, larger ones are cropped. -# Test 1. Should print 2631579683 1546 -pbmmake -g 128 96 | pbmtocis | cistopbm | cksum +echo "Test 1. Should print 2631579683 1546 twice" +pbmmake -g 128 96 | tee ${test_pbm} | cksum +pbmtocis ${test_pbm} | cistopbm | cksum -# Test 2. Should print 2425386270 41 -pbmtocis testgrid.pbm | cistopbm | pamcut 0 0 14 16 | 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} \ No newline at end of file diff --git a/test/cmuw-roundtrip.ok b/test/cmuw-roundtrip.ok index 845be5fb..4ec1a381 100644 --- a/test/cmuw-roundtrip.ok +++ b/test/cmuw-roundtrip.ok @@ -1 +1,2 @@ -2425386270 41 +Should print 281226646 481, cksum of maze.pbm +281226646 481 diff --git a/test/cmuw-roundtrip.test b/test/cmuw-roundtrip.test index e52adb70..725f9131 100755 --- a/test/cmuw-roundtrip.test +++ b/test/cmuw-roundtrip.test @@ -2,6 +2,5 @@ # This script tests: pbmtocmuwm cmuwmtopbm # Also requires: - -# Should print 2425386270 41, cksum of testgrid.pbm -pbmtocmuwm testgrid.pbm | cmuwmtopbm | cksum +echo "Should print 281226646 481, cksum of maze.pbm" +pbmtocmuwm maze.pbm | cmuwmtopbm | cksum diff --git a/test/cut-cat-roundtrip.ok b/test/cut-cat-roundtrip.ok index bc9b8cb4..edf1de67 100644 --- a/test/cut-cat-roundtrip.ok +++ b/test/cut-cat-roundtrip.ok @@ -1,92 +1,54 @@ -Test 1. -1926073387 101484 -1926073387 101484 -1926073387 101484 -1926073387 101484 -1926073387 101484 -1926073387 101484 -Test 2. -3891261972 202953 -3891261972 202953 -3891261972 202953 -3891261972 202953 -3891261972 202953 -3891261972 202953 -Test 3. -1926073387 101484 -1926073387 101484 -1926073387 101484 -1926073387 101484 -1926073387 101484 -Test 4. -26789469 202953 -26789469 202953 -26789469 202953 -26789469 202953 -26789469 202953 -Test 5. -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -Test 6. -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -1887700557 73 -Test 7. -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -Test 8. -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 -3221289196 73 +Test 1. Should print 1926073387 101484 six times +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +Test 2. Should print 3891261972 202953 1926073387 101484 six times +3891261972 202953 1926073387 101484 +3891261972 202953 1926073387 101484 +3891261972 202953 1926073387 101484 +3891261972 202953 1926073387 101484 +3891261972 202953 1926073387 101484 +3891261972 202953 1926073387 101484 +Test 3. Should print 1926073387 101484 five times +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +Test 4. Should print 26789469 202953 1926073387 101484 five times +26789469 202953 1926073387 101484 +26789469 202953 1926073387 101484 +26789469 202953 1926073387 101484 +26789469 202953 1926073387 101484 +26789469 202953 1926073387 101484 +Test 5. Should print 281226646 481 six times +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +Test 6. Should print 1748767123 895 281226646 481 six times +1748767123 895 281226646 481 +1748767123 895 281226646 481 +1748767123 895 281226646 481 +1748767123 895 281226646 481 +1748767123 895 281226646 481 +1748767123 895 281226646 481 +Test 7. Should print 281226646 481 seven times +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +Test 8. Should print 1346655680 954 281226646 481 five times +1346655680 954 281226646 481 +1346655680 954 281226646 481 +1346655680 954 281226646 481 +1346655680 954 281226646 481 +1346655680 954 281226646 481 diff --git a/test/cut-cat-roundtrip.test b/test/cut-cat-roundtrip.test index 95ee5279..970c3e17 100755 --- a/test/cut-cat-roundtrip.test +++ b/test/cut-cat-roundtrip.test @@ -1,128 +1,146 @@ #! /bin/bash # This script tests: pamcut -# Also requires: pnmcat pnmpad +# Also requires: pamfile pnmcat pnmpad pnmcrop tmpdir=${tmpdir:-/tmp} -quant_ppm=${tmpdir}/quant.ppm -right_pbm=${tmpdir}/right.pbm -left_pbm=${tmpdir}/left.pbm -right_ppm=${tmpdir}/right.ppm left_ppm=${tmpdir}/left.ppm -bottom_pbm=${tmpdir}/bottom.pbm -top_pbm=${tmpdir}/top.pbm -bottom_ppm=${tmpdir}/bottom.ppm +right_ppm=${tmpdir}/right.ppm top_ppm=${tmpdir}/top.ppm +bottom_ppm=${tmpdir}/bottom.ppm +padded_ppm=${tmpdir}/padded.ppm + +echo "Test 1. Should print 1926073387 101484 six times" +testimg_ppm_sum=`cat testimg.ppm | cksum` +echo ${testimg_ppm_sum} -# Test 1. Should print 1926073387 101484 six times -echo Test 1. + imgsize=$(pamfile -size testimg.ppm) + iw=$(echo ${imgsize} | cut -d" " -f1) + ih=$(echo ${imgsize} | cut -d" " -f2) -cat testimg.ppm | cksum for i in 0 1 128 224 225 do pamcut -left=$((i+1)) testimg.ppm > ${right_ppm} pamcut -right=$i testimg.ppm > ${left_ppm} pnmcat -lr ${left_ppm} ${right_ppm} | \ - pamcut -left=0 -width=227| cksum + pamcut -left=0 -width=${iw} | cksum rm ${left_ppm} ${right_ppm} done +echo "Test 2. Should print 3891261972 202953 1926073387 101484 six times" +# Padding added to right. -# Test 2. Should print 3891261972 202953 six times -# Not roundtrip. Padding added to right. -echo Test 2. +pnmpad -right=${iw} -black testimg.ppm | cksum | tr '\n' ' ' +echo ${testimg_ppm_sum} -pnmpad -right=227 -black testimg.ppm | cksum -for i in 0 1 128 224 225 +for border in 0 1 128 224 225 do - pamcut -left=$((i+1)) -width=227 -pad testimg.ppm > ${right_ppm} - pamcut -right=$i -width=227 -pad testimg.ppm > ${left_ppm} + pamcut -left=$((${border}+1)) -width=${iw} -pad testimg.ppm > ${right_ppm} + pamcut -right=${border} -width=${iw} -pad testimg.ppm > ${left_ppm} pnmcat -lr ${left_ppm} ${right_ppm} ${left_ppm} | \ - pamcut -left=$((227-i-1)) -width=$((227*2)) | cksum - rm ${left_ppm} ${right_ppm} + pamcut -left=$((${iw}-${border}-1)) -width=$((${iw}*2)) | \ + tee ${padded_ppm} | cksum | tr '\n' ' ' + pnmcrop -black -right ${padded_ppm} | cksum + rm ${left_ppm} ${right_ppm} ${padded_ppm} done -# Test 3. Should print 1926073387 101484 five times -echo Test 3. +echo "Test 3. Should print 1926073387 101484 five times" -cat testimg.ppm | cksum -for i in 0 1 70 147 +echo ${testimg_ppm_sum} +for border in 0 1 70 147 do - pamcut -top=$((i+1)) testimg.ppm > ${bottom_ppm} - pamcut -bottom=$i testimg.ppm > ${top_ppm} + pamcut -top=$((${border}+1)) testimg.ppm > ${bottom_ppm} + pamcut -bottom=${border} testimg.ppm > ${top_ppm} pnmcat -tb ${top_ppm} ${bottom_ppm} | \ - pamcut -top=0 -height=149 | cksum + pamcut -top=0 -height=${ih} | cksum rm ${top_ppm} ${bottom_ppm} done -# Test 4. Should print 26789469 202953 five times -# Not roundtrip. Padding added to bottom. -echo Test 4. +echo "Test 4. Should print 26789469 202953 1926073387 101484 five times" +# Padding added to bottom. -pnmpad -bottom=149 -black testimg.ppm | cksum -for i in 0 1 70 147 +pnmpad -bottom=${ih} -black testimg.ppm | cksum | tr '\n' ' ' +echo ${testimg_ppm_sum} +for border in 0 1 70 147 do - pamcut -top=$((i+1)) -height=149 -pad testimg.ppm > ${bottom_ppm} - pamcut -bottom=$i -height=149 -pad testimg.ppm > ${top_ppm} + pamcut -top=$((${border}+1)) -height=${ih} -pad testimg.ppm > ${bottom_ppm} + pamcut -bottom=${border} -height=${ih} -pad testimg.ppm > ${top_ppm} pnmcat -tb ${top_ppm} ${bottom_ppm} ${top_ppm} | \ - pamcut -top=$((149-i-1)) -height=$((149*2)) | cksum - rm ${top_ppm} ${bottom_ppm} + pamcut -top=$((${ih}-${border}-1)) -height=$((${ih}*2)) | \ + tee ${padded_ppm} | cksum | tr '\n' ' 'cksum + pnmcrop -black -bottom ${padded_ppm} | cksum + rm ${top_ppm} ${bottom_ppm} ${padded_ppm} done -# Test 5. Should print 2425386270 41 fourteen times -echo Test 5. +left_pbm=${tmpdir}/left.pbm +right_pbm=${tmpdir}/right.pbm +top_pbm=${tmpdir}/top.pbm +bottom_pbm=${tmpdir}/bottom.pbm +padded_pbm=${tmpdir}/padded.pbm + +echo "Test 5. Should print 281226646 481 six times" + +maze_pbm_sum=`cat maze.pbm | cksum` +echo ${maze_pbm_sum} + +imgsize=$(pamfile -size maze.pbm) +iw=$(echo ${imgsize} | cut -d" " -f1) +ih=$(echo ${imgsize} | cut -d" " -f2) -cat testgrid.pbm | cksum -for i in `seq 0 12` +for i in 0 1 10 30 50 do - pamcut -left=$((i+1)) testgrid.pbm > ${right_pbm} - pamcut -right=$i testgrid.pbm > ${left_pbm} - pnmcat -lr ${left_pbm} ${right_pbm} | \ - pamcut -left=0 -width=14 | cksum - rm ${left_pbm} ${right_pbm} + pamcut -left=$((i+1)) maze.pbm > ${right_ppm} + pamcut -right=$i maze.pbm > ${left_ppm} + pnmcat -lr ${left_ppm} ${right_ppm} | \ + pamcut -left=0 -width=${iw} | cksum + rm ${left_ppm} ${right_ppm} done -# Test 6. Should print 1887700557 73 fifteen times -# Not roundtrip. Padding added to right. -echo Test 6. +echo "Test 6. Should print 1748767123 895 281226646 481 six times" +# Padding added to right. + +pnmpad -right=${iw} -black maze.pbm | cksum | tr '\n' ' ' +echo ${maze_pbm_sum} -pnmpad -right=14 -black testgrid.pbm | cksum -for i in `seq 0 13` +for border in 0 1 10 30 50 do - pamcut -left=$((i+1)) -width=14 -pad testgrid.pbm > ${right_pbm} - pamcut -right=$i -width=14 -pad testgrid.pbm > ${left_pbm} - pnmcat -lr ${left_pbm} ${right_pbm} ${left_pbm} | \ - pamcut -left=$((14-i-1)) -width=28 | cksum - rm ${left_pbm} ${right_pbm} + pamcut -left=$((${border}+1)) -width=${iw} -pad maze.pbm > ${right_ppm} + pamcut -right=${border} -width=${iw} -pad maze.pbm > ${left_ppm} + pnmcat -lr ${left_ppm} ${right_ppm} ${left_ppm} | \ + pamcut -left=$((${iw}-${border}-1)) -width=$((${iw}*2)) | \ + tee ${padded_ppm} | cksum | tr '\n' ' ' + pnmcrop -black -right ${padded_ppm} | cksum + rm ${left_ppm} ${right_ppm} ${padded_ppm} done -# Test 7. Should print 2425386270 41 sixteen times -echo Test 7. -cat testgrid.pbm | cksum -for i in `seq 0 14` +echo "Test 7. Should print 281226646 481 seven times" + +echo ${maze_pbm_sum} +for border in 0 1 12 21 31 44 do - pamcut -top=$((i+1)) testgrid.pbm > ${bottom_pbm} - pamcut -bottom=$i testgrid.pbm > ${top_pbm} - pnmcat -tb ${top_pbm} ${bottom_pbm} | \ - pamcut -top=0 -height=16 | cksum - rm ${top_pbm} ${bottom_pbm} + pamcut -top=$((${border}+1)) maze.pbm > ${bottom_ppm} + pamcut -bottom=${border} maze.pbm > ${top_ppm} + pnmcat -tb ${top_ppm} ${bottom_ppm} | \ + pamcut -top=0 -height=${ih} | cksum + rm ${top_ppm} ${bottom_ppm} done -# Test 8. Should print 3221289196 73 seventeen times -# Not roundtrip. Padding added to bottom. -echo Test 8. +echo "Test 8. Should print 1346655680 954 281226646 481 five times" +# Padding added to bottom. -pnmpad -bottom=16 -black testgrid.pbm | cksum -for i in `seq 0 15` +pnmpad -bottom=${ih} -black maze.pbm | cksum | tr '\n' ' ' +echo ${maze_pbm_sum} +for border in 0 1 10 50 do - pamcut -top=$((i+1)) -height=16 -pad testgrid.pbm > ${bottom_pbm} - pamcut -bottom=$i -height=16 -pad testgrid.pbm > ${top_pbm} - pnmcat -tb ${top_pbm} ${bottom_pbm} ${top_pbm} | \ - pamcut -top=$((16-i-1)) -height=32 | cksum - rm ${top_pbm} ${bottom_pbm} + pamcut -top=$((${border}+1)) -height=${ih} -pad maze.pbm > ${bottom_ppm} + pamcut -bottom=${border} -height=${ih} -pad maze.pbm > ${top_ppm} + pnmcat -tb ${top_ppm} ${bottom_ppm} ${top_ppm} | \ + pamcut -top=$((${ih}-${border}-1)) -height=$((${ih}*2)) | \ + tee ${padded_ppm} | cksum | tr '\n' ' 'cksum + pnmcrop -black -bottom ${padded_ppm} | cksum + rm ${top_ppm} ${bottom_ppm} ${padded_ppm} done - diff --git a/test/cut-paste-roundtrip.test b/test/cut-paste-roundtrip.test index 1bb3a7c2..ac2c0fe7 100755 --- a/test/cut-paste-roundtrip.test +++ b/test/cut-paste-roundtrip.test @@ -2,6 +2,7 @@ # This script tests: pamcut pnmpaste # Also requires: pbmmake pnmpad +tmpdir=${tmpdir:-/tmp} base_ppm=${tmpdir}/base.ppm # Test 1. Should produce 2999529086 101484 diff --git a/test/g3-roundtrip.ok b/test/g3-roundtrip.ok index 603c9457..7140cc8b 100644 --- a/test/g3-roundtrip.ok +++ b/test/g3-roundtrip.ok @@ -1,6 +1,9 @@ +Test 1. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total three times 0 0 0 : 0 0 0 0 : 0 0 0 0 0 : 0 +Test 2. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total seven times +then 1777627284 265, 2985378006 3135, 3651878552 3135 0 0 0 : 0 0 0 0 : 0 0 0 0 0 : 0 @@ -11,3 +14,9 @@ 1777627284 265 2985378006 3135 3651878552 3135 +Test 3. Should print 0 0 0 : 0 twice +then 356688157 17399694 twice +0 0 0 : 0 +0 0 0 : 0 +356688157 17399694 +356688157 17399694 diff --git a/test/g3-roundtrip.test b/test/g3-roundtrip.test index d18e4466..f35c4935 100755 --- a/test/g3-roundtrip.test +++ b/test/g3-roundtrip.test @@ -1,23 +1,33 @@ #! /bin/bash # This script tests: g3topbm pbmtog3 -# Also requires: pnmcrop pbmmake +# Also requires: pamfile pnmcrop pbmmake pbmpage pnmpad pamenlarge tmpdir=${tmpdir:-/tmp} complete256_pbm=${tmpdir}/complete256.pbm widew_pbm=${tmpdir}/widew.pbm wideb_pbm=${tmpdir}/wideb.pbm +page_pbm=${tmpdir}/page.pbm +pagemax_pbm=${tmpdir}/pagemax.pbm -pbmtog3 -nofixedwidth testgrid.pbm | \ -g3topbm -width=14 | cmp -s - testgrid.pbm +echo "Test 1. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total three times" + +width=$(pamfile -size maze.pbm | cut -d" " -f1) + +pbmtog3 -nofixedwidth maze.pbm | \ +g3topbm -width=${width} | cmp -s - maze.pbm echo ${PIPESTATUS[@]} ":" $? -pbmtog3 -nofixedwidth -reversebits testgrid.pbm | \ -g3topbm -width=14 -reversebits | cmp -s - testgrid.pbm +pbmtog3 -nofixedwidth -reversebits maze.pbm | \ +g3topbm -width=${width} -reversebits | cmp -s - maze.pbm echo ${PIPESTATUS[@]} ":" $? -pbmtog3 testgrid.pbm | \ +pbmtog3 maze.pbm | \ g3topbm | pnmcrop -white -right -bottom | \ - cmp -s - testgrid.pbm ; echo ${PIPESTATUS[@]} ":" $? + cmp -s - maze.pbm ; echo ${PIPESTATUS[@]} ":" $? + + +echo "Test 2. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total seven times" +echo "then 1777627284 265, 2985378006 3135, 3651878552 3135" # works with gawk and mawk # produce all possible 8-bit patterns @@ -27,7 +37,7 @@ LC_ALL=C awk 'BEGIN { print "P4"; # header for (i=0;i<256;++i) # raster printf("%c",i) }' > ${complete256_pbm} -pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | \ +pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | \ cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} ":" $? pbmtog3 -reverse -nofixedwidth ${complete256_pbm} | \ @@ -59,3 +69,20 @@ cat ${wideb_pbm} | cksum cat ${widew_pbm} | cksum rm ${complete256_pbm} ${wideb_pbm} ${widew_pbm} + + +echo "Test 3. Should print 0 0 0 : 0 twice" +echo "then 356688157 17399694 twice" + +pbmpage 3 -a4 | pamenlarge 2 > ${page_pbm} +pbmtog3 -nofixedwidth ${page_pbm} | g3topbm | \ + cmp -s - ${page_pbm} ; echo ${PIPESTATUS[@]} ":" $? + +pnmpad -width=1000 -height=1400 ${page_pbm} > ${pagemax_pbm} +pbmtog3 -nofixedwidth ${pagemax_pbm} | g3topbm | \ + cmp -s - ${pagemax_pbm} ; echo ${PIPESTATUS[@]} ":" $? + +cat ${page_pbm} | cksum +cat ${pagemax_pbm} | cksum + +rm ${page_pbm} ${pagemax_pbm} \ No newline at end of file diff --git a/test/gem-roundtrip.ok b/test/gem-roundtrip.ok index 845be5fb..5168378d 100644 --- a/test/gem-roundtrip.ok +++ b/test/gem-roundtrip.ok @@ -1 +1 @@ -2425386270 41 +281226646 481 diff --git a/test/gem-roundtrip.test b/test/gem-roundtrip.test index 0fce59db..106fe2cf 100755 --- a/test/gem-roundtrip.test +++ b/test/gem-roundtrip.test @@ -3,5 +3,5 @@ # Also requires: -# Should print 2425386270 41, cksum of testgrid.pbm -pbmtogem testgrid.pbm | gemtopnm | cksum +# Should print 281226646 481, cksum of maze.pbm +pbmtogem maze.pbm | gemtopnm | cksum diff --git a/test/gif-roundtrip.ok b/test/gif-roundtrip.ok index 607ebd5c..27d1bb47 100644 --- a/test/gif-roundtrip.ok +++ b/test/gif-roundtrip.ok @@ -1,18 +1,23 @@ +Test 1. Should print 1926073387 101484 1926073387 101484 +Test 2. Should produce 1571496937 33838 six times 1571496937 33838 1571496937 33838 1571496937 33838 1571496937 33838 1571496937 33838 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 +1571496937 33838 +Test 3. Should produce 281226646 481 six times +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +Test 4. Should produce P1 4 1 0101 P1 4 1 0101 -4030 : 0 0 0 0 : 0 , 4030 : 0 0 0 0 : 0 -4031 : 0 0 0 0 : 0 , 4031 : 0 0 0 0 : 0 -4097 : 0 0 0 0 : 0 , 4097 : 0 0 0 0 : 0 +Test 5. Should produce: N : 0 0 0 0 : 0 , N : 0 0 0 0 : 0 +(N=238, 239, 240, 241, 255, 256, 257, 4030, 4031, 4097) 238 : 0 0 0 0 : 0 , 238 : 0 0 0 0 : 0 239 : 0 0 0 0 : 0 , 239 : 0 0 0 0 : 0 240 : 0 0 0 0 : 0 , 240 : 0 0 0 0 : 0 @@ -20,3 +25,6 @@ P1 4 1 0101 255 : 0 0 0 0 : 0 , 255 : 0 0 0 0 : 0 256 : 0 0 0 0 : 0 , 256 : 0 0 0 0 : 0 257 : 0 0 0 0 : 0 , 257 : 0 0 0 0 : 0 +4030 : 0 0 0 0 : 0 , 4030 : 0 0 0 0 : 0 +4031 : 0 0 0 0 : 0 , 4031 : 0 0 0 0 : 0 +4097 : 0 0 0 0 : 0 , 4097 : 0 0 0 0 : 0 diff --git a/test/gif-roundtrip.test b/test/gif-roundtrip.test index 1e6c7760..2bc3a98d 100755 --- a/test/gif-roundtrip.test +++ b/test/gif-roundtrip.test @@ -7,7 +7,8 @@ tmpdir=${tmpdir:-/tmp} # Test 1. Break up input image into three monochrome planes, # maxval 255. Transform each plane to gif and back to pgm. # Reassemble the planes. Result should be identical to input. -# Should print 1926073387 101484 + +echo "Test 1. Should print 1926073387 101484" test_ppm=${tmpdir}/testimg.ppm @@ -29,13 +30,11 @@ pamtogif ${test_blu} | giftopnm | \ rm ${test_ppm} ${test_grn} ${test_blu} ${out_red} ${out_grn} - -# Test 2. Should produce 1571496937 33838 -# which is the result of cksum testimg.red -# five times +echo "Test 2. Should produce 1571496937 33838 six times" test_gif=${tmpdir}/testimg.gif +cat ${test_red} | cksum pamtogif ${test_red} | giftopnm | cksum pamtogif -interlace ${test_red} | giftopnm | cksum pamtogif -noclear ${test_red} | giftopnm | cksum @@ -46,22 +45,23 @@ echo "junk" >> ${test_gif} && \ rm ${test_gif} ${test_red} +echo "Test 3. Should produce 281226646 481 six times" +# maze.pbm is too small for -noclear to take effect -# Test 3. Should produce 2425386270 41 five times. -# testgrid.pbm is too small for -noclear to take effect - -pamtogif testgrid.pbm | giftopnm | cksum -pamtogif -nolzw testgrid.pbm | giftopnm | cksum -pamtogif -transparent=black testgrid.pbm | giftopnm | cksum -pamtogif -alpha=testgrid.pbm testgrid.pbm | giftopnm | cksum -pamtogif -transparent=white testgrid.pbm | giftopnm -alpha=- | \ +cat maze.pbm | cksum +pamtogif maze.pbm | giftopnm | cksum +pamtogif -nolzw maze.pbm | giftopnm | cksum +pamtogif -transparent=black maze.pbm | giftopnm | cksum +pamtogif -alpha=maze.pbm maze.pbm | giftopnm | cksum +pamtogif -transparent=white maze.pbm | giftopnm -alpha=- | \ pnminvert | cksum # Test 4. # In this gif file the code length changes after the last image data. # Image data: 3 bits, end code 4 bits. -# Should produce P1 4 1 0 1 0 1 + +echo "Test 4. Should produce P1 4 1 0101" pbmmake -g 4 1 | \ pamtogif -verbose | giftopnm -plain | \ @@ -71,25 +71,18 @@ echo "" # Test 5. # Test whether saturated code tables are handled correctly. -# Test input images which most use up the string code table or +# Test input images which use up the string code table or # come close to doing so. -# Should produce: -# 4030 0 , 4030 0 -# 4031 0 , 4031 0 -# 4097 0 , 4097 0 -# 238 0 , 238 0 -# 239 0 , 239 0 -# 240 0 , 240 0 -# 241 0 , 241 0 -# 255 0 , 255 0 -# 256 0 , 256 0 -# 257 0 , 257 0 -test4097_pgm=${tmpdir}/testimg4097.pgm +echo "Test 5. Should produce: N : 0 0 0 0 : 0 , N : 0 0 0 0 : 0" +echo "(N=238, 239, 240, 241, 255, 256, 257, 4030, 4031, 4097)" + test_pgm=${tmpdir}/testimg.pgm -# The following awk script produces a PGM file with no repeated sequences. +# The following awk scripts produce a PGM file with no repeated +# sequences. Obviously this cannot be compressed at all; the codes +# are consumed without ever being used. # Here is a smaller example with the same property: # P2 # 8 8 @@ -103,7 +96,9 @@ test_pgm=${tmpdir}/testimg.pgm # 3 6 3 7 4 5 4 6 # 4 7 5 6 5 7 6 7 -maxval=63 +test257_pgm=${tmpdir}/testimg257.pgm + +maxval=15 awk -v maxval=${maxval} 'BEGIN \ { print "P2" print "1 "(maxval+1) * (maxval+1) +1 @@ -115,26 +110,25 @@ awk -v maxval=${maxval} 'BEGIN \ for (j=i+1; j<=maxval; ++j) {print i; print j } print 0 -}' > ${test4097_pgm} +}' > ${test257_pgm} -for size in 4030 4031 4097 +for size in 238 239 240 241 255 256 257 do - pamcut -height ${size} ${test4097_pgm} > ${test_pgm} && + pamcut -height=${size} ${test257_pgm} > ${test_pgm} && pamtogif -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ cmp - ${test_pgm} - # pamdepth ${maxval} is necessary because - # giftopnm output is maxval 255 echo -n ${size} ":" ${PIPESTATUS[@]} ":" $? ", " - pamtogif -nolzw ${test_pgm} | giftopnm | pamdepth ${maxval} | \ + pamtogif -nolzw -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ cmp - ${test_pgm} echo ${size} ":" ${PIPESTATUS[@]} ":" $? rm ${test_pgm} done -rm ${test4097_pgm} -test257_pgm=${tmpdir}/testimg257.pgm +rm ${test257_pgm} -maxval=15 +test4097_pgm=${tmpdir}/testimg4097.pgm + +maxval=63 awk -v maxval=${maxval} 'BEGIN \ { print "P2" print "1 "(maxval+1) * (maxval+1) +1 @@ -146,18 +140,20 @@ awk -v maxval=${maxval} 'BEGIN \ for (j=i+1; j<=maxval; ++j) {print i; print j } print 0 -}' > ${test257_pgm} +}' > ${test4097_pgm} -for size in 238 239 240 241 255 256 257 +for size in 4030 4031 4097 do - pamcut -height=${size} ${test257_pgm} > ${test_pgm} && + pamcut -height ${size} ${test4097_pgm} > ${test_pgm} && pamtogif -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ cmp - ${test_pgm} + # pamdepth ${maxval} is necessary because + # giftopnm output is maxval 255 echo -n ${size} ":" ${PIPESTATUS[@]} ":" $? ", " - pamtogif -nolzw -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ + pamtogif -nolzw ${test_pgm} | giftopnm | pamdepth ${maxval} | \ cmp - ${test_pgm} echo ${size} ":" ${PIPESTATUS[@]} ":" $? rm ${test_pgm} done -rm ${test257_pgm} +rm ${test4097_pgm} diff --git a/test/gif-transparent1.ok b/test/gif-transparent1.ok new file mode 100644 index 00000000..a531329a --- /dev/null +++ b/test/gif-transparent1.ok @@ -0,0 +1,99 @@ +Test 0. +Should print 0 or 1 0. +Image 1: 1 0 +Image 2: 1 0 +Image 3: 0 +Image 4: 0 +Image 5: 0 +Test 1. +Should print 0 unless otherwise stated. +Image 1 +a1: 1 (should print 1) +a2: 0 +a3: 0 +b1: 1 (should print 1) +b2: 0 +b3: 0 +c1: 0 +c2: 0 +c3: 0 +c4: 0 +d1: 0 +d2: 0 +Image 2 +a1: 1 (should print 1) +a2: 0 +a3: 0 +b1: 1 (should print 1) +b2: 0 +b3: 0 +c1: 0 +c2: 0 +c3: 0 +c4: 0 +d1: 0 +d2: 0 +Image 3 +a1: 1 (should print 1) +a2: 0 +a3: 0 +b1: 1 (should print 1) +b2: 0 +b3: 0 +c1: 0 +c2: 0 +c3: 0 +c4: 0 +d1: 0 +d2: 0 +Test 2. +Should print 0 unless otherwise stated. +Image 1 +cl1: 0 +cl2: 0 +op1: 1 (should print 1) +op2: 0 +Image 2 +cl1: 0 +cl2: 0 +op1: 1 (should print 1) +op2: 0 +Image 3 +cl1: 0 +cl2: 0 +op1: 1 (should print 1) +op2: 0 +Test 3. +Should print 0 in all cases. +Image 1 +a2: 0 +a3: 0 +b2: 0 +b3: 0 +c4: 0 +Image 2 +a2: 0 +a3: 0 +b2: 0 +b3: 0 +c4: 0 +Image 3 +a2: 0 +a3: 0 +b2: 0 +b3: 0 +c4: 0 +Test 4. +Should print 0 in all cases. +color=rgb:0f/0f/0f +0 +0 +0 +color=rgb:ff/00/00 +0 +0 +0 +color=rgb:00/ff/00 +0 +0 +0 diff --git a/test/gif-transparent1.test b/test/gif-transparent1.test new file mode 100755 index 00000000..4684d1fc --- /dev/null +++ b/test/gif-transparent1.test @@ -0,0 +1,224 @@ +#! /bin/bash +# This script tests: giftopnm pamtogif ppmtogif +# Also requires: pamarith pamcomp pamdepth pamenlarge pamstack pbmmake +# Also requires: pnminvert ppmchange ppmpat ppmtopgm ppmtoppm + +tmpdir=${tmpdir:-/tmp} + +madras_ppm=${tmpdir}/madras.ppm +gingham_ppm=${tmpdir}/gingham.ppm +argyle_ppm=${tmpdir}/argyle.ppm + +alpha0_pbm=${tmpdir}/alpha0.pbm +alpha1_pbm=${tmpdir}/alpha1.pbm +clear_pbm=${tmpdir}/clear.pbm +opaque_pbm=${tmpdir}/opaque.pbm +alpha0_pam=${tmpdir}/alpha0.pam +alpha1_pam=${tmpdir}/alpha1.pam +clear_pam=${tmpdir}/clear.pam +opaque_pam=${tmpdir}/opaque.pam + +image0_alpha_pam=${tmpdir}/image0.alpha.pam +image1_alpha_pam=${tmpdir}/image1.alpha.pam + +out_pnm=${tmpdir}/out.pnm +out0_ppm=${tmpdir}/out0.ppm +out1_ppm=${tmpdir}/out1.ppm +out2_ppm=${tmpdir}/out2.ppm +a0_out_pbm=${tmpdir}/a0.out.pbm +a1_out_pbm=${tmpdir}/a1.out.pbm + +# Make test images & alpha masks + +ppmpat -argyle2 \ + -color=rgb:00/00/00,rgb:ff/ff/ff,rgb:ff/ff/ff 40 24 > ${argyle_ppm} +ppmpat -gingham3 \ + -color=rgb:3f/3f/3f,rgb:7f/7f/7f,rgb:ef/ef/ef 40 24 > ${gingham_ppm} +ppmpat -madras \ + -color=rgb:0f/0f/0f,rgb:ff/00/00,rgb:00/ff/00 40 24 > ${madras_ppm} + +pbmmake -g 5 3 | pamenlarge 8 | tee ${alpha0_pbm} | \ + pamdepth 255 > ${alpha0_pam} +pnminvert ${alpha0_pbm} | tee ${alpha1_pbm} | \ + pamdepth 255 > ${alpha1_pam} + +pbmmake -w 40 24 | tee ${clear_pbm} | pamdepth 255 > ${clear_pam} +pbmmake -b 40 24 | tee ${opaque_pbm} | pamdepth 255 > ${opaque_pam} + + +echo "Test 0." +echo "Should print 0 or 1 0." +i=1 +for test_pnm in ${argyle_ppm} ${gingham_ppm} ${madras_ppm} \ + ${alpha0_pbm} ${alpha1_pbm} + do + echo -n "Image $i: "; i=$((i+1)); + pamtogif ${test_pnm} | giftopnm | tee ${out_pnm} | \ + cmp -s - ${test_pnm}; result=$? + + if [ $result -eq 0 ]; + then echo $?; + else + ppmtoppm < ${out_pnm} | cmp -s - ${test_pnm}; echo $result $? + fi + # madras, alpha, alpha1 : should match + # argyle: giftopnm produces PBM, gingham: giftopnm produces PGM + rm ${out_pnm} + done + + +echo "Test 1." # Color + alpha channel +echo "Should print 0 unless otherwise stated." + +i=1 +for test_pnm in ${argyle_ppm} ${gingham_ppm} ${madras_ppm} + do + echo "Image $i"; i=$((i+1)); + + pamstack -tupletype="RGB_ALPHA" ${test_pnm} ${alpha0_pam} > \ + ${image0_alpha_pam} + pamstack -tupletype="RGB_ALPHA" ${test_pnm} ${alpha1_pam} > \ + ${image1_alpha_pam} + + pamtogif ${image0_alpha_pam} | giftopnm -alphaout=${a0_out_pbm} | \ + ppmtoppm | tee ${out0_ppm} | \ + cmp -s - ${test_pnm}; echo "a1:" $? "(should print 1)" + cmp -s ${alpha0_pbm} ${a0_out_pbm}; echo "a2:" $? # Should match + + pamarith -multiply ${test_pnm} ${alpha0_pbm} | \ + cmp -s - ${out0_ppm}; echo "a3:" $? # Should match + + pamtogif ${image1_alpha_pam} | giftopnm -alphaout=${a1_out_pbm} | \ + ppmtoppm | tee ${out1_ppm} | \ + cmp -s - ${test_pnm}; echo "b1:" $? "(should print 1)" + + cmp -s ${alpha1_pbm} ${a1_out_pbm}; echo "b2:" $? # Should match + + pamarith -multiply ${test_pnm} ${alpha1_pam} | \ + cmp -s - ${out1_ppm}; echo "b3:" $? # Should match + + pamarith -multiply ${test_pnm} ${alpha0_pbm} | \ + cmp -s - ${out0_ppm}; echo "c1:" $? # Should match + + pamarith -multiply ${test_pnm} ${alpha1_pbm} | \ + cmp -s - ${out1_ppm}; echo "c2:" $? # Should match + + pamcomp -alpha=${alpha0_pbm} ${out0_ppm} ${out1_ppm} | \ + cmp -s - ${test_pnm}; echo "c3:" $? # Should match + + pamcomp -alpha=${alpha1_pbm} ${out1_ppm} ${out0_ppm} | \ + cmp -s - ${test_pnm}; echo "c4:" $? # Should match + + pamtogif ${image0_alpha_pam} -alphacolor=rgb:00/00/80 | \ + giftopnm -alphaout=${a0_out_pbm} > /dev/null + cmp -s ${a0_out_pbm} ${alpha0_pbm}; echo "d1:" $? # Should match + + pamtogif ${image0_alpha_pam} -alphacolor=rgb:00/00/80 | \ + giftopnm | ppmtoppm | \ + ppmchange rgb:00/00/80 rgb:00/00/00 -remainder=rgb:ff/ff/ff | \ + ppmtopgm | \ + cmp -s - ${alpha0_pam}; echo "d2:" $? # Should match + + rm ${image0_alpha_pam} ${image1_alpha_pam} + rm ${out0_ppm} ${out1_ppm} # ${out0_pnm} ${out1_pnm} + rm ${a0_out_pbm} ${a1_out_pbm} + + done + +echo "Test 2." # clear/opaque alpha channel +echo "Should print 0 unless otherwise stated." + +i=1 +for test_pnm in ${argyle_ppm} ${gingham_ppm} ${madras_ppm} + do + echo "Image $i"; i=$((i+1)); + + pamstack -tupletype="RGB_ALPHA" ${test_pnm} ${clear_pam} > \ + ${image0_alpha_pam} + pamstack -tupletype="RGB_ALPHA" ${test_pnm} ${opaque_pam} > \ + ${image1_alpha_pam} + + # clear + pamtogif ${image0_alpha_pam} | giftopnm -alphaout=${a0_out_pbm} | \ + ppmtoppm | tee ${out0_ppm} | \ + cmp -s - ${test_pnm}; echo "cl1:" $? # Should match + cmp -s ${clear_pbm} ${a0_out_pbm}; echo "cl2:" $? # Should match + + # opaque + pamtogif ${image1_alpha_pam} | giftopnm -alphaout=${a1_out_pbm} | \ + tee ${out1_ppm} | \ + cmp -s - ${test_pnm}; echo "op1:" $? "(should print 1)" + + cmp -s ${opaque_pbm} ${a1_out_pbm}; echo "op2:" $? # Should match + + rm ${image0_alpha_pam} ${image1_alpha_pam} + rm ${out0_ppm} ${out1_ppm} + rm ${a0_out_pbm} ${a1_out_pbm} + + done + +rm ${clear_pbm} ${clear_pam} ${opaque_pbm} ${opaque_pam} + + +echo "Test 3." # ppmtogif +echo "Should print 0 in all cases." + +i=1 +for test_pnm in ${argyle_ppm} ${gingham_ppm} ${madras_ppm} + do + echo "Image $i"; i=$((i+1)); + + ppmtogif -alpha=${alpha0_pbm} ${test_pnm} | \ + giftopnm -alphaout=${a0_out_pbm} | \ + ppmtoppm > ${out0_ppm} + cmp -s ${alpha0_pbm} ${a0_out_pbm}; echo "a2:" $? # Should match + pamarith -multiply ${test_pnm} ${alpha0_pbm} | \ + cmp -s - ${out0_ppm}; echo "a3:" $? # Should match + + ppmtogif -alpha=${alpha1_pbm} ${test_pnm} | \ + giftopnm -alphaout=${a1_out_pbm} | \ + ppmtoppm > ${out1_ppm} + cmp -s ${alpha1_pbm} ${a1_out_pbm}; echo "b2:" $? # Should match + pamarith -multiply ${test_pnm} ${alpha1_pam} | \ + cmp -s - ${out1_ppm}; echo "b3:" $? # Should match + + pamcomp -alpha=${alpha1_pbm} ${out1_ppm} ${out0_ppm} | \ + cmp -s - ${test_pnm}; echo "c4:" $? # Should match + + rm ${out0_ppm} ${out1_ppm} + rm ${a0_out_pbm} ${a1_out_pbm} + + done + +rm ${alpha0_pbm} ${alpha1_pbm} +rm ${alpha0_pam} ${alpha1_pam} +rm ${argyle_ppm} ${gingham_ppm} + + +echo "Test 4." +echo "Should print 0 in all cases." +# no separate alpha channel +# designate colors which appear in madras as transparent + +for color in "0f/0f/0f" "ff/00/00" "00/ff/00" + do + echo "color=rgb:"${color} + pamtogif -transparent=rgb:${color} ${madras_ppm} | \ + giftopnm -alphaout=${a0_out_pbm} > ${out0_ppm} + cmp -s ${madras_ppm} ${out0_ppm}; echo $? # Should match + + pbmmake -g 40 24 | pamdepth 255 | pamstack ${madras_ppm} - | + pamtogif -transparent=rgb:${color} - | \ + giftopnm -alphaout=${a1_out_pbm} > ${out1_ppm} + cmp -s ${madras_ppm} ${out1_ppm}; echo $? # Should match + + ppmchange rgb:${color} rgb:00/00/00 \ + -remainder=rgb:ff/ff/ff ${madras_ppm} > ${out2_ppm} + + ppmtoppm < ${a0_out_pbm} | \ + cmp -s ${out2_ppm} -; echo $? # Should match + + rm ${out0_ppm} ${out1_ppm} ${out2_ppm} ${a0_out_pbm} ${a1_out_pbm} + done + +rm ${madras_ppm} diff --git a/test/ilbm-roundtrip.ok b/test/ilbm-roundtrip.ok index 54574a18..fcbdf4f6 100644 --- a/test/ilbm-roundtrip.ok +++ b/test/ilbm-roundtrip.ok @@ -1,10 +1,14 @@ -829921912 685 -829921912 685 -829921912 685 -829921912 685 +Test 1. Should produce 669206373 10102 five times +669206373 10102 +669206373 10102 +669206373 10102 +669206373 10102 +Test 2. Should produce 1926073387 101484 three times 1926073387 101484 1926073387 101484 1926073387 101484 +Test 3. Should print 984199586 101484 984199586 101484 +Test 4. Should print 2059976475 661 twice 2059976475 661 2059976475 661 diff --git a/test/ilbm-roundtrip.test b/test/ilbm-roundtrip.test index f62368ff..85e04b26 100755 --- a/test/ilbm-roundtrip.test +++ b/test/ilbm-roundtrip.test @@ -2,26 +2,27 @@ # This script tests: ppmtoilbm ilbmtoppm # Also requires: pamseq pamdepth pamtopnm pnmremap -#Test. 1 Should produce 829921912 685 four times -#Output is PPM raw, 14 by 16 maxval 255 -ppmtoilbm testgrid.pbm | ilbmtoppm | cksum -ppmtoilbm -aga testgrid.pbm | ilbmtoppm | cksum -ppmtoilbm -ham6 testgrid.pbm | ilbmtoppm | cksum -ppmtoilbm -ham8 testgrid.pbm | ilbmtoppm | cksum +echo "Test 1. Should produce 669206373 10102 five times" +#Output is PPM raw, 57 by 59 maxval 255 +ppmtoilbm maze.pbm | ilbmtoppm | cksum +ppmtoilbm -aga maze.pbm | ilbmtoppm | cksum +ppmtoilbm -ham6 maze.pbm | ilbmtoppm | cksum +ppmtoilbm -ham8 maze.pbm | ilbmtoppm | cksum -#Test. 2 Should produce 1926073387 101484 three times + +echo "Test 2. Should produce 1926073387 101484 three times" ppmtoilbm testimg.ppm | ilbmtoppm | cksum ppmtoilbm -24force testimg.ppm | ilbmtoppm | cksum ppmtoilbm -dcbits 8 8 8 -nocompress testimg.ppm | ilbmtoppm | cksum -#Test. 3 Should print 984199586 101484 +echo "Test 3. Should print 984199586 101484" pamseq 3 5 -tupletype=RGB | pamdepth 255 | pamtopnm | \ pnmremap -mapfile=- testimg.ppm | ppmtoilbm | ilbmtoppm | cksum -#Test. 4 Should print 2059976475 661 twice +echo "Test 4. Should print 2059976475 661 twice" pamseq 3 5 -tupletype=RGB | pamtopnm | \ ppmtoilbm -compress | ilbmtoppm | cksum pamseq 3 5 -tupletype=RGB | pamtopnm | \ diff --git a/test/jbig-roundtrip.ok b/test/jbig-roundtrip.ok index b98a694b..c9164120 100644 --- a/test/jbig-roundtrip.ok +++ b/test/jbig-roundtrip.ok @@ -1,2 +1,2 @@ -2425386270 41 +281226646 481 1571496937 33838 diff --git a/test/jbig-roundtrip.test b/test/jbig-roundtrip.test index 570d7336..eac742ff 100755 --- a/test/jbig-roundtrip.test +++ b/test/jbig-roundtrip.test @@ -2,8 +2,8 @@ # This script tests: pnmtojbig jbigtopnm # Also requires: pamchannel pamtopnm -# Test 1. Should print 2425386270 41 -pnmtojbig testgrid.pbm | jbigtopnm | cksum +# Test 1. Should print 281226646 481 +pnmtojbig maze.pbm | jbigtopnm | cksum # Test 2. Should print 1571496937 33838 pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ diff --git a/test/lookup-roundtrip.test b/test/lookup-roundtrip.test index 63ec0777..491294a2 100755 --- a/test/lookup-roundtrip.test +++ b/test/lookup-roundtrip.test @@ -10,3 +10,5 @@ ppmhist testimg.ppm -map > ${mapfile} # Test. Should produce 1926073387 101484 pamunlookup -lookupfile=${mapfile} testimg.ppm |\ pamlookup -lookupfile=${mapfile} | cksum + +rm ${mapfile} \ No newline at end of file diff --git a/test/lps-roundtrip.ok b/test/lps-roundtrip.ok index 02b1d1a9..277907af 100644 --- a/test/lps-roundtrip.ok +++ b/test/lps-roundtrip.ok @@ -1 +1,2 @@ +Test. Should print match match diff --git a/test/lps-roundtrip.test b/test/lps-roundtrip.test index f30062a8..71cd354d 100755 --- a/test/lps-roundtrip.test +++ b/test/lps-roundtrip.test @@ -1,22 +1,25 @@ #! /bin/bash # This script tests: pbmtolps pstopnm -# Also requires: gs pamdepth pamscale pnmcrop pnmpsnr +# Also requires: gs pamdepth pamscale pnmcrop pnmpsnr pamfile # The ordinary round-trip does not work because of the way ghostscript # renders: a line is considered wider than a single pixel and all pixels # it touches are set to black if the output is PBM. To work around this, # we tell pstopnm to output PGM at a high resolution (=large dpi value). +tmpdir=${tmpdir:-/tmp} +test_pgm=${tmpdir}/test.pgm -test_pgm=${tmpdir}/testgrid.pgm +echo "Test. Should print match" +xysize=$(pamfile -size testgrid.pbm | awk '{print "-xsize="$1,"-ysize="$2}') pamdepth 255 testgrid.pbm > ${test_pgm} - + pbmtolps -dpi 72 testgrid.pbm | \ pstopnm -dpi $((72*12)) -stdout -pgm | \ - pnmcrop -white | pamscale -xsize=14 -ysize=16 | \ + pnmcrop -white | pamscale ${xysize} | \ pnmpsnr -target=30 - ${test_pgm} - -# ghostscript version 8.71: pnmpsnr lumina 33.14dB - + + # ghostscript version 8.71: pnmpsnr lumina 33.14dB + rm ${test_pgm} diff --git a/test/macp-roundtrip.ok b/test/macp-roundtrip.ok index 9ff9d249..28c16ee0 100644 --- a/test/macp-roundtrip.ok +++ b/test/macp-roundtrip.ok @@ -1,5 +1,14 @@ -2425386270 41 -2425386270 41 +Test 1. Should produce 281226646 481 twice +281226646 481 +281226646 481 +Test 2. Should produce 2329957971 51851 2329957971 51851 +Test 3. Should produce 2907103393 5086 three times 2907103393 5086 2907103393 5086 +2907103393 5086 +Test 4. Should produce 3432623660 51851 four times +3432623660 51851 +3432623660 51851 +3432623660 51851 +3432623660 51851 diff --git a/test/macp-roundtrip.test b/test/macp-roundtrip.test index 4774a2c2..b264e3d1 100755 --- a/test/macp-roundtrip.test +++ b/test/macp-roundtrip.test @@ -1,31 +1,51 @@ #! /bin/bash # This script tests: pbmtomacp macptopbm -# Also requires: pnmcrop pbmpage pbmupc pnmpad +# Also requires: pnmcrop pbmpage pbmupc pnmpad pbmmake tmpdir=${tmpdir:-/tmp} -temp1_pbm=${tmpdir}/temp1.ppm -temp2_pbm=${tmpdir}/temp2.ppm +temp1_pbm=${tmpdir}/temp1.pbm +temp2_pbm=${tmpdir}/temp2.pbm +tempupc_pbm=${tmpdir}/tempupc.pbm +temp3_pbm=${tmpdir}/temp3.pbm +temp3_macp=${tmpdir}/temp3.macp - -# Test 1. Should produce 2425386270 41 twice -# Because Macpaint files are fixed size (576 x 720 pixels) +# Macpaint files are fixed size (576 x 720 pixels) # pbmtomacp automatically adds padding when input is smaller. -pbmtomacp testgrid.pbm | macptopbm | tee ${temp1_pbm} | \ +echo "Test 1. Should produce 281226646 481 twice" +pbmtomacp maze.pbm | macptopbm | tee ${temp1_pbm} | \ pnmcrop | cksum pbmtomacp ${temp1_pbm} | macptopbm | pnmcrop | cksum +rm ${temp1_pbm} -#Test 2. Should produce 2329957971 51851 +echo "Test 2. Should produce 2329957971 51851" pbmpage 1 | pbmtomacp | macptopbm | cksum - -#Test 3. Should produce 2907103393 5086 twice -pbmupc 0 12345 67890 | pnmpad -black -t 44 -b 20 -l 100 -r 251 | pbmtomacp | macptopbm | \ +echo "Test 3. Should produce 2907103393 5086 three times" +pbmupc 0 12345 67890 | tee ${tempupc_pbm} | \ + pnmpad -black -t 44 -b 20 -l 100 -r 251 | \ + pbmtomacp | macptopbm | \ tee ${temp2_pbm} | \ pnmcrop | pnmcrop | cksum +pnmpad -black -t 44 -l 100 ${tempupc_pbm} | \ + pbmtomacp| macptopbm | pnmcrop -white | pnmcrop | cksum + pbmtomacp ${temp2_pbm} | macptopbm | pnmcrop | pnmcrop | cksum -rm ${temp1_pbm} ${temp2_pbm} +rm ${temp2_pbm} ${tempupc_pbm} + + +echo "Test 4. Should produce 3432623660 51851 four times" +pbmmake -b 576 720 | tee ${temp3_pbm} | cksum + +pbmtomacp ${temp3_pbm} | tee ${temp3_macp} | macptopbm | cksum + +pbmtomacp -norle ${temp3_pbm} | macptopbm | cksum + +( head -c 128 /dev/zero ; cat ${temp3_macp} ) | \ + macptopbm -extraskip 128 | cksum + +rm ${temp3_pbm} ${temp3_macp} diff --git a/test/maze.pbm b/test/maze.pbm new file mode 100644 index 00000000..9bdd80e1 --- /dev/null +++ b/test/maze.pbm Binary files differdiff --git a/test/mda-roundtrip.ok b/test/mda-roundtrip.ok index ef27ffd0..ab449885 100644 --- a/test/mda-roundtrip.ok +++ b/test/mda-roundtrip.ok @@ -1,2 +1,5 @@ +Test 1. Should print 1757803444 169 twice 1757803444 169 -2425386270 41 +1757803444 169 +Test 2. Should print 281226646 481 +281226646 481 diff --git a/test/mda-roundtrip.test b/test/mda-roundtrip.test index 58376f3f..6b4d89b9 100755 --- a/test/mda-roundtrip.test +++ b/test/mda-roundtrip.test @@ -1,13 +1,15 @@ #! /bin/bash # This script tests: pbmtomda mdatopbm -# Also requires: pbmmake pnmpad pamcut +# Also requires: pbmmake pnmpad pamcut pamfile # Pbmtomda requires input width and height to be multiples of 8. -# Test 1. Should print 1757803444 169 +echo "Test 1. Should print 1757803444 169 twice" +pbmmake -g 32 40 | cksum pbmmake -g 32 40 | pbmtomda | mdatopbm | cksum -# Test 2. Should print 2425386270 41 -pnmpad -right 2 testgrid.pbm | \ - pbmtomda | mdatopbm | pamcut 0 0 14 16 | cksum +echo "Test 2. Should print 281226646 481" +size=$(pamfile -size maze.pbm | awk '{print "-width="$1,"-height="$2}') +pnmpad -mwidth=8 -halign=0 -mheight=8 -valign=0 ${size} maze.pbm | \ + pbmtomda | mdatopbm | pamcut -left=0 -top=0 ${size} | cksum diff --git a/test/mgr-roundtrip.ok b/test/mgr-roundtrip.ok index 845be5fb..0e845958 100644 --- a/test/mgr-roundtrip.ok +++ b/test/mgr-roundtrip.ok @@ -1 +1,7 @@ -2425386270 41 +Test 1. Should print 281226646 481 +281226646 481 +Test 2. Should print 429369764 1034, 448060073 4105 twice each +429369764 1034 +429369764 1034 +448060073 4105 +448060073 4105 diff --git a/test/mgr-roundtrip.test b/test/mgr-roundtrip.test index 252ae996..d96d836d 100755 --- a/test/mgr-roundtrip.test +++ b/test/mgr-roundtrip.test @@ -1,7 +1,15 @@ #! /bin/bash # This script tests: pbmtomgr mgrtopbm -# Also requires: +# Also requires: pbmmake +echo "Test 1. Should print 281226646 481" +pbmtomgr maze.pbm | mgrtopbm | cksum + +echo "Test 2. Should print 429369764 1034, 448060073 4105 twice each" +# Maximum width and height allowed + +pbmmake -g 4095 2 | cksum +pbmmake -g 4095 2 | pbmtomgr | mgrtopbm | cksum +pbmmake -g 1 4095 | cksum +pbmmake -g 1 4095 | pbmtomgr | mgrtopbm | cksum -# Should print 2425386270 41, cksum of testgrid.pbm -pbmtomgr testgrid.pbm | mgrtopbm | cksum diff --git a/test/mrf-roundtrip.ok b/test/mrf-roundtrip.ok index 845be5fb..5168378d 100644 --- a/test/mrf-roundtrip.ok +++ b/test/mrf-roundtrip.ok @@ -1 +1 @@ -2425386270 41 +281226646 481 diff --git a/test/mrf-roundtrip.test b/test/mrf-roundtrip.test index c9d8ce3a..8513a908 100755 --- a/test/mrf-roundtrip.test +++ b/test/mrf-roundtrip.test @@ -3,5 +3,5 @@ # Also requires: -# Should print 2425386270 41, cksum of testgrid.pbm -pbmtomrf testgrid.pbm | mrftopbm | cksum +# Should print 281226646 481, cksum of maze.pbm +pbmtomrf maze.pbm | mrftopbm | cksum diff --git a/test/pad-crop-roundtrip.ok b/test/pad-crop-roundtrip.ok index 0e712ce7..764cadfa 100644 --- a/test/pad-crop-roundtrip.ok +++ b/test/pad-crop-roundtrip.ok @@ -1,4 +1,4 @@ 1926073387 101484 1926073387 101484 -2425386270 41 -2425386270 41 +281226646 481 +281226646 481 diff --git a/test/pad-crop-roundtrip.test b/test/pad-crop-roundtrip.test index 75979901..8cca8a5f 100755 --- a/test/pad-crop-roundtrip.test +++ b/test/pad-crop-roundtrip.test @@ -2,17 +2,25 @@ # This script tests: pnmcrop pnmmargin pnmpad # Also requires: +# Test 1. Should produce 1926073387 101484, cksum of testimg.ppm + pnmmargin -white 10 testimg.ppm | \ pnmcrop | cksum +# Test 2. Should produce 1926073387 101484 + pnmpad -white -left 10 -top 10 testimg.ppm | \ pnmpad -white -right 10 -bottom 10 | \ pnmcrop -right -bottom | pnmcrop -left -top | cksum -pnmmargin -white 10 testgrid.pbm | \ +# Test 3. Should produce 281226646 481, cksum of maze.pbm + +pnmmargin -white 10 maze.pbm | \ pnmcrop | cksum -pnmpad -white -left 10 -top 10 testgrid.pbm | \ +# Test 4. Should produce 281226646 481 + +pnmpad -white -left 10 -top 10 maze.pbm | \ pnmpad -white -right 10 -bottom 10 | \ pnmcrop -left -right | pnmcrop -top -bottom | cksum diff --git a/test/palm-roundtrip.ok b/test/palm-roundtrip.ok index b9ea3056..d69c3a96 100644 --- a/test/palm-roundtrip.ok +++ b/test/palm-roundtrip.ok @@ -1,10 +1,10 @@ -Test 1 -584219238 236 -584219238 236 -584219238 236 -584219238 236 -584219238 236 -Test 2 +Test 1. Should print 2067616594 3375 five times +2067616594 3375 +2067616594 3375 +2067616594 3375 +2067616594 3375 +2067616594 3375 +Test 2. Should print 0 0 0 : 0 four times 0 0 0 : 0 0 0 0 : 0 0 0 0 : 0 diff --git a/test/palm-roundtrip.test b/test/palm-roundtrip.test index b00454ca..20fcefa9 100755 --- a/test/palm-roundtrip.test +++ b/test/palm-roundtrip.test @@ -6,11 +6,9 @@ tmpdir=${tmpdir:-/tmp} test4bit_pgm=${tmpdir}/test4bit.pgm test256color_ppm=${tmpdir}/test256color.ppm -# Test 1. Should print 584219238 236 5 times +echo "Test 1. Should print 2067616594 3375 five times" -echo "Test 1" - -pamdepth 15 testgrid.pbm | tee ${test4bit_pgm} | cksum +pamdepth 15 maze.pbm | tee ${test4bit_pgm} | cksum for flags in "" \ "-scanline_compression" \ @@ -21,9 +19,7 @@ for flags in "" \ rm ${test4bit_pgm} -# Test 2. Should print 0 4 times - -echo "Test 2" +echo "Test 2. Should print 0 0 0 : 0 four times" pnmquant 256 testimg.ppm > ${test256color_ppm} || echo "pnmquant failed" diff --git a/test/pamarith-compare-equal.ok b/test/pamarith-compare-equal.ok index ef1c2981..d6b1f624 100644 --- a/test/pamarith-compare-equal.ok +++ b/test/pamarith-compare-equal.ok @@ -6,6 +6,17 @@ Test 1 1:P3 1:8 8 1:2 +1:1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 0 0 0 2 2 2 0 0 +1:1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 2 2 2 0 0 0 2 2 +1:1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 0 0 0 2 2 2 0 0 +1:1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 2 2 2 0 0 0 2 2 +1:1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 0 0 0 2 2 2 0 0 +1:0 2 2 2 0 0 0 2 2 2 0 0 0 2 2 1 1 1 1 1 1 1 1 1 +1:2 0 0 0 2 2 2 0 0 0 2 2 2 0 0 1 1 1 1 1 1 1 1 1 +1:0 2 2 2 0 0 0 2 2 2 0 0 0 2 2 1 1 1 1 1 1 1 1 1 +1:P3 +1:8 8 +1:2 5:0 0 2 0 0 2 0 0 2 0 0 2 0 0 2 2 0 2 2 0 2 2 0 2 3:2 0 2 2 0 2 2 0 2 2 0 2 2 0 2 2 0 0 2 0 0 2 0 0 Test 2 @@ -16,14 +27,19 @@ Test 2 1:P3 1:8 8 1:1 +5:1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 +3:0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 +1:P3 +1:8 8 +1:1 8:0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Test 3 1:P1 -1:14 16 -16:00000000000000 +1:35 33 +33:00000000000000000000000000000000000 1:P1 -1:14 16 -16:11111111111111 +1:35 33 +33:11111111111111111111111111111111111 1:P1 1:14 16 8:10101010101010 11111111111111 @@ -32,9 +48,9 @@ Test 3 8:01010101010101 00000000000000 Test 4 1:P2 -1:14 16 +1:35 33 1:2 -16:1 1 1 1 1 1 1 1 1 1 1 1 1 1 +33:1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1:P2 1:14 16 1:2 @@ -48,11 +64,11 @@ Test 4 1:2 8:1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Test 5 -Should produce 1285449498 54 +Should produce 1285449498 54 four times 1285449498 54 1285449498 54 1285449498 54 1285449498 54 -Should produce 244506188 54 +Should produce 244506188 54 twice 244506188 54 244506188 54 diff --git a/test/pamarith-compare-equal.test b/test/pamarith-compare-equal.test index 903ad538..0af9ee27 100755 --- a/test/pamarith-compare-equal.test +++ b/test/pamarith-compare-equal.test @@ -1,20 +1,25 @@ #! /bin/bash # This script tests: pamarith -# Also requires: ppmpat pnminvert pbmmake pgmmake +# Also requires: ppmpat pnminvert pamfile pbmmake pgmmake pamcut tmpdir=${tmpdir:-/tmp} input1_ppm=${tmpdir}/input1.ppm +inputm_ppm=${tmpdir}/inputm.ppm input2_ppm=${tmpdir}/input2.ppm echo "Test 1" ppmpat -tartan -color=rgb:00/80/ff,rgb:80/ff/00,rgb:ff/00/80 \ 8 8 > ${input1_ppm} +ppmpat -tartan -color=rgb:00/80/ff,rgb:80/ff/00,rgb:ff/00/80 \ + -mesh 8 8 > ${inputm_ppm} ppmpat -tartan -color=rgb:80/ff/00,rgb:ff/00/80,rgb:00/80/ff \ 8 8 > ${input2_ppm} pamarith -compare -plain ${input1_ppm} ${input1_ppm} | \ uniq -c | sed -e 's/^ *//' -e 's/ /:/' +pamarith -compare -plain ${input1_ppm} ${inputm_ppm} | \ + uniq -c | sed -e 's/^ *//' -e 's/ /:/' pamarith -compare -plain ${input1_ppm} ${input2_ppm} | \ uniq -c | sed -e 's/^ *//' -e 's/ /:/' @@ -22,54 +27,66 @@ echo "Test 2" pamarith -equal -plain ${input1_ppm} ${input1_ppm} | \ uniq -c | sed -e 's/^ *//' -e 's/ /:/' +pamarith -equal -plain ${input1_ppm} ${inputm_ppm} | \ + uniq -c | sed -e 's/^ *//' -e 's/ /:/' pamarith -equal -plain ${input1_ppm} ${input2_ppm} | \ uniq -c | sed -e 's/^ *//' -e 's/ /:/' -rm ${input1_ppm} ${input2_ppm} +rm ${input1_ppm} ${inputm_ppm} ${input2_ppm} echo "Test 3" -pamarith -equal -plain testgrid.pbm testgrid.pbm | \ +input3_pbm=${tmpdir}/input3.pbm +pamcut maze.pbm -left=0 -top=0 -width=35 -height=33 > ${input3_pbm} + +pamarith -equal -plain ${input3_pbm} ${input3_pbm} | \ uniq -c | sed -e 's/^ *//' -e 's/ /:/' -pnminvert testgrid.pbm | pamarith -equal -plain testgrid.pbm - | \ +pnminvert ${input3_pbm} | pamarith -equal -plain ${input3_pbm} - | \ uniq -c | sed -e 's/^ *//' -e 's/ /:/' -pbmmake -w 14 16 | pamarith -equal -plain testgrid.pbm - | \ + +xysize=$(pamfile -size testgrid.pbm) + +pbmmake -w ${xysize} | pamarith -equal -plain testgrid.pbm - | \ awk '{printf("%s%c",$0, NR<3 || NR%2==0 ? "\n" : " ")}' | uniq -c | sed -e 's/^ *//' -e 's/ /:/' -pbmmake -b 14 16 | pamarith -equal -plain testgrid.pbm - | \ +pbmmake -b ${xysize} | pamarith -equal -plain testgrid.pbm - | \ awk '{printf("%s%c",$0, NR<3 || NR%2==0 ? "\n" : " ")}' | uniq -c | sed -e 's/^ *//' -e 's/ /:/' echo "Test 4" - -pamarith -compare -plain testgrid.pbm testgrid.pbm | \ + + +pamarith -compare -plain ${input3_pbm} ${input3_pbm} | \ uniq -c | sed -e 's/^ *//' -e 's/ /:/' + pnminvert testgrid.pbm | pamarith -compare -plain testgrid.pbm - | \ awk '{printf("%s%c",$0, NR<4 || NR%2==1 ? "\n" : " ")}' | uniq -c | sed -e 's/^ *//' -e 's/ /:/' -pbmmake -w 14 16 | pamarith -compare -plain testgrid.pbm - | \ +pbmmake -w ${xysize} | pamarith -compare -plain testgrid.pbm - | \ awk '{printf("%s%c",$0, NR<4 || NR%2==1 ? "\n" : " ")}' | uniq -c | sed -e 's/^ *//' -e 's/ /:/' -pbmmake -b 14 16 | pamarith -compare -plain testgrid.pbm - | \ +pbmmake -b ${xysize} | pamarith -compare -plain testgrid.pbm - | \ awk '{printf("%s%c",$0, NR<4 || NR%2==1 ? "\n" : " ")}' | uniq -c | sed -e 's/^ *//' -e 's/ /:/' +rm ${input3_pbm} echo "Test 5" # -closeness input40_pgm=${tmpdir}/input40.pgm input50_pgm=${tmpdir}/input50.pgm -equal_pgm=${tmpdir}/equal.pgm pgmmake -maxval=99 0.40 7 3 > ${input40_pgm} pgmmake -maxval=99 0.50 7 3 > ${input50_pgm} -echo "Should produce 1285449498 54" +echo "Should produce 1285449498 54 four times" pamarith -equal -plain ${input40_pgm} ${input40_pgm} | cksum pamarith -equal -plain -closeness=10.2 ${input40_pgm} ${input50_pgm} | cksum pamarith -equal -plain -closeness=11 ${input40_pgm} ${input50_pgm} | cksum pamarith -equal -plain -closeness=90 ${input40_pgm} ${input50_pgm} | cksum -echo "Should produce 244506188 54" +echo "Should produce 244506188 54 twice" pamarith -equal -plain ${input40_pgm} ${input50_pgm} | cksum -pamarith -equal -plain -closeness=09 ${input40_pgm} ${input50_pgm} | cksum +pamarith -equal -plain -closeness=09 ${input40_pgm} ${input50_pgm} | cksum + +rm ${input40_pgm} ${input50_pgm} \ No newline at end of file diff --git a/test/pamarith.ok b/test/pamarith.ok index 0862df8e..c9fc49db 100644 --- a/test/pamarith.ok +++ b/test/pamarith.ok @@ -193,19 +193,19 @@ Test 3 3072492814 913 3072492814 913 Test 4 (input = output) -cksum is 2425386270 41 or 2921940274 59 +Prints 281226646 481 five times, then 2921940274 59 five times input image -2425386270 41 +281226646 481 -minimum -2425386270 41 +281226646 481 -maximum -2425386270 41 +281226646 481 -mean -2425386270 41 +281226646 481 -and -2425386270 41 +281226646 481 -or -2425386270 41 +281226646 481 input image 2921940274 59 -minimum @@ -219,13 +219,13 @@ input image -or 2921940274 59 Test 5 (blank output) -cksum is 2817549367 41 or 320101399 59 +Prints 2247801875 481 three times, then 320101399 59 three times -subtract -2817549367 41 +2247801875 481 -difference -2817549367 41 +2247801875 481 -xor -2817549367 41 +2247801875 481 -subtract 320101399 59 -difference diff --git a/test/pamarith.test b/test/pamarith.test index b7fe3212..b6b4538c 100755 --- a/test/pamarith.test +++ b/test/pamarith.test @@ -88,9 +88,9 @@ for fn in "-subtract" "-divide" "-compare" "-shiftleft" "-shiftright" rm ${input3_ppm} ${input4_ppm} ${input4_pgm} echo "Test 4 (input = output)" -echo "cksum is 2425386270 41 or 2921940274 59" +echo "Prints 281226646 481 five times, then 2921940274 59 five times" -for image in testgrid.pbm ${input1_ppm} +for image in maze.pbm ${input1_ppm} do echo "input image" cat ${image} | cksum @@ -103,9 +103,9 @@ for image in testgrid.pbm ${input1_ppm} echo "Test 5 (blank output)" -echo "cksum is 2817549367 41 or 320101399 59" +echo "Prints 2247801875 481 three times, then 320101399 59 three times" -for image in testgrid.pbm ${input1_ppm} +for image in maze.pbm ${input1_ppm} do for fn in "-subtract" "-difference" "-xor" do @@ -116,7 +116,6 @@ for image in testgrid.pbm ${input1_ppm} rm ${input1_ppm} - 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/pamchannel.ok b/test/pamchannel.ok index 41d3f890..91629202 100644 --- a/test/pamchannel.ok +++ b/test/pamchannel.ok @@ -1,9 +1,11 @@ -Test 1 +Test 1:red-channel Should produce 1571496937 33838 1571496937 33838 -Test 2 +Test 2:green-channel Should produce 394856971 33838 394856971 33838 -Test 3 +Test 3:blue-channel Should produce 3164158573 33838 3164158573 33838 +Test 4:single-channel Should produce 281226646 481 +281226646 481 Test Invalid Expected failure 1 1 Expected failure 2 1 diff --git a/test/pamchannel.test b/test/pamchannel.test index 6bb0cf67..bce1d4eb 100755 --- a/test/pamchannel.test +++ b/test/pamchannel.test @@ -12,27 +12,23 @@ # 3164158573 33838 testimg.blu -# Test 1. red channel -# Should produce 1571496937 33838 -echo "Test 1" - +echo "Test 1:red-channel Should produce 1571496937 33838" pamchannel -infile testimg.ppm 0 | \ pamtopnm --assume | cksum -# Test 2. green channel -# Should produce 394856971 33838 -echo "Test 2" - +echo "Test 2:green-channel Should produce 394856971 33838" pamchannel -infile testimg.ppm -tupletype="GRAYSCALE" 1 | \ pamtopnm | cksum -# Test 3. blue channel -# Should produce 3164158573 33838 -echo "Test 3" +echo "Test 3:blue-channel Should produce 3164158573 33838" pamchannel -infile testimg.ppm 2 | \ pamtopnm --assume | cksum +echo "Test 4:single-channel Should produce 281226646 481" +pamchannel -infile maze.pbm 0 | \ + pamtopnm --assume | cksum + # Test invalid: specified channel does not exist echo 1>&2 @@ -48,14 +44,15 @@ echo "Test Invalid" pamchannel -infile testgrid.pbm 1 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamchannel -infile testimg.ppm 3 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamtopam testimg.ppm | pamchannel -infile=- 4 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} + diff --git a/test/pamcrater.test b/test/pamcrater.test index 027e34e3..25b12135 100755 --- a/test/pamcrater.test +++ b/test/pamcrater.test @@ -52,7 +52,7 @@ pamshadedrelief ${test100_pam} > ${testshaded_pam} pamcut -top=$((128 - 99)) -height=1 ${testshaded_pam} | cksum ) | uniq -c | awk '{print $1}' -rm ${testshaded_pam} ${test100_pam} +rm ${testshaded_pam} ${test100_pam} ${test150_pam} echo "Test Invalid." @@ -66,19 +66,19 @@ echo "------------------------------" 1>&2 pamcrater -width 0 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcrater -height 0 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcrater -number 0 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcrater -test -radius=10 | pamshadedrelief -gamma 0 > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pamcut.ok b/test/pamcut.ok index 3d5c5a7f..fc4dc3de 100644 --- a/test/pamcut.ok +++ b/test/pamcut.ok @@ -1,22 +1,22 @@ -Test 1. +Test 1. Should print 2958909756 124815 2958909756 124815 -Test 2. +Test 2. Should print 1550940962 10933 1550940962 10933 -Test 3. +Test 3. Should print 708474423 14 twice 708474423 14 708474423 14 -Test 4. +Test 4. Should print 659346598 80124 four times 659346598 80124 659346598 80124 659346598 80124 659346598 80124 -Test 5. -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -Test 6. +Test 5. Should print 281226646 481 five times +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +Test 6. Should print 3412257956 129 3412257956 129 Test Invalid Expected failure 1 1 diff --git a/test/pamcut.test b/test/pamcut.test index ced45f9c..e18c3cf2 100755 --- a/test/pamcut.test +++ b/test/pamcut.test @@ -1,28 +1,23 @@ #! /bin/bash # This script tests: pamcut pbmmake -# Also requires: +# Also requires: pamfile -# Test 1. Should print 2958909756 124815 -echo Test 1. +echo "Test 1. Should print 2958909756 124815" pamcut -top 0 -left 0 -width 260 -height 160 \ -pad testimg.ppm | cksum -# Test 2. Should print 1550940962 10933 -echo Test 2. +echo "Test 2. Should print 1550940962 10933" pamcut -top 200 -left 120 -width 40 -height 40 \ -pad testimg.ppm | cksum -# Test 3. Should print 708474423 14 twice -echo Test 3. +echo "Test 3. Should print 708474423 14 twice" pamcut -top 5 -left 5 -bottom 5 -right 5 testimg.ppm | cksum pamcut -width 1 -height 1 -bottom 5 -right 5 testimg.ppm | cksum - -# Test 4. Should print 659346598 80124 four times -echo Test 4. +echo "Test 4. Should print 659346598 80124 four times" pamcut -croptop 10 -cropleft 10 -cropbottom 10 -cropright 10 testimg.ppm | \ cksum @@ -30,19 +25,20 @@ pamcut -top 10 -left 10 -bottom 138 -right 216 testimg.ppm | cksum pamcut -top 10 -left 10 -bottom -11 -right -11 testimg.ppm | cksum pamcut -top 10 -left 10 -width 207 -height 129 testimg.ppm | cksum +echo "Test 5. Should print 281226646 481 five times" -# Test 5. Should print 2425386270 41 five times -echo Test 5. - -pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 testgrid.pbm | \ +width=$(pamfile -size maze.pbm | awk '{print $1}') +height=$(pamfile -size maze.pbm | awk '{print $2}') + +pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 maze.pbm | \ cksum -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. +pamcut -top 0 -left 0 -bottom $((${height} -1)) -right $((${width} -1)) \ + maze.pbm | cksum +pamcut -top 0 -left 0 -bottom -1 -right -1 maze.pbm | cksum +pamcut -top 0 -left 0 -width ${width} -height ${height} maze.pbm | cksum +pamcut maze.pbm | cksum + +echo "Test 6. Should print 3412257956 129" pbmmake -g 50 50 | pamcut 5 5 30 30 | cksum @@ -61,77 +57,77 @@ echo "-----------------------------------------------------------" 1>&2 pamcut -left=1 -right=1 -width=14 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcut -top=1 -bottom=1 -height=16 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcut -right=1 -cropright=1 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcut -top=1 -croptop=1 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcut -bottom=1 -cropbottom=1 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcut -left=1 -cropleft=1 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # excessive cropping pamcut -cropleft=7 -cropright=8 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcut -left=7 -right=6 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 8" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcut -croptop=8 -cropbottom=8 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 9" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcut -top=10 -bottom=9 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # pad absent pamcut -cropleft=1 -width=14 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 10" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcut -croptop=1 -height=16 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 11" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # legacy style: insufficient number of positional parameters pamcut 5 testimg.ppm > ${test_out} || \ echo -n "Expected failure 12" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcut 5 4 testimg.ppm > ${test_out} || \ echo -n "Expected failure 13" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamcut 5 5 30 testimg.ppm > ${test_out} || \ echo -n "Expected failure 14" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pamdepth-roundtrip.ok b/test/pamdepth-roundtrip.ok index 89db1a57..28db2ee1 100644 --- a/test/pamdepth-roundtrip.ok +++ b/test/pamdepth-roundtrip.ok @@ -5,4 +5,4 @@ 1926073387 101484 1926073387 101484 1926073387 101484 -2425386270 41 +281226646 481 diff --git a/test/pamdepth-roundtrip.test b/test/pamdepth-roundtrip.test index 0c7cb8b0..d3f0d6d3 100755 --- a/test/pamdepth-roundtrip.test +++ b/test/pamdepth-roundtrip.test @@ -9,5 +9,5 @@ pamdepth $i testimg.ppm | \ pamdepth 255 | cksum done -pamdepth 255 testgrid.pbm | pamdepth 1 | \ +pamdepth 255 maze.pbm | pamdepth 1 | \ pgmtopbm -th -val=0.5 | cksum diff --git a/test/pamdepth.test b/test/pamdepth.test index eaa1b165..86f6c952 100755 --- a/test/pamdepth.test +++ b/test/pamdepth.test @@ -32,9 +32,9 @@ echo "-----------------------------------------------------------" 1>&2 pamdepth 0 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamdepth 65536 testimg.ppm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pamdice-roundtrip.ok b/test/pamdice-roundtrip.ok index 4a850615..9f648fd0 100644 --- a/test/pamdice-roundtrip.ok +++ b/test/pamdice-roundtrip.ok @@ -1,18 +1,16 @@ -test 1 -2425386270 41 -test 2 -2425386270 41 -test 3 -2425386270 41 -test 4. +Test 1. Should print 281226646 481 +281226646 481 +Test 2. Should print 281226646 481 +281226646 481 +Test 3. Should print 281226646 481 +281226646 481 +Test 4. Should print 281226646 481 +281226646 481 +Test 5. Should print 1926073387 101484 five times 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 +Test 6. Should print 1926073387 101484 1926073387 101484 diff --git a/test/pamdice-roundtrip.test b/test/pamdice-roundtrip.test index c5ccde66..741615f5 100755 --- a/test/pamdice-roundtrip.test +++ b/test/pamdice-roundtrip.test @@ -1,38 +1,60 @@ #! /bin/bash # This script tests: pamdice pamundice -# Also requires: - +# Also requires: pamfile tmpdir=${tmpdir:-/tmp} fname_stem=${tmpdir}/pamdice_part -echo test 1 +mazesize=$(pamfile -size maze.pbm) +mw=$(echo ${mazesize} | cut -d" " -f1) +mh=$(echo ${mazesize} | cut -d" " -f2) + +echo "Test 1. Should print 281226646 481" -pamdice testgrid.pbm -outstem=${fname_stem} +pamdice maze.pbm -outstem=${fname_stem} pamundice ${fname_stem}_%1d_%1a.pbm -down=1 -across=1 | cksum rm ${fname_stem}_0_0.pbm -echo test 2 +echo "Test 2. Should print 281226646 481" + +width=10 +tiles=$(( (${mw}+${width}-1) / ${width} )) + + +pamdice maze.pbm -outstem=${fname_stem} -width=${width} +pamundice ${fname_stem}_%1d_%1a.pbm -across=${tiles} | cksum +rm ${fname_stem}_*_*.pbm + +echo "Test 3. Should print 281226646 481" -pamdice testgrid.pbm -outstem=${fname_stem} -width=3 -pamundice ${fname_stem}_%1d_%1a.pbm -across=5 | cksum -rm ${fname_stem}_0_?.pbm +width=5 +tiles=$(( (${mw}+${width}-1) / ${width} )) -echo test 3 +pamdice maze.pbm -outstem=${fname_stem} -width=${width} +pamundice ${fname_stem}_%1d_%2a.pbm -across=${tiles} | cksum +rm ${fname_stem}_*_*.pbm -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" +echo "Test 4. Should print 281226646 481" + +height=10 +tiles=$(( (${mh}+${height}-1) / ${height} )) + +pamdice maze.pbm -outstem=${fname_stem} -height=${height} +pamundice ${fname_stem}_%1d_%1a.pbm -down=${tiles} | cksum +rm ${fname_stem}_*_*.pbm + +echo "Test 5. Should print 1926073387 101484 five times" + +for option 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 +echo "Test 6. Should print 1926073387 101484" + 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/pamditherbw.test b/test/pamditherbw.test index 378d7e94..43d2b00f 100755 --- a/test/pamditherbw.test +++ b/test/pamditherbw.test @@ -49,61 +49,61 @@ echo "-----------------------------------------------------------" 1>&2 pamditherbw -fs -atkinson ${test_red} > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamditherbw -floyd -atkinson ${test_red} > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamditherbw -dither8 -cluster3 ${test_red} > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamditherbw -cluster3 -cluster4 ${test_red} > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamditherbw -cluster3 -cluster8 ${test_red} > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamditherbw -cluster4 -cluster8 ${test_red} > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamditherbw -hilbert -threshold ${test_red} > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamditherbw -clump=8 ${test_red} > ${test_out} || \ echo -n "Expected failure 8" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamditherbw -fs -clump=8 ${test_red} > ${test_out} || \ echo -n "Expected failure 9" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamditherbw -hilbert -clump=1 ${test_red} > ${test_out} || \ echo -n "Expected failure 10" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamditherbw -th -value=-1 ${test_red} > ${test_out} || \ echo -n "Expected failure 11" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamditherbw -th -value=1.1 ${test_red} > ${test_out} || \ echo -n "Expected failure 12" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} rm ${test_red} diff --git a/test/pamenlarge-pamscale-point.test b/test/pamenlarge-pamscale-point.test index 08b34bb7..f0f0948b 100755 --- a/test/pamenlarge-pamscale-point.test +++ b/test/pamenlarge-pamscale-point.test @@ -29,8 +29,8 @@ enlarge_pbm=${tmpdir}/enlarge.pbm for option in "6 -nomix" "15 -nomix -linear" "24 -nomix" do scale=${option%% *} - pamenlarge $scale testgrid.pbm > ${enlarge_pbm} - pamscale $option testgrid.pbm | cmp -s - ${enlarge_pbm} + pamenlarge $scale maze.pbm > ${enlarge_pbm} + pamscale $option maze.pbm | cmp -s - ${enlarge_pbm} echo $option ${PIPESTATUS[@]} ":" $? rm ${enlarge_pbm} done diff --git a/test/pamenlarge-pbm.test b/test/pamenlarge-pbm.test index 10c00ba0..87493516 100755 --- a/test/pamenlarge-pbm.test +++ b/test/pamenlarge-pbm.test @@ -58,4 +58,4 @@ for width in `seq 16` # done -rm ${test3_pbm}.[1-9] ${test3_pbm}.1[1-6] \ No newline at end of file +rm ${test3_pbm}.[1-9] ${test3_pbm}.1[0-6] \ No newline at end of file diff --git a/test/pamenlarge.ok b/test/pamenlarge.ok index a2408871..9107e870 100644 --- a/test/pamenlarge.ok +++ b/test/pamenlarge.ok @@ -1,4 +1,10 @@ +Test 1. Should print 3424505894 913236 3424505894 913236 +Test 2. Should print 3763267672 304422 3763267672 304422 -3342398172 297 +Test 3. Should print 3748791794 3905 +3748791794 3905 +Test 4. Should print 1618994486 1194 +1618994486 1194 +Test 5. Should print 398497872 6806 398497872 6806 diff --git a/test/pamenlarge.test b/test/pamenlarge.test index 3820f47e..851362e8 100755 --- a/test/pamenlarge.test +++ b/test/pamenlarge.test @@ -2,13 +2,14 @@ # This script tests: pamenlarge # Also requires: pamchannel pamseq pamtopnm - -# Test 1. Should print 3424505894 913236 +echo "Test 1. Should print 3424505894 913236" pamenlarge 3 testimg.ppm | cksum -# Test 2. Should print 3763267672 304422 +echo "Test 2. Should print 3763267672 304422" pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ pamenlarge 3 | cksum -# Test 3. Should print 3342398172 297 -pamenlarge 3 testgrid.pbm | cksum -# Test 4. Should print 398497872 6806 +echo "Test 3. Should print 3748791794 3905" +pamenlarge 3 maze.pbm | cksum +echo "Test 4. Should print 1618994486 1194" +pamenlarge -xscale=21 -yscale=2 testgrid.pbm | cksum +echo "Test 5. Should print 398497872 6806" pamseq 3 4 | pamtopnm -assume | pamenlarge 3 -plain | cksum diff --git a/test/pamfile.test b/test/pamfile.test index 16d084ea..41aa3c85 100755 --- a/test/pamfile.test +++ b/test/pamfile.test @@ -33,14 +33,14 @@ echo "-----------------------------------------------------------" 1>&2 pamfile -size -machine testimg.ppm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamfile -count -machine testimg.ppm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} head -n1 testimg.ppm | pamfile > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pamfind.test b/test/pamfind.test index 7b612f78..e689754f 100755 --- a/test/pamfind.test +++ b/test/pamfind.test @@ -46,19 +46,19 @@ echo "Test Invalid" pamfind -color=black -target=1,1,1 testimg.ppm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamfind -target=0,0 testimg.ppm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamfind -target=0,0,0,0 testimg.ppm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamfind testimg.ppm > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pamfix.test b/test/pamfix.test index d13e0230..1293dfe2 100755 --- a/test/pamfix.test +++ b/test/pamfix.test @@ -1,6 +1,8 @@ #! /bin/bash # This script tests: pamfix -# Also requires: +# Also requires: pbmmake + +tmpdir=${tmpdir:-/tmp} # Test 1. echo "Test 1" diff --git a/test/pamflip-roundtrip.ok b/test/pamflip-roundtrip.ok index 653ab007..48d5ab62 100644 --- a/test/pamflip-roundtrip.ok +++ b/test/pamflip-roundtrip.ok @@ -1,12 +1,59 @@ -1926073387 101484 -1926073387 101484 -1926073387 101484 -1926073387 101484 -1926073387 101484 -1926073387 101484 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 +Test 1. Should produce 1988581932 2989 fifteen times +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +1988581932 2989 +Test 2. Should produce 2729474106 27 nine times +2729474106 27 +2729474106 27 +2729474106 27 +2729474106 27 +2729474106 27 +2729474106 27 +2729474106 27 +2729474106 27 +2729474106 27 +Test 3. Should produce 1849343241 27 nine times +1849343241 27 +1849343241 27 +1849343241 27 +1849343241 27 +1849343241 27 +1849343241 27 +1849343241 27 +1849343241 27 +1849343241 27 +Test 4. Should print a single pixel PPM image maxval 65535 in +plain (ascii) format; then produce 2434897823 19 nine times +P3 +1 1 +65535 +1 10000 65535 +2434897823 19 +2434897823 19 +2434897823 19 +2434897823 19 +2434897823 19 +2434897823 19 +2434897823 19 +2434897823 19 +2434897823 19 +Test 4. Should produce 281226646 481 seven times +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 diff --git a/test/pamflip-roundtrip.test b/test/pamflip-roundtrip.test index c5a34ad9..27a3c1f6 100755 --- a/test/pamflip-roundtrip.test +++ b/test/pamflip-roundtrip.test @@ -1,35 +1,108 @@ #! /bin/bash # This script tests: pamflip -# Also requires: +# Also requires: ppmpat pamseq pamtopnm +tmpdir=${tmpdir:-/tmp} +tartan_ppm=${tmpdir}/test.ppm +test1_pgm=${tmpdir}/test1.pgm +test2_pgm=${tmpdir}/test2.pgm +dot_ppm=${tmpdir}/dot.ppm -pamflip -lr testimg.ppm | pamflip -lr | cksum -pamflip -tb testimg.ppm | pamflip -tb | cksum -pamflip -r180 testimg.ppm | \ - pamflip -r180 | cksum -pamflip -xy testimg.ppm | pamflip -xy | cksum -pamflip -r90 testimg.ppm | \ - pamflip -r90 | \ - pamflip -r90 | \ - pamflip -r90 | cksum -pamflip -r270 testimg.ppm | \ - pamflip -r270 | \ - pamflip -r270 | \ - pamflip -r270 | cksum - -pamflip -lr testgrid.pbm | \ - pamflip -lr | cksum -pamflip -tb testgrid.pbm | \ - pamflip -tb | cksum -pamflip -r180 testgrid.pbm | \ +echo "Test 1. Should produce 1988581932 2989 fifteen times" + +ppmpat -tartan -mesh \ + -color=rgb:0/0/0,rgb:ff/00/ff,rgb:80/90/20 31 32 > ${tartan_ppm} + +pamflip -null ${tartan_ppm} | cksum +pamflip -lr ${tartan_ppm} | pamflip -lr | cksum +pamflip -tb ${tartan_ppm} | pamflip -tb | cksum +pamflip -r180 ${tartan_ppm} | \ pamflip -r180 | cksum -pamflip -xy testgrid.pbm | \ - pamflip -xy | cksum -pamflip -r90 testgrid.pbm | \ - pamflip -r90 | \ - pamflip -r90 | \ - pamflip -r90 | cksum -pamflip -r270 testgrid.pbm | \ - pamflip -r270 | \ - pamflip -r270 | \ - pamflip -r270 | cksum +pamflip -xy ${tartan_ppm} | pamflip -xy | cksum +pamflip -r90 ${tartan_ppm} | pamflip -r90 | \ + pamflip -r90 | pamflip -r90 | cksum +pamflip -r270 ${tartan_ppm} | pamflip -r270 | \ + pamflip -r270 | pamflip -r270 | cksum +pamflip -xform=leftright ${tartan_ppm} | pamflip -leftright | cksum +pamflip -xform=topbottom ${tartan_ppm} | pamflip -topbottom | cksum +pamflip -xform=transpose ${tartan_ppm} | pamflip -transpose | cksum +pamflip -xform=leftright,leftright ${tartan_ppm} | cksum +pamflip -xform=topbottom,topbottom ${tartan_ppm} | cksum +pamflip -xform=transpose,transpose ${tartan_ppm} | cksum +pamflip -tb ${tartan_ppm} | pamflip -lr | \ + pamflip -xform=leftright,topbottom | cksum +pamflip -tb ${tartan_ppm} | pamflip -lr | pamflip -xy | \ + pamflip -xform=leftright,topbottom,transpose | cksum + +rm ${tartan_ppm} + +pamseq 1 15 | pamtopnm -assume > ${test1_pgm} + +echo "Test 2. Should produce 2729474106 27 nine times" + +pamflip -null ${test1_pgm} | cksum +pamflip -lr ${test1_pgm} | pamflip -lr | cksum +pamflip -tb ${test1_pgm} | pamflip -tb | cksum +pamflip -r180 ${test1_pgm} | pamflip -r180 | cksum +pamflip -xy ${test1_pgm} | pamflip -xy | cksum +pamflip -r90 ${test1_pgm} | pamflip -r270 | cksum +pamflip -r270 ${test1_pgm} | pamflip -r90 | cksum +pamflip -r90 ${test1_pgm} | pamflip -r90 | \ + pamflip -r90 | pamflip -r90 | cksum +pamflip -r270 ${test1_pgm} | pamflip -r270 | \ + pamflip -r270 | pamflip -r270 | cksum + +pamflip -r180 ${test1_pgm} > ${test2_pgm} +rm ${test1_pgm} + +echo "Test 3. Should produce 1849343241 27 nine times" + +pamflip -null ${test2_pgm} | cksum +pamflip -lr ${test2_pgm} | pamflip -lr | cksum +pamflip -tb ${test2_pgm} | pamflip -tb | cksum +pamflip -r180 ${test2_pgm} | pamflip -r180 | cksum +pamflip -xy ${test2_pgm} | pamflip -xy | cksum +pamflip -r90 ${test2_pgm} | pamflip -r270 | cksum +pamflip -r270 ${test2_pgm} | pamflip -r90 | cksum +pamflip -r90 ${test2_pgm} | pamflip -r90 | \ + pamflip -r90 | pamflip -r90 | cksum +pamflip -r270 ${test2_pgm} | pamflip -r270 | \ + pamflip -r270 | pamflip -r270 | cksum + +rm ${test2_pgm} + +cat > ${dot_ppm} <<EOF +P3 +1 1 +65535 +1 10000 65535 +EOF + +echo "Test 4. Should print a single pixel PPM image maxval 65535 in " +echo "plain (ascii) format; then produce 2434897823 19 nine times" + +pamflip -null -plain ${dot_ppm} +pamflip -null ${dot_ppm} | cksum +pamflip -lr ${dot_ppm} | pamflip -lr | cksum +pamflip -tb ${dot_ppm} | pamflip -tb | cksum +pamflip -r180 ${dot_ppm} | pamflip -r180 | cksum +pamflip -xy ${dot_ppm} | pamflip -xy | cksum +pamflip -r90 ${dot_ppm} | pamflip -r270 | cksum +pamflip -r270 ${dot_ppm} | pamflip -r90 | cksum +pamflip -r90 ${dot_ppm} | pamflip -r90 | pamflip -r90 | pamflip -r90 | cksum +pamflip -r270 ${dot_ppm} | pamflip -r270 | \ + pamflip -r270 | pamflip -r270 | cksum + +rm ${dot_ppm} + +echo "Test 4. Should produce 281226646 481 seven times" + +pamflip -null maze.pbm | cksum +pamflip -lr maze.pbm | pamflip -lr | cksum +pamflip -tb maze.pbm | pamflip -tb | cksum +pamflip -r180 maze.pbm | pamflip -r180 | cksum +pamflip -xy maze.pbm | pamflip -xy | cksum +pamflip -r90 maze.pbm | pamflip -r90 | pamflip -r90 | pamflip -r90 | cksum +pamflip -r270 maze.pbm | pamflip -r270 | pamflip -r270 | pamflip -r270 | cksum + +# TODO: PBM various lengths: samples with -lr diff --git a/test/pamflip1.ok b/test/pamflip1.ok index 64e0407e..1169d773 100644 --- a/test/pamflip1.ok +++ b/test/pamflip1.ok @@ -1,5 +1,10 @@ -2116496681 101484 +Test 1. Should print 1350702313 12336 +1350702313 12336 +Test 2. Should print 1035759697 40048 +1035759697 40048 +Test 3. Should print 217037000 101484 217037000 101484 -2052917888 101484 -3375384165 41 -604323149 41 +Test 4. Should print 1178735266 481 +1178735266 481 +Test 5. Should print 2339906255 481 +2339906255 481 diff --git a/test/pamflip1.test b/test/pamflip1.test index 840cac73..b30bf6b0 100755 --- a/test/pamflip1.test +++ b/test/pamflip1.test @@ -1,15 +1,19 @@ #! /bin/bash # This script tests: pamflip -# Also requires: +# Also requires: pamseq +echo "Test 1. Should print 1350702313 12336" +pamseq 3 15 | pamflip -lr | cksum -# Test 1. Should print 2116496681 101484 -pamflip -lr testimg.ppm | cksum -# Test 2. Should print 217037000 101484 +echo "Test 2. Should print 1035759697 40048" +pamseq 4 9 | pamflip -tb | cksum + +echo "Test 3. Should print 217037000 101484" pamflip -cw testimg.ppm | cksum -# Test 3. Should print 2052917888 101484 -pamflip -tb testimg.ppm | cksum -# Test 4. Should print 3375384165 41 -pamflip -lr testgrid.pbm | cksum -# Test 5. Should print 604323149 41 -pamflip -tb testgrid.pbm | cksum + +echo "Test 4. Should print 1178735266 481" +pamflip -lr maze.pbm | cksum + +echo "Test 5. Should print 2339906255 481" +pamflip -tb maze.pbm | cksum + diff --git a/test/pamflip2.ok b/test/pamflip2.ok index d2ea501e..e3b4185c 100644 --- a/test/pamflip2.ok +++ b/test/pamflip2.ok @@ -1,3 +1,6 @@ -490797850 37 -3727293411 37 -3511745816 37 +Test 1. Should print 748061765 465 +748061765 465 +Test 2. Should print 3217647947 465 +3217647947 465 +Test 2. Should print 1086015439 465 +1086015439 465 diff --git a/test/pamflip2.test b/test/pamflip2.test index 4dddb770..8df293b5 100755 --- a/test/pamflip2.test +++ b/test/pamflip2.test @@ -9,9 +9,11 @@ ## optional SSE routine. If you make a wrong choice during configure, ## this test will fail. -# Test 1. Should print 490797850 37 -pamflip -cw testgrid.pbm | cksum -# Test 1. Should print 3727293411 37 -pamflip -ccw testgrid.pbm | cksum -# Test 2. Should print 3511745816 37 -pamflip -xy testgrid.pbm | cksum +echo "Test 1. Should print 748061765 465" +pamflip -cw maze.pbm | cksum + +echo "Test 2. Should print 3217647947 465" +pamflip -ccw maze.pbm | cksum + +echo "Test 2. Should print 1086015439 465" +pamflip -xy maze.pbm | cksum diff --git a/test/pamfunc.ok b/test/pamfunc.ok index 4a531577..d358355b 100644 --- a/test/pamfunc.ok +++ b/test/pamfunc.ok @@ -36,13 +36,13 @@ Test 4: Should print 1926073387 101484 eight times 1926073387 101484 1926073387 101484 1926073387 101484 -Test 5: Should print 2425386270 41 six times -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 +Test 5: Should print 281226646 481 six times +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 Test Invalid Expected failure 1 1 Expected failure 2 1 diff --git a/test/pamfunc.test b/test/pamfunc.test index e52584b4..fbb39164 100755 --- a/test/pamfunc.test +++ b/test/pamfunc.test @@ -73,16 +73,16 @@ pamfunc -shiftleft 0 testimg.ppm | cksum pamfunc -shiftright 0 testimg.ppm | cksum -echo "Test 5: Should print 2425386270 41 six times" +echo "Test 5: Should print 281226646 481 six times" -cat testgrid.pbm | cksum +cat maze.pbm | cksum -pamfunc -andmask 0x1 testgrid.pbm | cksum -pamfunc -ormask 0x0 testgrid.pbm | cksum -pamfunc -xormask 0x1 testgrid.pbm | pamfunc -xormask 0x1 | cksum +pamfunc -andmask 0x1 maze.pbm | cksum +pamfunc -ormask 0x0 maze.pbm | cksum +pamfunc -xormask 0x1 maze.pbm | pamfunc -xormask 0x1 | cksum -pamfunc -shiftleft 0 testgrid.pbm | cksum -pamfunc -shiftright 0 testgrid.pbm | cksum +pamfunc -shiftleft 0 maze.pbm | cksum +pamfunc -shiftright 0 maze.pbm | cksum echo "Invalid command-line argument combinations." 1>&2 echo "Error messages should appear below the line." 1>&2 diff --git a/test/pamgauss.test b/test/pamgauss.test index 7952c7df..87e172a8 100755 --- a/test/pamgauss.test +++ b/test/pamgauss.test @@ -30,24 +30,24 @@ test_out=${tmpdir}/test_out pamgauss 3 3 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamgauss 3 3 -sigma=0 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamgauss 3 3 -sigma=-1.5 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamgauss 3 -sigma=0.5 > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamgauss 3 3 3 -sigma=0.5 > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pamhue.test b/test/pamhue.test index 47688175..622fdf2f 100755 --- a/test/pamhue.test +++ b/test/pamhue.test @@ -16,11 +16,11 @@ pamseq -tupletype=RGB 3 1 | pamdepth 255 | pamhue -huechange=60 | \ echo "Test 3" # pamhue has no effect on monotone images -# Should print 2425386270 41 twice +# Should print 281226646 481 twice -pamhue -huechange=45 testgrid.pbm | cmp -s - testgrid.pbm +pamhue -huechange=45 maze.pbm | cmp -s - maze.pbm echo ${PIPESTATUS[@]} ":" $? -pamhue -huechange=180 testgrid.pbm | cmp -s - testgrid.pbm +pamhue -huechange=180 maze.pbm | cmp -s - maze.pbm echo ${PIPESTATUS[@]} ":" $? echo "Test 4" @@ -45,4 +45,4 @@ echo "-----------------------------------------------------------" 1>&2 pamhue testimg.ppm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pamscale-reportonly.test b/test/pamscale-reportonly.test index 9aacab56..a5d2cdcc 100755 --- a/test/pamscale-reportonly.test +++ b/test/pamscale-reportonly.test @@ -33,34 +33,34 @@ pamscale -reportonly -xsize=640 -ysize=400 -xscale=2 testimg.ppm > \ ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamscale -reportonly -xsize=640 -xscale=2 -yscale=3 testimg.ppm > \ ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -pixels=200000 testimg.ppm \ > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -xysize 640 400 testimg.ppm \ > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -xyfit 640 400 testimg.ppm \ > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -xyfill 640 400 testimg.ppm \ > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pamseq.test b/test/pamseq.test index 9c089cf3..a98a6545 100755 --- a/test/pamseq.test +++ b/test/pamseq.test @@ -19,17 +19,17 @@ test_out=${tmpdir}/test_out pamseq 1 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamseq 0 255 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamseq 3 0 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} c64="0123456789012345678901234567890123456789012345678901234567890123" c256=${c64}${c64}${c64}${c64} @@ -39,4 +39,4 @@ c256=${c64}${c64}${c64}${c64} pamseq -tupletype="${c256}" 3 15 > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pamslice-roundtrip.ok b/test/pamslice-roundtrip.ok index eae64745..50e83b2a 100644 --- a/test/pamslice-roundtrip.ok +++ b/test/pamslice-roundtrip.ok @@ -1,4 +1,9 @@ -2425386270 41 -914327477 4864 -914327477 4864 -914327477 4864 +Test 1. Should print 139976034 137 twice +139976034 137 +139976034 137 +Test 2. Should print 1624460505 574 three times +1624460505 574 +1624460505 574 +1624460505 574 +Test 3. Should print 1624460505 574 +1624460505 574 diff --git a/test/pamslice-roundtrip.test b/test/pamslice-roundtrip.test index 6cb5533f..d1a8a72c 100755 --- a/test/pamslice-roundtrip.test +++ b/test/pamslice-roundtrip.test @@ -1,75 +1,77 @@ #! /bin/bash # This script tests: pamslice pamdeinterlace -# Also requires: pamcut pamtopnm pamflip +# Also requires: pamfile pamcut pamtopnm pamflip - -# Test 1. -# Slice rows, one by one, out of testgrid.pbm. +echo "Test 1. Should print 139976034 137 twice" +# Slice rows, one by one, out of maze.pbm. # Add header and reconstruct pbm image. # Note that in pamslice output 0 is white and 1 is black: opposite of PBM -# Should print 2425386270 41 + +mwidth=$(pamfile -size maze.pbm | cut -d" " -f1) +height=16 + +pamcut -top=0 -left=0 -height=${height} maze.pbm | cksum (echo "P1" - echo "14 16" - seq 0 15 | while read i; + echo "${mwidth} ${height}" + for ((i = 0; i < ${height}; ++i)) do - pamslice -row=$i testgrid.pbm - done | awk '{print $2}' | sed 'y/01/10/' ) \ + pamslice -row=$i maze.pbm + done | cut -d" " -f2- | sed 'y/01/10/' ) \ | pamtopnm | cksum -# Test 2. + +echo "Test 2. Should print 1624460505 574 three times" # Slice rows, one by one, out of ppm test image # We take a part out of testimg.ppm with pamcut for processing the # whole image takes much time. # Add header and reconstruct ppm image. -# Should print 914327477 4864 -tmpdir=${tmpdir:-/tmp} -test4933_ppm=${tmpdir}/test4933.ppm +tmpdir=${tmpdir:-/tmp} +test1711_ppm=${tmpdir}/test1711.ppm -pamcut 50 50 49 33 testimg.ppm > ${test4933_ppm} +pamcut -left=50 -top=50 -width=17 -height=11 testimg.ppm | \ + tee ${test1711_ppm} | cksum (echo "P3" - echo "49 33" + echo "17 11" echo "255" - seq 0 32 | while read i; + for ((i = 0; i < 11; ++i)) do - pamslice -row=$i ${test4933_ppm} - done | awk '{print $2, $3, $4}' ) \ + pamslice -row=$i ${test1711_ppm} + done | cut -d" " -f2- ) \ | pamtopnm | cksum # Same as above test 2, but take cols instead of rows. # Should print 914327477 4864 (echo "P3" - echo "33 49" + echo "11 17" echo "255" - seq 0 48 | while read i; + for ((i = 0; i < 17; ++i)) do - pamslice -col=$i ${test4933_ppm} - done | awk '{print $2, $3, $4}' ) \ - | pamflip -xy | cksum + pamslice -col=$i ${test1711_ppm} + done | cut -d " " -f2- ) | pamflip -xy | cksum -# Test 4. +echo "Test 3. Should print 1624460505 574" # Divide input image into two with pamdeinterlace and recombine. testeven_ppm=${tmpdir}/testeven.ppm testodd_ppm=${tmpdir}/testodd.ppm -pamdeinterlace -takeodd ${test4933_ppm} > ${testodd_ppm} -pamdeinterlace -takeeven ${test4933_ppm} > ${testeven_ppm} +pamdeinterlace -takeodd ${test1711_ppm} > ${testodd_ppm} +pamdeinterlace -takeeven ${test1711_ppm} > ${testeven_ppm} -(echo "P3" - echo "49 33" - echo "255" - ( seq 0 15 | while read i; - do - pamslice -row=$i ${testeven_ppm} - pamslice -row=$i ${testodd_ppm} - done - pamslice -row=16 ${testeven_ppm}; - ) | awk '{print $2, $3, $4}' ) \ - | pamtopnm | cksum +( echo "P3" + echo "17 11" + echo "255" + ( for ((i = 0; i < 5; ++i)) + do + pamslice -row=$i ${testeven_ppm} + pamslice -row=$i ${testodd_ppm} + done + pamslice -row=5 ${testeven_ppm}; + ) | cut -d" " -f2- ) | pamtopnm | cksum -rm ${test4933_ppm} ${testodd_ppm} ${testeven_ppm} +rm ${test1711_ppm} ${testodd_ppm} ${testeven_ppm} diff --git a/test/pamstretch.test b/test/pamstretch.test index 55dd4e9c..8cbc555a 100755 --- a/test/pamstretch.test +++ b/test/pamstretch.test @@ -13,6 +13,7 @@ pamstretch -xscale=2 -blackedge testimg.ppm | cksum # Test 3. Should print 3427416462 301047 echo test 3 +tmpdir=${tmpdir:-/tmp} dropedge1_ppm=${tmpdir}/drop1.ppm pamstretch -yscale=3 -dropedge testimg.ppm | tee ${dropedge1_ppm} | cksum @@ -39,10 +40,10 @@ blackedge_ppm=${tmpdir}/black.ppm pamstretch 3 testimg.ppm | tee ${stretch_ppm} | cksum pamstretch 3 -blackedge testimg.ppm | tee ${blackedge_ppm} | cksum pamstretch -xscale=3 -dropedge ${dropedge1_ppm} | tee ${dropedge_ppm} | cksum -width_height=`pamfile -size ${dropedge_ppm} | \ - awk '{print "-width="$1, "-height="$2}'` +width_height=$(pamfile -size ${dropedge_ppm} | \ + awk '{print "-width="$1, "-height="$2}') pamcut -left=0 -top=0 ${width_height} ${stretch_ppm} | cksum pamcut -left=0 -top=0 ${width_height} ${blackedge_ppm} | cksum pamcut -left=0 -top=0 ${width_height} ${dropedge_ppm} | cksum -rm ${stretch_ppm} ${dropedge_ppm} ${dropedge1_ppm} ${blackedge_ppm} \ No newline at end of file +rm ${stretch_ppm} ${dropedge_ppm} ${dropedge1_ppm} ${blackedge_ppm} diff --git a/test/pamsumm.ok b/test/pamsumm.ok index 63b5f6bd..b9ce0269 100644 --- a/test/pamsumm.ok +++ b/test/pamsumm.ok @@ -1,9 +1,14 @@ -Test 1 +Test 1. Should print in order: 56, 0, 1, 0.250000 56 0 1 0.250000 -Test 2 +Test 2. Should print in order: 1627, 0, 1, 0.483794 +1627 +0 +1 +0.483794 +Test 3. Should print in order: 10772432, 15, 255, 106.164760 10772432 15 255 diff --git a/test/pamsumm.test b/test/pamsumm.test index 3d008533..32a9b8c1 100755 --- a/test/pamsumm.test +++ b/test/pamsumm.test @@ -2,14 +2,21 @@ # This script tests: pamsumm # Also requires: -echo "Test 1" +echo "Test 1. Should print in order: 56, 0, 1, 0.250000" for type in -sum -min -max -mean do pamsumm -brief $type testgrid.pbm done -echo "Test 2" +echo "Test 2. Should print in order: 1627, 0, 1, 0.483794" + +for type in -sum -min -max -mean + do + pamsumm -brief $type maze.pbm + done + +echo "Test 3. Should print in order: 10772432, 15, 255, 106.164760" for type in -sum -min -max -mean do @@ -30,19 +37,19 @@ echo "-----------------------------------------------------------" 1>&2 pamsumm -sum -min testimg.ppm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamsumm -sum -max testimg.ppm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamsumm -mean -max testimg.ppm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pamsumm testimg.ppm > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pamtopam.ok b/test/pamtopam.ok index dcb597d3..d84b2b6c 100644 --- a/test/pamtopam.ok +++ b/test/pamtopam.ok @@ -1,3 +1,18 @@ +Test 1. Should print five PAM headers +P7 +WIDTH 14 +HEIGHT 16 +DEPTH 1 +MAXVAL 1 +TUPLTYPE BLACKANDWHITE +ENDHDR +P7 +WIDTH 1 +HEIGHT 1 +DEPTH 1 +MAXVAL 255 +TUPLTYPE GRAYSCALE +ENDHDR P7 WIDTH 227 HEIGHT 149 @@ -6,11 +21,26 @@ MAXVAL 255 TUPLTYPE RGB ENDHDR P7 -WIDTH 14 -HEIGHT 16 -DEPTH 1 +WIDTH 64 +HEIGHT 1 +DEPTH 2 +MAXVAL 7 +TUPLTYPE GRAYSCALE_ALPHA +ENDHDR +P7 +WIDTH 16 +HEIGHT 1 +DEPTH 4 MAXVAL 1 -TUPLTYPE BLACKANDWHITE +TUPLTYPE RGB_ALPHA ENDHDR -1873848880 101532 +Test 2. Should print 2260748250 293 2260748250 293 +Test 3. Should print 1873848880 101532 +1873848880 101532 +Test 4. Should print 1475247910 3432 twice +1475247910 3432 +1475247910 3432 +Test 5. Should print 2347274358 101825 twice +2347274358 101825 +2347274358 101825 diff --git a/test/pamtopam.test b/test/pamtopam.test index 394d9904..e9b4f93d 100755 --- a/test/pamtopam.test +++ b/test/pamtopam.test @@ -1,10 +1,25 @@ #! /bin/bash # This script tests: pamtopam -# Also requires: +# Also requires: pgmmake pamseq +echo "Test 1. Should print five PAM headers" -pamtopam < testimg.ppm | sed '/ENDHDR/q' pamtopam < testgrid.pbm | sed '/ENDHDR/q' +pgmmake 0.5 1 1 | pamtopam | sed '/ENDHDR/q' +pamtopam < testimg.ppm | sed '/ENDHDR/q' +pamseq -tupletype="GRAYSCALE_ALPHA" 2 7 | pamtopam | sed '/ENDHDR/q' +pamseq -tupletype="RGB_ALPHA" 4 1 | pamtopam | sed '/ENDHDR/q' -pamtopam < testimg.ppm | cksum +echo "Test 2. Should print 2260748250 293" pamtopam < testgrid.pbm | cksum + +echo "Test 3. Should print 1873848880 101532" +pamtopam < testimg.ppm | cksum + +echo "Test 4. Should print 1475247910 3432 twice" +pamtopam < maze.pbm | cksum +pamtopam < maze.pbm | pamtopam | cksum + +echo "Test 5. Should print 2347274358 101825 twice" +cat testgrid.pbm testimg.ppm | pamtopam | cksum +( pamtopam < testgrid.pbm; pamtopam < testimg.ppm ) | cksum diff --git a/test/pamtopdbimg.test b/test/pamtopdbimg.test index 9afee8f1..d6c105bf 100755 --- a/test/pamtopdbimg.test +++ b/test/pamtopdbimg.test @@ -82,13 +82,13 @@ awk 'BEGIN { ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; head -c 65533 ${text65597} > ${text65533} head -c 65534 ${text65597} > ${text65534} -pamtopdbimg -uncompressed testgrid.pbm | \ +pamtopdbimg -uncompressed maze.pbm | \ wc -c | tr -d ' ' echo ${PIPESTATUS[0]} -pamtopdbimg -uncompressed -notefile=${text65533} testgrid.pbm | \ +pamtopdbimg -uncompressed -notefile=${text65533} maze.pbm | \ wc -c | tr -d ' ' echo ${PIPESTATUS[0]} -pamtopdbimg -uncompressed -notefile=${text65534} testgrid.pbm | \ +pamtopdbimg -uncompressed -notefile=${text65534} maze.pbm | \ wc -c | tr -d ' ' echo ${PIPESTATUS[0]} diff --git a/test/pamundice.ok b/test/pamundice.ok index ef0f6e13..1234431d 100644 --- a/test/pamundice.ok +++ b/test/pamundice.ok @@ -1,17 +1,17 @@ -Test 1. +Test 1. Should print 2096818803 2818 twice 2096818803 2818 2096818803 2818 -Test 2. +Test 2. Should print 2096818803 2818 twice 2096818803 2818 2096818803 2818 -Test 3. +Test 3. Should print 2096818803 2818 twice 2096818803 2818 2096818803 2818 -Test 4. -557392151 459 -557392151 459 -557392151 459 -557392151 459 +Test 4. Should print 2434390296 4436 four times +2434390296 4436 +2434390296 4436 +2434390296 4436 +2434390296 4436 Test Invalid Expected failure 1 1 Expected failure 2 1 diff --git a/test/pamundice.test b/test/pamundice.test index 5c1f9c6b..1e3dd31b 100755 --- a/test/pamundice.test +++ b/test/pamundice.test @@ -1,12 +1,11 @@ #! /bin/bash # This script tests: pamundice -# Also requires: pgmmake pnmtile pnmcat pnmpad +# Also requires: pamfile pgmmake pnmtile pnmcat tmpdir=${tmpdir:-/tmp} fname_stem=${tmpdir}/part -# Test 1. -echo "Test 1." +echo "Test 1. Should print 2096818803 2818 twice" for ((x=0; x<3; ++x)) do for ((y=0; y<5; ++y)) @@ -20,9 +19,7 @@ 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." +echo "Test 2. Should print 2096818803 2818 twice" tempfile=${tmpdir}/temp @@ -46,8 +43,7 @@ rm ${tempfile}_[012] rm ${fname_stem}_?_?.pgm -# Test 3. -echo "Test 3." +echo "Test 3. Should print 2096818803 2818 twice" for ((x=0; x<2; ++x)) do for ((y=0; y<5; ++y)) @@ -89,21 +85,22 @@ rm ${fname_stem}_?_?.pgm # Test 4. -echo "Test 4." +echo "Test 4. Should print 2434390296 4436 four times" -# Add margins to testgrid.pbm +msize=$(pamfile -size maze.pbm) +mw=$(echo ${msize} | cut -d" " -f1) +mh=$(echo ${msize} | cut -d" " -f2) -testimg_pbm=${tmpdir}/testimg.pbm -pnmpad -top=2 -left=3 -black testgrid.pbm > ${testimg_pbm} +pnmtile $((${mw} * 2)) $((${mh} * 5)) maze.pbm | cksum for x in `seq 0 1` do for y in `seq 0 4` - do cp ${testimg_pbm} ${fname_stem}_${y}_${x}.pbm; done + do cp maze.pbm ${fname_stem}_${y}_${x}.pbm; done done for (( i=0 ; i<=9; ++i)) do - echo ${testimg_pbm} + echo maze.pbm done | pamundice -down=5 -across=2 -listfile=- | cksum pamundice -down=5 -across=2 ${fname_stem}_"%1d"_"%1a".pbm | cksum @@ -111,11 +108,8 @@ 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 +pamundice -down=5 -across=2 maze.pbm | cksum -rm ${testimg_pbm} # Test Invalid. echo "Test Invalid" @@ -131,76 +125,76 @@ echo "-----------------------------------------------------------" 1>&2 pamundice -down=5 -across=2 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # -down=0 pamundice -down=0 -across=2 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # -across=0 pamundice -down=5 -across=0 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # -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 " "$? - rm -f {test_out} + rm -f ${test_out} # -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 " "$? - rm -f {test_out} + rm -f ${test_out} # 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 " "$? - rm -f {test_out} + rm -f ${test_out} # 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 " "$? - rm -f {test_out} + rm -f ${test_out} # no precision pamundice -down=5 -across=2 ${fname_stem}_"%d"_"%a".pbm > ${test_out} || \ echo -n "Expected failure 8" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # -hoverlap too large -pamundice -down=5 -across=2 -hoverlap=18 \ +pamundice -down=5 -across=2 -hoverlap=$((${mw}+1)) \ ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ echo -n "Expected failure 9" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # -voverlap too large -pamundice -down=5 -across=2 -voverlap=19 \ +pamundice -down=5 -across=2 -voverlap=$((${mh}+1)) \ ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ echo -n "Expected failure 10" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # 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 " "$? - rm -f {test_out} + 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} || \ echo -n "Expected failure 12" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} rm ${fname_stem}*.pbm diff --git a/test/pbm-ppm-roundtrip.ok b/test/pbm-ppm-roundtrip.ok new file mode 100644 index 00000000..91c502b5 --- /dev/null +++ b/test/pbm-ppm-roundtrip.ok @@ -0,0 +1,39 @@ +Test 1. Should print 281226646 481 five times. +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +Test 2. Should print three all-white, then three all-black PBM images +P1 +7 3 +0000000 +0000000 +0000000 + +P1 +7 3 +0000000 +0000000 +0000000 + +P1 +7 3 +0000000 +0000000 +0000000 + +P1 +17 2 +11111111111111111 +11111111111111111 + +P1 +17 2 +11111111111111111 +11111111111111111 + +P1 +17 2 +11111111111111111 +11111111111111111 diff --git a/test/pbm-ppm-roundtrip.test b/test/pbm-ppm-roundtrip.test new file mode 100755 index 00000000..23b6c1c4 --- /dev/null +++ b/test/pbm-ppm-roundtrip.test @@ -0,0 +1,34 @@ +#! /bin/bash +# This script tests: pgmtoppm ppmtopgm ppmtoppm pgmtopbm +# Also requires: pbmmake ppmcolormask pnminvert + +echo "Test 1. Should print 281226646 481 five times." + +cat maze.pbm | cksum +pgmtoppm black-white maze.pbm | ppmtopgm | \ + pgmtopbm -th -val=0.5 | cksum +pgmtoppm white-black maze.pbm | ppmtopgm | \ + pgmtopbm -th -val=0.5 | pnminvert | cksum +pgmtoppm white-black maze.pbm | ppmcolormask white | cksum +ppmtoppm < maze.pbm | ppmtopgm | pgmtopbm -th -val=0.5 | cksum + +echo "Test 2. Should print three all-white, then three all-black PBM images" + +pbmmake -w 7 3 -plain +echo + +pbmmake -w 7 3 | pgmtoppm black-white | ppmtopgm | \ + pgmtopbm -th -val=0.5 -plain +echo +pbmmake -w 7 3 | ppmtoppm | ppmtopgm | \ + pgmtopbm -th -val=0.5 -plain +echo + +pbmmake -b 17 2 -plain +echo + +pbmmake -b 17 2 | pgmtoppm black-white | ppmtopgm | \ + pgmtopbm -th -val=0.5 -plain +echo +pbmmake -b 17 2 | ppmtoppm | ppmtopgm | \ + pgmtopbm -th -val=0.5 -plain diff --git a/test/pbmclean.test b/test/pbmclean.test index 3fb24b25..0e17ba8a 100755 --- a/test/pbmclean.test +++ b/test/pbmclean.test @@ -48,6 +48,6 @@ echo "-----------------------------------------------------------" 1>&2 pbmclean -black -white -min=1 -extended testgrid.pbm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # note that without -extended the above is valid. diff --git a/test/pbmmake.test b/test/pbmmake.test index 9945394a..eef4e0da 100755 --- a/test/pbmmake.test +++ b/test/pbmmake.test @@ -34,39 +34,39 @@ test_out=${tmpdir}/test_out pbmmake -b -w -plain 1 1 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmmake -b -g -plain 1 1 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmmake -white -gray -plain 1 1 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmmake -white -plain > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmmake -white -plain 1 > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmmake -white -plain 1 0 > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmmake -white -plain 0 1 > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmmake -white -plain 1 1 1 > ${test_out} || \ echo -n "Expected failure 8" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pbmminkowski.ok b/test/pbmminkowski.ok index 71a909ce..9780e3c2 100644 --- a/test/pbmminkowski.ok +++ b/test/pbmminkowski.ok @@ -21,3 +21,11 @@ vertices: 224 area: 56 perimeter: 224 eulerchi: 56 + + tiles: 1627 + x-edges: 2479 + y-edges: 2427 +vertices: 3376 + area: 1627 +perimeter: 3304 + eulerchi: 97 diff --git a/test/pbmminkowski.test b/test/pbmminkowski.test index 389ff44a..3ad96dfa 100755 --- a/test/pbmminkowski.test +++ b/test/pbmminkowski.test @@ -1,11 +1,12 @@ #! /bin/bash # This script tests: pbmminkowski -# Also requires: pbmmake pnmmargin pnmpad +# Also requires: pbmmake pnmpad - -pbmmake -w 1 1 | pnmmargin -b 1 | \ +pbmmake -w 1 1 | pnmpad -black -top=1 -left=1 -bottom=1 -right=1 | \ pbmminkowski echo pbmmake -g 3 3 | pbmminkowski echo pbmminkowski testgrid.pbm +echo +pbmminkowski maze.pbm \ No newline at end of file diff --git a/test/pbmnoise-parameters.ok b/test/pbmnoise-parameters.ok new file mode 100644 index 00000000..c2a61c37 --- /dev/null +++ b/test/pbmnoise-parameters.ok @@ -0,0 +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 diff --git a/test/pbmnoise-parameters.test b/test/pbmnoise-parameters.test new file mode 100755 index 00000000..f3348ae8 --- /dev/null +++ b/test/pbmnoise-parameters.test @@ -0,0 +1,143 @@ +#! /bin/bash +# This script tests: pbmnoise +# Also requires: + +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +echo "Test Invalid" + +test_out=${tmpdir}/test_out + +# Invalid -ratio arguments + +pbmnoise -ratio 100 100 > ${test_out} || \ + echo -n "Expected failure 1" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio 0 1 100 > ${test_out} || \ + echo -n "Expected failure 2" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=1.1 100 100 > ${test_out} || \ + echo -n "Expected failure 3" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=-1 100 100 > ${test_out} || \ + echo -n "Expected failure 4" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=half 100 100 > ${test_out} || \ + echo -n "Expected failure 5" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=0/1/1 100 100 > ${test_out} || \ + echo -n "Expected failure 6" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=-1/2 100 100 > ${test_out} || \ + echo -n "Expected failure 7" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=1/0 100 100 > ${test_out} || \ + echo -n "Expected failure 8" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=/2 100 100 > ${test_out} || \ + echo -n "Expected failure 9" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=4/2 100 100 > ${test_out} || \ + echo -n "Expected failure 10" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=6/ 100 100 > ${test_out} || \ + echo -n "Expected failure 11" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=1.0/2.0 100 100 > ${test_out} || \ + echo -n "Expected failure 12" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +# denominator must be power of 2 +pbmnoise -ratio=3/9 100 100 > ${test_out} || \ + echo -n "Expected failure 13" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=a/2 100 100 > ${test_out} || \ + echo -n "Expected failure 14" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + + +pbmnoise -ratio=2/a 100 100 > ${test_out} || \ + echo -n "Expected failure 15" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=1/-2 100 100 > ${test_out} || \ + echo -n "Expected failure 16" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +# Denominator must be 65536 or less +pbmnoise -ratio=1/65537 100 100 > ${test_out} || \ + echo -n "Expected failure 17" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -ratio=1/131072 100 100 > ${test_out} || \ + echo -n "Expected failure 17" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -endian=large 100 100 > ${test_out} || \ + echo -n "Expected failure 18" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -randomseed 100 100 > ${test_out} || \ + echo -n "Expected failure 19" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -randomseed=-1 100 100 > ${test_out} || \ + echo -n "Expected failure 20" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise -randomseed=0.1 100 100 > ${test_out} || \ + echo -n "Expected failure 21" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise > ${test_out} || \ + echo -n "Expected failure 22" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise 100 > ${test_out} || \ + echo -n "Expected failure 23" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmnoise 100 200 300 > ${test_out} || \ + echo -n "Expected failure 24" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + + diff --git a/test/pbmnoise1.ok b/test/pbmnoise1.ok new file mode 100644 index 00000000..84f1f04e --- /dev/null +++ b/test/pbmnoise1.ok @@ -0,0 +1,50 @@ +Test 1. Should print 242292858 962 five times +242292858 962 +242292858 962 +242292858 962 +242292858 962 +242292858 962 +Test 2. +P1 32 1 00000000000000000000000000000000 +P1 32 1 00010000000001000000000000000000 +P1 32 1 00010000000001000010000000000000 +P1 32 1 00010000000001000000000000000000 +P1 32 1 00010000000001000010010000000000 +P1 32 1 01010001000101000000000000000000 +P1 32 1 00010000000001000010100000000000 +P1 32 1 01010001000111000000000000100010 +P1 32 1 10011001000001100010010000000000 +P1 32 1 01010001000111000000010100100010 +P1 32 1 01011001000101000010100000000000 +P1 32 1 01010001000111000001010100100110 +P1 32 1 00010000000001000111110000000100 +P1 32 1 01010001010111001001010100100110 +P1 32 1 01011011000111000010101000101010 +P1 32 1 01010001011111011001010100110110 +P1 32 1 10011001001001110010011000101110 +P1 32 1 01010001011111011011010101110110 +P1 32 1 01011011000111000010111110101010 +P1 32 1 01010001011111011011110101110110 +P1 32 1 11011001010101101111110000000100 +P1 32 1 01011001011111011011110101110110 +P1 32 1 01011011000111000111111110101110 +P1 32 1 01011011011111011011111101111110 +P1 32 1 10111111101011110111111000111111 +P1 32 1 01011011011111011011111111111110 +P1 32 1 11011011010111101111111110101110 +P1 32 1 01011011011111011111111111111110 +P1 32 1 11111111111111111111111000111111 +P1 32 1 11011011011111111111111111111110 +P1 32 1 11111111111111111111111110111111 +P1 32 1 11111111111111111111111111111111 +P1 32 1 11111111111111111111111111111111 +Test 3. Should print 126142586 1218 four times +126142586 1218 +126142586 1218 +126142586 1218 +126142586 1218 +Test 4. +P1 64 1 1000010001101101101000100101001110101011010010011111001011100110 +P1 64 1 1000010001101101101000100101001110101011010010011111001011100110 +P1 64 1 0101001110100010011011011000010011100110111100100100100110101011 +P1 64 1 0101001110100010011011011000010011100110111100100100100110101011 diff --git a/test/pbmnoise1.test b/test/pbmnoise1.test new file mode 100755 index 00000000..1b8fc241 --- /dev/null +++ b/test/pbmnoise1.test @@ -0,0 +1,36 @@ +#! /bin/bash +# This script tests: pbmnoise +# + +# Assumes that the random number generator is Mersenne Twister + +echo "Test 1. Should print 242292858 962 five times" + +for arg in "" "-ratio=1/2" "-ratio=256/512" "-ratio=32768/65536" "-pack" + do + pbmnoise -endian=big -randomseed=1 1088 7 ${arg} | cksum +done + +echo "Test 2." + +for ((i=0 ; i<=32; i++)) + do + pbmnoise -endian=little -randomseed=11 -ratio=$i/32 -plain 32 1 | \ + tr '\n' ' '; echo +done + +echo "Test 3. Should print 126142586 1218 four times" + +pbmnoise -endian=big -pack -randomseed=12 -plain 19 64 | sed 2d | tr -d '\n' | cksum +pbmnoise -endian=big -pack -randomseed=12 -plain 152 8 | sed 2d | tr -d '\n' | cksum +pbmnoise -endian=big -pack -randomseed=12 -plain 64 19 | sed 2d | tr -d '\n' | cksum +pbmnoise -endian=big -randomseed=12 -plain 64 19 | sed 2d | tr -d '\n' | cksum + +echo "Test 4." + + pbmnoise -endian=big -randomseed=23 64 1 -plain | tr '\n' ' '; echo +( pbmnoise -endian=native -randomseed=23 64 1 -plain | tr '\n' ' '; echo + pbmnoise -endian=swap -randomseed=23 64 1 -plain | tr '\n' ' '; echo +) | sort -nr + pbmnoise -endian=little -randomseed=23 64 1 -plain | tr '\n' ' '; echo + diff --git a/test/pbmnoise2.ok b/test/pbmnoise2.ok new file mode 100644 index 00000000..5c3959e0 --- /dev/null +++ b/test/pbmnoise2.ok @@ -0,0 +1,19 @@ +Test 1. Should print OK 1, then OK 2 three times +OK 1 +OK 2 +OK 2 +OK 2 +Test 2. Should print OK 1, then OK 2 three times +OK 1 +OK 2 +OK 2 +OK 2 +Test 3-black. Should print 255 384 100% 100% four times + 255 384 100% 100% + 255 384 100% 100% + 255 384 100% 100% + 255 384 100% 100% +Test 3-white. Should print 0 320 100% 100% three times + 0 320 100% 100% + 0 320 100% 100% + 0 320 100% 100% diff --git a/test/pbmnoise2.test b/test/pbmnoise2.test new file mode 100755 index 00000000..7476d03c --- /dev/null +++ b/test/pbmnoise2.test @@ -0,0 +1,85 @@ +#! /bin/bash +# This script tests: pbmnoise +# Also requires: pgmhist + +# Expected value and variance of binominal distribution: +# Pb: probability of getting a black pixel (=ratio) +# Pw: probability of getting a white pixel (= 1 - Pb = 1 - ratio) +# +# E(width, height, Pb, Pw) = width * height * Pb +# V(width, height, Pb, Pw) = width * height * Pb * Pw +# +# When width * height is large and Pb is not too near edges +# approximate with normal distribution + +echo "Test 1. Should print OK 1, then OK 2 three times" + +args1="-endian=big -randomseed=1" + +( pbmnoise ${args1} 320 200 | pgmhist + pbmnoise -ratio=1/2 ${args1} 160 400 | pgmhist + pbmnoise -ratio=2/4 ${args1} 64000 1 | pgmhist + pbmnoise -pack ${args1} 10 6400 | pgmhist ) | \ + awk 'BEGIN { pixels=64000; Pb=Pw=0.5; + average=pixels*Pb; + sd=sqrt(pixels*Pb*Pw); # standard deviation + sl=1.96 # significance level + limit1 = average - sd * sl; + limit2 = average + sd * sl + count=-1 # initial value + } + $1!=0 { next } + { v=1 } # initial value + limit1 < $2 && $2 < limit2 { v=0 } + v==0 {print "OK", (count==prev)+1} + v==1 {print "NG" $0} + {prev=count}' + + + +echo "Test 2. Should print OK 1, then OK 2 three times" + +args2="-endian=big -randomseed=2" + +( pbmnoise -ratio=11/32 ${args1} 32 119 | pgmhist + pbmnoise -ratio=11/32 ${args1} 224 17 | pgmhist + pbmnoise -ratio=22/64 ${args1} 3808 1 | pgmhist + pbmnoise -ratio=44/128 -pack ${args1} 1904 2 | pgmhist ) | \ + awk 'BEGIN {pixels=32*119; Pb=11/32; Pw=1-Pb; + average=pixels*Pb; + sd=sqrt(pixels*Pb*Pw); # standard deviation + sl=1.96 # significance level + limit1 = average - sd * sl; + limit2 = average + sd * sl + count=-1 # initial value + } + $1!=0 { next } + { v=1 } # initial value + limit1 < $2 && $2 < limit2 { v=0 } + v==0 {print "OK", (count==prev)+1} + v==1 {print "NG" $0} + {prev=count}' + + + + +echo "Test 3-black. Should print 255 384 100% 100% four times" + +pbmnoise -ratio=0/1 -randomseed=1 128 3 | pgmhist | \ + awk '$1==0 || $1==255' +pbmnoise -ratio=0/1024 -randomseed=1 64 6 | pgmhist | \ + awk '$1==0 || $1==255' +pbmnoise -ratio=0/8192 -randomseed=1 32 12 | pgmhist | \ + awk '$1==0 || $1==255' +pbmnoise -ratio=0/65536 -randomseed=1 -pack 1 384 | pgmhist | \ + awk '$1==0 || $1==255' + +echo "Test 3-white. Should print 0 320 100% 100% three times" + +pbmnoise -ratio=1/1 -randomseed=1 64 5 | pgmhist | \ + awk '$1==0 || $1==255' +pbmnoise -ratio=8/8 -randomseed=1 32 10 | pgmhist | \ + awk '$1==0 || $1==255' +pbmnoise -ratio=65536/65536 -randomseed=1 -pack 2 160 | pgmhist | \ + awk '$1==0 || $1==255' + diff --git a/test/pbmpage.test b/test/pbmpage.test index cfacefa7..2ee27122 100755 --- a/test/pbmpage.test +++ b/test/pbmpage.test @@ -22,14 +22,14 @@ test_out=${tmpdir}/test_out pbmpage -a3 1 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmpage 0 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmpage 4 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pbmpscale.ok b/test/pbmpscale.ok index c26ffef3..9ea594d8 100644 --- a/test/pbmpscale.ok +++ b/test/pbmpscale.ok @@ -1,53 +1,178 @@ +Test 1. Should print "abc" rendered in PBM plain format P1 -21 45 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -111111111111111111110 -111111111111111111111 -111111111111111111111 -001111100000000001111 -000111000000000000111 -000111000000000000111 -000111000000000000000 -000111000000000000000 -000111000000000000000 -000111000000000111000 -000111000000000111000 -000111100000001111000 -000111111111111111000 -000111111111111111000 -000111111111111111000 -000111100000001111000 -000111000000000111000 -000111000000000111000 -000111000000000000000 -000111000000000000000 -000111000000000000000 -000111000000000000000 -000111000000000000000 -001111100000000000000 -111111111111000000000 -111111111111000000000 -111111111111000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -000000000000000000000 -2150868536 457 -3761734242 1065 -3462719777 1803 +17 15 +00000000000000000 +00000000000000000 +00000000000000000 +00000011000000000 +00000001000000000 +00000001000000000 +00110001110000110 +01001001001001001 +00111001001001000 +01001001001001000 +01001001001001001 +00110101110000110 +00000000000000000 +00000000000000000 +00000000000000000 +Test 2. "ABC" in PBM plain format +P1 +48 30 +000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 +000000001100000000111111111110000000000111100011 +000000001100000000111111111111100000011111110011 +000000001100000000011110000111100000011110011111 +000000011110000000001100000011110000111100001111 +000000010010000000001100000000110000111000000111 +000000110011000000001100000000110001110000000011 +000000110011000000001100000011110001100000000000 +000001100001100000001110000111100011000000000000 +000001000000100000001111111111000011000000000000 +000011000000110000001111111111000011000000000000 +000011111111110000001110000001100011000000000000 +000011111111110000001100000000110001100000000000 +000011100001110000001100000000110001110000000011 +000111000000111000001100000001110000111000000111 +001100000000001100001100000011110000111100001111 +011100000000001110011110000111100000011110011110 +111111000000111111111111111111100000011111111110 +111111000000111111111111111110000000000111111000 +000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000 +Test 3. "D.!" in PBM plain format +P1 +42 45 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +111111111111111110000000000000000000000111 +111111111111111111000000000000000000000111 +111111111111111111100000000000000000000111 +001111100000001111110000000000000000000111 +000111000000000111111000000000000000000111 +000111000000000111111000000000000000000111 +000111000000000001111000000000000000000111 +000111000000000000111000000000000000000111 +000111000000000000111100000000000000000111 +000111000000000000001110000000000000000111 +000111000000000000000111000000000000000111 +000111000000000000000111000000000000000111 +000111000000000000000111000000000000000111 +000111000000000000000111000000000000000111 +000111000000000000000111000000000000000111 +000111000000000000000111000000000000000111 +000111000000000000000111000000000000000111 +000111000000000000001110000000000000000111 +000111000000000000111100000000000000000111 +000111000000000000111000000000000000000111 +000111000000000001111000000000000000000111 +000111000000000111111000000000000000000000 +000111000000000111111000000000000000000000 +001111100000001111110000000000000000000000 +111111111111111111100000000000111000000111 +111111111111111111000000000000111000000111 +111111111111111110000000000000111000000111 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000 +Test 3. "E,?" in PBM plain format +P1 +60 60 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +011111111111111111111111110000000000000000000000011111100000 +111111111111111111111111111000000000000000000000111111110000 +111111111111111111111111111100000000000000000001111111111000 +011111111111111111111111111100000000000000000011111111111100 +001111111100000000000011111100000000000000000111110000111110 +000111111000000000000001111100000000000000001111100000011111 +000011110000000000000000111100000000000000001111000000001111 +000011110000000000000000011000000000000000000110000000001111 +000011110000000000000000000000000000000000000000000000001111 +000011110000000000000000000000000000000000000000000000001111 +000011110000000000000000000000000000000000000000000000011111 +000011110000000000000000000000000000000000000000000000111110 +000011110000000000000110000000000000000000000000000001111100 +000011110000000000001111000000000000000000000000000011111000 +000011111000000000011111000000000000000000000000000111110000 +000011111100000000111111000000000000000000000000001111100000 +000011111111111111111111000000000000000000000000011111000000 +000011111111111111111111000000000000000000000000111110000000 +000011111111111111111111000000000000000000000000111100000000 +000011111111111111111111000000000000000000000000111100000000 +000011111100000000111111000000000000000000000000111100000000 +000011111000000000011111000000000000000000000000111100000000 +000011110000000000001111000000000000000000000000111100000000 +000011110000000000000110000000000000000000000000111100000000 +000011110000000000000000000000000000000000000000111100000000 +000011110000000000000000000000000000000000000000111100000000 +000011110000000000000000000000000000000000000000111100000000 +000011110000000000000000000000000000000000000000011000000000 +000011110000000000000000011000000000000000000000000000000000 +000011110000000000000000111100000000000000000000000000000000 +000111111000000000000001111100000000000000000000000000000000 +001111111100000000000011111100000000000000000000000000000000 +011111111111111111111111111100000000011000000000011000000000 +111111111111111111111111111100000000111100000000111100000000 +111111111111111111111111111000000000111100000000111100000000 +011111111111111111111111110000000000111100000000011000000000 +000000000000000000000000000000000000111100000000000000000000 +000000000000000000000000000000000000111100000000000000000000 +000000000000000000000000000000000001111100000000000000000000 +000000000000000000000000000000000011111000000000000000000000 +000000000000000000000000000000000111110000000000000000000000 +000000000000000000000000000000001111100000000000000000000000 +000000000000000000000000000000001111000000000000000000000000 +000000000000000000000000000000000110000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000 +Test 5. Should print 576003211 10631 +576003211 10631 +Test 6. Should print 3501321825 369 +3501321825 369 +Test 7. Should print 1588181271 535 +1588181271 535 +Test 8. Should print 2843090781 610 +2843090781 610 +Test 9. Should print 146160766 820 +146160766 820 +Test 10. Should print 3327221668 2111 +3327221668 2111 +Test Invalid Expected failure 1 1 Expected failure 2 1 Expected failure 3 1 diff --git a/test/pbmpscale.test b/test/pbmpscale.test index 21ad6cd1..a92511b0 100755 --- a/test/pbmpscale.test +++ b/test/pbmpscale.test @@ -1,18 +1,35 @@ #! /bin/bash # This script tests: pbmpscale -# Also requires: pamenlarge pbmtext - - -pbmtext -nomargin "F" | pbmpscale 3 -plain - -for i in 2 3 4 -do -pamenlarge 2 testgrid.pbm | \ - pbmpscale $i | cksum -done - +# Also requires: pbmtext + +echo "Test 1. Should print \"abc\" rendered in PBM plain format" +pbmtext -nomargin "abc" | pbmpscale 1 -plain +echo "Test 2. \"ABC\" in PBM plain format" +pbmtext -nomargin "ABC" | pbmpscale 2 -plain +echo "Test 3. \"D.!\" in PBM plain format" +pbmtext -nomargin "D.!" | pbmpscale 3 -plain +echo "Test 3. \"E,?\" in PBM plain format" +pbmtext -nomargin "E,?" | pbmpscale 4 -plain + +echo "Test 5. Should print 576003211 10631" +pbmpscale 5 maze.pbm | cksum + +echo "Test 6. Should print 3501321825 369" +pbmtext -nomargin "6" | pbmpscale 6 | cksum +echo "Test 7. Should print 1588181271 535" +pbmtext -nomargin "7" | pbmpscale 7 | cksum +echo "Test 8. Should print 2843090781 610" +pbmtext -nomargin "8" | pbmpscale 8 | cksum +echo "Test 9. Should print 146160766 820" +pbmtext -nomargin "9" | pbmpscale 9 | cksum +echo "Test 10. Should print 3327221668 2111" +pbmtext -nomargin "10" | pbmpscale 10 | cksum + +tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out +echo "Test Invalid" + echo 1>&2 echo "Invalid command-line argument combinations." 1>&2 echo "Error messages should appear below the line." 1>&2 @@ -21,14 +38,14 @@ echo "-----------------------------------------------------------" 1>&2 pbmpscale testgrid.pbm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmpscale 0 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmpscale 2 3 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pbmtext-bdf.test b/test/pbmtext-bdf.test index b12c10bf..d3d4b37f 100755 --- a/test/pbmtext-bdf.test +++ b/test/pbmtext-bdf.test @@ -173,3 +173,5 @@ do echo $? rm ${font_corrupt_bdf} done + +rm ${font_bdf} \ No newline at end of file diff --git a/test/pbmtog3.ok b/test/pbmtog3.ok index cef9e3f9..6660206b 100644 --- a/test/pbmtog3.ok +++ b/test/pbmtog3.ok @@ -1,10 +1,20 @@ -3697098186 144 -1248301383 122 -686713716 144 -215463240 122 +Test 1. Should print 2156383714 1106 +2156383714 1106 +Test 2. Should print 162371073 1049 +162371073 1049 +Test 3. Should print 750267045 1106 +750267045 1106 +Test 4. Should print 1140269483 1049 +1140269483 1049 +Test 5. Should print 28792587 47 28792587 47 +Test 6. Should print 277456854 32 277456854 32 +Test 7. Should print 28792587 47 28792587 47 +Test 8. Should print 3736247115 62 3736247115 62 +Test 9. Should print 2820255307 2191856 2820255307 2191856 +Test 10. Should print 4159089282 2226575 4159089282 2226575 diff --git a/test/pbmtog3.test b/test/pbmtog3.test index c5dc3357..c23e8af0 100755 --- a/test/pbmtog3.test +++ b/test/pbmtog3.test @@ -2,24 +2,33 @@ # This script tests: pbmtog3 # Also requires: pbmmake -# Test 1. Should print 3697098186 144 -pbmtog3 testgrid.pbm | cksum -# Test 2. Should print 1248301383 122 -pbmtog3 -nofixedwidth testgrid.pbm | cksum -# Test 3. Should print 686713716 144 -pbmtog3 -reverse testgrid.pbm | cksum -# Test 4. Should print 215463240 122 -pbmtog3 -nofixedwidth -reverse testgrid.pbm | cksum -# Test 5. Should print 28792587 47 +echo "Test 1. Should print 2156383714 1106" +pbmtog3 maze.pbm | cksum + +echo "Test 2. Should print 162371073 1049" +pbmtog3 -nofixedwidth maze.pbm | cksum + +echo "Test 3. Should print 750267045 1106" +pbmtog3 -reverse maze.pbm | cksum + +echo "Test 4. Should print 1140269483 1049" +pbmtog3 -nofixedwidth -reverse maze.pbm | cksum + +echo "Test 5. Should print 28792587 47" pbmmake -w 10 10 | pbmtog3 | cksum -# Test 6. Should print 277456854 32 + +echo "Test 6. Should print 277456854 32" pbmmake -w 10 10 | \ pbmtog3 -nofixedwidth | cksum -# Test 7. Should print 28792587 47 + +echo "Test 7. Should print 28792587 47" pbmmake -w 10000 10 | pbmtog3 | cksum -# Test 8. Should print 3736247115 62 + +echo "Test 8. Should print 3736247115 62" pbmmake -b 10 10 | pbmtog3 | cksum -# Test 9. Should print 2820255307 2191856 + +echo "Test 9. Should print 2820255307 2191856" pbmmake -g 1700 2286 | pbmtog3 | cksum -# Test 10. Should print 4159089282 2226575 + +echo "Test 10. Should print 4159089282 2226575" pbmmake -g 1800 2286 | pbmtog3 | cksum diff --git a/test/pbmtopgm.test b/test/pbmtopgm.test index dc872640..53b25aab 100755 --- a/test/pbmtopgm.test +++ b/test/pbmtopgm.test @@ -20,19 +20,19 @@ echo "-----------------------------------------------------------" 1>&2 pbmtopgm 5 0 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmtopgm 0 9 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmtopgm 15 5 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmtopgm 5 17 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pbmupc.test b/test/pbmupc.test index a29a06f3..f4a4d1e8 100755 --- a/test/pbmupc.test +++ b/test/pbmupc.test @@ -22,44 +22,44 @@ echo "-----------------------------------------------------------" 1>&2 pbmupc -s3 0 72890 00011 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmupc -s1 72890 00011 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmupc -s1 0 72890 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmupc -s1 10 72890 00011 > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmupc -s1 0 172890 00011 > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmupc -s1 0 2890 00011 > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmupc -s1 0 72890 100011 > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmupc -s1 0 72890 0011 > ${test_out} || \ echo -n "Expected failure 8" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pbmupc -s1 0 72890 100011 1 > ${test_out} || \ echo -n "Expected failure 9" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pgmhist.test b/test/pgmhist.test index 0179a4f6..b028b07a 100755 --- a/test/pgmhist.test +++ b/test/pgmhist.test @@ -37,19 +37,19 @@ echo "-----------------------------------------------------------" 1>&2 pgmhist -median -quartile testgrid.pbm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmhist -median -decile testgrid.pbm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmhist -quartile -decile testgrid.pbm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmhist testimg.ppm > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pgmmake.test b/test/pgmmake.test index bd9882a5..0ec5efd6 100755 --- a/test/pgmmake.test +++ b/test/pgmmake.test @@ -21,39 +21,39 @@ test_out=${tmpdir}/test_out pgmmake 100 5 5 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmmake 1.01 5 5 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmmake .5 5 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmmake .5 > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmmake -maxval=5 5 5 > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmmake -maxval=0 .5 5 5 > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmmake -maxval=-1 .5 5 5 > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmmake -maxval=65536 .5 5 5 > ${test_out} || \ echo -n "Expected failure 8" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pgmminkowski.test b/test/pgmminkowski.test index 52e02e19..9d8c257d 100755 --- a/test/pgmminkowski.test +++ b/test/pgmminkowski.test @@ -1,8 +1,8 @@ #! /bin/bash # This script tests: pgmminkowski -# Also requires: pbmmake pgmmake pnmmargin pnmpad +# Also requires: pbmmake pgmmake pnmpad -pgmmake .5 1 1 | pnmmargin -b 1 | \ +pgmmake .5 1 1 | pnmpad -black -top=1 -left=1 -bottom=1 -right=1 | \ pgmminkowski echo pbmmake -g 3 3 | pgmminkowski diff --git a/test/pgmnoise-parameters.test b/test/pgmnoise-parameters.test index d2a96530..bf3deb3f 100755 --- a/test/pgmnoise-parameters.test +++ b/test/pgmnoise-parameters.test @@ -13,24 +13,24 @@ echo "-----------------------------------------------------------" 1>&2 pgmnoise -maxval=255 -randomseed=1 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise 100 -randomseed=1 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise 100 0 -randomseed=1 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise 0 100 -randomseed=1 > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise 100 100 100 -randomseed=1 > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pgmnoise.test b/test/pgmnoise.test index ab98a5e2..4a6e21dd 100755 --- a/test/pgmnoise.test +++ b/test/pgmnoise.test @@ -1,6 +1,6 @@ #! /bin/bash # This script tests: pgmnoise -# Also requires: pgmhist pamvalidate +# Also requires: pgmhist pamvalidate pamfile echo "Test 1." echo "Should print: 2132901423 10015" # (Mersenne Twister) @@ -70,49 +70,49 @@ echo "-----------------------------------------------------------" 1>&2 pgmnoise 0 0 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise 0 1 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise 1 0 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise 1 > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise 100 -1 > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise -randomseed=-1 100 100 > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise -maxval=-1 100 100 > ${test_out} || \ echo -n "Expected failure 8" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise -maxval=0 100 100 > ${test_out} || \ echo -n "Expected failure 9" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pgmnoise -maxval=$((256 * 256 * 256 * 256)) 10 10 > ${test_out} || \ echo -n "Expected failure 10" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pgmtoppm.ok b/test/pgmtoppm.ok index 55e5af95..2484c487 100644 --- a/test/pgmtoppm.ok +++ b/test/pgmtoppm.ok @@ -1,3 +1,39 @@ +Test 1. Should print 1767073524 779 twice, then 1676700883 779 +1767073524 779 1767073524 779 1676700883 779 +Test 2. Should print 718580145 779 twice +718580145 779 +718580145 779 +Test 3. Should print 718580145 779 twice +718580145 779 718580145 779 +Test 4. Should print 829921912 685 seven times +829921912 685 +829921912 685 +829921912 685 +829921912 685 +829921912 685 +829921912 685 +829921912 685 +Test 5. Should print 934505096 685 four times +934505096 685 +934505096 685 +934505096 685 +934505096 685 +Test 6. Should print 3083028153 685 three times +3083028153 685 +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 diff --git a/test/pgmtoppm.test b/test/pgmtoppm.test index 70df0d97..622a0688 100755 --- a/test/pgmtoppm.test +++ b/test/pgmtoppm.test @@ -1,22 +1,139 @@ #! /bin/bash # This script tests: pgmtoppm -# Also requires: pamseq pamtopnm pgmramp - +# Also requires: pamtopnm pnminvert pamseq pgmramp tmpdir=${tmpdir:-/tmp} +echo "Test 1. Should print 1767073524 779 twice, then 1676700883 779" + test_pgm=${tmpdir}/test.pgm -palette=${tmpdir}/palette +palette_pam=${tmpdir}/palette.pam +palette_ppm=${tmpdir}/palette.ppm -pgmramp -maxval=5 -lr 256 1 >${test_pgm} -pamseq 3 5 -tupletype=RGB | pamtopnm \ - >${palette} +pgmramp -maxval=5 -lr 256 1 > ${test_pgm} -# Test 1. pgmtoppm green ${test_pgm} | cksum - +pgmtoppm black-green ${test_pgm} | cksum pgmtoppm yellow-blue ${test_pgm} | cksum -pgmtoppm -map=${palette} ${test_pgm} | cksum -rm ${test_pgm} ${palette} +echo "Test 2. Should print 718580145 779 twice" +pamseq 3 5 -tupletype=RGB | tee ${palette_pam} | pamtopnm > ${palette_ppm} +pgmtoppm -map=${palette_pam} ${test_pgm} | cksum +pgmtoppm -map=${palette_ppm} ${test_pgm} | cksum + +rm ${palette_pam} + +echo "Test 3. Should print 718580145 779 twice" + +pgmtoppm white-black ${test_pgm} | pnminvert | cksum +pnminvert ${test_pgm} | pgmtoppm white-black | cksum + +rm ${test_pgm} + +echo "Test 4. Should print 829921912 685 seven times" + +pgmtoppm white testgrid.pbm | cksum +pgmtoppm black-white testgrid.pbm | cksum +pgmtoppm rgb:ff/ff/ff testgrid.pbm | cksum +pgmtoppm -white=rgb-255:255/255/255 testgrid.pbm | cksum +pgmtoppm rgb:00/00/00-rgb:ff/ff/ff testgrid.pbm | cksum +pgmtoppm rgbi:0/0/0-rgbi:1/1/1 testgrid.pbm | cksum +pgmtoppm -black=rgb-255:0/0/0 -white=rgb-255:255/255/255 testgrid.pbm | cksum + +echo "Test 5. Should print 934505096 685 four times" + +pgmtoppm white-black testgrid.pbm | cksum +pgmtoppm white testgrid.pbm | pnminvert| cksum +pnminvert testgrid.pbm | pgmtoppm black-white | cksum +pnminvert testgrid.pbm | pgmtoppm white | cksum + +echo "Test 6. Should print 3083028153 685 three times" + +pgmtoppm black testgrid.pbm | cksum +pgmtoppm black-black testgrid.pbm | cksum +pgmtoppm rgbi:0/0/0-rgbi:0/0/0 testgrid.pbm | cksum + +echo "Test 7 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 + +pgmtoppm white testimg.ppm > \ + ${test_out} || \ + echo -n "Expected failure 1" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pgmtoppm -map=/dev/null testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 2" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pgmtoppm black white testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 3" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pgmtoppm hwite testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 4" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pgmtoppm off-color testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 5" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pgmtoppm rgb-255:7/7/7 testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 6" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pgmtoppm -black=black -white=white white testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 7" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pgmtoppm -black=rgb:0/0/0 -map=${palette_ppm} testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 8" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pgmtoppm -white=rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 9" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pgmtoppm rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 10" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pgmtoppm rgb:00/00/00-rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 11" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +#pgmtoppm rgb-255:7/7/7 testgrid.pbm > \ +# ${test_out} || \ +# echo -n "Expected failure 12" +# test -s ${test_out}; echo " "$? +# rm -f ${test_out} + +rm -f ${palette_ppm} diff --git a/test/pi3-roundtrip.ok b/test/pi3-roundtrip.ok index 3fde31b1..c4351b83 100644 --- a/test/pi3-roundtrip.ok +++ b/test/pi3-roundtrip.ok @@ -1,2 +1,5 @@ +Test 1. Should print: 3139449799 32011 twice 3139449799 32011 -2425386270 41 +3139449799 32011 +Test 2. Should print: 281226646 481, cksum of maze.pbm +281226646 481 diff --git a/test/pi3-roundtrip.test b/test/pi3-roundtrip.test index 5700337d..6c75acc7 100755 --- a/test/pi3-roundtrip.test +++ b/test/pi3-roundtrip.test @@ -1,16 +1,15 @@ #! /bin/bash # This script tests: pbmtopi3 pi3topbm -# Also requires: pbmmake pamcut - +# Also requires: pbmmake pamcut pamfile # The pi3 image format specifies a fixed image size of 640x400. # Pbmtopi3 rejects images that do not conform. -# Test -# Should print: 3139449799 32011 +echo "Test 1. Should print: 3139449799 32011 twice" +pbmmake -g 640 400 | cksum pbmmake -g 640 400 | pbmtopi3 | pi3topbm | cksum -# Test 2. -# Should print: 2425386270 41 -pamcut -pad 0 0 640 400 testgrid.pbm | \ - pbmtopi3 | pi3topbm | pamcut 0 0 14 16 | cksum +echo "Test 2. Should print: 281226646 481, cksum of maze.pbm" +size=$(pamfile -size maze.pbm | awk '{print "-width="$1,"-height="$2}') +pamcut -pad -left=0 -top=0 -width=640 -height=400 maze.pbm | \ + pbmtopi3 | pi3topbm | pamcut -left=0 -top=0 ${size} | cksum diff --git a/test/pj-roundtrip.test b/test/pj-roundtrip.test index 2b0d61e5..3ed30927 100755 --- a/test/pj-roundtrip.test +++ b/test/pj-roundtrip.test @@ -19,8 +19,8 @@ echo "Test 2. Should print: 0 0 : 0" testout_ppm=${tmpdir}/testout.ppm -ppmtopj testgrid.pbm | pjtoppm > ${testout_ppm} - ppmtoppm < testgrid.pbm | cmp -s - ${testout_ppm} > /dev/null +ppmtopj maze.pbm | pjtoppm > ${testout_ppm} + ppmtoppm < maze.pbm | cmp -s - ${testout_ppm} > /dev/null echo ${PIPESTATUS[@]} ":" $? rm ${testout_ppm} diff --git a/test/png-roundtrip.ok b/test/png-roundtrip.ok index 28b8c057..ec0a1937 100644 --- a/test/png-roundtrip.ok +++ b/test/png-roundtrip.ok @@ -16,21 +16,21 @@ 1926073387 101484 1926073387 101484 1926073387 101484 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 diff --git a/test/png-roundtrip.test b/test/png-roundtrip.test index 7e7c4a9b..fcb5927a 100755 --- a/test/png-roundtrip.test +++ b/test/png-roundtrip.test @@ -28,7 +28,7 @@ for flags in "" -interlace \ pnmtopng testimg.ppm $flags | pngtopam | cksum done -# Test 2. Should print 2425386270 41 18 times +# Test 2. Should print 281226646 481 18 times for flags in "" -interlace \ -gamma=.45 \ -hist \ @@ -47,5 +47,5 @@ for flags in "" -interlace \ -comp_strategy=filtered \ -force do - pnmtopng testgrid.pbm $flags | pngtopam | cksum + pnmtopng maze.pbm $flags | pngtopam | cksum done diff --git a/test/png-roundtrip2.ok b/test/png-roundtrip2.ok index 0e712ce7..764cadfa 100644 --- a/test/png-roundtrip2.ok +++ b/test/png-roundtrip2.ok @@ -1,4 +1,4 @@ 1926073387 101484 1926073387 101484 -2425386270 41 -2425386270 41 +281226646 481 +281226646 481 diff --git a/test/png-roundtrip2.test b/test/png-roundtrip2.test index af2ad029..5705a1ae 100755 --- a/test/png-roundtrip2.test +++ b/test/png-roundtrip2.test @@ -15,8 +15,8 @@ for flags in "" -gamma=.45 pamtopng testimg.ppm $flags | pngtopam | cksum done -# Test 2. Should print 2425386270 41 twice +# Test 2. Should print 281226646 481 twice for flags in "" -gamma=.45 do - pamtopng testgrid.pbm $flags | pngtopam | cksum + pamtopng maze.pbm $flags | pngtopam | cksum done diff --git a/test/pnm-pam-roundtrip.ok b/test/pnm-pam-roundtrip.ok index 67f7a1fe..ace97410 100644 --- a/test/pnm-pam-roundtrip.ok +++ b/test/pnm-pam-roundtrip.ok @@ -1,2 +1,2 @@ 1926073387 101484 -2425386270 41 +281226646 481 diff --git a/test/pnm-pam-roundtrip.test b/test/pnm-pam-roundtrip.test index b8e60c88..13925f74 100755 --- a/test/pnm-pam-roundtrip.test +++ b/test/pnm-pam-roundtrip.test @@ -4,4 +4,4 @@ pamtopam < testimg.ppm | pamtopnm | cksum -pamtopam < testgrid.pbm | pamtopnm | cksum +pamtopam < maze.pbm | pamtopnm | cksum diff --git a/test/pnm-plain-roundtrip.ok b/test/pnm-plain-roundtrip.ok index 67f7a1fe..ace97410 100644 --- a/test/pnm-plain-roundtrip.ok +++ b/test/pnm-plain-roundtrip.ok @@ -1,2 +1,2 @@ 1926073387 101484 -2425386270 41 +281226646 481 diff --git a/test/pnm-plain-roundtrip.test b/test/pnm-plain-roundtrip.test index 3779d761..bf685e85 100755 --- a/test/pnm-plain-roundtrip.test +++ b/test/pnm-plain-roundtrip.test @@ -5,5 +5,5 @@ pamtopnm -plain testimg.ppm | \ pamtopnm | cksum -pamtopnm -plain testgrid.pbm | \ +pamtopnm -plain maze.pbm | \ pamtopnm | cksum diff --git a/test/pnmcat.ok b/test/pnmcat.ok index b92a1420..57769353 100644 --- a/test/pnmcat.ok +++ b/test/pnmcat.ok @@ -1,8 +1,82 @@ -Test 1. -1704087873 73 -4150323653 73 -1522490272 202953 -2862441566 202953 +Test 1. Should print a simple PBM image four times +P1 +2 2 +01 +10 +P1 +2 2 +01 +10 +P1 +2 2 +01 +10 +P1 +2 2 +01 +10 +Test 2. Should print 2197356643 895 twice +2197356643 895 +2197356643 895 +Test 3. Should print 3313353797 954 +3313353797 954 +Test 4. Should print 1731660895 1308 three times +1731660895 1308 +1731660895 1308 +1731660895 1308 +Test 5. Should print 2985957591 1426 three times +2985957591 1426 +2985957591 1426 +2985957591 1426 +Test 6. Should print a simple PGM image three times +P2 +4 4 +3 +0 0 1 1 +0 1 1 2 +1 1 2 2 +1 2 2 3 +P2 +4 4 +3 +0 0 1 1 +0 1 1 2 +1 1 2 2 +1 2 2 3 +P2 +4 4 +3 +0 0 1 1 +0 1 1 2 +1 1 2 2 +1 2 2 3 +Test 7. Should print 2097565808 394 twice +2097565808 394 +2097565808 394 +Test 8. Should print 3086569577 394 +3086569577 394 +Test 9. Should print 4288335051 586 three times +4288335051 586 +4288335051 586 +4288335051 586 +Test 10. Should print 642720605 586 three times +642720605 586 +642720605 586 +642720605 586 +Test 11. Should print 3622741282 1019 twice +3622741282 1019 +3622741282 1019 +Test 12. Should print 1401081637 1019 +1401081637 1019 +Test 13. Should print 2756501917 1019 +2756501917 1019 +Test 14. Should print 587933655 107742 twice +587933655 107742 +587933655 107742 +Test 15. Should print 3948141157 107742 +3948141157 107742 +Test 16. Should print 3910239002 107742 +3910239002 107742 Test Invalid Expected failure 1 1 Expected failure 2 1 diff --git a/test/pnmcat.test b/test/pnmcat.test index 519e01c7..c098d967 100755 --- a/test/pnmcat.test +++ b/test/pnmcat.test @@ -1,18 +1,91 @@ #! /bin/bash # This script tests: pnmcat -# Also requires: +# Also requires: pbmmake pgmramp ppmtoppm -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 +tmpdir=${tmpdir:-/tmp} +check2x2_pbm=${tmpdir}/check2x2.pbm +maze2lr_pbm=${tmpdir}/maze2lr.pbm +maze2tb_pbm=${tmpdir}/maze2tb.pbm +diag_pgm=${tmpdir}/diag.pgm +diag_ppm=${tmpdir}/diag.ppm +diag2lr_ppm=${tmpdir}/diag2lr.ppm +diag2tb_ppm=${tmpdir}/diag2tb.ppm + +echo "Test 1. Should print a simple PBM image four times" +pbmmake -g 2 2 | tee ${check2x2_pbm} | pnmcat -lr -plain +pnmcat -tb -plain ${check2x2_pbm} +pnmcat -lr -black -plain ${check2x2_pbm} +cat ${check2x2_pbm} | pnmcat -tb -white -plain + +rm ${check2x2_pbm} + +echo "Test 2. Should print 2197356643 895 twice" +pnmcat -lr -white maze.pbm maze.pbm | tee ${maze2lr_pbm} | cksum +cat maze.pbm | pnmcat -lr -black maze.pbm - | cksum + +echo "Test 3. Should print 3313353797 954" +pnmcat -tb maze.pbm maze.pbm | tee ${maze2tb_pbm} | cksum + +echo "Test 4. Should print 1731660895 1308 three times" +pnmcat -lr maze.pbm maze.pbm maze.pbm | cksum +pnmcat -lr ${maze2lr_pbm} maze.pbm | cksum +cat ${maze2lr_pbm} | pnmcat -lr - maze.pbm | cksum + +echo "Test 5. Should print 2985957591 1426 three times" +pnmcat -tb maze.pbm maze.pbm maze.pbm | cksum +pnmcat -tb maze.pbm ${maze2tb_pbm} | cksum +cat maze.pbm | pnmcat -tb - ${maze2tb_pbm} | cksum + +rm ${maze2lr_pbm} ${maze2tb_pbm} + +echo "Test 6. Should print a simple PGM image three times" +pgmramp -diag 4 4 -maxval=3 | tee ${diag_pgm} | pnmcat -lr -plain +pnmcat -tb -plain ${diag_pgm} +cat ${diag_pgm} | pnmcat -tb -plain + +rm ${diag_pgm} + +pgmramp -diag 8 8 -maxval 7 | ppmtoppm > ${diag_ppm} + +echo "Test 7. Should print 2097565808 394 twice" +pnmcat -lr -black ${diag_ppm} ${diag_ppm} | tee ${diag2lr_ppm} | cksum +cat ${diag_ppm} | pnmcat -lr -white ${diag_ppm} - | cksum + +echo "Test 8. Should print 3086569577 394" +pnmcat -tb ${diag_ppm} ${diag_ppm} | tee ${diag2tb_ppm} | cksum + +echo "Test 9. Should print 4288335051 586 three times" +pnmcat -lr ${diag_ppm} ${diag_ppm} ${diag_ppm} | cksum +pnmcat -lr ${diag_ppm} ${diag2lr_ppm} | cksum +cat ${diag2lr_ppm} | pnmcat -lr - ${diag_ppm} | cksum + +echo "Test 10. Should print 642720605 586 three times" +pnmcat -tb ${diag_ppm} ${diag_ppm} ${diag_ppm} | cksum +pnmcat -tb ${diag2tb_ppm} ${diag_ppm} | cksum +cat ${diag_ppm} | pnmcat -tb ${diag2tb_ppm} - | cksum + +rm ${diag2lr_ppm} ${diag2tb_ppm} + +echo "Test 11. Should print 3622741282 1019 twice" +pnmcat -tb -white testgrid.pbm ${diag_ppm} | cksum +pnmcat -tb -jcenter -white testgrid.pbm ${diag_ppm} | cksum +echo "Test 12. Should print 1401081637 1019" +pnmcat -tb -jleft -white testgrid.pbm ${diag_ppm} | cksum +echo "Test 13. Should print 2756501917 1019" +pnmcat -tb -jright -white testgrid.pbm ${diag_ppm} | cksum + +echo "Test 14. Should print 587933655 107742 twice" +pnmcat -lr -black testgrid.pbm testimg.ppm | cksum +pnmcat -lr -jcenter -black testgrid.pbm testimg.ppm | cksum +echo "Test 15. Should print 3948141157 107742" +pnmcat -lr -jtop -black testgrid.pbm testimg.ppm | cksum +echo "Test 16. Should print 3910239002 107742" +pnmcat -lr -jbottom -black testgrid.pbm testimg.ppm | cksum + +rm ${diag_ppm} echo "Test Invalid" -tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out echo 1>&2 @@ -24,74 +97,74 @@ echo "-----------------------------------------------------------" 1>&2 pnmcat testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # both directions specified pnmcat -topbottom -leftright testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # both pad colors specified pnmcat -topbottom -white -black testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # justification parameters overspecified pnmcat -lr -jtop -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcat -lr -jtop -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcat -lr -jcenter -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcat -tb -jleft -jright testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcat -tb -jleft -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 8" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcat -tb -jcenter -jright testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 9" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # 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 " "$? - rm -f {test_out} + rm -f ${test_out} pnmcat -lr -jright testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 11" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcat -tb -jtop testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 12" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcat -tb -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ echo -n "Expected failure 13" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # 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} + rm -f ${test_out} diff --git a/test/pnmcolormap.test b/test/pnmcolormap.test index 9ac0ea9e..90d11f6d 100755 --- a/test/pnmcolormap.test +++ b/test/pnmcolormap.test @@ -2,9 +2,9 @@ # This script tests: pnmcolormap # Also requires: -pnmcolormap -plain -sort 2 testgrid.pbm -pnmcolormap -plain -sort -square 2 testgrid.pbm -pnmcolormap -plain -sort all testgrid.pbm +pnmcolormap -plain -sort 2 maze.pbm +pnmcolormap -plain -sort -square 2 maze.pbm +pnmcolormap -plain -sort all maze.pbm echo 1>&2 echo "Invalid command-line arguments." 1>&2 @@ -17,35 +17,35 @@ test_out=${tmpdir}/test_out pnmcolormap 0 testimg.ppm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcolormap -1 testimg.ppm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcolormap 0.1 testimg.ppm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcolormap -center -meancolor 16 testimg.ppm > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcolormap -center -meanpixel 16 testimg.ppm > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcolormap -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmcolormap -spreadbrightness -spreadluminosity 16 \ testimg.ppm > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pnminvert-roundtrip.ok b/test/pnminvert-roundtrip.ok index 67f7a1fe..ace97410 100644 --- a/test/pnminvert-roundtrip.ok +++ b/test/pnminvert-roundtrip.ok @@ -1,2 +1,2 @@ 1926073387 101484 -2425386270 41 +281226646 481 diff --git a/test/pnminvert-roundtrip.test b/test/pnminvert-roundtrip.test index 52d15039..ddc5dc5d 100755 --- a/test/pnminvert-roundtrip.test +++ b/test/pnminvert-roundtrip.test @@ -4,4 +4,4 @@ pnminvert testimg.ppm | pnminvert | cksum -pnminvert testgrid.pbm | pnminvert | cksum +pnminvert maze.pbm | pnminvert | cksum diff --git a/test/pnminvert.ok b/test/pnminvert.ok index 6cf5f011..d35b30b9 100644 --- a/test/pnminvert.ok +++ b/test/pnminvert.ok @@ -1,7 +1,12 @@ -1240379484 41 +Test 1. Should print 1739442872 481 +1739442872 481 +Test 2. Should print 1416115901 101484 1416115901 101484 +Test 3. Should print 1174803406 33838 1174803406 33838 +Test 4. Should print 2595564405 14 three times 2595564405 14 2595564405 14 2595564405 14 +Test 7. Should print 2896726098 15 2896726098 15 diff --git a/test/pnminvert.test b/test/pnminvert.test index b80716ef..68a4e066 100755 --- a/test/pnminvert.test +++ b/test/pnminvert.test @@ -2,25 +2,20 @@ # This script tests: pnminvert # Also requires: pbmmake pamchannel pamtopnm +echo "Test 1. Should print 1739442872 481" +pnminvert maze.pbm | cksum -# Test 1. Should print 1240379484 41 -pnminvert testgrid.pbm | cksum - -# Test 2. Should print 1416115901 101484 +echo "Test 2. Should print 1416115901 101484" pnminvert testimg.ppm | cksum -# Test 3. Should print 1174803406 33838 +echo "Test 3. Should print 1174803406 33838" pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ pnminvert | cksum -# Test 4. Should print 2595564405 14 +echo "Test 4. Should print 2595564405 14 three times" pbmmake -w 7 7 | pnminvert | cksum - -# Test 5. Should print 2595564405 14 pbmmake -b 7 7 | cksum - -# Test 6. Should print 2595564405 14 pbmmake -b 7 7 | pnminvert | pnminvert | cksum -# Test 7. Should print 2896726098 15 +echo "Test 7. Should print 2896726098 15" pbmmake -g 8 8 | pnminvert | cksum diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test index bdd67883..2de7fc95 100755 --- a/test/pnmpsnr.test +++ b/test/pnmpsnr.test @@ -38,21 +38,21 @@ echo "-----------------------------------------------------------" 1>&2 pnmpsnr ${b_pbm} ${w_pbm} ${b_pbm} > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmpsnr ${b_pbm} > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmpsnr ${b_pbm} ${w_pbm} -target1=100 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmpsnr -machine > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} rm ${b_pbm} ${w_pbm} diff --git a/test/pnmquant.test b/test/pnmquant.test index 07830a3a..24cee077 100755 --- a/test/pnmquant.test +++ b/test/pnmquant.test @@ -44,39 +44,39 @@ test_out=${tmpdir}/test_out pnmquant 0 testimg.ppm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmquant testimg.ppm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmquant 10.5 testimg.ppm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmquant -center -meancolor 16 testimg.ppm > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmquant -center -meanpixel 16 testimg.ppm > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmquant -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmquant -spreadbrightness -spreadluminosity 16 testimg.ppm > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmquant -randomseed 1 -norandom 10 testimg.ppm > ${test_out} || \ echo -n "Expected failure 8" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pnmremap1.test b/test/pnmremap1.test index c2b9a6a6..b1cdd6d9 100755 --- a/test/pnmremap1.test +++ b/test/pnmremap1.test @@ -35,30 +35,30 @@ test_out=${tmpdir}/test_out pnmremap -mapfile=/dev/null testimg.ppm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmremap -mapfile=/dev/zero testimg.ppm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmremap testimg.ppm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmremap -fs -nofs testimg.ppm > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmremap -mapfile=testgrid.pbm -missingcolor=rgb:00/ff/00 testimg.ppm \ > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmremap -mapfile=testgrid.pbm -firstisdefault testimg.ppm > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/pnmtile.test b/test/pnmtile.test index 80378432..b9597467 100755 --- a/test/pnmtile.test +++ b/test/pnmtile.test @@ -31,19 +31,19 @@ echo "-----------------------------------------------------------" 1>&2 pnmtile 100 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmtile 100 0 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmtile 0 100 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} pnmtile 100 100 100 testgrid.pbm > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/ppmbrighten.test b/test/ppmbrighten.test index 40fe08f6..29ec78fb 100755 --- a/test/ppmbrighten.test +++ b/test/ppmbrighten.test @@ -26,6 +26,7 @@ echo "-----------------------------------------------------------" 1>&2 echo "Test Error: Should print 1 four times" +tmpdir=${tmpdir:-/tmp} output_ppm=${tmpdir}/output.ppm pambrighten -v -120 testimg.ppm > ${output_ppm} @@ -36,3 +37,5 @@ pambrighten -s -120 testimg.ppm > ${output_ppm} echo $? test -s ${output_ppm} echo $? + +rm ${output_ppm} diff --git a/test/ppmchange-roundtrip.ok b/test/ppmchange-roundtrip.ok index a676a1f2..4fb7d428 100644 --- a/test/ppmchange-roundtrip.ok +++ b/test/ppmchange-roundtrip.ok @@ -1,2 +1,2 @@ -2425386270 41 -2425386270 41 +281226646 481 +281226646 481 diff --git a/test/ppmchange-roundtrip.test b/test/ppmchange-roundtrip.test index 78f5b548..c1a35078 100755 --- a/test/ppmchange-roundtrip.test +++ b/test/ppmchange-roundtrip.test @@ -3,10 +3,10 @@ # Also requires: pgmtopbm pnminvert ppmtopgm -ppmchange black white white black testgrid.pbm | \ +ppmchange black white white black maze.pbm | \ pnminvert | ppmtopgm | \ pgmtopbm -th -val=0.5 | cksum -ppmchange black white white black testgrid.pbm | \ +ppmchange black white white black maze.pbm | \ ppmchange black white white black | \ ppmtopgm | pgmtopbm -th -val=0.5 | cksum diff --git a/test/ppmforge-parameters.test b/test/ppmforge-parameters.test index 342b8242..efc846a8 100755 --- a/test/ppmforge-parameters.test +++ b/test/ppmforge-parameters.test @@ -32,34 +32,34 @@ echo "-----------------------------------------------------------" 1>&2 ppmforge -night -dimension=0 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmforge -dimension=10 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmforge -dimension=-1 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmforge -clouds -mesh=1.99 > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmforge -clouds -power=0 > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmforge -ice=-1 > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmforge -glaciers=-1 > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/ppmhist.test b/test/ppmhist.test index a89c95bb..b5812503 100755 --- a/test/ppmhist.test +++ b/test/ppmhist.test @@ -38,14 +38,14 @@ echo "-----------------------------------------------------------" 1>&2 ppmhist -hexcolor -float testimg.ppm > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmhist -hexcolor -map testimg.ppm > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmhist -float -map testimg.ppm > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/ppmmake.test b/test/ppmmake.test index 61f417ca..26b592f7 100755 --- a/test/ppmmake.test +++ b/test/ppmmake.test @@ -21,49 +21,49 @@ echo "-----------------------------------------------------------" 1>&2 ppmmake rgb:gg/00/00 2 2 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmmake rgb:ff/ff/00 2 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmmake rgbi:1.1/0/0 2 2 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmmake rgbi:1.0/.5 2 2 > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmmake rainbow 2 2 > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmmake 2 2 > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmmake blue -maxval=0 2 2 > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmmake blue -maxval=-1 2 2 > ${test_out} || \ echo -n "Expected failure 8" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmmake blue -maxval=65536 2 2 > ${test_out} || \ echo -n "Expected failure 9" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} RGBDEF=/dev/null ppmmake red 2 2 > ${test_out} || \ echo -n "Expected failure 10" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/ppmpat.ok b/test/ppmpat.ok index 4a9cebd9..f2b355a9 100644 --- a/test/ppmpat.ok +++ b/test/ppmpat.ok @@ -1,14 +1,22 @@ -Test 1 +Test 1. Should print: 4008533639 781 4008533639 781 -Test 2 +Test 2. Should print: 738714211 781 +738714211 781 +Test 3. Should print: 3805937800 9613 3805937800 9613 -Test 3 +Test 4. Should print: 1586690955 9613 +1586690955 9613 +Test 5. Should print: 2698433077 1549 2698433077 1549 -Test 4 +Test 6. Should print: 1526189097 1549 +1526189097 1549 +Test 7. Should print: 3705929501 781 3705929501 781 -Test 5 +Test 8. Should print: 1996587666 781 +1996587666 781 +Test 9. Should print: 3057513592 661 3057513592 661 -Test 6 +Test 10. Should print: 1861389287 661 1861389287 661 Test Invalid Expected failure 1 1 diff --git a/test/ppmpat.test b/test/ppmpat.test index 88fb9fdd..6e916944 100755 --- a/test/ppmpat.test +++ b/test/ppmpat.test @@ -2,31 +2,43 @@ # This script tests: ppmpat # 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 +echo "Test 1. Should print: 4008533639 781" +ppmpat -gingham2 \ + -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 +echo "Test 2. Should print: 738714211 781" +ppmpat -g2 -mesh \ + --color=rgb:32/0d/b7,rgb:31/58/a3 16 16 | 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 +echo "Test 3. Should print: 3805937800 9613" +ppmpat -gingham3 \ + -color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 64 50 | cksum -# Test 4. Should print: 3705929501 781 -echo "Test 4" +echo "Test 4. Should print: 1586690955 9613" +ppmpat -g3 -mesh \ + -color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 64 50 | cksum + +echo "Test 5. Should print: 2698433077 1549" +ppmpat -madras \ + --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 32 16 | cksum + +echo "Test 6. Should print: 1526189097 1549" +ppmpat -madras -mesh \ + --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 32 16 | cksum + +echo "Test 7. Should print: 3705929501 781" 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" +echo "Test 8. Should print: 1996587666 781" +ppmpat -tartan -mesh \ + --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 16 16 | cksum + +echo "Test 9. Should print: 3057513592 661" ppmpat -argyle1 --color=rgb:ff/ff/ff,rgb:ff/0/0 12 18 | cksum -# Test 6. Should print: 1861389287 661 -echo "Test 6" +echo "Test 10. Should print: 1861389287 661" ppmpat -argyle2 --color=rgb:00/00/00,rgb:ff/80/80,rgb:e0/e0/e0 12 18 | cksum -# Test 7. echo "Test Invalid" tmpdir=${tmpdir:-/tmp} @@ -40,47 +52,47 @@ echo "-----------------------------------------------------------" 1>&2 ppmpat -g2 -g3 10 10 > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -madras -tartan 10 10 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -poles -squig 10 10 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -camo -anticamo 10 10 > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -argyle1 -argyle2 10 10 > ${test_out} || \ echo -n "Expected failure 5" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat 10 10 > ${test_out} || \ echo -n "Expected failure 6" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -g2 10 > ${test_out} || \ echo -n "Expected failure 7" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -g2 10 10 10 > ${test_out} || \ echo -n "Expected failure 8" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -g2 10 > ${test_out} || \ echo -n "Expected failure 9" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} clist1="-color=rgb:00/00/00" clist2="-color=rgb:00/00/00,rgb:00/00/ff" @@ -91,87 +103,87 @@ clist4="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff,rgb:ff/ff/ff" ppmpat -gingham2 ${clist1} 10 10 > ${test_out} || \ echo -n "Expected failure 10" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -argyle1 ${clist1} 10 10 > ${test_out} || \ echo -n "Expected failure 11" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -gingham2 ${clist3} 10 10 > ${test_out} || \ echo -n "Expected failure 12" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -argyle1 ${clist3} 10 10 > ${test_out} || \ echo -n "Expected failure 13" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # These require exactly 3 colors ppmpat -gingham3 ${clist2} 10 10 > ${test_out} || \ echo -n "Expected failure 14" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -argyle2 ${clist2} 10 10 > ${test_out} || \ echo -n "Expected failure 15" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -madras ${clist2} 10 10 > ${test_out} || \ echo -n "Expected failure 16" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -tartan ${clist2} 10 10 > ${test_out} || \ echo -n "Expected failure 17" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -gingham3 ${clist4} 10 10 > ${test_out} || \ echo -n "Expected failure 18" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -argyle2 ${clist4} 10 10 > ${test_out} || \ echo -n "Expected failure 19" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -madras ${clist4} 10 10 > ${test_out} || \ echo -n "Expected failure 20" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -tartan ${clist4} 10 10 > ${test_out} || \ echo -n "Expected failure 21" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # These require at least 3 colors ppmpat -squig ${clist2} 10 10 > ${test_out} || \ echo -n "Expected failure 22" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -camo ${clist2} 10 10 > ${test_out} || \ echo -n "Expected failure 23" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -anticamo ${clist2} 10 10 > ${test_out} || \ echo -n "Expected failure 24" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} # The squig pattern has an aspect ratio restriction ppmpat -squig ${clist3} 10 250 > ${test_out} || \ echo -n "Expected failure 25" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmpat -squig ${clist3} 500 20 > ${test_out} || \ echo -n "Expected failure 26" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} diff --git a/test/ppmtoarbtxt-roundtrip.test b/test/ppmtoarbtxt-roundtrip.test index dff78250..7c64114e 100755 --- a/test/ppmtoarbtxt-roundtrip.test +++ b/test/ppmtoarbtxt-roundtrip.test @@ -30,5 +30,4 @@ ppmtoarbtxt ${bodyskl} -hd ${headskl} testimg.ppm | tee ${inv_ppm} | cat ${inv_ppm} | ppmtoarbtxt ${bodyskl} -hd ${headskl} | pamtopnm | cksum - -rm ${bodyskl} ${headskl} +rm ${inv_ppm} ${bodyskl} ${headskl} diff --git a/test/ppmtoppm.ok b/test/ppmtoppm.ok index 764a3464..2b4ad9f8 100644 --- a/test/ppmtoppm.ok +++ b/test/ppmtoppm.ok @@ -1 +1,23 @@ -829921912 685 +Test 1. Should print a simple 4 x 3 pattern +P3 +4 3 +255 +255 255 255 0 0 0 255 255 255 0 0 0 +0 0 0 255 255 255 0 0 0 255 255 255 +255 255 255 0 0 0 255 255 255 0 0 0 +Test 2. Should print a simple 6 x 8 pattern +P3 +6 8 +5 +0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 2 2 2 +0 0 0 0 0 0 1 1 1 1 1 1 2 2 2 2 2 2 +0 0 0 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 +1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 +1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 +2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4 +2 2 2 3 3 3 3 3 3 4 4 4 4 4 4 5 5 5 +Test 3. Should print 669206373 10102 +669206373 10102 +Test 4. Should print 1926073387 101484 +1926073387 101484 diff --git a/test/ppmtoppm.test b/test/ppmtoppm.test index 797c733d..411c17f6 100755 --- a/test/ppmtoppm.test +++ b/test/ppmtoppm.test @@ -1,6 +1,15 @@ #! /bin/bash # This script tests: ppmtoppm -# Also requires: +# Also requires: pbmmake pgmramp +echo "Test 1. Should print a simple 4 x 3 pattern" +pbmmake -g 4 3 | ppmtoppm -plain -ppmtoppm < testgrid.pbm | cksum +echo "Test 2. Should print a simple 6 x 8 pattern" +pgmramp -diagonal -maxval=5 6 8 | ppmtoppm -plain + +echo "Test 3. Should print 669206373 10102" +ppmtoppm < maze.pbm | cksum + +echo "Test 4. Should print 1926073387 101484" +ppmtoppm < testimg.ppm | cksum \ No newline at end of file diff --git a/test/ppmwheel.ok b/test/ppmwheel.ok index 0b0a7746..790a19cb 100644 --- a/test/ppmwheel.ok +++ b/test/ppmwheel.ok @@ -6,3 +6,4 @@ Expected failure 1 1 Expected failure 2 1 Expected failure 3 1 Expected failure 4 1 +Expected failure 5 1 diff --git a/test/ppmwheel.test b/test/ppmwheel.test index f2fa55d9..150a75e5 100755 --- a/test/ppmwheel.test +++ b/test/ppmwheel.test @@ -124,19 +124,24 @@ echo "-----------------------------------------------------------" 1>&2 ppmwheel 10 -huevalue -huesaturation > ${test_out} || \ echo -n "Expected failure 1" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} ppmwheel 0 > ${test_out} || \ echo -n "Expected failure 2" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} -ppmwheel > ${test_out} || \ +ppmwheel 3 > ${test_out} || \ echo -n "Expected failure 3" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} -ppmwheel 10 10 > ${test_out} || \ +ppmwheel > ${test_out} || \ echo -n "Expected failure 4" test -s ${test_out}; echo " "$? - rm -f {test_out} + rm -f ${test_out} + +ppmwheel 10 10 > ${test_out} || \ + echo -n "Expected failure 5" + test -s ${test_out}; echo " "$? + rm -f ${test_out} diff --git a/test/ps-alt-roundtrip.ok b/test/ps-alt-roundtrip.ok index 2deba38d..a23005f9 100644 --- a/test/ps-alt-roundtrip.ok +++ b/test/ps-alt-roundtrip.ok @@ -1,2 +1,4 @@ +Test 1. Should print: 281226646 481 2425386270 41 -2916080186 235 +Test 2. Should print: 2154092425 3374 +2154092425 3374 diff --git a/test/ps-alt-roundtrip.test b/test/ps-alt-roundtrip.test index 8fc08f2b..07081d3a 100755 --- a/test/ps-alt-roundtrip.test +++ b/test/ps-alt-roundtrip.test @@ -24,7 +24,9 @@ # pstopnm does not use libnetpbm functions for output. # Output is filtered through at least one Netpbm program. -# Test 1. Should print: 2425386270 41 +echo "Test 1. Should print: 281226646 481" + +tmpdir=${tmpdir:-/tmp} testgrid1_ps=${tmpdir}/testgrid1.ps pbmtopsg3 -dpi=72 testgrid.pbm \ @@ -36,13 +38,12 @@ pstopnm -xborder=0 -yborder=0 -llx=0 -lly=-16 -urx=14 \ rm ${testgrid1_ps} - -# Test 2. Should print: 2916080186 235 +echo "Test 2. Should print: 2154092425 3374" # Output is pgm maxval=1 with black and white inverted. -# + testgrid_epsi=${tmpdir}/testgrid.epsi -pbmtoepsi testgrid.pbm > ${testgrid_epsi} && \ +pbmtoepsi maze.pbm > ${testgrid_epsi} && \ xysizebps=`awk '/BeginPreview/ {print $2,$3,$4}' \ ${testgrid_epsi}` && \ awk '/^%%BeginPreview:/ { p=1; next } /^%%EndImage/ { p=0; next } \ diff --git a/test/ps-flate-roundtrip.ok b/test/ps-flate-roundtrip.ok index 57fb124f..0fdf23f2 100644 --- a/test/ps-flate-roundtrip.ok +++ b/test/ps-flate-roundtrip.ok @@ -1,3 +1,5 @@ +Test 1. Should print: 1926073387 101484 twice 1926073387 101484 1926073387 101484 -1386192571 507420 +Test 2. Should print 1831481505 608904 +1831481505 608904 diff --git a/test/ps-flate-roundtrip.test b/test/ps-flate-roundtrip.test index 08d1500c..888f2856 100755 --- a/test/ps-flate-roundtrip.test +++ b/test/ps-flate-roundtrip.test @@ -17,7 +17,7 @@ tmpdir=${tmpdir:-/tmp} # pstopnm does not use libnetpbm functions for output. # Output is filtered through pamtopnm. -# Test 1. Should print: 1926073387 101484 twice +echo "Test 1. Should print: 1926073387 101484 twice" test1_ps=${tmpdir}/testimg1.ps for flag in "-ps -flate" "-ps -rle -ascii -flate" @@ -32,16 +32,17 @@ for flag in "-ps -flate" "-ps -rle -ascii -flate" rm ${test1_ps} -# Test 2. Should print: 1386192571 507420 +echo "Test 2. Should print 1831481505 608904" # See comments in ps-roundtrip.test test3_ps=${tmpdir}/testimg3.ps flag="-ps -bitspersample=12 -flate -rle -vmreclaim" -cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \ -pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \ - > ${test3_ps} && +cat testimg.ppm testimg.ppm testimg.ppm maze.pbm \ + testgrid.pbm testgrid.pbm | \ + pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \ + > ${test3_ps} && xysize3=`awk '/BoundingBox/ {print "-xsize="$4,"-ysize="$5 ; exit}' \ - ${test3_ps}` && + ${test3_ps}` && pstopnm -portrait -xborder=0 -yborder=0 $xysize3 -stdout ${test3_ps} | \ pamtopnm | cksum diff --git a/test/ps-roundtrip.ok b/test/ps-roundtrip.ok index 5ef66cc4..1a69224d 100644 --- a/test/ps-roundtrip.ok +++ b/test/ps-roundtrip.ok @@ -1,7 +1,9 @@ +Test 1. Should print 1926073387 101484 four times 1926073387 101484 1926073387 101484 1926073387 101484 1926073387 101484 +Test 2. Should print 2918318199 62 seven times 2918318199 62 2918318199 62 2918318199 62 @@ -9,6 +11,7 @@ 2918318199 62 2918318199 62 2918318199 62 -1386192571 507420 -1386192571 507420 -1386192571 507420 +Test 3. Should print 1831481505 608904 three times +1831481505 608904 +1831481505 608904 +1831481505 608904 diff --git a/test/ps-roundtrip.test b/test/ps-roundtrip.test index 207646cc..efce4fd6 100755 --- a/test/ps-roundtrip.test +++ b/test/ps-roundtrip.test @@ -11,7 +11,7 @@ tmpdir=${tmpdir:-/tmp} # pstopnm does not use libnetpbm functions for output. # Output is filtered through pamtopnm. -# Test 1. Should print: 1926073387 101484 four times +echo "Test 1. Should print 1926073387 101484 four times" test1_ps=${tmpdir}/testimg1.ps for flag in "" "-ps" "-rle" "-ps -ascii" @@ -25,9 +25,9 @@ for flag in "" "-ps" "-rle" "-ps -ascii" done rm ${test1_ps} -# Test 2. Should print: 2918318199 62 seven times + +echo "Test 2. Should print 2918318199 62 seven times" # Test image designed to detect problems with run-length compression -# g_pbm=${tmpdir}/g.pbm t_pbm=${tmpdir}/t.pbm @@ -52,8 +52,8 @@ for flag in "" "-rle" "-ps -rle -ascii" \ rm ${grid_ps} ${g_pbm} ${t_pbm} -#Test 3. Should print: 1386192571 507420 three times -# +echo "Test 3. Should print 1831481505 608904 three times" + # Special care is needed when conducting round-trips with multiple-image # files as input. # (1) pnmtops: -setpage is mandatory @@ -61,16 +61,16 @@ rm ${grid_ps} ${g_pbm} ${t_pbm} # Subsequent BoundingBox values are ignored. # (3) pstopnm: input must be an ordinary file. Input from stdin # (by pipe or input redirection: "< file" ) does not work. -# test3_ps=${tmpdir}/testimg3.ps for flag in "" "-ps" \ "-ps -bitspersample=12 -rle -vmreclaim" do -cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \ -pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \ - > ${test3_ps} && +cat testimg.ppm testimg.ppm testimg.ppm maze.pbm \ + testgrid.pbm testgrid.pbm | \ + pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \ + > ${test3_ps} && xysize3=`awk '/BoundingBox/ {print "-xsize="$4,"-ysize="$5 ; exit}' \ ${test3_ps}` && pstopnm -portrait -xborder=0 -yborder=0 $xysize3 -stdout ${test3_ps} | \ diff --git a/test/random-generator.test b/test/random-generator.test index ef204e4b..23dc1903 100755 --- a/test/random-generator.test +++ b/test/random-generator.test @@ -55,7 +55,7 @@ perlPgmProcessorProgram=' } ' -pgmnoise -randomseed=5489 -plain -maxval=65535 10 200 | tee /tmp/z | +pgmnoise -randomseed=5489 -plain -maxval=65535 10 200 | \ perl -walne "$perlPgmProcessorProgram" # The above outputs (10 * 200 / 2) = 1000 samples. diff --git a/test/rgb3-roundtrip.ok b/test/rgb3-roundtrip.ok index 367e5429..cbdb369c 100644 --- a/test/rgb3-roundtrip.ok +++ b/test/rgb3-roundtrip.ok @@ -1,6 +1,12 @@ +Test 1. Should print 1926073387 101484 1926073387 101484 +Test 2. Should print 3744829044 101514 3744829044 101514 -2425386270 41 +Test 3. Should print 281226646 481 twice +281226646 481 +281226646 481 +Test 4. Should print 0 twice 0 0 +Test 5. Should print 0 0 : 0 0 0 : 0 diff --git a/test/rgb3-roundtrip.test b/test/rgb3-roundtrip.test index 42fd822f..5edb1f19 100755 --- a/test/rgb3-roundtrip.test +++ b/test/rgb3-roundtrip.test @@ -10,6 +10,7 @@ tmpdir=${tmpdir:-/tmp} # Test 1. PPM (color) input +echo "Test 1. Should print 1926073387 101484" testimg_ppm=${tmpdir}/testimg.ppm testimg_red=${tmpdir}/testimg.red testimg_grn=${tmpdir}/testimg.grn @@ -19,28 +20,35 @@ cp testimg.ppm ${tmpdir} && ppmtorgb3 ${testimg_ppm} && rgb3toppm ${testimg_red} ${testimg_grn} ${testimg_blu} | cksum +# Simple cat of three planes +echo "Test 2. Should print 3744829044 101514" cat ${testimg_red} ${testimg_grn} ${testimg_blu} | cksum rm ${testimg_ppm} ${testimg_red} ${testimg_grn} ${testimg_blu} -# Test 2. PBM (monochrome) input -testgrid_pbm=${tmpdir}/testgrid.pbm -testgrid_red=${tmpdir}/testgrid.red -testgrid_grn=${tmpdir}/testgrid.grn -testgrid_blu=${tmpdir}/testgrid.blu +# Test 3. PBM (monochrome) input +echo "Test 3. Should print 281226646 481 twice" +maze_pbm=${tmpdir}/maze.pbm +maze_red=${tmpdir}/maze.red +maze_grn=${tmpdir}/maze.grn +maze_blu=${tmpdir}/maze.blu -cp testgrid.pbm ${tmpdir} && -ppmtorgb3 ${testgrid_pbm} && -rgb3toppm ${testgrid_red} ${testgrid_grn} ${testgrid_blu} | \ +cp maze.pbm ${tmpdir} && +ppmtorgb3 ${maze_pbm} && +rgb3toppm ${maze_red} ${maze_grn} ${maze_blu} | \ ppmtopgm | pgmtopbm -th -val=0.5 | cksum +pgmtopbm -th -val=0.5 ${maze_red} | cksum -# Test 3. +# Test 4. # With PGM or PBM input, the three monochrome planes should be # identical. Test for this. -cmp -s ${testgrid_red} ${testgrid_grn} ; echo $? -cmp -s ${testgrid_grn} ${testgrid_blu} ; echo $? -pgmtopgm < testgrid.pbm | cmp -s - ${testgrid_red} +echo "Test 4. Should print 0 twice" +cmp -s ${maze_red} ${maze_grn} ; echo $? +cmp -s ${maze_grn} ${maze_blu} ; echo $? + +echo "Test 5. Should print 0 0 : 0" +pgmtopgm < maze.pbm | cmp -s - ${maze_red} echo ${PIPESTATUS[@]} ":" $? -rm ${testgrid_pbm} ${testgrid_red} ${testgrid_grn} ${testgrid_blu} +rm ${maze_pbm} ${maze_red} ${maze_grn} ${maze_blu} diff --git a/test/sgi-roundtrip.ok b/test/sgi-roundtrip.ok index b1bd5ba6..3c3f022a 100644 --- a/test/sgi-roundtrip.ok +++ b/test/sgi-roundtrip.ok @@ -1,8 +1,13 @@ +Test 1. Should produce 1926073387 101484 twice 1926073387 101484 1926073387 101484 +Test 2. Should produce 1926073387 101484 twice 1926073387 101484 1926073387 101484 -538848130 235 -538848130 235 -2394972481 463 -2394972481 463 +Test 3. Should produce 281226646 481 twice +281226646 481 +281226646 481 +Test 4. Should produce 4155890407 6741 three times +4155890407 6741 +4155890407 6741 +4155890407 6741 diff --git a/test/sgi-roundtrip.test b/test/sgi-roundtrip.test index 5052bb81..073755d8 100755 --- a/test/sgi-roundtrip.test +++ b/test/sgi-roundtrip.test @@ -1,14 +1,14 @@ #! /bin/bash # This script tests: pnmtosgi sgitopnm -# Also requires: rgb3toppm pamdepth pamtopnm - +# Also requires: rgb3toppm pamdepth pamtopnm pgmtopbm +tmpdir=${tmpdir:-/tmp} a_sgi=${tmpdir}/a.sgi a_red=${tmpdir}/a.red a_grn=${tmpdir}/a.grn a_blu=${tmpdir}/a.blu -# Test 1. Should produce 1926073387 101484 twice +echo "Test 1. Should produce 1926073387 101484 twice" pnmtosgi -rle testimg.ppm | tee ${a_sgi} | sgitopnm | cksum sgitopnm -channel=0 ${a_sgi} > ${a_red} sgitopnm -channel=1 ${a_sgi} > ${a_grn} @@ -21,7 +21,7 @@ b_red=${tmpdir}/b.red b_grn=${tmpdir}/b.grn b_blu=${tmpdir}/b.blu -# Test 2. Should produce 1926073387 101484 twice +echo "Test 2. Should produce 1926073387 101484 twice" pnmtosgi -verbatim testimg.ppm | tee ${b_sgi} | sgitopnm | cksum sgitopnm -channel=0 ${b_sgi} > ${b_red} sgitopnm -channel=1 ${b_sgi} > ${b_grn} @@ -29,15 +29,16 @@ sgitopnm -channel=2 ${b_sgi} > ${b_blu} rgb3toppm ${b_red} ${b_grn} ${b_blu} | cksum rm ${b_sgi} ${b_red} ${b_grn} ${b_blu} -# Test 3. Should produce 2425386270 41 twice -pnmtosgi testgrid.pbm | sgitopnm | cksum # Defaults to -rle -pnmtosgi -verbatim testgrid.pbm | sgitopnm | cksum - +echo "Test 3. Should produce 281226646 481 twice" +pnmtosgi maze.pbm | sgitopnm | pgmtopbm -threshold -value=0.5 | cksum +# Defaults to -rle +pnmtosgi -verbatim maze.pbm | sgitopnm | \ + pgmtopbm -threshold -value=0.5 | cksum -testgrid_pgm=${tmpdir}/testgrid.pgm +maze_pgm=${tmpdir}/maze.pgm -# Test 4. Should produce 2394972481 463 twice -pamdepth 65535 testgrid.pbm | pamtopnm | tee ${testgrid_pgm} | \ - pnmtosgi -rle | sgitopnm | cksum -pnmtosgi -verbatim ${testgrid_pgm} | sgitopnm | cksum -rm ${testgrid_pgm} +echo "Test 4. Should produce 4155890407 6741 three times" +pamdepth 65535 maze.pbm | pamtopnm | tee ${maze_pgm} | cksum +pnmtosgi -rle ${maze_pgm} | sgitopnm | cksum +pnmtosgi -verbatim ${maze_pgm} | sgitopnm | cksum +rm ${maze_pgm} diff --git a/test/sunicon-roundtrip.ok b/test/sunicon-roundtrip.ok index 845be5fb..8bfdc3a0 100644 --- a/test/sunicon-roundtrip.ok +++ b/test/sunicon-roundtrip.ok @@ -1 +1,4 @@ -2425386270 41 +Test. Should print 0 three times +0 +0 +0 diff --git a/test/sunicon-roundtrip.test b/test/sunicon-roundtrip.test index a52fda68..c5b85909 100755 --- a/test/sunicon-roundtrip.test +++ b/test/sunicon-roundtrip.test @@ -1,8 +1,27 @@ #! /bin/bash # This script tests: pbmtosunicon sunicontopnm -# Also requires: pamcut +# Also requires: pamcut pnmpad # Width of Sun icons are multiples of 8. -# Test. Should print: 2425386270 41 -pbmtosunicon testgrid.pbm | sunicontopnm | pamcut 1 0 14 16 | cksum +#imgsize=$(pamfile -size maze.pbm | awk '{print "-width="$1, "-height="$2}') + +tmpdir=${tmpdir:-/tmp} + +maze16_pbm=${tmpdir}/maze16.pbm +maze32_pbm=${tmpdir}/maze32.pbm +maze64_pbm=${tmpdir}/maze64.pbm + +pamcut -top=0 -left=0 -width=16 -height=16 maze.pbm > ${maze16_pbm} +pamcut -top=0 -left=0 -width=32 -height=32 maze.pbm > ${maze32_pbm} +pnmpad -width=64 -height=64 maze.pbm > ${maze64_pbm} + +echo "Test. Should print 0 three times" +pbmtosunicon ${maze16_pbm} | sunicontopnm | cmp -s - ${maze16_pbm} +echo $? +pbmtosunicon ${maze32_pbm} | sunicontopnm | cmp -s - ${maze32_pbm} +echo $? +pbmtosunicon ${maze64_pbm} | sunicontopnm | cmp -s - ${maze64_pbm} +echo $? + +rm ${maze16_pbm} ${maze32_pbm} ${maze64_pbm} \ No newline at end of file diff --git a/test/targa-roundtrip.ok b/test/targa-roundtrip.ok index 514f970f..beb6700e 100644 --- a/test/targa-roundtrip.ok +++ b/test/targa-roundtrip.ok @@ -1,15 +1,15 @@ -Test 1 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -2425386270 41 -Test 2 +Test 1: Should print 281226646 481 ten times +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +Test 2: Should produce 1571496937 33838 ten times 1571496937 33838 1571496937 33838 1571496937 33838 @@ -20,19 +20,19 @@ Test 2 1571496937 33838 1571496937 33838 1571496937 33838 -Test 3 +Test 3. Should print 1926073387 101484 four times 1926073387 101484 1926073387 101484 1926073387 101484 1926073387 101484 -Test 4 +Test 4. Should print 0 0 0 : 0 six times 0 0 0 : 0 0 0 0 : 0 0 0 0 : 0 0 0 0 : 0 0 0 0 : 0 0 0 0 : 0 -Test 5 +Test 4. Should print 0 0 0 : 0 twice, then 0 0 0 0 : 0 six times 0 0 0 : 0 0 0 0 : 0 0 0 0 0 : 0 diff --git a/test/targa-roundtrip.test b/test/targa-roundtrip.test index 79b01b61..2dd04e91 100755 --- a/test/targa-roundtrip.test +++ b/test/targa-roundtrip.test @@ -4,25 +4,21 @@ tmpdir=${tmpdir:-/tmp} -#Test 1: Should print 2425386270 41, cksum of testgrid.pbm, ten times - -echo "Test 1" +echo "Test 1: Should print 281226646 481 ten times" for mode in "-mono" "-mono -norle" \ "-cmap" "-cmap -norle" "-cmap16" "-cmap16 -norle" \ "-rgb" "-rgb -norle" "" "-norle" do - pamtotga ${mode} testgrid.pbm | \ + pamtotga ${mode} maze.pbm | \ tgatoppm | ppmtopgm | \ pgmtopbm -threshold -val 0.5 | cksum done -#Test 2: Should produce 1571496937 33838, cksum of testimg.red, ten times - -echo "Test 2" +echo "Test 2: Should produce 1571496937 33838 ten times" test_pam=${tmpdir}/testimg.pgm -pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 > ${test_pam} +pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 > ${test_pam} for mode in "-mono" "-mono -norle" \ "-cmap" "-cmap -norle" "-cmap16" "-cmap16 -norle" \ @@ -33,19 +29,14 @@ for mode in "-mono" "-mono -norle" \ rm ${test_pam} - -#Test 3: Should print 1926073387 101484, cksum of testimg.ppm, four times - -echo "Test 3" +echo "Test 3. Should print 1926073387 101484 four times" for mode in "-rgb" "-rgb -norle" "" "-norle" do pamtotga ${mode} testimg.ppm | tgatoppm | cksum done -#Test 4: Should print 0 six times - -echo "Test 4" +echo "Test 4. Should print 0 0 0 : 0 six times" test256_ppm=${tmpdir}/test256.ppm pnmquant 256 testimg.ppm > ${test256_ppm} || echo "pnmquant failed" @@ -57,10 +48,7 @@ for mode in "-rgb" "-rgb -norle" "-cmap" "-cmap -norle" "" "-norle" echo ${PIPESTATUS[@]} ":" $? done - -#Test 5: Should print 0 eight times - -echo "Test 5" +echo "Test 4. Should print 0 0 0 : 0 twice, then 0 0 0 0 : 0 six times" test256_31_ppm=${tmpdir}/test256-31.ppm pamdepth 31 ${test256_ppm} > ${test256_31_ppm} || echo "pamdepth failed" diff --git a/test/tiff-flate-lzw-roundtrip.ok b/test/tiff-flate-lzw-roundtrip.ok index 4d5597cc..b3b0e1e7 100644 --- a/test/tiff-flate-lzw-roundtrip.ok +++ b/test/tiff-flate-lzw-roundtrip.ok @@ -1,7 +1,9 @@ +Test 1. Should print 1079668603 10237 six times 1079668603 10237 1079668603 10237 1079668603 10237 1079668603 10237 1079668603 10237 1079668603 10237 -2425386270 41 +Test 2. Should print 281226646 481 +281226646 481 diff --git a/test/tiff-flate-lzw-roundtrip.test b/test/tiff-flate-lzw-roundtrip.test index 59d4c483..f62c6767 100755 --- a/test/tiff-flate-lzw-roundtrip.test +++ b/test/tiff-flate-lzw-roundtrip.test @@ -8,11 +8,11 @@ ## features. tmpdir=${tmpdir:-/tmp} - tartan_ppm=${tmpdir}/testimg40.ppm # Make a test image with reduced colors which compresses better -# cksum is 1079668603 10237 + +echo "Test 1. Should print 1079668603 10237 six times" ppmpat -tartan --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 71 48 | \ tee ${tartan_ppm} | cksum @@ -28,7 +28,9 @@ pamtotiff -adobeflate ${tartan_ppm} | tifftopnm | cksum pamtotiff -lzw ${tartan_ppm} | tifftopnm | cksum pamtotiff -lzw -predictor=1 ${tartan_ppm} | tifftopnm | cksum -# PBM image: test flate compression -pamtotiff -flate testgrid.pbm | tifftopnm | cksum - rm ${tartan_ppm} + +echo "Test 2. Should print 281226646 481" + +# PBM image: test flate compression +pamtotiff -flate maze.pbm | tifftopnm | cksum diff --git a/test/tiff-roundtrip.ok b/test/tiff-roundtrip.ok index 14258de2..dec662ed 100644 --- a/test/tiff-roundtrip.ok +++ b/test/tiff-roundtrip.ok @@ -1,36 +1,36 @@ -PPM-rose +Test 1:PPM-rose Should print 1926073387 101484 five times 1926073387 101484 1926073387 101484 1926073387 101484 1926073387 101484 1926073387 101484 -PPM-6 +Test 2:PPM-6 Should print 1646869394 29498 four times 1646869394 29498 1646869394 29498 1646869394 29498 1646869394 29498 -PPM-2 +Test 3:PPM-2 Should print 3743909631 14836 four times 3743909631 14836 3743909631 14836 3743909631 14836 3743909631 14836 -PPM-gray +Test 4:PPM-gray Should print 603974118 4954 six times 603974118 4954 603974118 4954 603974118 4954 603974118 4954 603974118 4954 603974118 4954 -PPM-bilevel-black-white +Test 5:PPM-bilevel-black-white Should print 1001018459 4954 four times 1001018459 4954 1001018459 4954 1001018459 4954 1001018459 4954 -PBM -2425386270 41 -2425386270 41 -2425386270 41 -Extract from multi-image TIFF +Test 6:PBM Should print 281226646 481 three times +281226646 481 +281226646 481 +281226646 481 +Test 7:Extract from multi-image TIFF 1926073387 101484 1646869394 29498 3743909631 14836 diff --git a/test/tiff-roundtrip.test b/test/tiff-roundtrip.test index 55aba278..b4169319 100755 --- a/test/tiff-roundtrip.test +++ b/test/tiff-roundtrip.test @@ -13,9 +13,8 @@ argylegray_ppm=${tmpdir}/argyle2.ppm multiimage_tiff=${tmpdir}/multiimage.ppm # PPM image -# Should print 1926073387 101484 five times -echo PPM-rose +echo "Test 1:PPM-rose Should print 1926073387 101484 five times" pamtotiff testimg.ppm | tifftopnm -headerdump | cksum pamtotiff -truecolor testimg.ppm -output ${multiimage_tiff} && \ tifftopnm ${multiimage_tiff} -byrow | cksum @@ -25,9 +24,8 @@ pamtotiff -truecolor -lsb2msb testimg.ppm | \ tifftopnm -respectfillorder | cksum # PPM image with six colors -# Should print 1646869394 29498 four times -echo PPM-6 +echo "Test 2:PPM-6 Should print 1646869394 29498 four times" ppmpat -tartan -color=rgb:0/8/8,rgb:8/f/8,rgb:f/f/0 108 91 | \ tee ${tartan_ppm} | cksum pamtotiff -truecolor ${tartan_ppm} | tifftopnm | cksum @@ -37,12 +35,12 @@ pamtotiff ${tartan_ppm} -append -output ${multiimage_tiff} && \ # PPM image with two colors -# Should print 3743909631 14836 four times -echo PPM-2 +echo "Test 3:PPM-2 Should print 3743909631 14836 four times" ppmpat -argyle2 -color=rgb:0/0/0,rgb:f/8/f,rgb:0/0/0 61 81 | \ tee ${argylecolor_ppm} | cksum -pamtotiff -indexbits=2 ${argylecolor_ppm} -append -output ${multiimage_tiff} && \ +pamtotiff -indexbits=2 ${argylecolor_ppm} -append \ + -output ${multiimage_tiff} && \ tifftopnm ${multiimage_tiff} | pampick 2 | cksum pamtotiff -indexbits=1 ${argylecolor_ppm} | tifftopnm | cksum pamtotiff -indexbits=1 -g4 ${argylecolor_ppm} | tifftopnm | cksum @@ -51,9 +49,8 @@ pamtotiff -indexbits=1 -g4 ${argylecolor_ppm} | tifftopnm | cksum # pamtotiff detects the absence of colors and produces a grayscale # tiff image unless -color is specified # Pipeline output is PGM unless -color is specified -# Should print 603974118 4954 six times -echo PPM-gray +echo "Test 4:PPM-gray Should print 603974118 4954 six times" ppmpat -gingham3 -color=rgb:0/0/0,rgb:ff/ff/ff,rgb:0/0/0 61 81 | \ tee ${gingham_ppm} | ppmtopgm | cksum pamtotiff -color ${gingham_ppm} | tifftopnm | cksum @@ -67,9 +64,8 @@ pamtotiff -mb ${gingham_ppm} -append -output ${multiimage_tiff} && \ # pamtotiff detects the absence of colors and produces a grayscale # tiff image unless -color is specified # Pipeline output is PGM unless -color is specified -# Should print 1001018459 4954 four times -echo PPM-bilevel-black-white +echo "Test 5:PPM-bilevel-black-white Should print 1001018459 4954 four times" ppmpat -argyle2 -color=rgb:0/0/0,rgb:ff/ff/ff,rgb:0/0/0 61 81 | \ tee ${argylegray_ppm} | ppmtopgm | cksum pamtotiff -color -fill ${argylegray_ppm} | tifftopnm | cksum @@ -78,17 +74,17 @@ pamtotiff -mb ${argylegray_ppm} -append -output ${multiimage_tiff} && \ tifftopnm ${multiimage_tiff} | pampick 4 | cksum # PBM image -# Should print 2425386270 41 three times -echo PBM -pamtotiff testgrid.pbm | tifftopnm | cksum -pamtotiff -g3 -fill testgrid.pbm | tifftopnm | cksum -pamtotiff -g4 -mb testgrid.pbm -append -output ${multiimage_tiff} && \ + +echo "Test 6:PBM Should print 281226646 481 three times" +pamtotiff maze.pbm | tifftopnm | cksum +pamtotiff -g3 -fill maze.pbm | tifftopnm | cksum +pamtotiff -g4 -mb maze.pbm -append -output ${multiimage_tiff} && \ tifftopnm ${multiimage_tiff} | pampick 5 | cksum # Extract individual images from multi-image tiff file -echo "Extract from multi-image TIFF" +echo "Test 7:Extract from multi-image TIFF" tifftopnm ${multiimage_tiff} | pampick 0 | cksum tifftopnm ${multiimage_tiff} | pampick 1 | cksum tifftopnm ${multiimage_tiff} | pampick 2 | cksum diff --git a/test/wbmp-roundtrip.ok b/test/wbmp-roundtrip.ok index 845be5fb..5168378d 100644 --- a/test/wbmp-roundtrip.ok +++ b/test/wbmp-roundtrip.ok @@ -1 +1 @@ -2425386270 41 +281226646 481 diff --git a/test/wbmp-roundtrip.test b/test/wbmp-roundtrip.test index b651c3d0..6197032c 100755 --- a/test/wbmp-roundtrip.test +++ b/test/wbmp-roundtrip.test @@ -3,5 +3,5 @@ # Also requires: -# Should print 2425386270 41, cksum of testgrid.pbm -pbmtowbmp testgrid.pbm | wbmptopbm | cksum +# Should print 281226646 481, cksum of maze.pbm +pbmtowbmp maze.pbm | wbmptopbm | cksum diff --git a/test/winicon-roundtrip.ok b/test/winicon-roundtrip.ok index 4ba2606e..73e5030c 100644 --- a/test/winicon-roundtrip.ok +++ b/test/winicon-roundtrip.ok @@ -3,10 +3,10 @@ Test 1. Should print 4241318573 6973 four times 4241318573 6973 4241318573 6973 4241318573 6973 -Test 1. Should print 819454437 1093 six times -819454437 1093 -819454437 1093 -819454437 1093 -819454437 1093 -819454437 1093 -819454437 1093 +Test 1. Should print 1009647580 1093 six times +1009647580 1093 +1009647580 1093 +1009647580 1093 +1009647580 1093 +1009647580 1093 +1009647580 1093 diff --git a/test/winicon-roundtrip.test b/test/winicon-roundtrip.test index 00c78400..b4814fee 100755 --- a/test/winicon-roundtrip.test +++ b/test/winicon-roundtrip.test @@ -1,6 +1,6 @@ #! /bin/bash # This script tests: pamtowinicon ppmtowinicon winicontopam -# Also requires: pamchannel pamcut pamdepth pamtopam pngtopam pnmtile pnmtopng +# Also requires: pamchannel pamcut pamdepth pamtopam tmpdir=${tmpdir:-/tmp} test_pam=${tmpdir}/testimg.pam @@ -18,9 +18,9 @@ pamtowinicon -pngthreshold=1 ${test_pam} | winicontopam | \ rm ${test_pam} -echo "Test 1. Should print 819454437 1093 six times" +echo "Test 1. Should print 1009647580 1093 six times" -pnmtile 32 32 testgrid.pbm | pamtopam | \ +pamcut -top=0 -left=0 -width=32 -height=32 maze.pbm | pamtopam | \ tee ${test_pam} | cksum pamtowinicon ${test_pam} | winicontopam | \ pamdepth 1 | pamchannel -tupletype="BLACKANDWHITE" 0 | cksum @@ -33,5 +33,6 @@ pamtowinicon -pngthreshold=1 ${test_pam} | winicontopam | rm ${test_pam} -pnmtile 32 32 testgrid.pbm | ppmtowinicon | winicontopam | \ +pamcut -top=0 -left=0 -width=32 -height=32 maze.pbm | \ + ppmtowinicon | winicontopam | \ pamdepth 1 | pamchannel -tupletype="BLACKANDWHITE" 0 | cksum diff --git a/test/winicon-roundtrip2.test b/test/winicon-roundtrip2.test index 9d55ebee..d1f29cc9 100755 --- a/test/winicon-roundtrip2.test +++ b/test/winicon-roundtrip2.test @@ -1,7 +1,6 @@ #! /bin/bash # This script tests: pamtowinicon winicontopam -# Also requires: pamchannel pamdepth pamstack pamtopam pbmmake pngtopam -# Also requires: pnmtopng ppmpat +# Also requires: pamchannel pamdepth pamstack pamtopam pbmmake ppmpat tmpdir=${tmpdir:-/tmp} test_pam=${tmpdir}/testimg.pam diff --git a/test/xbm-roundtrip.ok b/test/xbm-roundtrip.ok index a676a1f2..82c6b5d8 100644 --- a/test/xbm-roundtrip.ok +++ b/test/xbm-roundtrip.ok @@ -1,2 +1,3 @@ -2425386270 41 -2425386270 41 +Test. Should print 281226646 481 twice +281226646 481 +281226646 481 diff --git a/test/xbm-roundtrip.test b/test/xbm-roundtrip.test index e84d6fc3..3f06e9a5 100755 --- a/test/xbm-roundtrip.test +++ b/test/xbm-roundtrip.test @@ -2,6 +2,7 @@ # This script tests: pbmtoxbm xbmtopbm # Also requires: +echo "Test. Should print 281226646 481 twice" -pbmtoxbm testgrid.pbm | xbmtopbm | cksum -pbmtoxbm -x10 testgrid.pbm | xbmtopbm | cksum +pbmtoxbm maze.pbm | xbmtopbm | cksum +pbmtoxbm -x10 maze.pbm | xbmtopbm | cksum diff --git a/test/xpm-roundtrip.ok b/test/xpm-roundtrip.ok index 845be5fb..5168378d 100644 --- a/test/xpm-roundtrip.ok +++ b/test/xpm-roundtrip.ok @@ -1 +1 @@ -2425386270 41 +281226646 481 diff --git a/test/xpm-roundtrip.test b/test/xpm-roundtrip.test index fd0253b1..61a5192d 100755 --- a/test/xpm-roundtrip.test +++ b/test/xpm-roundtrip.test @@ -5,5 +5,5 @@ #ppmtoxpm -hexonly testimg.ppm | \ # xpmtoppm | cksum -ppmtoxpm testgrid.pbm | xpmtoppm | \ +ppmtoxpm maze.pbm | xpmtoppm | \ ppmtopgm | pgmtopbm -th -value=0.5 | cksum diff --git a/test/xwd-roundtrip.ok b/test/xwd-roundtrip.ok index 25d3d871..864d737a 100644 --- a/test/xwd-roundtrip.ok +++ b/test/xwd-roundtrip.ok @@ -1,3 +1,6 @@ +Test 1. Should produce 1571496937 33838, cksum of testimg.red 1571496937 33838 +Test 2. Should produce 1926073387 101484 1926073387 101484 -2425386270 41 +Test 3. Should produce 281226646 481 +281226646 481 diff --git a/test/xwd-roundtrip.test b/test/xwd-roundtrip.test index cd0d38ad..4dffbbb0 100755 --- a/test/xwd-roundtrip.test +++ b/test/xwd-roundtrip.test @@ -2,15 +2,14 @@ # This script tests: pnmtoxwd xwdtopnm # Also requires: pamchannel pamtopnm pamdepth - -# Test 1. Should produce 1571496937 33838, cksum of testimg.red +echo "Test 1. Should produce 1571496937 33838, cksum of testimg.red" pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ pnmtoxwd | xwdtopnm | pamdepth 255 | cksum -# Test 2. Should produce 1926073387 101484 -pnmtoxwd --quiet testimg.ppm | \ +echo "Test 2. Should produce 1926073387 101484" +pnmtoxwd --quiet testimg.ppm | \ xwdtopnm --quiet | pamdepth 255 | cksum -# Test 3. Should produce 2425386270 41 -pnmtoxwd --quiet testgrid.pbm | \ +echo "Test 3. Should produce 281226646 481" +pnmtoxwd --quiet maze.pbm | \ xwdtopnm | cksum |