diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-10-12 16:57:22 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-10-12 16:57:22 +0000 |
commit | b5ce2c1e17a2c54884abdab3b2c562aa7c4f405a (patch) | |
tree | 2aecad4349f6a9884d166ade65fdef6ffe4105b9 | |
parent | c713f21f968f56f2cab2881a7784b735bbc219a8 (diff) | |
download | netpbm-mirror-b5ce2c1e17a2c54884abdab3b2c562aa7c4f405a.tar.gz netpbm-mirror-b5ce2c1e17a2c54884abdab3b2c562aa7c4f405a.tar.xz netpbm-mirror-b5ce2c1e17a2c54884abdab3b2c562aa7c4f405a.zip |
Add tests for pbmtoascii, ppmtoascii
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4962 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | test/Test-Order | 2 | ||||
-rw-r--r-- | test/pbm-misc-converters.ok | 4 | ||||
-rwxr-xr-x | test/pbm-misc-converters.test | 13 | ||||
-rw-r--r-- | test/pbmtoascii.ok | 56 | ||||
-rwxr-xr-x | test/pbmtoascii.test | 69 | ||||
-rw-r--r-- | test/ppmtoascii.ok | 6 | ||||
-rwxr-xr-x | test/ppmtoascii.test | 17 |
7 files changed, 153 insertions, 14 deletions
diff --git a/test/Test-Order b/test/Test-Order index b4e1f659..e7d73027 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -179,7 +179,9 @@ pbm-misc-converters.test pamtopdbimg.test pamtosvg.test +pbmtoascii.test pbmtog3.test +ppmtoascii.test ppmtoapplevol.test ppmtomitsu.test 411toppm.test diff --git a/test/pbm-misc-converters.ok b/test/pbm-misc-converters.ok index 1ae5d817..2a9d1cee 100644 --- a/test/pbm-misc-converters.ok +++ b/test/pbm-misc-converters.ok @@ -4,10 +4,6 @@ pbmto10x pbmto4425 2529120683 622 2529120683 622 -pbmtoascii -2361485126 1740 -2361485126 1740 -4017331268 450 pbmtodjvurle 2707446245 1744 2707446245 1744 diff --git a/test/pbm-misc-converters.test b/test/pbm-misc-converters.test index ba350bc7..ca94a4ae 100755 --- a/test/pbm-misc-converters.test +++ b/test/pbm-misc-converters.test @@ -1,7 +1,7 @@ #! /bin/sh -# This script tests: pbmto10x pbmto4425 pbmtoascii pbmtobbnbg -# This script tests: pbmtodjvurle pbmtoepson pbmtogo pbmtoibm23xx -# This script tests: pbmtolj pbmtoln03 pbmtomatrixorbital pbmtonokia +# This script tests: pbmto10x pbmto4425 pbmtobbnbg pbmtodjvurle +# This script tests: pbmtoepson pbmtogo pbmtoibm23xx pbmtolj +# This script tests: pbmtoln03 pbmtomatrixorbital pbmtonokia # This script tests: pbmtoplot pbmtoppa pbmtoptx pbmtozinc # Also requires: pbmpage @@ -18,13 +18,6 @@ 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 diff --git a/test/pbmtoascii.ok b/test/pbmtoascii.ok new file mode 100644 index 00000000..00469f8f --- /dev/null +++ b/test/pbmtoascii.ok @@ -0,0 +1,56 @@ +Test 1. +o"o"o"o"o"o"o"o"o"o"o"o"o"o"o"o +o"o"o"o"o"o"o"o"o"o"o"o"o"o"o"o +o"o"o"o"o"o"o"o"o"o"o"o"o"o"o"o +o"o"o"o"o"o"o"o"o"o"o"o"o"o"o"o" +o"o"o"o"o"o"o"o"o"o"o"o"o"o"o"o" +o"o"o"o"o"o"o"o"o"o"o"o"o"o"o"o" +Test 2.1 +MM + +o" +Test 2.2 +MMMM +MMMM + + +o"o" +o"o" +Test 2.3 +MM + +SS +Test 3. +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +"""""""""""""""""""""""""""""""""""""""" + +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM + +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +"""""""""""""""""""""""""""""""""""""""""" +Test 4. Should print 2361485126 1740 twice +2361485126 1740 +2361485126 1740 +Test 5. Should print 4017331268 450 twice +4017331268 450 +4017331268 450 +Test 6. Should print 3978896638 232 twice +3978896638 232 +3978896638 232 +Test 7. Should print 3334512471 3343 twice +3334512471 3343 +3334512471 3343 +Test 8. Should print match twice +match +match +Test Invalid +Expected failure 1 (no output) +Expected failure 2 (no output) diff --git a/test/pbmtoascii.test b/test/pbmtoascii.test new file mode 100755 index 00000000..847f4e5c --- /dev/null +++ b/test/pbmtoascii.test @@ -0,0 +1,69 @@ +#! /bin/sh +# This script tests: pbmtoascii +# Also requires: pbmmake pamenlarge pbmtoascii asciitopgm + +echo "Test 1." + +pbmmake -g 31 6 | pbmtoascii +pbmmake -g 32 6 | pbmtoascii + +echo "Test 2.1" + +pbmmake -b 2 2 | pbmtoascii +pbmmake -w 2 2 | pbmtoascii +pbmmake -g 2 2 | pbmtoascii + +echo "Test 2.2" + +pbmmake -b 4 4 | pbmtoascii +pbmmake -w 4 4 | pbmtoascii +pbmmake -g 4 4 | pbmtoascii + +echo "Test 2.3" + +pbmmake -b 4 4 | pbmtoascii -2x4 +pbmmake -w 4 4 | pbmtoascii -2x4 +pbmmake -g 4 4 | pbmtoascii -2x4 + +echo "Test 3." + +pbmmake -b 40 7 | pbmtoascii +echo +pbmmake -b 41 8 | pbmtoascii +echo +pbmmake -b 42 9 | pbmtoascii + +echo "Test 4. Should print 2361485126 1740 twice" + +pbmtoascii maze.pbm | cksum +pbmtoascii -1x2 maze.pbm | cksum + +echo "Test 5. Should print 4017331268 450 twice" + +pbmtoascii -2x4 < maze.pbm | cksum +pbmtoascii -2x4 maze.pbm | cksum + +echo "Test 6. Should print 3978896638 232 twice" +# Use Pamenlarge 1 to convert to plain format without additional requirements + +pamenlarge -plain 1 testgrid.pbm | sed -e 1,2d -e 'y/01/ M/' -e 's/ *$//' | cksum +pamenlarge -xscale 1 -yscale 2 testgrid.pbm | pbmtoascii | cksum + +echo "Test 7. Should print 3334512471 3343 twice" + +pamenlarge -plain 1 maze.pbm | sed -e 1,2d -e 'y/01/ M/' -e 's/ *$//' | cksum +pamenlarge -xscale 1 -yscale 2 maze.pbm | pbmtoascii | cksum + +echo "Test 8. Should print match twice" + +pamenlarge -xscale 1 -yscale 2 maze.pbm | pbmtoascii | asciitopgm 59 57 | pgmtopbm |\ + cmp maze.pbm - && echo "match" || echo "no match" +pamenlarge -xscale 1 -yscale 2 testgrid.pbm | pbmtoascii | asciitopgm 16 14 | pgmtopbm |\ + cmp testgrid.pbm - && echo "match" || echo "no match" + +echo "Test Invalid" + +. ${srcdir}/test-invalid.inc + +invCmd "pbmtoascii -1x2 -2x4 testgrid.pbm" +invCmd "pbmtoascii testimg.ppm" diff --git a/test/ppmtoascii.ok b/test/ppmtoascii.ok new file mode 100644 index 00000000..3c26835d --- /dev/null +++ b/test/ppmtoascii.ok @@ -0,0 +1,6 @@ +Test 1. Should print 242428674 57 three times +242428674 57 +242428674 57 +242428674 57 +Test Invalid +Expected failure 1 (no output) diff --git a/test/ppmtoascii.test b/test/ppmtoascii.test new file mode 100755 index 00000000..b5e03966 --- /dev/null +++ b/test/ppmtoascii.test @@ -0,0 +1,17 @@ +#! /bin/sh +# This script tests: ppmtoascii +# Also requires: pamseq pamenlarge + +echo "Test 1. Should print 242428674 57 three times" + +pamseq 3 1 | pamenlarge -xscale 1 -yscale 2 | ppmtoascii | cksum +pamseq 3 1 | pamenlarge -xscale 1 -yscale 2 | ppmtoascii -1x2 | cksum +pamseq 3 1 | pamenlarge -xscale 2 -yscale 4 | ppmtoascii -2x4 | cksum + + +echo "Test Invalid" + +. ./test-invalid.inc + +invCmd "ppmtoascii -1x2 -2x4 testimg.ppm" + |