diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2014-08-12 01:53:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2014-08-12 01:53:28 +0000 |
commit | 9870c37e41d719d5f85ab7e984699849f7d44a45 (patch) | |
tree | 2cc4238c91bd7e5bc39012abd1059e7caf809239 /test | |
parent | 018221506c4a8ffdd65d18fb8a1c830577e1e2ba (diff) | |
download | netpbm-mirror-9870c37e41d719d5f85ab7e984699849f7d44a45.tar.gz netpbm-mirror-9870c37e41d719d5f85ab7e984699849f7d44a45.tar.xz netpbm-mirror-9870c37e41d719d5f85ab7e984699849f7d44a45.zip |
Add new tests
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2247 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r-- | test/Test-Order | 8 | ||||
-rw-r--r-- | test/atari-roundtrip.ok | 3 | ||||
-rwxr-xr-x | test/atari-roundtrip.test | 40 | ||||
-rw-r--r-- | test/cis-roundtrip.ok | 2 | ||||
-rwxr-xr-x | test/cis-roundtrip.test | 20 | ||||
-rw-r--r-- | test/ilbm-roundtrip.ok | 1 | ||||
-rwxr-xr-x | test/ilbm-roundtrip.test | 20 | ||||
-rw-r--r-- | test/macp-roundtrip.ok | 2 | ||||
-rwxr-xr-x | test/macp-roundtrip.test | 15 | ||||
-rw-r--r-- | test/mda-roundtrip.ok | 2 | ||||
-rwxr-xr-x | test/mda-roundtrip.test | 19 | ||||
-rw-r--r-- | test/pcx-roundtrip.ok | 5 | ||||
-rwxr-xr-x | test/pcx-roundtrip.test | 49 | ||||
-rw-r--r-- | test/pgmbentley.ok | 1 | ||||
-rwxr-xr-x | test/pgmbentley.test | 10 | ||||
-rw-r--r-- | test/pi3-roundtrip.ok | 2 | ||||
-rwxr-xr-x | test/pi3-roundtrip.test | 22 | ||||
-rw-r--r-- | test/pict-roundtrip.ok | 1 | ||||
-rwxr-xr-x | test/pict-roundtrip.test | 15 | ||||
-rw-r--r-- | test/sgi-roundtrip.ok | 6 | ||||
-rwxr-xr-x | test/sgi-roundtrip.test | 38 |
21 files changed, 281 insertions, 0 deletions
diff --git a/test/Test-Order b/test/Test-Order index 9a9210e4..9773caae 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -66,6 +66,7 @@ ppmrelief.test pamedge.test ppmdim.test pnmshear.test +pgmbentley.test ppmmix.test @@ -99,9 +100,11 @@ pamslice-roundtrip.test # Round-trip tests : lossless converters +atari-roundtrip.test atk-roundtrip.test avs-roundtrip.test bmp-roundtrip.test +cis-roundtrip.test cmuw-roundtrip.test facesaver-roundtrip.test fits-roundtrip.test @@ -112,12 +115,17 @@ gif-quant-roundtrip.test hdiff-roundtrip.test jbig-roundtrip.test leaf-roundtrip.test +mda-roundtrip.test mgr-roundtrip.test mrf-roundtrip.test +pcx-roundtrip.test pfm-roundtrip.test +pi3-roundtrip.test +pict-roundtrip.test png-roundtrip.test ps-roundtrip.test ps-alt-roundtrip.test +sgi-roundtrip.test sunrast-roundtrip.test targa-roundtrip.test tiff-roundtrip.test diff --git a/test/atari-roundtrip.ok b/test/atari-roundtrip.ok new file mode 100644 index 00000000..48b8a30a --- /dev/null +++ b/test/atari-roundtrip.ok @@ -0,0 +1,3 @@ +3583332118 192013 +3583332118 192013 +3583332118 192013 diff --git a/test/atari-roundtrip.test b/test/atari-roundtrip.test new file mode 100755 index 00000000..85929a8b --- /dev/null +++ b/test/atari-roundtrip.test @@ -0,0 +1,40 @@ +# This script tests: ppmtopi1 pi1toppm ppmtoneo neotoppm +# Also requires: pgmramp pamscale pbmmake rgb3toppm + + alias ppmtopi1="${PBM_TESTPREFIX}ppmtopi1" + alias pi1toppm="${PBM_TESTPREFIX}pi1toppm" + alias ppmtoneo="${PBM_TESTPREFIX}ppmtoneo" + alias neotoppm="${PBM_TESTPREFIX}neotoppm" + alias pgmramp="${PBM_BINPREFIX}pgmramp" + alias pamscale="${PBM_BINPREFIX}pamscale" + alias pbmmake="${PBM_BINPREFIX}pbmmake" + alias rgb3toppm="${PBM_BINPREFIX}rgb3toppm" + shopt -s expand_aliases + +# Atari pi1 and neo files have the following characteristics: +# Size: 320x200 +# Maxval: 7 +# Color palette: at most 16 entries + +tmpdir=${tmpdir:-/tmp} +t_red=${tmpdir}/t.red +t_grn=${tmpdir}/t.grn +t_blu=${tmpdir}/t.blu +t_ppm=${tmpdir}/t.ppm + +pgmramp -lr -maxval=3 4 1 | \ + pamscale -xscale=80 -yscale=200 -nomix > ${t_red} +pbmmake -g 16 10 | pamenlarge 20 > ${t_grn} +pbmmake -g 8 5 | pamenlarge 40 > ${t_blu} +rgb3toppm ${t_red} ${t_grn} ${t_blu} | pamdepth 7 > ${t_ppm} + +#Test 0. Should print: 3583332118 192013 +cksum < ${t_ppm} + +#Test 1. Should print: 3583332118 192013 +ppmtopi1 ${t_ppm} | pi1toppm | cksum + +#Test 2. Should print: 3583332118 192013 +ppmtoneo ${t_ppm} | neotoppm | cksum + +rm ${t_red} ${t_grn} ${t_blu} ${t_ppm} diff --git a/test/cis-roundtrip.ok b/test/cis-roundtrip.ok new file mode 100644 index 00000000..da90078b --- /dev/null +++ b/test/cis-roundtrip.ok @@ -0,0 +1,2 @@ +2631579683 1546 +2425386270 41 diff --git a/test/cis-roundtrip.test b/test/cis-roundtrip.test new file mode 100755 index 00000000..895fe60e --- /dev/null +++ b/test/cis-roundtrip.test @@ -0,0 +1,20 @@ +#! /bin/bash +# This script tests: pbmtocis cistopbm +# Also requires: pbmmake pamenlarge pamcut + + alias pbmtocis="${PBM_TESTPREFIX}pbmtocis" + alias cistopbm="${PBM_TESTPREFIX}cistopbm" + alias pbmmake="${PBM_BINPREFIX}pbmmake" + alias pamenlarge="${PBM_BINPREFIX}pamenlarge" + alias pamcut="${PBM_BINPREFIX}pamcut" + shopt -s expand_aliases + +# 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 + +# Test 2. Should print 2425386270 41 +pbmtocis testgrid.pbm | cistopbm | pamcut 0 0 14 16 | cksum diff --git a/test/ilbm-roundtrip.ok b/test/ilbm-roundtrip.ok new file mode 100644 index 00000000..82eac5a8 --- /dev/null +++ b/test/ilbm-roundtrip.ok @@ -0,0 +1 @@ +1926073387 101484 diff --git a/test/ilbm-roundtrip.test b/test/ilbm-roundtrip.test new file mode 100755 index 00000000..495daf53 --- /dev/null +++ b/test/ilbm-roundtrip.test @@ -0,0 +1,20 @@ +#! /bin/bash +# This script tests: ppmtoilbm ilbmtoppm +# Also requires: pamseq pamdepth pamtopnm pnmremap + + alias ppmtoilbm="${PBM_TESTPREFIX}ppmtoilbm" + alias ilbmtoppm="${PBM_TESTPREFIX}ilbmtoppm" + alias pamseq="${PBM_BINPREFIX}pamseq" + alias pamdepth="${PBM_BINPREFIX}pamdepth" + alias pamtopnm="${PBM_BINPREFIX}pamtopnm" + alias pnmremap="${PBM_BINPREFIX}pnmremap" + shopt -s expand_aliases + +#Test. Should produce 1926073387 101484 +ppmtoilbm testimg.ppm | ilbmtoppm | cksum + +#Test. Should print 984199586 101484 +pamseq 3 5 -tupletype=RGB | pamdepth 255 | pamtopnm | \ + pnmremap -mapfile=- testimg.ppm | ppmtoilbm | ilbmtoppm | cksum + + diff --git a/test/macp-roundtrip.ok b/test/macp-roundtrip.ok new file mode 100644 index 00000000..20e24348 --- /dev/null +++ b/test/macp-roundtrip.ok @@ -0,0 +1,2 @@ +2425386270 41 +1005016577 51851 diff --git a/test/macp-roundtrip.test b/test/macp-roundtrip.test new file mode 100755 index 00000000..39228e5a --- /dev/null +++ b/test/macp-roundtrip.test @@ -0,0 +1,15 @@ +#! /bin/bash +# This script tests: pbmtomacp macptopbm +# Also requires: pamcrop pbmmake + + alias pbmtomacp="${PBM_TESTPREFIX}pbmtomacp" + alias macptopbm="${PBM_TESTPREFIX}macptopbm" + alias pnmcrop="${PBM_BINPREFIX}pnmcrop" + alias pbmmake="${PBM_BINPREFIX}pbmmake" + shopt -s expand_aliases + +#Test 1. Should produce 2425386270 41 +pbmtomacp testgrid.pbm | macptopbm | pnmcrop | cksum + +#Test 2. Should produce 1005016577 51851 +pbmmake -g 576 720 | pbmtomacp | macptopbm | cksum diff --git a/test/mda-roundtrip.ok b/test/mda-roundtrip.ok new file mode 100644 index 00000000..ef27ffd0 --- /dev/null +++ b/test/mda-roundtrip.ok @@ -0,0 +1,2 @@ +1757803444 169 +2425386270 41 diff --git a/test/mda-roundtrip.test b/test/mda-roundtrip.test new file mode 100755 index 00000000..3bde61ee --- /dev/null +++ b/test/mda-roundtrip.test @@ -0,0 +1,19 @@ +#! /bin/bash +# This script tests: pbmtomda mdatopbm +# Also requires: pbmmake pnmpad pamcut + + alias pbmtomda="${PBM_TESTPREFIX}pbmtomda" + alias mdatopbm="${PBM_TESTPREFIX}mdatopbm" + alias pbmmake="${PBM_BINPREFIX}pbmmake" + alias pnmpad="${PBM_BINPREFIX}pnmpad" + alias pamcut="${PBM_BINPREFIX}pamcut" + shopt -s expand_aliases + +# Pbmtomda requires input width and height to be multiples of 8. + +# Test 1. Should print 1757803444 169 +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 diff --git a/test/pcx-roundtrip.ok b/test/pcx-roundtrip.ok new file mode 100644 index 00000000..968f46b9 --- /dev/null +++ b/test/pcx-roundtrip.ok @@ -0,0 +1,5 @@ +1926073387 101484 +369063776 101484 +369063776 101484 +369063776 101484 +829921912 685 diff --git a/test/pcx-roundtrip.test b/test/pcx-roundtrip.test new file mode 100755 index 00000000..5efbbca9 --- /dev/null +++ b/test/pcx-roundtrip.test @@ -0,0 +1,49 @@ +# This script tests: ppmtopcx pcxtoppm +# Also requires: pnmremap + + alias ppmtopcx="${PBM_TESTPREFIX}ppmtopcx" + alias pcxtoppm="${PBM_TESTPREFIX}pcxtoppm" + alias ppmremap="${PBM_BINPREFIX}ppmremap" + shopt -s expand_aliases + +tmpdir=${tmpdir:-/tmp} +pcxstd_ppm=${tmpdir}/pcxstd_ppm +testpcx_ppm=${tmpdir}/test-pcx.ppm + +cat > ${pcxstd_ppm} << EOF +P3 +16 1 +255 + 0 0 0 + 0 0 170 + 0 170 0 + 0 170 170 +170 0 0 +170 0 170 +170 170 0 +170 170 170 + 85 85 85 + 85 85 255 + 85 255 85 + 85 255 255 +255 85 85 +255 85 255 +255 255 85 +255 255 255 +EOF + +# Test 1. Should print 1926073387 101484 +ppmtopcx testimg.ppm | pcxtoppm | cksum + +# Test 2. Should print 369063776 101484 three times +pnmremap testimg.ppm -mapfile=${pcxstd_ppm} | tee ${testpcx_ppm} | cksum +ppmtopcx -stdpalette -packed ${testpcx_ppm} | pcxtoppm | cksum +ppmtopcx -stdpalette -packed -8bit ${testpcx_ppm} | pcxtoppm | cksum + +rm ${testpcx_ppm} ${pcxstd_ppm} + +# Test 3. Should print 829921912 685 which is the +# result of: +# pgmtoppm < testgrid.pbm | cksum +ppmtopcx -stdpalette -packed testgrid.pbm | pcxtoppm | cksum + diff --git a/test/pgmbentley.ok b/test/pgmbentley.ok new file mode 100644 index 00000000..2ae59958 --- /dev/null +++ b/test/pgmbentley.ok @@ -0,0 +1 @@ +4127286153 16399 diff --git a/test/pgmbentley.test b/test/pgmbentley.test new file mode 100755 index 00000000..8af2c59c --- /dev/null +++ b/test/pgmbentley.test @@ -0,0 +1,10 @@ +#! /bin/bash +# This script tests: pgmbentley +# Also requires: pgmramp + + alias pgmbentley="${PBM_TESTPREFIX}pgmbentley" + alias pgmramp="${PBM_BINPREFIX}pgmramp" + shopt -s expand_aliases + +# Test. Should produce 4127286153 16399 +pgmramp -rect 128 128 | pgmbentley | cksum diff --git a/test/pi3-roundtrip.ok b/test/pi3-roundtrip.ok new file mode 100644 index 00000000..3fde31b1 --- /dev/null +++ b/test/pi3-roundtrip.ok @@ -0,0 +1,2 @@ +3139449799 32011 +2425386270 41 diff --git a/test/pi3-roundtrip.test b/test/pi3-roundtrip.test new file mode 100755 index 00000000..cd4232eb --- /dev/null +++ b/test/pi3-roundtrip.test @@ -0,0 +1,22 @@ +# This script tests: pbmtopi3 pi3topbm +# Also requires: pbmmake pamcut + + alias pbmtopi3="${PBM_TESTPREFIX}pbmtopi3" + alias pi3topbm="${PBM_TESTPREFIX}pi3topbm" + alias pbmmake="${PBM_BINPREFIX}pbmmake" + alias pamcut="${PBM_BINPREFIX}pamcut" + shopt -s expand_aliases + +# The pi3 image format specifies a fixed image size of 640x400. +# Pbmtopi3 rejects images that do not conform. + +# Test +# Should print: 3139449799 32011 +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 + + diff --git a/test/pict-roundtrip.ok b/test/pict-roundtrip.ok new file mode 100644 index 00000000..d50b54bc --- /dev/null +++ b/test/pict-roundtrip.ok @@ -0,0 +1 @@ +984199586 101484 diff --git a/test/pict-roundtrip.test b/test/pict-roundtrip.test new file mode 100755 index 00000000..457cb4b8 --- /dev/null +++ b/test/pict-roundtrip.test @@ -0,0 +1,15 @@ +#! /bin/bash +# This script tests: picttoppm ppmtopict +# Also requires: pamseq pamdepth pamtopnm pnmremap + + alias picttoppm="${PBM_TESTPREFIX}picttoppm" + alias ppmtopict="${PBM_TESTPREFIX}ppmtopict" + alias pamseq="${PBM_BINPREFIX}pamseq" + alias pamdepth="${PBM_BINPREFIX}pamdepth" + alias pamtopnm="${PBM_BINPREFIX}pamtopnm" + alias pnmremap="${PBM_BINPREFIX}pnmremap" + shopt -s expand_aliases + +#Test. Should print 984199586 101484 +pamseq 3 5 -tupletype=RGB | pamdepth 255 | pamtopnm | \ + pnmremap -mapfile=- testimg.ppm | ppmtopict | picttoppm | cksum diff --git a/test/sgi-roundtrip.ok b/test/sgi-roundtrip.ok new file mode 100644 index 00000000..541d59b1 --- /dev/null +++ b/test/sgi-roundtrip.ok @@ -0,0 +1,6 @@ +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +538848130 235 +538848130 235 diff --git a/test/sgi-roundtrip.test b/test/sgi-roundtrip.test new file mode 100755 index 00000000..99b5735e --- /dev/null +++ b/test/sgi-roundtrip.test @@ -0,0 +1,38 @@ +#! /bin/bash +# This script tests: pnmtosgi sgitopnm +# Also requires: rgb3toppm + + alias pnmtosgi="${PBM_TESTPREFIX}pnmtosgi" + alias sgitopnm="${PBM_TESTPREFIX}sgitopnm" + alias rgb3toppm="${PBM_BINPREFIX}rgb3toppm" + shopt -s expand_aliases + +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 +pnmtosgi -rle testimg.ppm | tee ${a_sgi} | sgitopnm | cksum +sgitopnm -channel=0 ${a_sgi} > ${a_red} +sgitopnm -channel=1 ${a_sgi} > ${a_grn} +sgitopnm -channel=2 ${a_sgi} > ${a_blu} +rgb3toppm ${a_red} ${a_grn} ${a_blu} | cksum +rm ${a_sgi} ${a_red} ${a_grn} ${a_blu} + +b_sgi=${tmpdir}/b.sgi +b_red=${tmpdir}/b.red +b_grn=${tmpdir}/b.grn +b_blu=${tmpdir}/b.blu + +# 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} +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 |