From be71d9f416a205d4dd977b93f5f96f97e8628cca Mon Sep 17 00:00:00 2001 From: giraffedata Date: Thu, 3 Feb 2022 01:26:10 +0000 Subject: Add stdin tests, et al git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4272 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- test/Test-Order | 18 +++++- test/cut-cat-roundtrip.test | 10 ++-- test/ilbm-roundtrip.ok | 6 +- test/ilbm-roundtrip.test | 27 ++++++--- test/lps-roundtrip.ok | 4 +- test/lps-roundtrip.test | 16 ++++-- test/pamflip-pbm-roundtrip.ok | 122 ++++++++++++++++++++++++++++++++++++++++ test/pamflip-pbm-roundtrip.test | 74 ++++++++++++++++++++++++ test/pamflip-roundtrip.ok | 16 ++++-- test/pamflip-roundtrip.test | 23 +++++--- test/pamundice.test | 42 +++++++------- test/pbm-misc-converters.ok | 33 ++++++++++- test/pbm-misc-converters.test | 112 +++++++++++++++++++++++++++--------- test/ppmtoapplevol.ok | 6 ++ test/ppmtoapplevol.test | 30 ++++++++++ test/stdin-pbm1.ok | 9 +++ test/stdin-pbm1.test | 43 ++++++++++++++ test/stdin-pbm2.ok | 28 +++++++++ test/stdin-pbm2.test | 67 ++++++++++++++++++++++ test/stdin-pgm1.ok | 11 ++++ test/stdin-pgm1.test | 46 +++++++++++++++ test/stdin-pgm2.ok | 6 ++ test/stdin-pgm2.test | 44 +++++++++++++++ test/stdin-pnm1.ok | 23 ++++++++ test/stdin-pnm1.test | 59 +++++++++++++++++++ test/stdin-pnm2.ok | 28 +++++++++ test/stdin-pnm2.test | 77 +++++++++++++++++++++++++ test/stdin-ppm1.ok | 15 +++++ test/stdin-ppm1.test | 57 +++++++++++++++++++ test/stdin-ppm2.ok | 10 ++++ test/stdin-ppm2.test | 51 +++++++++++++++++ test/stdin-ppm3.ok | 20 +++++++ test/stdin-ppm3.test | 72 ++++++++++++++++++++++++ test/xbm-roundtrip.test | 4 +- 34 files changed, 1125 insertions(+), 84 deletions(-) create mode 100644 test/pamflip-pbm-roundtrip.ok create mode 100755 test/pamflip-pbm-roundtrip.test create mode 100644 test/ppmtoapplevol.ok create mode 100755 test/ppmtoapplevol.test create mode 100644 test/stdin-pbm1.ok create mode 100755 test/stdin-pbm1.test create mode 100644 test/stdin-pbm2.ok create mode 100755 test/stdin-pbm2.test create mode 100644 test/stdin-pgm1.ok create mode 100755 test/stdin-pgm1.test create mode 100644 test/stdin-pgm2.ok create mode 100755 test/stdin-pgm2.test create mode 100644 test/stdin-pnm1.ok create mode 100755 test/stdin-pnm1.test create mode 100644 test/stdin-pnm2.ok create mode 100755 test/stdin-pnm2.test create mode 100644 test/stdin-ppm1.ok create mode 100755 test/stdin-ppm1.test create mode 100644 test/stdin-ppm2.ok create mode 100755 test/stdin-ppm2.test create mode 100644 test/stdin-ppm3.ok create mode 100755 test/stdin-ppm3.test (limited to 'test') diff --git a/test/Test-Order b/test/Test-Order index c21f892d..c2f59a74 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -129,16 +129,29 @@ pammixmulti-identity.test symmetry.test +# Standard input tests + +stdin-pbm1.test +stdin-pbm2.test +stdin-pgm1.test +stdin-pgm2.test +stdin-ppm1.test +stdin-ppm2.test +stdin-ppm3.test +stdin-pnm1.test +stdin-pnm2.test + +pbm-misc-converters.test + # Format converter tests pamtopdbimg.test pbmtog3.test +ppmtoapplevol.test 411toppm.test eyuvtoppm.test rawtoppm.test -pbm-misc-converters.test - gif-transparent1.test # Miscellaneous utility tests @@ -155,6 +168,7 @@ pnm-plain-roundtrip.test pnm-pam-roundtrip.test pnminvert-roundtrip.test pamflip-roundtrip.test +pamflip-pbm-roundtrip.test pamdepth-roundtrip.test pad-crop-roundtrip.test pbm-ppm-roundtrip.test diff --git a/test/cut-cat-roundtrip.test b/test/cut-cat-roundtrip.test index f9928b30..c2799a7b 100755 --- a/test/cut-cat-roundtrip.test +++ b/test/cut-cat-roundtrip.test @@ -12,12 +12,12 @@ padded_ppm=${tmpdir}/padded.ppm echo "Test 1. Should print 1926073387 101484 six times" -testimg_ppm_sum=`cat testimg.ppm | cksum` +testimg_ppm_sum=`cksum < testimg.ppm` echo ${testimg_ppm_sum} - imgsize=$(pamfile -size testimg.ppm) - width=$(echo ${imgsize} | cut -d " " -f 1) - height=$(echo ${imgsize} | cut -d " " -f 2) +imgsize=$(pamfile -size testimg.ppm) +width=$(echo ${imgsize} | cut -d " " -f 1) +height=$(echo ${imgsize} | cut -d " " -f 2) for i in 0 1 128 224 225 do @@ -83,7 +83,7 @@ padded_pbm=${tmpdir}/padded.pbm echo "Test 5. Should print 281226646 481 six times" -maze_pbm_sum=`cat maze.pbm | cksum` +maze_pbm_sum=`cksum < maze.pbm` echo ${maze_pbm_sum} imgsize=$(pamfile -size maze.pbm) diff --git a/test/ilbm-roundtrip.ok b/test/ilbm-roundtrip.ok index fcbdf4f6..07c44515 100644 --- a/test/ilbm-roundtrip.ok +++ b/test/ilbm-roundtrip.ok @@ -9,6 +9,10 @@ Test 2. Should produce 1926073387 101484 three times 1926073387 101484 Test 3. Should print 984199586 101484 984199586 101484 -Test 4. Should print 2059976475 661 twice +Test 4. Should print 2059976475 661 three times 2059976475 661 2059976475 661 +2059976475 661 +Test 5. Should print 482756572 101484 twice +482756572 101484 +482756572 101484 diff --git a/test/ilbm-roundtrip.test b/test/ilbm-roundtrip.test index 85e04b26..c0b684ed 100755 --- a/test/ilbm-roundtrip.test +++ b/test/ilbm-roundtrip.test @@ -1,6 +1,6 @@ -#! /bin/bash +#! /bin/sh # This script tests: ppmtoilbm ilbmtoppm -# Also requires: pamseq pamdepth pamtopnm pnmremap +# Also requires: pamseq pamdepth pamtopnm pnmremap pnmcolormap echo "Test 1. Should produce 669206373 10102 five times" #Output is PPM raw, 57 by 59 maxval 255 @@ -16,14 +16,25 @@ ppmtoilbm testimg.ppm | ilbmtoppm | cksum ppmtoilbm -24force testimg.ppm | ilbmtoppm | cksum ppmtoilbm -dcbits 8 8 8 -nocompress testimg.ppm | ilbmtoppm | cksum +tmpdir=${tmpdir:-/tmp} echo "Test 3. Should print 984199586 101484" -pamseq 3 5 -tupletype=RGB | pamdepth 255 | pamtopnm | \ +test_ppm=${tmpdir}/test.ppm +pamseq 3 5 -tupletype=RGB | pamdepth 255 | pamtopnm | tee ${test_ppm} | \ pnmremap -mapfile=- testimg.ppm | ppmtoilbm | ilbmtoppm | cksum -echo "Test 4. Should print 2059976475 661 twice" -pamseq 3 5 -tupletype=RGB | pamtopnm | \ - ppmtoilbm -compress | ilbmtoppm | cksum -pamseq 3 5 -tupletype=RGB | pamtopnm | \ - ppmtoilbm -nocompress | ilbmtoppm | cksum +echo "Test 4. Should print 2059976475 661 three times" +cat ${test_ppm} | cksum +ppmtoilbm -compress ${test_ppm} | ilbmtoppm | cksum +ppmtoilbm -nocompress ${test_ppm} | ilbmtoppm | cksum + +rm ${test_ppm} + +echo "Test 5. Should print 482756572 101484 twice" +mapfile=${tmpdir}/mapfile +pnmcolormap 32 testimg.ppm > ${mapfile} +ppmtoilbm -map ${mapfile} testimg.ppm | ilbmtoppm | tee ${test_ppm} | cksum +ppmtoilbm -map ${mapfile} ${test_ppm} | ilbmtoppm | cksum + +rm ${mapfile} ${test_ppm} diff --git a/test/lps-roundtrip.ok b/test/lps-roundtrip.ok index 277907af..c2c8ab3b 100644 --- a/test/lps-roundtrip.ok +++ b/test/lps-roundtrip.ok @@ -1,2 +1,4 @@ -Test. Should print match +Test 1. Should print match match +Test 2. Should print 0 +0 diff --git a/test/lps-roundtrip.test b/test/lps-roundtrip.test index 71cd354d..78350d71 100755 --- a/test/lps-roundtrip.test +++ b/test/lps-roundtrip.test @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # This script tests: pbmtolps pstopnm # Also requires: gs pamdepth pamscale pnmcrop pnmpsnr pamfile @@ -9,17 +9,25 @@ tmpdir=${tmpdir:-/tmp} test_pgm=${tmpdir}/test.pgm +test_ps=${tmpdir}/test.ps -echo "Test. Should print match" +echo "Test 1. 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 | \ +pbmtolps -dpi 72 testgrid.pbm | tee ${test_ps} | \ pstopnm -dpi $((72*12)) -stdout -pgm | \ pnmcrop -white | pamscale ${xysize} | \ pnmpsnr -target=30 - ${test_pgm} - + # ghostscript version 8.71: pnmpsnr lumina 33.14dB + + +echo "Test 2. Should print 0" + +pbmtolps -dpi 72 < testgrid.pbm | sed 's/noname/testgrid.pbm/' | \ + cmp -s ${test_ps} - + echo $? rm ${test_pgm} diff --git a/test/pamflip-pbm-roundtrip.ok b/test/pamflip-pbm-roundtrip.ok new file mode 100644 index 00000000..c72e40d6 --- /dev/null +++ b/test/pamflip-pbm-roundtrip.ok @@ -0,0 +1,122 @@ +Test 1. Should print 281226646 481 seven times +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +281226646 481 +Test 2. Should print 1576602925 8 fourteen times +1576602925 8 +1576602925 8 +1576602925 8 +1576602925 8 +1576602925 8 +1576602925 8 +1576602925 8 +1576602925 8 +1576602925 8 +1576602925 8 +1576602925 8 +1576602925 8 +1576602925 8 +1576602925 8 +Test 3. Should print N : 0 thirty-two times +1 : 0 +2 : 0 +3 : 0 +4 : 0 +5 : 0 +6 : 0 +7 : 0 +8 : 0 +9 : 0 +10 : 0 +11 : 0 +12 : 0 +13 : 0 +14 : 0 +15 : 0 +16 : 0 +17 : 0 +18 : 0 +19 : 0 +20 : 0 +21 : 0 +22 : 0 +23 : 0 +24 : 0 +25 : 0 +26 : 0 +27 : 0 +28 : 0 +29 : 0 +30 : 0 +31 : 0 +32 : 0 +Test 4. Should print N : 0 thirty-two times +1 : 0 +2 : 0 +3 : 0 +4 : 0 +5 : 0 +6 : 0 +7 : 0 +8 : 0 +9 : 0 +10 : 0 +11 : 0 +12 : 0 +13 : 0 +14 : 0 +15 : 0 +16 : 0 +17 : 0 +18 : 0 +19 : 0 +20 : 0 +21 : 0 +22 : 0 +23 : 0 +24 : 0 +25 : 0 +26 : 0 +27 : 0 +28 : 0 +29 : 0 +30 : 0 +31 : 0 +32 : 0 +Test 5. Should print N : 0 thirty-two times +1 : 0 +2 : 0 +3 : 0 +4 : 0 +5 : 0 +6 : 0 +7 : 0 +8 : 0 +9 : 0 +10 : 0 +11 : 0 +12 : 0 +13 : 0 +14 : 0 +15 : 0 +16 : 0 +17 : 0 +18 : 0 +19 : 0 +20 : 0 +21 : 0 +22 : 0 +23 : 0 +24 : 0 +25 : 0 +26 : 0 +27 : 0 +28 : 0 +29 : 0 +30 : 0 +31 : 0 +32 : 0 diff --git a/test/pamflip-pbm-roundtrip.test b/test/pamflip-pbm-roundtrip.test new file mode 100755 index 00000000..71f2e926 --- /dev/null +++ b/test/pamflip-pbm-roundtrip.test @@ -0,0 +1,74 @@ +#! /bin/sh +# This script tests: pamflip +# Also requires: ppmpat pamseq pamtopnm + +tmpdir=${tmpdir:-/tmp} +dot_pbm=${tmpdir}/dot.pbm +noise_pbm=${tmpdir}/noise.pbm + +echo "Test 1. Should print 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 + +echo "Test 2. Should print 1576602925 8 fourteen times" + +pbmmake -b 1 1 | tee ${dot_pbm} | cksum +pamflip -null ${dot_pbm} | cksum + +# the next six aren't round-trip +pamflip -lr ${dot_pbm} | cksum +pamflip -tb ${dot_pbm} | cksum +pamflip -r180 ${dot_pbm} | cksum +pamflip -xy ${dot_pbm} | cksum +pamflip -r90 ${dot_pbm} | cksum +pamflip -r270 ${dot_pbm} | cksum + +pamflip -lr ${dot_pbm} | pamflip -lr | cksum +pamflip -tb ${dot_pbm} | pamflip -tb | cksum +pamflip -r180 ${dot_pbm} | pamflip -r180 | cksum +pamflip -xy ${dot_pbm} | pamflip -xy | cksum +pamflip -r90 ${dot_pbm} | pamflip -r90 | pamflip -r90 | pamflip -r90 | cksum +pamflip -r270 ${dot_pbm} | pamflip -r270 | \ + pamflip -r270 | pamflip -r270 | cksum + +rm ${dot_pbm} + +echo "Test 3. Should print N : 0 thirty-two times" + +for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 \ + 20 21 22 23 24 25 26 27 28 29 30 31 32 + do + pbmnoise -randomseed=${i} -pack ${i} 3 > ${noise_pbm} && \ + pamflip -lr ${noise_pbm} | pamflip -lr | cmp -s - ${noise_pbm} + echo $i : $? + rm ${noise_pbm} + done + +echo "Test 4. Should print N : 0 thirty-two times" + +for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 \ + 20 21 22 23 24 25 26 27 28 29 30 31 32 + do + pbmnoise -randomseed=${i} -pack 7 ${i} > ${noise_pbm} && \ + pamflip -tb ${noise_pbm} | pamflip -tb | cmp -s - ${noise_pbm} + echo $i : $? + rm ${noise_pbm} + done + + +echo "Test 5. Should print N : 0 thirty-two times" + +for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 \ + 20 21 22 23 24 25 26 27 28 29 30 31 32 + do + pbmnoise -randomseed=${i} -pack ${i} ${i} > ${noise_pbm} && \ + pamflip -xy ${noise_pbm} | pamflip -xy | cmp -s - ${noise_pbm} + echo $i : $? + rm ${noise_pbm} + done diff --git a/test/pamflip-roundtrip.ok b/test/pamflip-roundtrip.ok index 48d5ab62..70ed6424 100644 --- a/test/pamflip-roundtrip.ok +++ b/test/pamflip-roundtrip.ok @@ -1,4 +1,4 @@ -Test 1. Should produce 1988581932 2989 fifteen times +Test 1. Should print 1988581932 2989 fifteen times 1988581932 2989 1988581932 2989 1988581932 2989 @@ -14,7 +14,7 @@ Test 1. Should produce 1988581932 2989 fifteen times 1988581932 2989 1988581932 2989 1988581932 2989 -Test 2. Should produce 2729474106 27 nine times +Test 2. Should print 2729474106 27 nine times 2729474106 27 2729474106 27 2729474106 27 @@ -24,7 +24,7 @@ Test 2. Should produce 2729474106 27 nine times 2729474106 27 2729474106 27 2729474106 27 -Test 3. Should produce 1849343241 27 nine times +Test 3. Should print 1849343241 27 nine times 1849343241 27 1849343241 27 1849343241 27 @@ -35,7 +35,7 @@ Test 3. Should produce 1849343241 27 nine times 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 +plain (ascii) format; then print 2434897823 19 fifteen times P3 1 1 65535 @@ -49,7 +49,13 @@ P3 2434897823 19 2434897823 19 2434897823 19 -Test 4. Should produce 281226646 481 seven times +2434897823 19 +2434897823 19 +2434897823 19 +2434897823 19 +2434897823 19 +2434897823 19 +Test 5. Should print 281226646 481 seven times 281226646 481 281226646 481 281226646 481 diff --git a/test/pamflip-roundtrip.test b/test/pamflip-roundtrip.test index 27a3c1f6..6103f6fb 100755 --- a/test/pamflip-roundtrip.test +++ b/test/pamflip-roundtrip.test @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # This script tests: pamflip # Also requires: ppmpat pamseq pamtopnm @@ -8,7 +8,7 @@ test1_pgm=${tmpdir}/test1.pgm test2_pgm=${tmpdir}/test2.pgm dot_ppm=${tmpdir}/dot.ppm -echo "Test 1. Should produce 1988581932 2989 fifteen times" +echo "Test 1. Should print 1988581932 2989 fifteen times" ppmpat -tartan -mesh \ -color=rgb:0/0/0,rgb:ff/00/ff,rgb:80/90/20 31 32 > ${tartan_ppm} @@ -38,7 +38,7 @@ rm ${tartan_ppm} pamseq 1 15 | pamtopnm -assume > ${test1_pgm} -echo "Test 2. Should produce 2729474106 27 nine times" +echo "Test 2. Should print 2729474106 27 nine times" pamflip -null ${test1_pgm} | cksum pamflip -lr ${test1_pgm} | pamflip -lr | cksum @@ -55,7 +55,7 @@ pamflip -r270 ${test1_pgm} | pamflip -r270 | \ pamflip -r180 ${test1_pgm} > ${test2_pgm} rm ${test1_pgm} -echo "Test 3. Should produce 1849343241 27 nine times" +echo "Test 3. Should print 1849343241 27 nine times" pamflip -null ${test2_pgm} | cksum pamflip -lr ${test2_pgm} | pamflip -lr | cksum @@ -79,10 +79,19 @@ P3 EOF echo "Test 4. Should print a single pixel PPM image maxval 65535 in " -echo "plain (ascii) format; then produce 2434897823 19 nine times" +echo "plain (ascii) format; then print 2434897823 19 fifteen times" pamflip -null -plain ${dot_ppm} + +# These are not round-trip pamflip -null ${dot_ppm} | cksum +pamflip -lr ${dot_ppm} | cksum +pamflip -tb ${dot_ppm} | cksum +pamflip -xy ${dot_ppm} | cksum +pamflip -r90 ${dot_ppm} | cksum +pamflip -r180 ${dot_ppm} | cksum +pamflip -r270 ${dot_ppm} | cksum + pamflip -lr ${dot_ppm} | pamflip -lr | cksum pamflip -tb ${dot_ppm} | pamflip -tb | cksum pamflip -r180 ${dot_ppm} | pamflip -r180 | cksum @@ -95,7 +104,7 @@ pamflip -r270 ${dot_ppm} | pamflip -r270 | \ rm ${dot_ppm} -echo "Test 4. Should produce 281226646 481 seven times" +echo "Test 5. Should print 281226646 481 seven times" pamflip -null maze.pbm | cksum pamflip -lr maze.pbm | pamflip -lr | cksum @@ -104,5 +113,3 @@ 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/pamundice.test b/test/pamundice.test index 1e3dd31b..14b43dfb 100755 --- a/test/pamundice.test +++ b/test/pamundice.test @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # This script tests: pamundice # Also requires: pamfile pgmmake pnmtile pnmcat @@ -7,8 +7,8 @@ fname_stem=${tmpdir}/part echo "Test 1. Should print 2096818803 2818 twice" -for ((x=0; x<3; ++x)) - do for ((y=0; y<5; ++y)) +for x in 0 1 2 + do for y in 0 1 2 3 4 do pgmmake "."$(( x* 25 + y )) 11 17 > ${fname_stem}_${y}_${x}.pgm done @@ -23,7 +23,7 @@ echo "Test 2. Should print 2096818803 2818 twice" tempfile=${tmpdir}/temp -for ((y=0; y<5; ++y)) +for y in 0 1 2 3 4 do pamundice -across=3 ${fname_stem}"_"$y"_%1a".pgm > ${tempfile}_"$y" done @@ -33,7 +33,7 @@ rm ${tempfile}_[01234] # Note: the following 2 are valid. There should not be warning messages. -for ((x=0; x<3; ++x)) +for x in 0 1 2 do pamundice -down=5 ${fname_stem}"_%1d_"$x.pgm > ${tempfile}"_"$x done @@ -45,15 +45,15 @@ rm ${fname_stem}_?_?.pgm echo "Test 3. Should print 2096818803 2818 twice" -for ((x=0; x<2; ++x)) - do for ((y=0; y<5; ++y)) +for x in 0 1 + do for y in 0 1 2 3 4 do pgmmake "."$(( x* 25 + y )) 12 17 > ${fname_stem}_${y}_${x}.pgm done done -for ((x=2; x<3; ++x)) - do for ((y=0; y<5; ++y)) +for x in 2 + do for y in 0 1 2 3 4 do pgmmake "."$(( x* 25 + y )) 11 17 > ${fname_stem}_${y}_${x}.pgm done @@ -64,15 +64,15 @@ pamundice -across=3 -down=5 \ rm ${fname_stem}_?_?.pgm -for ((x=0; x<3; ++x)) - do for ((y=0; y<4; ++y)) +for x in 0 1 2 + do for y in 0 1 2 3 do pgmmake "."$(( x* 25 + y )) 11 18 > ${fname_stem}_${y}_${x}.pgm done done -for ((x=0; x<3; ++x)) - do for ((y=4; y<5; ++y)) +for x in 0 1 2 + do for y in 4 do pgmmake "."$(( x* 25 + y )) 11 17 > ${fname_stem}_${y}_${x}.pgm done @@ -88,17 +88,17 @@ rm ${fname_stem}_?_?.pgm echo "Test 4. Should print 2434390296 4436 four times" msize=$(pamfile -size maze.pbm) -mw=$(echo ${msize} | cut -d" " -f1) -mh=$(echo ${msize} | cut -d" " -f2) +mw=$(echo ${msize} | cut -d " " -f 1) +mh=$(echo ${msize} | cut -d " " -f 2) pnmtile $((${mw} * 2)) $((${mh} * 5)) maze.pbm | cksum -for x in `seq 0 1` - do for y in `seq 0 4` +for x in 0 1 + do for y in 0 1 2 3 4 do cp maze.pbm ${fname_stem}_${y}_${x}.pbm; done done -for (( i=0 ; i<=9; ++i)) +for i in 0 1 2 3 4 5 6 7 8 9 do echo maze.pbm done | pamundice -down=5 -across=2 -listfile=- | cksum @@ -184,8 +184,10 @@ pamundice -down=5 -across=2 -voverlap=$((${mh}+1)) \ 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} || \ +for i in 0 1 2 3 4 5 6 7 8 9 + do + mktemp -u XXXXXXXXXX.${i} || echo ":::::::::::"${i}":::::::::::" + done | pamundice -down=5 -across=2 -listfile=- > ${test_out} || \ echo -n "Expected failure 11" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pbm-misc-converters.ok b/test/pbm-misc-converters.ok index 4a511d35..1ae5d817 100644 --- a/test/pbm-misc-converters.ok +++ b/test/pbm-misc-converters.ok @@ -1,27 +1,58 @@ +pbmto10x 3017587389 501 +3017587389 501 +pbmto4425 +2529120683 622 2529120683 622 +pbmtoascii +2361485126 1740 2361485126 1740 4017331268 450 -3481527833 672 +pbmtodjvurle +2707446245 1744 2707446245 1744 +pbmtoepson +2100180787 510 2100180787 510 2963515498 510 2100180787 510 1513122412 510 +pbmtogo +34750317 804 34750317 804 +pbmtoibm23xx 1731023722 546 +1731023722 546 +pbmtolj +1540204160 762 1540204160 762 908699854 763 908699854 763 +pbmtoln03 1554612498 636 +1554612498 636 +pbmtomatrixorbital +1574732995 458 1574732995 458 +pbmtonokia +3813814418 972 3813814418 972 1385394245 966 3924854157 972 3970098281 3388 167529797 3384 2260274013 483 +pbmtoplot +2120102625 5318 2120102625 5318 +pbmtoptx 541430122 708 +541430122 708 +pbmtozinc +2297581967 1725 2297581967 1725 +pbmtobbnbg +3481527833 672 +pbmtoppa +3955750161 284701 3955750161 284701 diff --git a/test/pbm-misc-converters.test b/test/pbm-misc-converters.test index 93773e48..ba350bc7 100755 --- a/test/pbm-misc-converters.test +++ b/test/pbm-misc-converters.test @@ -2,39 +2,97 @@ # This script tests: pbmto10x pbmto4425 pbmtoascii pbmtobbnbg # This script tests: pbmtodjvurle pbmtoepson pbmtogo pbmtoibm23xx # This script tests: pbmtolj pbmtoln03 pbmtomatrixorbital pbmtonokia -# This script tests: pbmtoplot pbmtoptx pbmtozinc -# Also requires: pbmpage pbmtoppa +# This script tests: pbmtoplot pbmtoppa pbmtoptx pbmtozinc +# Also requires: pbmpage # Note: one-way test. # These converters do not have counterparts that work in the opposite # direction. We check whether the output is unchanged from older # versions. -pbmto10x maze.pbm | cksum -pbmto4425 maze.pbm | cksum -pbmtoascii maze.pbm | cksum -pbmtoascii -2x4 maze.pbm | cksum -pbmtobbnbg < maze.pbm | cksum -pbmtodjvurle maze.pbm | cksum -pbmtoepson maze.pbm | cksum +echo "pbmto10x" +pbmto10x maze.pbm | cksum +pbmto10x < maze.pbm | cksum + +echo "pbmto4425" +pbmto4425 maze.pbm | cksum +pbmto4425 < maze.pbm | cksum + +# Asciitopgm works in the opposite direction, but the round-trip is not accurate + +echo "pbmtoascii" +pbmtoascii maze.pbm | cksum +pbmtoascii < maze.pbm | cksum +pbmtoascii -2x4 maze.pbm | cksum + +echo "pbmtodjvurle" +pbmtodjvurle maze.pbm | cksum +pbmtodjvurle < maze.pbm | cksum + +echo "pbmtoepson" +pbmtoepson maze.pbm | cksum +pbmtoepson < maze.pbm | cksum pbmtoepson -protocol=escp maze.pbm | cksum pbmtoepson -protocol=escp9 maze.pbm | cksum pbmtoepson -nonadjacent maze.pbm | cksum -pbmtogo maze.pbm | cksum -pbmtoibm23xx -xres=60 -yres=60 maze.pbm | cksum -pbmtolj maze.pbm | cksum -pbmtolj -packbits maze.pbm | cksum -pbmtolj -compress maze.pbm | cksum -pbmtoln03 maze.pbm | cksum -pbmtomatrixorbital < maze.pbm | cksum -pbmtonokia -fmt HEX_NOL maze.pbm | cksum -pbmtonokia -fmt HEX_NGG maze.pbm | cksum -pbmtonokia -fmt HEX_NPM maze.pbm | cksum -pbmtonokia -fmt NOL maze.pbm | cksum -pbmtonokia -fmt NGG maze.pbm | cksum -pbmtonokia -fmt NPM maze.pbm | cksum -pbmtoplot maze.pbm | cksum -pbmtoptx maze.pbm | cksum -pbmtozinc maze.pbm | cksum - -(pbmpage 1; pbmpage 2; pbmpage 3) | pbmtoppa | cksum + +echo "pbmtogo" +pbmtogo maze.pbm | cksum +pbmtogo < maze.pbm | cksum + +echo "pbmtoibm23xx" +pbmtoibm23xx -xres=60 -yres=60 maze.pbm | cksum +pbmtoibm23xx -xres=60 -yres=60 < maze.pbm | cksum + +echo "pbmtolj" +pbmtolj maze.pbm | cksum +pbmtolj < maze.pbm | cksum +pbmtolj -packbits maze.pbm | cksum +pbmtolj -compress maze.pbm | cksum + +echo "pbmtoln03" +pbmtoln03 maze.pbm | cksum +pbmtoln03 < maze.pbm | cksum + +echo "pbmtomatrixorbital" +pbmtomatrixorbital maze.pbm | cksum +pbmtomatrixorbital < maze.pbm | cksum + +echo "pbmtonokia" +pbmtonokia -fmt HEX_NOL maze.pbm | cksum +pbmtonokia -fmt HEX_NOL < maze.pbm | cksum +pbmtonokia -fmt HEX_NGG maze.pbm | cksum +pbmtonokia -fmt HEX_NPM maze.pbm | cksum +pbmtonokia -fmt NOL maze.pbm | cksum +pbmtonokia -fmt NGG maze.pbm | cksum +pbmtonokia -fmt NPM maze.pbm | cksum + +echo "pbmtoplot" +pbmtoplot maze.pbm | cksum +pbmtoplot < maze.pbm | cksum + +echo "pbmtoptx" +pbmtoptx maze.pbm | cksum +pbmtoptx < maze.pbm | cksum + +# pbmtozinc embeds input filename in the output + +echo "pbmtozinc" +pbmtozinc maze.pbm | cksum +pbmtozinc < maze.pbm | sed 's/noname/maze/' | cksum + +# pbmtobbnbg input must be from stdin + +echo "pbmtobbnbg" +pbmtobbnbg < maze.pbm | cksum + +# pbmtoppa has constraints on what can be accepted as input; maze.pbm is not accepted +# pbmpage produces suitable input + +tmpdir=${tmpdir:-/tmp} +testpage_pbm=${tmpdir}/testpage.pbm + +echo "pbmtoppa" +(pbmpage 1; pbmpage 2; pbmpage 3) | tee ${testpage_pbm} | pbmtoppa | cksum +pbmtoppa ${testpage_pbm} | cksum +rm ${testpage_pbm} diff --git a/test/ppmtoapplevol.ok b/test/ppmtoapplevol.ok new file mode 100644 index 00000000..46acda60 --- /dev/null +++ b/test/ppmtoapplevol.ok @@ -0,0 +1,6 @@ +Test: should print 1518149010 3065 +1518149010 3065 +Test Invalid +Expected failure 1 1 +Expected failure 2 1 +Expected failure 3 1 diff --git a/test/ppmtoapplevol.test b/test/ppmtoapplevol.test new file mode 100755 index 00000000..6b109251 --- /dev/null +++ b/test/ppmtoapplevol.test @@ -0,0 +1,30 @@ +#! /bin/sh +# This script tests: ppmtoapplevol +# Also requires: ppmmake pbmmake + +echo "Test: should print 1518149010 3065" +ppmmake rgb:0/0/0 255 12 | ppmtoapplevol | cksum + +echo "Invalid input." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +echo "Test Invalid" + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +pbmmake 10 11 | ppmtoapplevol > ${test_out} || \ + echo -n "Expected failure 1" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmmake 10 13 | ppmtoapplevol > ${test_out} || \ + echo -n "Expected failure 2" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pbmmake 256 12 | ppmtoapplevol > ${test_out} || \ + echo -n "Expected failure 3" + test -s ${test_out}; echo " "$? + rm -f ${test_out} diff --git a/test/stdin-pbm1.ok b/test/stdin-pbm1.ok new file mode 100644 index 00000000..30eaf634 --- /dev/null +++ b/test/stdin-pbm1.ok @@ -0,0 +1,9 @@ +pbmclean: 0 0 0 +pbmlife: 0 0 0 +pbmmask: 0 0 0 +pbmminkowski: 0 0 0 +pbmtoepsi: 0 0 0 +pbmtopsg3: 0 0 0 +pbmpscale 1 : 0 0 0 +pbmreduce -threshold 2 : 0 0 0 +pbmtopgm 2 2 : 0 0 0 diff --git a/test/stdin-pbm1.test b/test/stdin-pbm1.test new file mode 100755 index 00000000..2155b3fa --- /dev/null +++ b/test/stdin-pbm1.test @@ -0,0 +1,43 @@ +#! /bin/sh +# This script tests: pbmclean pbmlife pbmmask pbmminkowski pbmtoepsi +# This script tests: pbmtopsg3 pbmpscale pbmreduce pbmtopgm +# Also requires: pbmmake + +# Tests whether output is unchanged when +# (1) input is a named file: pbm-command input-file +# (2) input is from stdin: pbm-command < input-file + +tmpdir=${tmpdir:-/tmp} +out1=${tmpdir}/out1 +out2=${tmpdir}/out2 +out3=${tmpdir}/out3 +out4=${tmpdir}/out4 +small_pbm=${tmpdir}/small.pbm + +pbmmake -b 3 3 > ${small_pbm} + +for testprog in \ + pbmclean \ + pbmlife \ + pbmmask \ + pbmminkowski \ + pbmtoepsi \ + pbmtopsg3 \ + "pbmpscale 1 " \ + "pbmreduce -threshold 2 " \ + "pbmtopgm 2 2 " + do + ${testprog} ${small_pbm} > ${out1}; status1=$? + ${testprog} < ${small_pbm} > ${out2}; status2=$? + cmp -s ${out1} ${out2} + echo ${testprog}": "${status1} ${status2} $? + done + +rm ${small_pbm} + +# For Pbm converters not tested here see pbm-misc-converters.test + +# These programs do not have a converter in the opposite direction: +# Brushtopbm +# Ddbugtopbm +# Thinkjettopbm (?) diff --git a/test/stdin-pbm2.ok b/test/stdin-pbm2.ok new file mode 100644 index 00000000..0b946f90 --- /dev/null +++ b/test/stdin-pbm2.ok @@ -0,0 +1,28 @@ +pbmtoatk: 0 0 0 +atktopbm: 0 0 0 +pbmtocis: 0 0 0 +cistopbm: 0 0 0 +pbmtocmuwm: 0 0 0 +cmuwmtopbm: 0 0 0 +pbmtoescp2: 0 0 0 +escp2topbm: 0 0 0 +pbmtog3: 0 0 0 +g3topbm: 0 0 0 +pbmtogem: 0 0 0 +gemtopnm: 0 0 0 +pbmtomacp: 0 0 0 +macptopbm: 0 0 0 +pbmtomda: 0 0 0 +mdatopbm: 0 0 0 +pbmtomgr: 0 0 0 +mgrtopbm: 0 0 0 +pbmtomrf: 0 0 0 +mrftopbm: 0 0 0 +pbmtopi3: 0 0 0 +pi3topbm: 0 0 0 +pbmtosunicon: 0 0 0 +sunicontopnm: 0 0 0 +pbmtowbmp: 0 0 0 +wbmptopbm: 0 0 0 +pbmtoybm: 0 0 0 +ybmtopbm: 0 0 0 diff --git a/test/stdin-pbm2.test b/test/stdin-pbm2.test new file mode 100755 index 00000000..b85c875c --- /dev/null +++ b/test/stdin-pbm2.test @@ -0,0 +1,67 @@ +#! /bin/sh +# This script tests: pbmtoatk atktopbm pbmtocis cistopbm pbmtocmuwm cmuwmtopbm +# This script tests: pbmtoescp2 escp2topbm pbmtog3 g3topbm pbmtogem gemtopnm +# This script tests: pbmtomacp macptopbm pbmtomda mdatopbm pbmtomgr mgrtopbm +# This script tests: pbmtomrf mrftopbm pbmtopi3 pi3topbm pbmtosunicon +# This script tests: sunicontopnm pbmtowbmp wbmptopbm pbmtoybm ybmtopbm +# Also requires: + +tmpdir=${tmpdir:-/tmp} +out1=${tmpdir}/out1 +out2=${tmpdir}/out2 +out3=${tmpdir}/out3 +out4=${tmpdir}/out4 + +for fmt in \ + atk \ + cis \ + cmuwm \ + escp2 \ + g3 \ + gem \ + macp \ + mda \ + mgr \ + mrf \ + pi3 \ + sunicon \ + wbmp \ + ybm + do + testprog1="pbmto"${fmt} + + if [ ${fmt} = "sunicon" -o ${fmt} = "gem" ]; + then testprog2=${fmt}"topnm"; + else testprog2=${fmt}"topbm"; + fi + + ${testprog1} testgrid.pbm > ${out1}; status1=$? + ${testprog1} < testgrid.pbm > ${out2}; status2=$? + cmp -s ${out1} ${out2} + echo ${testprog1}": "${status1} ${status2} $? + + ${testprog2} ${out1} > ${out3}; status3=$? + ${testprog2} < ${out1} > ${out4}; status4=$? + + if [ ${fmt} = "xbm" ]; + then sed -i '3s/noname/testgrid/' ${out3}; + fi + + cmp -s ${out3} ${out4} + echo ${testprog2}": "${status3} ${status4} $? + + rm ${out1} ${out2} ${out3} ${out4} + done + +# We don't test Pbmtopgm Pgmtopbm Asciitopbm Asciitopgm here + +# Pbmtopk Pktopbm require resolution output pk file, tk file +# some conditions apply to input image dimensions + +# These three programs embed the input file name in the output +# If the input is from stdin, "noname" +# Pbmtolps tested in lps-roundtrip.test +# Pbmtoxbm xbm-roundtrip.test +# Pbmtozinc pbm-misc-converters.test + +# Icontopbm Pbmtoicon Pbmtox10bm are legacy diff --git a/test/stdin-pgm1.ok b/test/stdin-pgm1.ok new file mode 100644 index 00000000..f2dc323c --- /dev/null +++ b/test/stdin-pgm1.ok @@ -0,0 +1,11 @@ +pgmabel: 0 0 0 +pgmbentley: 0 0 0 +pgmdeshadow: 0 0 0 +pgmenhance: 0 0 0 +pgmhist: 0 0 0 +pgmmedian: 0 0 0 +pgmminkowski: 0 0 0 +pgmtexture: 0 0 0 +pgmtopbm -th : 0 0 0 +pgmtoppm rgb:00/00/00 : 0 0 0 +rawtopgm -headerskip 11 3 3 : 0 0 0 diff --git a/test/stdin-pgm1.test b/test/stdin-pgm1.test new file mode 100755 index 00000000..40376e88 --- /dev/null +++ b/test/stdin-pgm1.test @@ -0,0 +1,46 @@ +#! /bin/sh +# This script tests: pgmabel pgmbentley pgmdeshadow pgmenhance pgmhist +# This script tests: pgmmedian pgmminkowski pgmtexture pgmtopbm pgmtoppm +# This script tests: rawtopgm +# Also requires: pgmmake + +tmpdir=${tmpdir:-/tmp} +small_pgm=${tmpdir}/small.pgm +out1=${tmpdir}/out1 +out2=${tmpdir}/out2 +out3=${tmpdir}/out3 +out4=${tmpdir}/out4 + +pgmmake 0.5 3 3 > ${small_pgm} + +for testprog in \ + pgmabel \ + pgmbentley \ + pgmdeshadow \ + pgmenhance \ + pgmhist \ + pgmmedian \ + pgmminkowski \ + pgmtexture \ + "pgmtopbm -th " \ + "pgmtoppm rgb:00/00/00 " \ + "rawtopgm -headerskip 11 3 3 " + do + ${testprog} ${small_pgm} > ${out1}; status1=$? + ${testprog} < ${small_pgm} > ${out2}; status2=$? + cmp -s ${out1} ${out2} + echo ${testprog}": "${status1} ${status2} $? + rm ${out1} ${out2} + done + +rm ${small_pgm} + + +# Pgmtopgm accepts input only from stdin + +# These three programs are legacy +# Pgmedge +# Pgmnorm +# Pgmoil + +# Pgmmorphconv needs template file diff --git a/test/stdin-pgm2.ok b/test/stdin-pgm2.ok new file mode 100644 index 00000000..719dff1d --- /dev/null +++ b/test/stdin-pgm2.ok @@ -0,0 +1,6 @@ +pgmtofs : 0 0 0 +fstopgm : 0 0 0 +pgmtolispm : 0 0 0 +lispmtopgm : 0 0 0 +pgmtost4 : 0 0 0 +st4topgm : 0 0 0 diff --git a/test/stdin-pgm2.test b/test/stdin-pgm2.test new file mode 100755 index 00000000..49fc4cda --- /dev/null +++ b/test/stdin-pgm2.test @@ -0,0 +1,44 @@ +#! /bin/sh +# This script tests: pgmtofs fstopgm pgmtolispm lispmtopgm pgmtost4 st4topgm +# Also requires: pgmmake + +tmpdir=${tmpdir:-/tmp} +test_pgm=${tmpdir}/test.pgm +out1=${tmpdir}/out1 +out2=${tmpdir}/out2 +out3=${tmpdir}/out3 +out4=${tmpdir}/out4 + +pgmmake 0.75 192 165 > ${test_pgm} + +for fmt in \ + fs \ + lispm \ + st4 + do + testprog1="pgmto"${fmt} + testprog2=${fmt}"topgm" + + ${testprog1} ${test_pgm} > ${out1}; status1=$? + ${testprog1} < ${test_pgm} > ${out2}; status2=$? + cmp -s ${out1} ${out2} + echo ${testprog1}" :" ${status1} ${status2} $? + + ${testprog2} ${out1} > ${out3}; status3=$? + ${testprog2} < ${out1} > ${out4}; status4=$? + cmp -s ${out3} ${out4} + echo ${testprog2}" :" ${status3} ${status4} $? + + rm ${out1} ${out2} ${out3} ${out4} + done + +rm ${test_pgm} + +# pgmtost4 size must be 192 x 165 + +# The following programs do not have converters in the opposite direction +# Bioradtopgm +# Hipstopgm +# Psidtopgm +# Rawtopgm +# Spottopgm diff --git a/test/stdin-pnm1.ok b/test/stdin-pnm1.ok new file mode 100644 index 00000000..53adea98 --- /dev/null +++ b/test/stdin-pnm1.ok @@ -0,0 +1,23 @@ +pnmalias: 0 0 0 +pnmcat -lr : 0 0 0 +pnmcolormap all : 0 0 0 +pnmconvol -matrix=-1,3,-1 : 0 0 0 +pnmcrop: 0 0 0 +pnmgamma -ungamma 0.5 : 0 0 0 +pnmhisteq: 0 0 0 +pnmhistmap: 0 0 0 +pnminvert: 0 0 0 +pnmmargin 2 : 0 0 0 +pnmmercator: 0 0 0 +pnmmontage: 0 0 0 +pnmnlfilt 0.5 0.5 : 0 0 0 +pnmnorm: 0 0 0 +pnmpad: 0 0 0 +pnmquant 64 : 0 0 0 +pnmrotate 90 : 0 0 0 +pnmscalefixed 1 : 0 0 0 +pnmshear 45 : 0 0 0 +pnmsmooth: 0 0 0 +pnmtile 4 4 : 0 0 0 +pnmtoddif: 0 0 0 +pnmtopclxl -colorok : 0 0 0 diff --git a/test/stdin-pnm1.test b/test/stdin-pnm1.test new file mode 100755 index 00000000..e88ceb09 --- /dev/null +++ b/test/stdin-pnm1.test @@ -0,0 +1,59 @@ +#! /bin/sh +# This script tests: pnmalias pnmcat pnmcolormap pnmconvol pnmcrop pnmgamma +# This script tests: pnmhisteq pnmhistmap pnminvert pnmmargin pnmmercator +# This script tests: pnmmontage pnmnlfilt pnmnorm pnmpad pnmquant pnmrotate +# This script tests: pnmscalefixed pnmshear pnmsmooth pnmtile pnmtoddif +# This script tests: pnmtopclxl +# Also requires: ppmpat pamflip + +tmpdir=${tmpdir:-/tmp} +small_ppm=${tmpdir}/test.ppm +out1=${tmpdir}/out1 +out2=${tmpdir}/out2 + +ppmpat -g2 -color=rgb:00/00/ff,rgb:ff/00/00 -mesh 4 4 > ${small_ppm} + +for testprog in \ + pnmalias \ + "pnmcat -lr " \ + "pnmcolormap all " \ + "pnmconvol -matrix=-1,3,-1 " \ + pnmcrop \ + "pnmgamma -ungamma 0.5 " \ + pnmhisteq \ + pnmhistmap \ + pnminvert \ + "pnmmargin 2 " \ + pnmmercator \ + pnmmontage \ + "pnmnlfilt 0.5 0.5 " \ + pnmnorm \ + pnmpad \ + "pnmquant 64 " \ + "pnmrotate 90 " \ + "pnmscalefixed 1 " \ + "pnmshear 45 " \ + pnmsmooth \ + "pnmtile 4 4 " \ + pnmtoddif \ + "pnmtopclxl -colorok " + do + ${testprog} ${small_ppm} > ${out1}; status1=$? + ${testprog} < ${small_ppm} > ${out2}; status2=$? + cmp -s ${out1} ${out2} + echo ${testprog}": "${status1} ${status2} $? + rm ${out1} ${out2} + done + + +rm ${small_ppm} + +# Pnmquantall: overwrites input files +# Pnmremap: requires -mapfile=file +# Pnmpsnr : compares two input files +# Pnmindex: no input from stdin +# Pnmpaste: requires two input files +# Pnmstitch: requires two input files + +# pnmmargin: uses pamflip +# pnmsmooth: uses pnmconvol \ No newline at end of file diff --git a/test/stdin-pnm2.ok b/test/stdin-pnm2.ok new file mode 100644 index 00000000..8c3db709 --- /dev/null +++ b/test/stdin-pnm2.ok @@ -0,0 +1,28 @@ +Test. Should print (command): 0 0 0 +The following are exceptions: should print (command): 0 0 1 +pnmtops, pstopnm, pnmtorle, pnmtoxwd, pnmtotiffcmyk + +pnmtofiasco --progress-meter 0 : 0 0 0 +fiascotopnm: 0 0 0 +pnmtojbig: 0 0 0 +jbigtopnm: 0 0 0 +pnmtojpeg: 0 0 0 +jpegtopnm: 0 0 0 +pnmtopalm: 0 0 0 +palmtopnm: 0 0 0 +pnmtopng: 0 0 0 +pngtopam: 0 0 0 +pnmtops: 0 0 1 +pstopnm: 0 0 1 +pnmtorast: 0 0 0 +rasttopnm: 0 0 0 +pnmtorle: 0 0 1 +rletopnm: 0 0 0 +pnmtosgi: 0 0 0 +sgitopnm: 0 0 0 +pnmtosir: 0 0 0 +sirtopnm: 0 0 0 +pnmtoxwd: 0 0 1 +xwdtopnm: 0 0 0 +pnmtotiffcmyk: 0 0 1 +tifftopnm: 0 0 0 diff --git a/test/stdin-pnm2.test b/test/stdin-pnm2.test new file mode 100755 index 00000000..ee97c992 --- /dev/null +++ b/test/stdin-pnm2.test @@ -0,0 +1,77 @@ +#! /bin/sh +# This script tests: pnmtofiasco fiascotopnm pnmtojbig jbigtopnm pnmtojpeg +# This script tests: jpegtopnm pnmtopalm palmtopnm pnmtopng pngtopam pnmtops +# This script tests: pstopnm pnmtorast rasttopnm pnmtorle rletopnm pnmtosgi +# This script tests: sgitopnm pnmtosir sirtopnm pnmtoxwd xwdtopnm pnmtotiffcmyk +# This script tests: tifftopnm +# Also requires: pgmramp + +tmpdir=${tmpdir:-/tmp} +test_pgm=${tmpdir}/test.pgm +out1=${tmpdir}/out1 +out2=${tmpdir}/out2 +out3=${tmpdir}/out3 +out4=${tmpdir}/out4 + +pgmramp -diag 32 32 > ${test_pgm} + +echo "Test. Should print (command): 0 0 0" +echo "The following are exceptions: should print (command): 0 0 1" +echo "pnmtops, pstopnm, pnmtorle, pnmtoxwd, pnmtotiffcmyk" +echo + +for fmt in \ + fiasco \ + jbig \ + jpeg \ + palm \ + png \ + ps \ + rast \ + rle \ + sgi \ + sir \ + xwd \ + tiffcmyk + do + + if [ ${fmt} = "fiasco" ] + then testprog1="pnmto"${fmt}" --progress-meter 0 "; + else + testprog1="pnmto"${fmt}; + fi + + if [ ${fmt} = "png" ] + then testprog2=${fmt}"topam"; + elif [ ${fmt} = "tiffcmyk" ] + then testprog2="tifftopnm"; + else + testprog2=${fmt}"topnm"; + fi + + ${testprog1} ${test_pgm} > ${out1}; status1=$? + ${testprog1} < ${test_pgm} > ${out2}; status2=$? + cmp -s ${out1} ${out2} + echo ${testprog1}": "${status1} ${status2} $? + + ${testprog2} ${out1} > ${out3}; status3=$? + ${testprog2} < ${out1} > ${out4}; status4=$? + cmp -s ${out3} ${out4} + echo ${testprog2}": "${status3} ${status4} $? + + rm ${out1} ${out2} ${out3} ${out4} + done + +rm ${test_pgm} + + +# pnmtofiasco width, height must be even and at least 32 +# +# pnmtojbig input must be bilevel black-white or gray +# pnmtops input file name embedded in output +# pnmtorle input file name, creation time embedded in output +# file name blank when input is from stdin +# pnmtotiffcmyk input file name embedded in output +# "Standard input" if from stdin +# pnmtoxwd input file name embedded in output +# "stdin" if from stdin diff --git a/test/stdin-ppm1.ok b/test/stdin-ppm1.ok new file mode 100644 index 00000000..d3a7ec5f --- /dev/null +++ b/test/stdin-ppm1.ok @@ -0,0 +1,15 @@ +ppmchange: 0 0 0 +ppmcolormask -color=rgb:0/0/ff : 0 0 0 +ppmdim 0.5 : 0 0 0 +ppmdist: 0 0 0 +ppmdither: 0 0 0 +ppmflash 0.5 : 0 0 0 +ppmglobe 12 : 0 0 0 +ppmhist: 0 0 0 +ppmlabel: 0 0 0 +ppmntsc: 0 0 0 +ppmrelief: 0 0 0 +ppmshadow: 0 0 0 +ppmshift 2 -seed=1 : 0 0 0 +ppmspread 2 -randomseed=1 : 0 0 0 +ppmtv 0.5 : 0 0 0 diff --git a/test/stdin-ppm1.test b/test/stdin-ppm1.test new file mode 100755 index 00000000..67d5da49 --- /dev/null +++ b/test/stdin-ppm1.test @@ -0,0 +1,57 @@ +#! /bin/sh +# This script tests: ppmchange ppmcolormask ppmdim ppmdist ppmdither ppmflash +# This script tests: ppmglobe ppmhist ppmlabel ppmntsc ppmrelief ppmshadow +# This script tests: ppmshift ppmspread ppmtv +# Also requires: ppmpat + +tmpdir=${tmpdir:-/tmp} +test_ppm=${tmpdir}/test.ppm +out1=${tmpdir}/out1 +out2=${tmpdir}/out2 + +ppmpat -g2 -color=rgb:00/00/ff,rgb:ff/00/00 -mesh 12 12 > ${test_ppm} + +for testprog in \ + ppmchange \ + "ppmcolormask -color=rgb:0/0/ff " \ + "ppmdim 0.5 " \ + ppmdist \ + ppmdither \ + "ppmflash 0.5 " \ + "ppmglobe 12 " \ + ppmhist \ + ppmlabel \ + ppmntsc \ + ppmrelief \ + ppmshadow \ + "ppmshift 2 -seed=1 " \ + "ppmspread 2 -randomseed=1 " \ + "ppmtv 0.5 " + do + ${testprog} ${test_ppm} > ${out1}; status1=$? + ${testprog} < ${test_ppm} > ${out2}; status2=$? + cmp -s ${out1} ${out2} + echo ${testprog}": "${status1} ${status2} $? + rm ${out1} ${out2} + done + +rm ${test_ppm} + +# These utlities do not have a counterpart "ppmto*" program + +# Gouldtoppm +# Imgtoppm +# Mtvtoppm +# Pc1toppm +# Pgmtoppm +# Qrttoppm +# Rawtoppm +# Sldtoppm +# Spctoppm +# Ximtoppm + +# Tgatoppm -> Pamtotga +# Xvminitoppm -> Pamtoxvmini + +# Ppm3d and Ppmmix require input two files +# Ppmfade produces a series of output files diff --git a/test/stdin-ppm2.ok b/test/stdin-ppm2.ok new file mode 100644 index 00000000..8e12a25f --- /dev/null +++ b/test/stdin-ppm2.ok @@ -0,0 +1,10 @@ +ppmtoacad: 0 0 0 +ppmtoapplevol: 0 0 0 +ppmtoascii: 0 0 0 +ppmtolj: 0 0 0 +ppmtomitsu: 0 0 0 +ppmtopgm: 0 0 0 +ppmtopuzz: 0 0 0 +ppmtosixel: 0 0 0 +ppmtoterm: 0 0 0 +ppmtoicr: 0 0 0 diff --git a/test/stdin-ppm2.test b/test/stdin-ppm2.test new file mode 100755 index 00000000..63306b1d --- /dev/null +++ b/test/stdin-ppm2.test @@ -0,0 +1,51 @@ +#! /bin/sh +# This script tests: ppmtoacad ppmtoapplevol ppmtoascii ppmtolj ppmtomitsu +# This script tests: ppmtopgm ppmtopuzz ppmtosixel ppmtoterm ppmtoicr +# Also requires: ppmpat + +tmpdir=${tmpdir:-/tmp} +test_ppm=${tmpdir}/test.ppm +out1=${tmpdir}/out1 +out2=${tmpdir}/out2 + +ppmpat -g2 -color=rgb:00/00/ff,rgb:ff/00/00 -mesh 12 12 > ${test_ppm} + +# These converters do not have counterparts in the reverse direction + +for testprog in \ + ppmtoacad \ + ppmtoapplevol \ + ppmtoascii \ + ppmtolj \ + ppmtomitsu \ + ppmtopgm \ + ppmtopuzz \ + ppmtosixel \ + ppmtoterm + do + ${testprog} ${test_ppm} > ${out1}; status1=$? + ${testprog} < ${test_ppm} > ${out2}; status2=$? + cmp -s ${out1} ${out2} + echo ${testprog}": "${status1} ${status2} $? + rm ${out1} ${out2} + done + +rm ${test_ppm} + +testprog=ppmtoicr + + ${testprog} testgrid.pbm > ${out1}; status1=$? + ${testprog} < testgrid.pbm > ${out2}; status2=$? + sed 's/untitled/testgrid.pbm/g' ${out2} | cmp -s ${out1} - + echo ${testprog}": "${status1} ${status2} $? + rm ${out1} ${out2} + +# Ppmtoppm input is from standard input + +# Ppmtoapplevol height must be 12 +# Ppmtoarbtxt needs body template file +# Ppmtompeg parameter file must be given + +# Ppmtoicr file name embedded in output "untitled" if no name + +# Ppmtoyuvsplit produces three output files diff --git a/test/stdin-ppm3.ok b/test/stdin-ppm3.ok new file mode 100644 index 00000000..3dc56137 --- /dev/null +++ b/test/stdin-ppm3.ok @@ -0,0 +1,20 @@ +ppmtobmp: 0 0 0 +bmptopnm: 0 0 0 +ppmtoilbm: 0 0 0 +ilbmtoppm: 0 0 0 +ppmtoleaf: 0 0 0 +leaftoppm: 0 0 0 +ppmtoneo: 0 0 0 +neotoppm: 0 0 0 +ppmtopcx: 0 0 0 +pcxtoppm: 0 0 0 +ppmtopi1: 0 0 0 +pi1toppm: 0 0 0 +ppmtopict: 0 0 0 +picttoppm: 0 0 0 +ppmtopj: 0 0 0 +pjtoppm: 0 0 0 +ppmtospu: 0 0 0 +sputoppm: 0 0 0 +ppmtoxpm: 0 0 0 +xpmtoppm: 0 0 0 diff --git a/test/stdin-ppm3.test b/test/stdin-ppm3.test new file mode 100755 index 00000000..e21718d0 --- /dev/null +++ b/test/stdin-ppm3.test @@ -0,0 +1,72 @@ +#! /bin/sh +# This script tests: ppmtobmp bmptopnm ppmtoilbm ilbmtoppm ppmtoleaf leaftoppm +# This script tests: ppmtoneo neotoppm ppmtopcx pcxtoppm ppmtopi1 pi1toppm +# This script tests: ppmtopict picttoppm ppmtopj pjtoppm ppmtospu sputoppm +# This script tests: ppmtoxpm xpmtoppm +# Also requires: ppmmake + +tmpdir=${tmpdir:-/tmp} +test_ppm=${tmpdir}/test.ppm +out1=${tmpdir}/out1 +out2=${tmpdir}/out2 + +ppmmake -maxval 7 rgb:00/00/00 320 200 > ${test_ppm} + +tmpdir=${tmpdir:-/tmp} +out1=${tmpdir}/out1 +out2=${tmpdir}/out2 +out3=${tmpdir}/out3 +out4=${tmpdir}/out4 + +for fmt in \ + bmp \ + ilbm \ + leaf \ + neo \ + pcx \ + pi1 \ + pict \ + pj \ + spu \ + xpm + do + testprog1="ppmto"${fmt} + if [ ${fmt} = "bmp" ] + then testprog2=${fmt}"topnm"; + else testprog2=${fmt}"toppm"; + fi + + ${testprog1} ${test_ppm} > ${out1}; status1=$? + ${testprog1} < ${test_ppm} > ${out2}; status2=$? + if [ ${fmt} = "xpm" ] + then + sed -i '/^static char/s/static char .* = {/static char file/' \ + ${out1} ${out2}; + fi + cmp -s ${out1} ${out2} + diff ${out1} ${out2} + echo ${testprog1}": "${status1} ${status2} $? + + ${testprog2} ${out1} > ${out3}; status3=$? + ${testprog2} < ${out1} > ${out4}; status4=$? + cmp -s ${out3} ${out4} + echo ${testprog2}": "${status3} ${status4} $? + done + +# asciitopgm +# bmptopnm + +# winicontopam + +# spu width=320 height=200 fixed + +# eyuvtoppm width, height is mandatory +# yuvtoppm width, height is mandatory + +# winicontoppm max size 255 255 + +# xpm maxval 15 or larger + +# yuvsplit splits output into three files + +# ppmtowinicon winicontoppm legacy diff --git a/test/xbm-roundtrip.test b/test/xbm-roundtrip.test index 3f06e9a5..a8754150 100755 --- a/test/xbm-roundtrip.test +++ b/test/xbm-roundtrip.test @@ -1,8 +1,8 @@ -#! /bin/bash +#! /bin/sh # This script tests: pbmtoxbm xbmtopbm # Also requires: echo "Test. Should print 281226646 481 twice" pbmtoxbm maze.pbm | xbmtopbm | cksum -pbmtoxbm -x10 maze.pbm | xbmtopbm | cksum +pbmtoxbm -x10 < maze.pbm | xbmtopbm | cksum -- cgit 1.4.1