From 31b2f7ca49f576a9b7a5fe6b0cfed343c82d9d09 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 16 Sep 2023 22:57:46 +0000 Subject: test updates; move some tests from other directories to test directory, improve ppmrough, xwd-roundtrip git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4663 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/pamtosvg/pamtosvg.test | 8 ---- converter/ppm/ppmtomitsu.test | 12 ----- generator/pamstereogram.test | 70 ----------------------------- test/Test-Order | 6 +++ test/pamstereogram.ok | 32 ++++++++++++++ test/pamstereogram.test | 80 ++++++++++++++++++++++++++++++++++ test/pamtosvg.ok | 4 ++ test/pamtosvg.test | 45 +++++++++++++++++++ test/ppmrough.ok | 23 ++++++++++ test/ppmrough.test | 46 ++++++++++++++++++- test/ppmtomitsu.ok | 14 ++++++ test/ppmtomitsu.test | 31 +++++++++++++ test/xwd-roundtrip.ok | 7 ++- test/xwd-roundtrip.test | 17 +++++--- 14 files changed, 296 insertions(+), 99 deletions(-) delete mode 100644 converter/other/pamtosvg/pamtosvg.test delete mode 100644 converter/ppm/ppmtomitsu.test delete mode 100644 generator/pamstereogram.test create mode 100755 test/pamstereogram.ok create mode 100755 test/pamstereogram.test create mode 100755 test/pamtosvg.ok create mode 100755 test/pamtosvg.test create mode 100755 test/ppmtomitsu.ok create mode 100755 test/ppmtomitsu.test diff --git a/converter/other/pamtosvg/pamtosvg.test b/converter/other/pamtosvg/pamtosvg.test deleted file mode 100644 index 3217287e..00000000 --- a/converter/other/pamtosvg/pamtosvg.test +++ /dev/null @@ -1,8 +0,0 @@ -echo "Test 1. Should print nothing" -# This will print nothing if successful (diff will find no difference) -ppmmake black 20 20 | ppmdraw -script="line 5 2 15 17" | ./pamtosvg | \ - diff testline.svg - - -echo "Test 2. Should print nothing" -# This will print nothing if successful (diff will find no difference) -./pamtosvg ../../../testgrid.pbm | diff testgrid.svg - diff --git a/converter/ppm/ppmtomitsu.test b/converter/ppm/ppmtomitsu.test deleted file mode 100644 index f574d927..00000000 --- a/converter/ppm/ppmtomitsu.test +++ /dev/null @@ -1,12 +0,0 @@ -echo Test 1. Should print 3110813682 101562 -./ppmtomitsu ../../testimg.ppm | cksum -echo Test 2. Should print 239186803 34399 -pnmquant 100 ../../testimg.ppm | ./ppmtomitsu | cksum -echo Test 3. Should print 3201293405 310 -./ppmtomitsu ../../testgrid.pbm | cksum -echo Test 4. Should print 3354679572 752 -./ppmtomitsu -tiny ../../testgrid.pbm | cksum -echo Test 5. Should print 3999654426 101549 -./ppmtomitsu -tiny ../../testimg.ppm | cksum -echo Test 2. Should print 3078685526 101549 -pnmquant 100 ../../testimg.ppm | ./ppmtomitsu -tiny | cksum diff --git a/generator/pamstereogram.test b/generator/pamstereogram.test deleted file mode 100644 index 80f70ee0..00000000 --- a/generator/pamstereogram.test +++ /dev/null @@ -1,70 +0,0 @@ -# Make some input files -pamdepth -quiet 255 ../testgrid.pbm >/tmp/testgrid.pgm - - -# Random pattern - -echo Test 01. Should print 610673698 293: -./pamstereogram -randomseed=1 ../testgrid.pbm | cksum -echo Test 02. Should print 610673698 293: -./pamstereogram -randomseed=1 -blackandwhite ../testgrid.pbm | cksum -echo Test 03. Should print 3439084201 170: -pamseq -tupletype=GRAYSCALE 1 100 | ./pamstereogram -randomseed=1 | cksum -echo Test 04. Should print 2484923390 1070: -pamgauss 100 10 -maxval=10000 -sigma 20 | pamfunc -multiplier=500 | \ - ./pamstereogram -randomseed=1 -dpi=10 | cksum - -# Makemask - -echo Test 10. Should print 1266273778 293: -./pamstereogram -randomseed=1 -makemask ../testgrid.pbm | cksum - -echo Test 11. Should print 3034751595 1070: -pamgauss 100 10 -maxval=10000 -sigma 20 | pamfunc -multiplier=500 | \ - ./pamstereogram -randomseed=1 -dpi=10 -makemask | cksum - -# Grayscale - -echo Test 20. Should print 2468969328 289: -./pamstereogram -randomseed=1 -grayscale ../testgrid.pbm | cksum -echo Test 21. Should print 1946982115 4068: -pamseq 1 100 | pnmtile 200 20 | \ - ./pamstereogram -randomseed=1 -dpi=10 -grayscale | \ - cksum -echo Test 22. Should print 2078013430 4068: -pamseq 1 100 | pnmtile 200 20 | \ - ./pamstereogram -randomseed=1 -dpi=10 -grayscale -maxval 255 | \ - cksum - -# Color - -echo Test 30. Should print 1319392622 731: -./pamstereogram -randomseed=1 -color ../testgrid.pbm | cksum -echo Test 31. Should print 389886159 12062: -pamseq 1 100 | pnmtile 200 20 | \ - ./pamstereogram -randomseed=1 -dpi=10 -color | \ - cksum - -# Pattern file - -echo Test 40. Should print 1834916830 660: -pamgradient black gray50 white gray50 100 50 | \ - ./pamstereogram -patfile ../testgrid.pbm -eyesep=.1 -crosseyed | cksum - -echo Test 41. Should print 4016818756 5014: -pamgradient black gray50 white gray50 100 50 | \ - ./pamstereogram -patfile /tmp/testgrid.pgm -eyesep=.1 -crosseyed | cksum - -# drawguides - -echo Test 51. Should print 2365956562 11071: -pamgradient black gray50 white gray50 100 50 | \ - ./pamstereogram -randomseed=1 -dpi 10 -guidesize=20 | cksum - -echo Test 51. Should print 3502025270 1441: -pamgradient black gray50 white gray50 100 50 | \ - ./pamstereogram -patfile=../testgrid.pbm -dpi 10 -guidesize=20 | cksum - - -# Clean up files we created -rm /tmp/testgrid.pgm diff --git a/test/Test-Order b/test/Test-Order index 7bec1002..63a071d9 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -27,6 +27,8 @@ pamcrater.test ppmpat.test ppmforge-parameters.test +pamstereogram.test + # Generators with random components pbmnoise1.test @@ -137,6 +139,8 @@ pammixmulti-identity.test pamaddnoise-parameters.test +pamstack.test + # Symmetry test symmetry.test @@ -161,8 +165,10 @@ pbm-misc-converters.test # Format converter tests pamtopdbimg.test +pamtosvg.test pbmtog3.test ppmtoapplevol.test +ppmtomitsu.test 411toppm.test eyuvtoppm.test rawtoppm.test diff --git a/test/pamstereogram.ok b/test/pamstereogram.ok new file mode 100755 index 00000000..265a4fc5 --- /dev/null +++ b/test/pamstereogram.ok @@ -0,0 +1,32 @@ +Test 00. Should print 729348909 237 +729348909 237 +Test 01. Should print 3308667841 293 +3308667841 293 +Test 02. Should print 3308667841 293 +3308667841 293 +Test 03. Should print 748200469 170 +748200469 170 +Test 04. Should print 1538641408 1070 +1538641408 1070 +Test 10. Should print 1266273778 293 +1266273778 293 +Test 11. Should print 55276708 1070 +55276708 1070 +Test 20. Should print 1920539795 289 +1920539795 289 +Test 21. Should print 4069109690 4068 +4069109690 4068 +Test 22. Should print 1163376052 4068 +1163376052 4068 +Test 30. Should print 2127252909 731 +2127252909 731 +Test 31. Should print 858421050 12062 +858421050 12062 +Test 40. Should print 1236679620 660 +1236679620 660 +Test 41. Should print 1022068930 5014 +1022068930 5014 +Test 51. Should print 3784833098 11071 +3784833098 11071 +Test 52. Should print 1419662425 1441 +1419662425 1441 diff --git a/test/pamstereogram.test b/test/pamstereogram.test new file mode 100755 index 00000000..02da9724 --- /dev/null +++ b/test/pamstereogram.test @@ -0,0 +1,80 @@ +#! /bin/sh +# This script tests: pamstereogram +# Also requires: pamdepth + +tmpdir=${tmpdir:-/tmp} +testgrid_pgm=${tmpdir}/testgrid.pgm + +# Make input file + +echo "Test 00. Should print 729348909 237" +pamdepth -quiet 255 testgrid.pbm | tee ${testgrid_pgm} | cksum + + +# Random pattern + +echo "Test 01. Should print 3308667841 293" +pamstereogram -randomseed=1 testgrid.pbm | cksum +echo "Test 02. Should print 3308667841 293" +pamstereogram -randomseed=1 -blackandwhite testgrid.pbm | cksum +echo "Test 03. Should print 748200469 170" +pamseq -tupletype=GRAYSCALE 1 100 | pamstereogram -randomseed=1 | cksum +echo "Test 04. Should print 1538641408 1070" +pamgauss 100 10 -maxval=10000 -sigma 20 | pamfunc -multiplier=500 | \ + pamstereogram -randomseed=1 -dpi=10 | cksum + +# Makemask + +echo "Test 10. Should print 1266273778 293" +pamstereogram -randomseed=1 -makemask testgrid.pbm | cksum + +echo "Test 11. Should print 55276708 1070" +pamgauss 100 10 -maxval=10000 -sigma 20 | pamfunc -multiplier=500 | \ + pamstereogram -randomseed=1 -dpi=10 -makemask | cksum + +# Grayscale + +echo "Test 20. Should print 1920539795 289" +pamstereogram -randomseed=1 -grayscale testgrid.pbm | cksum +echo "Test 21. Should print 4069109690 4068" +pamseq 1 100 | pnmtile 200 20 | \ + pamstereogram -randomseed=1 -dpi=10 -grayscale | \ + cksum +echo "Test 22. Should print 1163376052 4068" +pamseq 1 100 | pnmtile 200 20 | \ + pamstereogram -randomseed=1 -dpi=10 -grayscale -maxval 255 | \ + cksum + +# Color + +echo "Test 30. Should print 2127252909 731" +pamstereogram -randomseed=1 -color testgrid.pbm | cksum +echo "Test 31. Should print 858421050 12062" +pamseq 1 100 | pnmtile 200 20 | \ + pamstereogram -randomseed=1 -dpi=10 -color | \ + cksum + +# Pattern file + +echo "Test 40. Should print 1236679620 660" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -patfile testgrid.pbm -eyesep=.1 -crosseyed | cksum + +echo "Test 41. Should print 1022068930 5014" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -patfile ${testgrid_pgm} -eyesep=.1 -crosseyed | cksum + +# drawguides + +echo "Test 51. Should print 3784833098 11071" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -randomseed=1 -dpi 10 -guidesize=20 -guidetop | cksum + +echo "Test 52. Should print 1419662425 1441" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -patfile=testgrid.pbm -dpi 10 -guidesize=20 -guidetop | cksum + + +# Clean up files we created +rm ${testgrid_pgm} + diff --git a/test/pamtosvg.ok b/test/pamtosvg.ok new file mode 100755 index 00000000..918555e0 --- /dev/null +++ b/test/pamtosvg.ok @@ -0,0 +1,4 @@ +Test 1. Should print match +match +Test 2. Should print match +match diff --git a/test/pamtosvg.test b/test/pamtosvg.test new file mode 100755 index 00000000..332040ea --- /dev/null +++ b/test/pamtosvg.test @@ -0,0 +1,45 @@ +#! /bin/sh +# This script tests: pamtosvg +# Also requires: ppmmake ppmdraw + +tmpdir=${tmpdir:-/tmp} +testline_svg=${tmpdir}/testline.svg +testgrid_svg=${tmpdir}/testgrid.svg + +cat > ${testline_svg} << EOF + + + + + +EOF + +echo "Test 1. Should print match" + +ppmmake black 20 20 | ppmdraw -script="line 5 2 15 17" | pamtosvg |\ + cmp -s ${testline_svg} - && echo "match" || echo "no match" +rm ${testline_svg} + +cat > ${testgrid_svg} << EOF + + + + + +EOF + +echo "Test 2. Should print match" + +pamtosvg testgrid.pbm | tee /tmp/a2 |\ + cmp -s ${testgrid_svg} - && echo "match" || echo "no match" +rm ${testgrid_svg} diff --git a/test/ppmrough.ok b/test/ppmrough.ok index 83643849..4beff006 100755 --- a/test/ppmrough.ok +++ b/test/ppmrough.ok @@ -1 +1,24 @@ +Test 1. Should print 378403602 30015 378403602 30015 +Test 2. Should print 378403602 30015 +378403602 30015 +Test 3. Should print 535171440 30015 +535171440 30015 +Test 4. Should print 937167683 30015 +937167683 30015 +Test 5. Should print 1927474861 30015 +1927474861 30015 +Test 6. Should print 3596045345 30015 +3596045345 30015 +Test 7. Should print 198510149 30015 +198510149 30015 +Test 8. Should print 1128371780 30015 +1128371780 30015 +Test 9. Should print 2909877411 30015 +2909877411 30015 +Test 10. Should print 2820370592 30015 +2820370592 30015 +Test 11. Should print 2028409204 30015 +2028409204 30015 +Test 12. Should print 4234304830 30015 +4234304830 30015 diff --git a/test/ppmrough.test b/test/ppmrough.test index b10ba941..e1d720d5 100755 --- a/test/ppmrough.test +++ b/test/ppmrough.test @@ -2,5 +2,47 @@ # This script tests: ppmrough # Also requires: -# Should print: 378403602 30015 (Glibc and MAC OS) -ppmrough -randomseed 1 | cksum +defaultopts="-randomseed 1 -bg rgb:00/ff/ff -fg rgb:ff/ff/00 -w 100 -h 100" + +# No border + +echo "Test 1. Should print 378403602 30015" +ppmrough -randomseed 1 | cksum + +echo "Test 2. Should print 378403602 30015" +ppmrough -randomseed 1 -var 0 | cksum + +# Vertical border + +echo "Test 3. Should print 535171440 30015" +ppmrough ${defaultopts} -left 20 | cksum + +echo "Test 4. Should print 937167683 30015" +ppmrough ${defaultopts} -right 20 | cksum + +echo "Test 5. Should print 1927474861 30015" +ppmrough ${defaultopts} -left 50 | cksum + +echo "Test 6. Should print 3596045345 30015" +ppmrough ${defaultopts} -right 50 | cksum + +echo "Test 7. Should print 198510149 30015" +ppmrough ${defaultopts} -right 20 -var 0 | cksum + +# Horizontal border + +echo "Test 8. Should print 1128371780 30015" +ppmrough ${defaultopts} -top 30 | cksum + +echo "Test 9. Should print 2909877411 30015" +ppmrough ${defaultopts} -bottom 25 | cksum + +echo "Test 10. Should print 2820370592 30015" +ppmrough ${defaultopts} -top 50 | cksum + +echo "Test 11. Should print 2028409204 30015" +ppmrough ${defaultopts} -bottom 50 | cksum + +echo "Test 12. Should print 4234304830 30015" +ppmrough ${defaultopts} -bottom 10 -var 0 | cksum + diff --git a/test/ppmtomitsu.ok b/test/ppmtomitsu.ok new file mode 100755 index 00000000..951189d4 --- /dev/null +++ b/test/ppmtomitsu.ok @@ -0,0 +1,14 @@ +Test 0. Should print 458455366 101484 +458455366 101484 +Test 1. Should print 3110813682 101562 +3110813682 101562 +Test 2. Should print 4168174994 34399 +4168174994 34399 +Test 3. Should print 3201293405 310 +3201293405 310 +Test 4. Should print 3354679572 752 +3354679572 752 +Test 5. Should print 3999654426 101549 +3999654426 101549 +Test 6. Should print 4201246884 101549 +4201246884 101549 diff --git a/test/ppmtomitsu.test b/test/ppmtomitsu.test new file mode 100755 index 00000000..ce4bbf56 --- /dev/null +++ b/test/ppmtomitsu.test @@ -0,0 +1,31 @@ +#! /bin/sh +# This script tests: ppmtomitsu +# Also requires: pnmcolormap pnmremap + +tmpdir=${tmpdir:-/tmp} +testimg100_ppm=${tmpdir}/testimg100.ppm + +echo "Test 0. Should print 458455366 101484" +# equivalent to: Pnmquant 100 testimg.ppm +pnmcolormap 100 testimg.ppm | pnmremap -nofloyd -mapfile=- testimg.ppm |\ + tee ${testimg100_ppm} | cksum + +echo "Test 1. Should print 3110813682 101562" +ppmtomitsu testimg.ppm | cksum + +echo "Test 2. Should print 4168174994 34399" +ppmtomitsu ${testimg100_ppm} | cksum + +echo "Test 3. Should print 3201293405 310" +ppmtomitsu testgrid.pbm | cksum + +echo "Test 4. Should print 3354679572 752" +ppmtomitsu -tiny testgrid.pbm | cksum + +echo "Test 5. Should print 3999654426 101549" +ppmtomitsu -tiny testimg.ppm | cksum + +echo "Test 6. Should print 4201246884 101549" +ppmtomitsu -tiny ${testimg100_ppm} | cksum + +rm ${testimg100_ppm} diff --git a/test/xwd-roundtrip.ok b/test/xwd-roundtrip.ok index 864d737a..31dcba3e 100644 --- a/test/xwd-roundtrip.ok +++ b/test/xwd-roundtrip.ok @@ -1,6 +1,9 @@ -Test 1. Should produce 1571496937 33838, cksum of testimg.red +Test 1. Should produce 1571496937 33838, cksum of testimg.red twice +1571496937 33838 1571496937 33838 Test 2. Should produce 1926073387 101484 1926073387 101484 -Test 3. Should produce 281226646 481 +Test 3. Should produce 281226646 481 three times +281226646 481 +281226646 481 281226646 481 diff --git a/test/xwd-roundtrip.test b/test/xwd-roundtrip.test index 2d00971d..1583cd68 100755 --- a/test/xwd-roundtrip.test +++ b/test/xwd-roundtrip.test @@ -1,15 +1,22 @@ #! /bin/sh # This script tests: pnmtoxwd xwdtopnm -# Also requires: pamchannel pamtopnm pamdepth +# Also requires: pamchannel pamtopnm pamdepth ppmtopgm -echo "Test 1. Should produce 1571496937 33838, cksum of testimg.red" +echo "Test 1. Should produce 1571496937 33838, cksum of testimg.red twice" pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ pnmtoxwd | xwdtopnm | pamdepth 255 | cksum +pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ + pnmtoxwd -direct | xwdtopnm -quiet | pamdepth 255 | ppmtopgm | cksum + echo "Test 2. Should produce 1926073387 101484" pnmtoxwd --quiet testimg.ppm | \ xwdtopnm --quiet | pamdepth 255 | cksum -echo "Test 3. Should produce 281226646 481" -pnmtoxwd --quiet maze.pbm | \ - xwdtopnm | cksum +echo "Test 3. Should produce 281226646 481 three times" +pnmtoxwd --quiet maze.pbm | xwdtopnm | cksum + +pnmtoxwd --quiet -pseudodepth 1 maze.pbm | xwdtopnm | cksum + +pnmtoxwd --quiet -pseudodepth 16 maze.pbm | xwdtopnm | cksum + -- cgit 1.4.1