diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-11-25 23:02:05 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-11-25 23:02:05 +0000 |
commit | 33d7c4aaf44705573e4d9a53a706e594b6c7cdb8 (patch) | |
tree | 781d4d0a1bb24f42b9a5465b3512444436428033 /test | |
parent | 2bac3b28489811b74478118dcfce12c9232d8f5e (diff) | |
download | netpbm-mirror-33d7c4aaf44705573e4d9a53a706e594b6c7cdb8.tar.gz netpbm-mirror-33d7c4aaf44705573e4d9a53a706e594b6c7cdb8.tar.xz netpbm-mirror-33d7c4aaf44705573e4d9a53a706e594b6c7cdb8.zip |
avoid false negatives in tests where input generation fails; add tests for -os2, -windows, -mapfile to BMP roundtrip test
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3441 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r-- | test/Test-Order | 1 | ||||
-rw-r--r-- | test/bmp-quant-roundtrip.ok | 6 | ||||
-rwxr-xr-x | test/bmp-quant-roundtrip.test | 36 | ||||
-rw-r--r-- | test/bmp-roundtrip.ok | 20 | ||||
-rwxr-xr-x | test/bmp-roundtrip.test | 41 | ||||
-rw-r--r-- | test/g3-roundtrip.ok | 20 | ||||
-rwxr-xr-x | test/g3-roundtrip.test | 20 | ||||
-rw-r--r-- | test/gif-quant-roundtrip.ok | 2 | ||||
-rwxr-xr-x | test/gif-quant-roundtrip.test | 2 | ||||
-rw-r--r-- | test/gif-roundtrip.ok | 20 | ||||
-rwxr-xr-x | test/gif-roundtrip.test | 8 | ||||
-rw-r--r-- | test/palm-roundtrip.ok | 8 | ||||
-rwxr-xr-x | test/palm-roundtrip.test | 2 | ||||
-rw-r--r-- | test/pbmtext-utf8.ok | 4 | ||||
-rwxr-xr-x | test/pbmtext-utf8.test | 4 | ||||
-rw-r--r-- | test/pdb-roundtrip.ok | 22 | ||||
-rwxr-xr-x | test/pdb-roundtrip.test | 6 | ||||
-rw-r--r-- | test/pnmtile.ok | 2 | ||||
-rwxr-xr-x | test/pnmtile.test | 2 | ||||
-rw-r--r-- | test/rgb3-roundtrip.ok | 2 | ||||
-rwxr-xr-x | test/rgb3-roundtrip.test | 2 | ||||
-rw-r--r-- | test/targa-roundtrip.ok | 28 | ||||
-rwxr-xr-x | test/targa-roundtrip.test | 6 |
23 files changed, 180 insertions, 84 deletions
diff --git a/test/Test-Order b/test/Test-Order index 6abc2287..fbeaf6a3 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -119,6 +119,7 @@ atari-roundtrip.test atk-roundtrip.test avs-roundtrip.test bmp-roundtrip.test +bmp-quant-roundtrip.test cis-roundtrip.test cmuw-roundtrip.test facesaver-roundtrip.test diff --git a/test/bmp-quant-roundtrip.ok b/test/bmp-quant-roundtrip.ok new file mode 100644 index 00000000..5262df53 --- /dev/null +++ b/test/bmp-quant-roundtrip.ok @@ -0,0 +1,6 @@ +colors=256, bpp=8 +0 0 0 : 0 +0 0 0 : 0 +colors=16, bpp=4 +0 0 0 : 0 +0 0 0 : 0 diff --git a/test/bmp-quant-roundtrip.test b/test/bmp-quant-roundtrip.test new file mode 100755 index 00000000..2c223b7c --- /dev/null +++ b/test/bmp-quant-roundtrip.test @@ -0,0 +1,36 @@ +#! /bin/bash +# This script tests: bmptopnm ppmtobmp pnmquant +# Also requires: ppmhist + +tmpdir=${tmpdir:-/tmp} +quant_ppm=${tmpdir}/quant.ppm + +colors=256 # any value between 2 - 256 works +bpp=8 +echo colors=${colors}, bpp=${bpp} + +pnmquant ${colors} testimg.ppm > ${quant_ppm} + +for mode in "-windows" "-os2" + do + ppmtobmp $mode -bpp=${bpp} ${quant_ppm} | bmptopnm | \ + cmp -s - ${quant_ppm} > /dev/null + echo ${PIPESTATUS[@]} ":" $? + done + +rm ${quant_ppm} + +colors=16 # any value between 2 - 16 works +bpp=4 +echo colors=${colors}, bpp=${bpp} + +pnmquant ${colors} testimg.ppm > ${quant_ppm} + +for mode in "-windows" "-os2" + do + ppmtobmp -bpp=${bpp} ${quant_ppm} | bmptopnm | \ + cmp -s - ${quant_ppm} > /dev/null + echo ${PIPESTATUS[@]} ":" $? + done + +rm ${quant_ppm} diff --git a/test/bmp-roundtrip.ok b/test/bmp-roundtrip.ok index 67f7a1fe..4f4f8367 100644 --- a/test/bmp-roundtrip.ok +++ b/test/bmp-roundtrip.ok @@ -1,2 +1,20 @@ -1926073387 101484 +PBM +2425386270 41 +2425386270 41 +2425386270 41 2425386270 41 +PPM +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +PGM +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 diff --git a/test/bmp-roundtrip.test b/test/bmp-roundtrip.test index be9a4548..c9ef363a 100755 --- a/test/bmp-roundtrip.test +++ b/test/bmp-roundtrip.test @@ -1,7 +1,42 @@ #! /bin/bash # This script tests: bmptopnm ppmtobmp -# Also requires: +# Also requires: pamchannel pamtopnm pamseq +tmpdir=${tmpdir:-/tmp} -ppmtobmp testimg.ppm | bmptopnm | cksum -ppmtobmp testgrid.pbm | bmptopnm | cksum +# Test 1. Should print 2425386270 41 four times + +echo PBM + +for mode in "" "-bpp=1" "-windows" "-os2" + do + ppmtobmp ${mode} testgrid.pbm | bmptopnm | cksum + done + +# Test 2. Should print 1926073387 101484 four times + +echo PPM + +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 + +red_pgm=${tmpdir}/red.pgm +mapfile_pgm=${tmpdir}/mapfile.pgm +pamseq -tupletype="GRAYSCALE" 1 255 > ${mapfile_pgm} + +pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | \ + pamtopnm | tee ${red_pgm} | cksum + +for mode in "" "-bpp=8" "-windows" "-os2" + do + ppmtobmp ${mode} ${red_pgm} | bmptopnm | cksum + ppmtobmp ${mode} -mapfile=${mapfile_pgm} ${red_pgm} | bmptopnm | cksum + done + +rm ${mapfile_pgm} ${red_pgm} \ No newline at end of file diff --git a/test/g3-roundtrip.ok b/test/g3-roundtrip.ok index 853d06d2..603c9457 100644 --- a/test/g3-roundtrip.ok +++ b/test/g3-roundtrip.ok @@ -1,13 +1,13 @@ -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 1777627284 265 2985378006 3135 3651878552 3135 diff --git a/test/g3-roundtrip.test b/test/g3-roundtrip.test index 10174733..6e31c587 100755 --- a/test/g3-roundtrip.test +++ b/test/g3-roundtrip.test @@ -9,15 +9,15 @@ wideb_pbm=${tmpdir}/wideb.pbm pbmtog3 -nofixedwidth testgrid.pbm | \ g3topbm -width=14 | cmp -s - testgrid.pbm -echo $? +echo ${PIPESTATUS[@]} ":" $? pbmtog3 -nofixedwidth -reversebits testgrid.pbm | \ g3topbm -width=14 -reversebits | cmp -s - testgrid.pbm -echo $? +echo ${PIPESTATUS[@]} ":" $? pbmtog3 testgrid.pbm | \ g3topbm | pnmcrop -white -right -bottom | \ - cmp -s - testgrid.pbm ; echo $? + cmp -s - testgrid.pbm ; echo ${PIPESTATUS[@]} ":" $? # works with gawk and mawk # produce all possible 8-bit patterns @@ -28,31 +28,31 @@ LC_ALL=C awk 'BEGIN { print "P4"; # header printf("%c",i) }' > ${complete256_pbm} pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | \ - cmp -s - ${complete256_pbm} ; echo $? + cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} ":" $? pbmtog3 -reverse -nofixedwidth ${complete256_pbm} | \ g3topbm -reversebits -width=8 | \ - cmp -s - ${complete256_pbm} ; echo $? + cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} ":" $? pbmtog3 -align8 ${complete256_pbm} | \ g3topbm -width=1728 | pnmcrop -white -right | \ - cmp -s - ${complete256_pbm} ; echo $? + cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} ":" $? pbmtog3 -align16 ${complete256_pbm} | \ g3topbm -width=1728 | pnmcrop -white -right | \ - cmp -s - ${complete256_pbm} ; echo $? + cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} ":" $? pbmmake -w 5000 5 > ${widew_pbm} pbmtog3 -nofixedwidth ${widew_pbm} | g3topbm | \ - cmp -s - ${widew_pbm} ; echo $? + cmp -s - ${widew_pbm} ; echo ${PIPESTATUS[@]} ":" $? pbmtog3 -nofixedwidth ${widew_pbm} | \ g3topbm -width=5000 | \ - cmp -s - ${widew_pbm} ; echo $? + cmp -s - ${widew_pbm} ; echo ${PIPESTATUS[@]} ":" $? pbmmake -b 5000 5 > ${wideb_pbm} pbmtog3 -nofixedwidth ${wideb_pbm} | g3topbm | \ - cmp -s - ${wideb_pbm} ; echo $? + cmp -s - ${wideb_pbm} ; echo ${PIPESTATUS[@]} ":" $? cat ${complete256_pbm} | cksum cat ${wideb_pbm} | cksum diff --git a/test/gif-quant-roundtrip.ok b/test/gif-quant-roundtrip.ok index 573541ac..b813e8db 100644 --- a/test/gif-quant-roundtrip.ok +++ b/test/gif-quant-roundtrip.ok @@ -1 +1 @@ -0 +0 0 0 : 0 diff --git a/test/gif-quant-roundtrip.test b/test/gif-quant-roundtrip.test index 8b911740..910fa369 100755 --- a/test/gif-quant-roundtrip.test +++ b/test/gif-quant-roundtrip.test @@ -13,6 +13,6 @@ quant_ppm=${tmpdir}/quant.ppm pnmquant ${colors} testimg.ppm > ${quant_ppm} && pamtogif ${quant_ppm} | giftopnm | \ cmp -s - ${quant_ppm} > /dev/null -echo $? +echo ${PIPESTATUS[@]} ":" $? rm ${quant_ppm} diff --git a/test/gif-roundtrip.ok b/test/gif-roundtrip.ok index 1704ba03..607ebd5c 100644 --- a/test/gif-roundtrip.ok +++ b/test/gif-roundtrip.ok @@ -10,13 +10,13 @@ 2425386270 41 2425386270 41 P1 4 1 0101 -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 +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 +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 +241 : 0 0 0 0 : 0 , 241 : 0 0 0 0 : 0 +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 diff --git a/test/gif-roundtrip.test b/test/gif-roundtrip.test index b49cc6d2..1e6c7760 100755 --- a/test/gif-roundtrip.test +++ b/test/gif-roundtrip.test @@ -124,10 +124,10 @@ for size in 4030 4031 4097 cmp - ${test_pgm} # pamdepth ${maxval} is necessary because # giftopnm output is maxval 255 - echo -n ${size} $? ", " + echo -n ${size} ":" ${PIPESTATUS[@]} ":" $? ", " pamtogif -nolzw ${test_pgm} | giftopnm | pamdepth ${maxval} | \ cmp - ${test_pgm} - echo ${size} $? + echo ${size} ":" ${PIPESTATUS[@]} ":" $? rm ${test_pgm} done @@ -153,10 +153,10 @@ for size in 238 239 240 241 255 256 257 pamcut -height=${size} ${test257_pgm} > ${test_pgm} && pamtogif -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ cmp - ${test_pgm} - echo -n ${size} $? ", " + echo -n ${size} ":" ${PIPESTATUS[@]} ":" $? ", " pamtogif -nolzw -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ cmp - ${test_pgm} - echo ${size} $? + echo ${size} ":" ${PIPESTATUS[@]} ":" $? rm ${test_pgm} done diff --git a/test/palm-roundtrip.ok b/test/palm-roundtrip.ok index 56325809..b9ea3056 100644 --- a/test/palm-roundtrip.ok +++ b/test/palm-roundtrip.ok @@ -5,7 +5,7 @@ Test 1 584219238 236 584219238 236 Test 2 -0 -0 -0 -0 +0 0 0 : 0 +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 8af57b4a..b00454ca 100755 --- a/test/palm-roundtrip.test +++ b/test/palm-roundtrip.test @@ -33,7 +33,7 @@ for flags in "" \ "-packbits_compression" do pnmtopalm -colormap $flags ${test256color_ppm} | palmtopnm | \ cmp -s - ${test256color_ppm} > /dev/null - echo $? + echo ${PIPESTATUS[@]} ":" $? done rm ${test256color_ppm} diff --git a/test/pbmtext-utf8.ok b/test/pbmtext-utf8.ok index 9e65dec4..588bf617 100644 --- a/test/pbmtext-utf8.ok +++ b/test/pbmtext-utf8.ok @@ -2,7 +2,7 @@ 2066913605 5110 2920616515 2301 2920616515 2301 -0 +0 0 0 0 : 0 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ -1 +0 1 : 1 diff --git a/test/pbmtext-utf8.test b/test/pbmtext-utf8.test index 010c02db..cf495b7c 100755 --- a/test/pbmtext-utf8.test +++ b/test/pbmtext-utf8.test @@ -66,7 +66,7 @@ awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \ LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar -text-dump | \ cmp --quiet - ${output} -echo $? +echo ${PIPESTATUS[@]} ":" $? rm ${output} @@ -92,4 +92,4 @@ echo "-----------------------------------------------------------" 1>&2 LC_ALL=C \ awk 'BEGIN { for (i=128; i<=129;++i) printf("%c",i); print ""}' | \ LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar -text-dump -echo $? +echo ${PIPESTATUS[@]} ":" $? diff --git a/test/pdb-roundtrip.ok b/test/pdb-roundtrip.ok index cb920669..b903da8d 100644 --- a/test/pdb-roundtrip.ok +++ b/test/pdb-roundtrip.ok @@ -3,16 +3,16 @@ pbm grid 2224198737 25671 2224198737 25671 pbm tiled -0 0 0 -0 0 0 -0 0 0 -0 0 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 pgm ellipse -0 0 0 -0 0 0 -0 0 0 -0 0 0 +0 0 0 0 0 : 0 +0 0 0 0 0 : 0 +0 0 0 0 0 : 0 +0 0 0 0 0 : 0 pgm ellipse -4depth -0 0 0 -0 0 0 -0 0 0 +0 0 0 0 0 : 0 +0 0 0 0 0 : 0 +0 0 0 0 0 : 0 diff --git a/test/pdb-roundtrip.test b/test/pdb-roundtrip.test index a6de93d2..6b4e152c 100755 --- a/test/pdb-roundtrip.test +++ b/test/pdb-roundtrip.test @@ -24,7 +24,7 @@ for flag in "" "-compressed" "-maybecompressed" "-uncompressed" do pamtopdbimg ${flag} ${tiled_pbm} | pdbimgtopam | pamtopnm | \ cmp -s - ${tiled_pbm} - echo ${PIPESTATUS[0]} ${PIPESTATUS[1]} $? + echo ${PIPESTATUS[@]} ":" $? done rm ${tiled_pbm} @@ -37,7 +37,7 @@ for flag in "" "-compressed" "-maybecompressed" "-uncompressed" do pamtopdbimg ${flag} ${ellipse_pgm} | pdbimgtopam | \ pamtopnm | pamdepth 3 | cmp -s - ${ellipse_pgm} - echo ${PIPESTATUS[0]} ${PIPESTATUS[1]} $? + echo ${PIPESTATUS[@]} ":" $? done rm ${ellipse_pgm} @@ -50,6 +50,6 @@ for flag in "-compressed" "-maybecompressed" "-uncompressed" do pamtopdbimg -4depth ${flag} ${ellipse_pgm} | pdbimgtopam | \ pamtopnm | pamdepth 15 | cmp -s - ${ellipse_pgm} - echo ${PIPESTATUS[0]} ${PIPESTATUS[1]} $? + echo ${PIPESTATUS[@]} ":" $? done rm ${ellipse_pgm} \ No newline at end of file diff --git a/test/pnmtile.ok b/test/pnmtile.ok index 559d0f65..4a29e0dc 100644 --- a/test/pnmtile.ok +++ b/test/pnmtile.ok @@ -1,2 +1,2 @@ 4228632379 259 -0 +0 0 : 0 diff --git a/test/pnmtile.test b/test/pnmtile.test index 409c0e50..e297da66 100755 --- a/test/pnmtile.test +++ b/test/pnmtile.test @@ -17,6 +17,6 @@ pnmtile 454 298 testimg.ppm > ${testimg4_ppm} && pnmcat -lr testimg.ppm testimg.ppm > ${testimg2_ppm} && pnmcat -tb ${testimg2_ppm} ${testimg2_ppm} | \ cmp -s - ${testimg4_ppm} -echo $? +echo ${PIPESTATUS[@]} ":" $? rm ${testimg2_ppm} ${testimg4_ppm} diff --git a/test/rgb3-roundtrip.ok b/test/rgb3-roundtrip.ok index 64da849d..367e5429 100644 --- a/test/rgb3-roundtrip.ok +++ b/test/rgb3-roundtrip.ok @@ -3,4 +3,4 @@ 2425386270 41 0 0 -0 +0 0 : 0 diff --git a/test/rgb3-roundtrip.test b/test/rgb3-roundtrip.test index cac52220..42fd822f 100755 --- a/test/rgb3-roundtrip.test +++ b/test/rgb3-roundtrip.test @@ -41,6 +41,6 @@ rgb3toppm ${testgrid_red} ${testgrid_grn} ${testgrid_blu} | \ cmp -s ${testgrid_red} ${testgrid_grn} ; echo $? cmp -s ${testgrid_grn} ${testgrid_blu} ; echo $? pgmtopgm < testgrid.pbm | cmp -s - ${testgrid_red} - echo $? + echo ${PIPESTATUS[@]} ":" $? rm ${testgrid_pbm} ${testgrid_red} ${testgrid_grn} ${testgrid_blu} diff --git a/test/targa-roundtrip.ok b/test/targa-roundtrip.ok index bf6ef088..514f970f 100644 --- a/test/targa-roundtrip.ok +++ b/test/targa-roundtrip.ok @@ -26,18 +26,18 @@ Test 3 1926073387 101484 1926073387 101484 Test 4 -0 -0 -0 -0 -0 -0 +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 -0 -0 -0 -0 -0 -0 -0 -0 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 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 98d21881..79b01b61 100755 --- a/test/targa-roundtrip.test +++ b/test/targa-roundtrip.test @@ -54,7 +54,7 @@ pnmquant 256 testimg.ppm > ${test256_ppm} || echo "pnmquant failed" for mode in "-rgb" "-rgb -norle" "-cmap" "-cmap -norle" "" "-norle" do pamtotga ${mode} ${test256_ppm} | tgatoppm | cmp -s - ${test256_ppm} - echo $? + echo ${PIPESTATUS[@]} ":" $? done @@ -68,13 +68,13 @@ rm ${test256_ppm} for mode in "-cmap16" "-cmap16 -norle" do pamtotga ${mode} ${test256_31_ppm} | tgatoppm | cmp -s - ${test256_31_ppm} - echo $? + echo ${PIPESTATUS[@]} ":" $? done for mode in "-rgb" "-rgb -norle" "-cmap" "-cmap -norle" "" "-norle" do pamtotga ${mode} ${test256_31_ppm} | tgatoppm | \ pamdepth 31 | cmp -s - ${test256_31_ppm} - echo $? + echo ${PIPESTATUS[@]} ":" $? done rm ${test256_31_ppm} |