diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-09-26 23:52:08 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-09-26 23:52:08 +0000 |
commit | 4c361c0a7638b4f068e8b524e4ff43374a286018 (patch) | |
tree | 0aef192966a1ae996a9f2a0364f3ccbb15d512c7 /test | |
parent | cd7f17a619a0421a1dfb2ceb09f4af60ead8ad5f (diff) | |
download | netpbm-mirror-4c361c0a7638b4f068e8b524e4ff43374a286018.tar.gz netpbm-mirror-4c361c0a7638b4f068e8b524e4ff43374a286018.tar.xz netpbm-mirror-4c361c0a7638b4f068e8b524e4ff43374a286018.zip |
Promote Development to Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3972 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rwxr-xr-x | test/Available-Testprog | 8 | ||||
-rw-r--r-- | test/Test-Order | 8 | ||||
-rw-r--r-- | test/all-in-place.ok | 4 | ||||
-rwxr-xr-x | test/all-in-place.test | 6 | ||||
-rw-r--r-- | test/channel-stack-roundtrip.ok | 11 | ||||
-rwxr-xr-x | test/channel-stack-roundtrip.test | 34 | ||||
-rw-r--r-- | test/legacy-names.ok | 4 | ||||
-rwxr-xr-x | test/legacy-names.test | 8 | ||||
-rw-r--r-- | test/pamarith.ok | 182 | ||||
-rwxr-xr-x | test/pamarith.test | 165 | ||||
-rw-r--r-- | test/pambrighten.ok | 96 | ||||
-rwxr-xr-x | test/pambrighten.test | 99 | ||||
-rw-r--r-- | test/pamdice.ok | 2 | ||||
-rwxr-xr-x | test/pamdice.test | 2 | ||||
-rw-r--r-- | test/pamexec.ok | 4 | ||||
-rwxr-xr-x | test/pamexec.test | 4 | ||||
-rw-r--r-- | test/pamfunc.ok | 70 | ||||
-rwxr-xr-x | test/pamfunc.test | 166 | ||||
-rwxr-xr-x | test/pamtopdbimg.test | 2 | ||||
-rwxr-xr-x | test/pamvalidate.test | 11 | ||||
-rwxr-xr-x | test/pbmtext-utf8.test | 4 | ||||
-rw-r--r-- | test/pj-roundtrip.ok | 4 | ||||
-rwxr-xr-x | test/pj-roundtrip.test | 12 | ||||
-rw-r--r-- | test/ppmbrighten.ok | 10 | ||||
-rwxr-xr-x | test/ppmbrighten.test | 30 | ||||
-rw-r--r-- | test/winicon-roundtrip.ok | 14 | ||||
-rwxr-xr-x | test/winicon-roundtrip.test | 42 | ||||
-rw-r--r-- | test/winicon-roundtrip2.ok | 80 | ||||
-rwxr-xr-x | test/winicon-roundtrip2.test | 150 |
29 files changed, 1190 insertions, 42 deletions
diff --git a/test/Available-Testprog b/test/Available-Testprog index 8176b57a..033c7eec 100755 --- a/test/Available-Testprog +++ b/test/Available-Testprog @@ -6,7 +6,6 @@ if [ "${CHECK_TYPE}" = "install" ]; then fi # Special case: no arguments were passed to this program -# For all-in-place.test and legacy-names.test if [ $# = 0 ]; then exit 0 @@ -19,6 +18,10 @@ fi # each directory (for example converter/other/Makefile) for library # requirements and relevant variables. +# Note that any variable used to determine whether a program exists +# (BUILD_FIASCO, JASPERLIB, JBIGLIB, JPEGLIB, etc.) +# must be in CHECK_VARS in GNUMakefile to be detected here. + for i in $@ do case $i in @@ -57,6 +60,9 @@ for i in $@ svgtopam) [ "${XML2_LIBS}" = "NONE" ] && exit 1 ;; + ppmsvgalib) + [ "${LINUXSVGALIB}" = "NONE" ] && exit 1 ;; + thinkjettopbm) [ -z "${LEX}" ] && exit 1 ;; diff --git a/test/Test-Order b/test/Test-Order index f907c29b..6c553be1 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -83,6 +83,7 @@ pnmremap2.test pnmquant.test pnmquantall.test pnmtile.test +pambrighten.test ppmbrighten.test ppmdither.test ppmrelief.test @@ -91,6 +92,9 @@ ppmdim.test pnmshear.test pgmbentley.test +pamfunc.test +pamarith.test + pamenlarge.test pamenlarge-pbm.test @@ -149,9 +153,10 @@ enlarge-reduce-roundtrip.test cut-cat-roundtrip.test pamhue-roundtrip.test -# Round-trip tests: miscellaneous utility +# Round-trip tests: miscellaneous utilities pamexec-roundtrip.test +channel-stack-roundtrip.test # Round-trip tests : lossless converters @@ -202,6 +207,7 @@ tiff-flate-lzw-roundtrip.test utahrle-roundtrip.test wbmp-roundtrip.test winicon-roundtrip.test +winicon-roundtrip2.test xbm-roundtrip.test xpm-roundtrip.test xv-roundtrip.test diff --git a/test/all-in-place.ok b/test/all-in-place.ok index 2df9f392..4d840102 100644 --- a/test/all-in-place.ok +++ b/test/all-in-place.ok @@ -238,11 +238,9 @@ pnmtosir: ok pnmtotiffcmyk: ok pnmtoxwd: ok ppm3d: ok -ppmbrighten: ok ppmchange: ok ppmcie: ok ppmcolormask: ok -ppmcolors: ok ppmdcfont: ok ppmddumpfont: ok ppmdim: ok @@ -266,6 +264,7 @@ ppmrough: ok ppmshadow: ok ppmshift: ok ppmspread: ok +ppmsvgalib: ok ppmtoacad: ok ppmtoapplevol: ok ppmtoarbtxt: ok @@ -276,6 +275,7 @@ ppmtoicr: ok ppmtoilbm: ok ppmtoleaf: ok ppmtolj: ok +ppmtompeg: ok ppmtomitsu: ok ppmtoneo: ok ppmtopcx: ok diff --git a/test/all-in-place.test b/test/all-in-place.test index 6cf677ef..78a9346a 100755 --- a/test/all-in-place.test +++ b/test/all-in-place.test @@ -280,11 +280,9 @@ ordinary_testprogs="\ pnmtotiffcmyk \ pnmtoxwd \ ppm3d \ - ppmbrighten \ ppmchange \ ppmcie \ ppmcolormask \ - ppmcolors \ ppmdcfont \ ppmddumpfont \ ppmdim \ @@ -308,6 +306,7 @@ ordinary_testprogs="\ ppmshadow \ ppmshift \ ppmspread \ + ppmsvgalib \ ppmtoacad \ ppmtoapplevol \ ppmtoarbtxt \ @@ -318,6 +317,7 @@ ordinary_testprogs="\ ppmtoilbm \ ppmtoleaf \ ppmtolj \ + ppmtompeg \ ppmtomitsu \ ppmtoneo \ ppmtopcx \ @@ -431,3 +431,5 @@ testExitStatus anytopnm 0 $? manweb --help > /dev/null testExitStatus manweb 0 $? + +# We do not test vidtoppm. \ No newline at end of file diff --git a/test/channel-stack-roundtrip.ok b/test/channel-stack-roundtrip.ok new file mode 100644 index 00000000..708305f1 --- /dev/null +++ b/test/channel-stack-roundtrip.ok @@ -0,0 +1,11 @@ +Test 1: should print 1873848880 101532 twice, then 0 +1873848880 101532 +1873848880 101532 +1873848880 101532 +1873848880 101532 +1873848880 101532 +0 +Test 2: Should print 447072062 33892 three times +447072062 33892 +447072062 33892 +447072062 33892 diff --git a/test/channel-stack-roundtrip.test b/test/channel-stack-roundtrip.test new file mode 100755 index 00000000..dae64605 --- /dev/null +++ b/test/channel-stack-roundtrip.test @@ -0,0 +1,34 @@ +#! /bin/bash +# This script tests: pamchanel pamstack +# Also requires: pamtopam pamstack pamtopnm + +tmpdir=${tmpdir:-/tmp} +r_pam=${tmpdir}/testimg_r.pam +g_pam=${tmpdir}/testimg_g.pam +b_pam=${tmpdir}/testimg_b.pam +rgb_pam=${tmpdir}/testimg_rgb.pam + +echo "Test 1: should print 1873848880 101532 twice, then 0" + +pamchannel -tupletype="GRAYSCALE" -infile testimg.ppm 0 > ${r_pam} +pamchannel -tupletype="GRAYSCALE" -infile testimg.ppm 1 > ${g_pam} +pamchannel -tupletype="GRAYSCALE" -infile testimg.ppm 2 > ${b_pam} + +pamtopam < testimg.ppm | pamstack -tupletype="RGB" - | cksum +pamstack ${r_pam} ${g_pam} | \ +pamstack -tupletype="RGB" - ${b_pam} | cksum +pamstack ${r_pam} | \ +pamstack -tupletype="RGB" - ${g_pam} ${b_pam} | cksum +pamstack ${r_pam} ${b_pam} ${g_pam} ${b_pam} ${b_pam} ${b_pam} | \ + pamchannel -tupletype="RGB" 0 2 4 | cksum +pamstack -tupletype="RGB" ${r_pam} ${g_pam} ${b_pam} | tee ${rgb_pam} | cksum +pamtopnm ${rgb_pam} | cmp - testimg.ppm +echo $? + +echo "Test 2: Should print 447072062 33892 three times" + +cat ${r_pam} | cksum +pamstack -tupletype="GRAYSCALE" ${r_pam} | cksum +pamstack ${r_pam} | pamchannel -tupletype="GRAYSCALE" 0 | cksum + +rm ${r_pam} ${g_pam} ${b_pam} ${rgb_pam} diff --git a/test/legacy-names.ok b/test/legacy-names.ok index 94ef875f..27baf672 100644 --- a/test/legacy-names.ok +++ b/test/legacy-names.ok @@ -26,14 +26,16 @@ pnmtofits: ok pnmtoplainpnm: ok pnmtopnm: ok pnmtotiff: ok +ppmbrighten: ok +ppmcolors: ok ppmnorm: ok ppmquant: ok ppmquantall: ok ppmtogif: ok ppmtojpeg: ok ppmtomap: ok -ppmtompeg: ok ppmtotga: ok ppmtouil: ok hpcdtoppm: ok pcdovtoppm: ok +pcdindex: ok diff --git a/test/legacy-names.test b/test/legacy-names.test index 5a65615f..e20dde76 100755 --- a/test/legacy-names.test +++ b/test/legacy-names.test @@ -83,13 +83,14 @@ ordinary_testprogs="\ pnmtoplainpnm \ pnmtopnm \ pnmtotiff \ + ppmbrighten \ + ppmcolors \ ppmnorm \ ppmquant \ ppmquantall \ ppmtogif \ ppmtojpeg \ ppmtomap \ - ppmtompeg \ ppmtotga \ ppmtouil \ " @@ -125,10 +126,13 @@ for i in $ordinary_testprogs -# Test hpcdtoppm and pcdovtoppm. Simply confirm their existence. +# Test hpcdtoppm, pcdovtoppm and pcdindex. Simply confirm their existence. type -p hpcdtoppm > /dev/null testExitStatus hpcdtoppm 0 $? type -p pcdovtoppm > /dev/null testExitStatus pcdovtoppm 0 $? + +type -p pcdindex > /dev/null +testExitStatus pcdindex 0 $? diff --git a/test/pamarith.ok b/test/pamarith.ok new file mode 100644 index 00000000..782637d3 --- /dev/null +++ b/test/pamarith.ok @@ -0,0 +1,182 @@ +Test 1 +P2 +16 2 +15 +0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 +-add +P2 16 1 15 2 3 4 5 6 7 8 9 10 11 12 13 14 15 15 15 +1927712885 59 +1927712885 59 +1927712885 59 +-subtract +P2 16 1 15 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 +622443613 59 +622443613 59 +622443613 59 +-multiply +P2 16 1 15 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 +1589721418 59 +1589721418 59 +1589721418 59 +-divide +P2 16 1 15 0 8 15 15 15 15 15 15 15 15 15 15 15 15 15 15 +321546811 59 +321546811 59 +321546811 59 +-difference +P2 16 1 15 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 +590140907 59 +590140907 59 +590140907 59 +-minimum +P2 16 1 15 0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 +3746423180 59 +3746423180 59 +3746423180 59 +-maximum +P2 16 1 15 2 2 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +201376294 59 +201376294 59 +201376294 59 +-mean +P2 16 1 15 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 +1456675831 59 +1456675831 59 +1456675831 59 +-compare +P2 16 1 2 0 0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 +196115582 58 +196115582 58 +196115582 58 +-and +P2 16 1 15 0 0 2 2 0 0 2 2 0 0 2 2 0 0 2 2 +3660405045 59 +3660405045 59 +3660405045 59 +-or +P2 16 1 15 2 3 2 3 6 7 6 7 10 11 10 11 14 15 14 15 +157317791 59 +157317791 59 +157317791 59 +-nand +P2 16 1 15 15 15 13 13 15 15 13 13 15 15 13 13 15 15 13 13 +1625584307 59 +1625584307 59 +1625584307 59 +-nor +P2 16 1 15 13 12 13 12 9 8 9 8 5 4 5 4 1 0 1 0 +3014218009 59 +3014218009 59 +3014218009 59 +-xor +P2 16 1 15 2 3 0 1 6 7 4 5 10 11 8 9 14 15 12 13 +3227090877 59 +3227090877 59 +3227090877 59 +-shiftleft +P2 16 1 15 0 4 8 12 0 4 8 12 0 4 8 12 0 4 8 12 +952940636 59 +952940636 59 +952940636 59 +-shiftright +P2 16 1 15 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 +2898922266 59 +2898922266 59 +2898922266 59 +Test 2 PBM +P1 +8 2 +01010101 +00001111 +-add +P1 8 1 00000101 +-subtract +P1 8 1 11110101 +-multiply +P1 8 1 01011111 +-divide +P1 8 1 01010000 +-difference +P1 8 1 10100101 +-minimum +P1 8 1 01011111 +-maximum +P1 8 1 00000101 +-mean +P1 8 1 00000101 +-compare +P2 8 1 2 1 0 1 0 2 1 2 1 +-and +P1 8 1 01011111 +-or +P1 8 1 00000101 +-nand +P1 8 1 10100000 +-nor +P1 8 1 11111010 +-xor +P1 8 1 10100101 +-shiftleft +P1 8 1 11110101 +-shiftright +P1 8 1 11110101 +Test 3 (input = output) +cksum is 2425386270 41 or 2921940274 59 +input image +2425386270 41 +-minimum +2425386270 41 +-maximum +2425386270 41 +-mean +2425386270 41 +-and +2425386270 41 +-or +2425386270 41 +input image +2921940274 59 +-minimum +2921940274 59 +-maximum +2921940274 59 +-mean +2921940274 59 +-and +2921940274 59 +-or +2921940274 59 +Test 4 (blank output) +cksum is 2817549367 41 or 320101399 59 +-subtract +2817549367 41 +-difference +2817549367 41 +-xor +2817549367 41 +-subtract +320101399 59 +-difference +320101399 59 +-xor +320101399 59 +Test Invalid +Expected failure 1 1 +Expected failure 2 1 +Expected failure 3 1 +Expected failure 4 1 +Expected failure 5 1 +Expected failure 6 1 +Expected failure 7 1 +Expected failure 8 1 +Expected failure 9 1 +Expected failure 10 1 +Expected failure 11 1 +Expected failure 12 1 +Expected failure 13 1 +Expected failure 14 1 +Expected failure 15 1 +Expected failure 16 1 +Expected failure 17 1 +Expected failure 18 1 diff --git a/test/pamarith.test b/test/pamarith.test new file mode 100755 index 00000000..d8055385 --- /dev/null +++ b/test/pamarith.test @@ -0,0 +1,165 @@ + +#! /bin/bash +# This script tests: pamarith +# Also requires: pamchannel pamseq pamtopnm pgmmake pnmcat rgb3toppm +# Also requires: pbmmake pamenlarge + +tmpdir=${tmpdir:-/tmp} +input1_pgm=${tmpdir}/input1.pgm +input2_pgm=${tmpdir}/input2.pgm +output_pgm=${tmpdir}/output.pgm +input1_ppm=${tmpdir}/input1.ppm +input2_ppm=${tmpdir}/input2.ppm + +echo "Test 1" + +pamseq 1 15 | pamtopnm -assume > ${input1_pgm} +pgmmake -maxval 15 0.15 16 1 > ${input2_pgm} + +rgb3toppm ${input1_pgm} ${input1_pgm} ${input1_pgm} > ${input1_ppm} +rgb3toppm ${input2_pgm} ${input2_pgm} ${input2_pgm} > ${input2_ppm} + +pnmcat -tb -plain ${input1_pgm} ${input2_pgm} + +for fn in "-add" "-subtract" "-multiply" "-divide" "-difference" \ + "-minimum" "-maximum" "-mean" "-compare" \ + "-and" "-or" "-nand" "-nor" "-xor" \ + "-shiftleft" "-shiftright" + do + echo ${fn} + pamarith ${fn} -plain ${input1_pgm} ${input2_pgm} | tr '\n' ' '; echo + pamarith ${fn} ${input1_pgm} ${input2_pgm} > ${output_pgm} + rgb3toppm ${output_pgm} ${output_pgm} ${output_pgm} | cksum + pamarith ${fn} ${input1_ppm} ${input2_pgm} | cksum + pamarith ${fn} ${input1_ppm} ${input2_ppm} | cksum + done + +rm ${input1_pgm} ${input2_pgm} ${output_pgm} ${input2_ppm} + + +input1_pbm=${tmpdir}/input1.pbm +input2_pbm=${tmpdir}/input2.pbm + +echo "Test 2 PBM" + +pbmmake -g 8 1 > ${input1_pbm} +pbmmake -g 2 1 | pamenlarge -xscale=4 > ${input2_pbm} + +pnmcat -tb -plain ${input1_pbm} ${input2_pbm} + +for fn in "-add" "-subtract" "-multiply" "-divide" "-difference" \ + "-minimum" "-maximum" "-mean" "-compare" \ + "-and" "-or" "-nand" "-nor" "-xor" \ + "-shiftleft" "-shiftright" + do + echo ${fn} + pamarith ${fn} -plain ${input1_pbm} ${input2_pbm} | tr '\n' ' '; echo + done + +rm ${input1_pbm} ${input2_pbm} + + +echo "Test 3 (input = output)" +echo "cksum is 2425386270 41 or 2921940274 59" + +for image in testgrid.pbm ${input1_ppm} + do + echo "input image" + cat ${image} | cksum + for fn in "-minimum" "-maximum" "-mean" "-and" "-or" + do + echo ${fn} + pamarith ${fn} ${image} ${image} | cksum + done + done + + +echo "Test 4 (blank output)" +echo "cksum is 2817549367 41 or 320101399 59" + +for image in testgrid.pbm ${input1_ppm} + do + for fn in "-subtract" "-difference" "-xor" + do + echo ${fn} + pamarith ${fn} ${image} ${image} | cksum + done + done + +rm ${input1_ppm} + + +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +echo "Test Invalid" + +output_ppm=${tmpdir}/output.ppm + +pamarith -add -subtract testimg.ppm testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 1" + test -s ${output_ppm}; echo " "$? +pamarith -multiply -divide testimg.ppm testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 2" + test -s ${output_ppm}; echo " "$? +pamarith -difference -minimum testimg.ppm testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 3" + test -s ${output_ppm}; echo " "$? +pamarith -maximum -mean testimg.ppm testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 4" + test -s ${output_ppm}; echo " "$? +pamarith -compare -and testimg.ppm testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 5" + test -s ${output_ppm}; echo " "$? +pamarith -or -nand testimg.ppm testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 6" + test -s ${output_ppm}; echo " "$? +pamarith -nor -xor testimg.ppm testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 7" + test -s ${output_ppm}; echo " "$? +pamarith -shiftleft -shiftright testimg.ppm testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 8" + test -s ${output_ppm}; echo " "$? +pamarith -add=1 testimg.ppm testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 9" + test -s ${output_ppm}; echo " "$? + +pamarith -plain testimg.ppm testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 10" + test -s ${output_ppm}; echo " "$? + +pamarith testimg.ppm testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 11" + test -s ${output_ppm}; echo " "$? + +pamarith -add testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} + echo -n "Expected failure 12" + test -s ${output_ppm}; echo " "$? +pamarith -add testimg.ppm > ${output_ppm} + echo -n "Expected failure 13" + test -s ${output_ppm}; echo " "$? +pamarith -add > ${output_ppm} + echo -n "Expected failure 14" + test -s ${output_ppm}; echo " "$? + +pamarith -add testimg.ppm testgrid.pbm > ${output_ppm} + echo -n "Expected failure 15" + test -s ${output_ppm}; echo " "$? + +pamchannel -infile testimg.ppm 0 1 | \ + pamarith -add testimg.ppm - > ${output_ppm} + echo -n "Expected failure 16" + test -s ${output_ppm}; echo " "$? + +pamenlarge -xscale=2 testgrid.pbm | \ + pamarith -add testgrid.pbm - > ${output_ppm} + echo -n "Expected failure 17" + test -s ${output_ppm}; echo " "$? + +pamenlarge -yscale=3 testgrid.pbm | \ + pamarith -add testgrid.pbm - > ${output_ppm} + echo -n "Expected failure 18" + test -s ${output_ppm}; echo " "$? + +rm ${output_ppm} \ No newline at end of file diff --git a/test/pambrighten.ok b/test/pambrighten.ok new file mode 100644 index 00000000..6c58b4c9 --- /dev/null +++ b/test/pambrighten.ok @@ -0,0 +1,96 @@ +Test 1 +P3 +8 1 +255 +0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 + +P3 +8 1 +255 +0 0 0 0 0 110 0 110 0 0 110 110 110 0 0 110 0 110 110 110 0 110 110 110 + +P3 +8 1 +255 +0 0 0 0 0 90 0 90 0 0 90 90 90 0 0 90 0 90 90 90 0 90 90 90 + +P3 +8 1 +255 +0 0 0 0 0 200 0 200 0 0 200 200 200 0 0 200 0 200 200 200 0 200 200 200 + +P3 +8 1 +255 +0 0 0 0 0 255 0 255 0 0 255 255 255 0 0 255 0 255 255 255 0 255 255 255 + +P3 +8 1 +255 +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 2 +P3 +8 1 +255 +0 0 0 10 10 100 10 100 10 10 100 100 100 10 10 100 10 100 100 100 10 100 100 100 + +P3 +8 1 +255 +0 0 0 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 + +Test 3: Output invariant +P3 +8 1 +255 +0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 + +P3 +8 1 +255 +0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 + +P3 +8 1 +255 +0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 + +P3 +8 1 +255 +0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 + +P3 +8 1 +255 +0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 + +P3 +8 1 +255 +0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 + +Test 4: Should print 3990234518 268 six times +3990234518 268 +3990234518 268 +3990234518 268 +3990234518 268 +3990234518 268 +3990234518 268 +Test Error: Should print 1 six times +1 +1 +1 +1 +1 +1 +Test Error: Should print 99 followed by 1, four times +99 +1 +99 +1 +99 +1 +99 +1 diff --git a/test/pambrighten.test b/test/pambrighten.test new file mode 100755 index 00000000..3e1a3eb1 --- /dev/null +++ b/test/pambrighten.test @@ -0,0 +1,99 @@ +#! /bin/bash +# This script tests: pambrighten +# Also requires: pgmramp + +tmpdir=${tmpdir:-/tmp} + +input_ppm=${tmpdir}/input.ppm + +cat > ${input_ppm} << EOF +P3 +8 1 +255 +0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 +EOF + +# Test 1 + +echo "Test 1" +pambrighten -v 0 -plain ${input_ppm} +pambrighten -v +10 -plain ${input_ppm} +pambrighten -v -10 -plain ${input_ppm} +pambrighten -v +100 -plain ${input_ppm} +pambrighten -v +200 -plain ${input_ppm} +pambrighten -v -100 -plain ${input_ppm} + +echo "Test 2" +pambrighten -s -10 -plain ${input_ppm} +pambrighten -s -100 -plain ${input_ppm} + +echo "Test 3: Output invariant" +pambrighten -plain ${input_ppm} +pambrighten -v 0 -plain ${input_ppm} +pambrighten -s 0 -plain ${input_ppm} +pambrighten -s +10 -plain ${input_ppm} +pambrighten -s +100 -plain ${input_ppm} +pambrighten -s +200 -plain ${input_ppm} + +rm ${input_ppm} + +echo "Test 4: Should print 3990234518 268 six times" + +input_pgm=${tmpdir}/input.pgm + +pgmramp -lr 255 1 | tee ${input_pgm} | cksum +pambrighten -s -100 ${input_pgm} | cksum +pambrighten -s -10 ${input_pgm} | cksum +pambrighten -s +10 ${input_pgm} | cksum +pambrighten -s +100 ${input_pgm} | cksum +pambrighten -s +200 ${input_pgm} | cksum + +rm ${input_pgm} + + +# Test 2 +# These should all fail. + +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +echo "Test Error: Should print 1 six times" + +output_ppm=${tmpdir}/output.ppm + +pambrighten -v -120 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? +pambrighten -s -120 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? +pambrighten 10 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? + + +echo "Test Error: Should print 99 followed by 1, four times" + +pambrighten -s 1.20 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? +pambrighten -v 10.5 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? +pambrighten -v testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? +pambrighten -s testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? + + +rm -f ${output_ppm} diff --git a/test/pamdice.ok b/test/pamdice.ok index 83db2775..99504ec0 100644 --- a/test/pamdice.ok +++ b/test/pamdice.ok @@ -1,5 +1,5 @@ Test 1. - 10 P1@1 1@0@ +10 P1@1 1@0@ Test 2. P1@1 1@0@ P1@1 1@1@ diff --git a/test/pamdice.test b/test/pamdice.test index 71a9d645..3199fd4a 100755 --- a/test/pamdice.test +++ b/test/pamdice.test @@ -12,7 +12,7 @@ pbmmake -w 2 5 | pamdice -height=1 -width=1 -outstem=${fname_stem} -plain ls ${fname_stem}*.pbm | while read file do cat ${file} | tr '\n' '@' ; echo - done | sort | uniq -c + done | sort | uniq -c | sed 's/^ *//' rm ${fname_stem}*.pbm diff --git a/test/pamexec.ok b/test/pamexec.ok index 4bfa5202..23e4268e 100644 --- a/test/pamexec.ok +++ b/test/pamexec.ok @@ -1,6 +1,6 @@ Test 1 : Should print 10 stdin: PBM RAW 21 24 1 1 BLACKANDWHITE twice - 10 stdin: PBM RAW 21 24 1 1 BLACKANDWHITE - 10 stdin: PBM RAW 21 24 1 1 BLACKANDWHITE +10 stdin: PBM RAW 21 24 1 1 BLACKANDWHITE +10 stdin: PBM RAW 21 24 1 1 BLACKANDWHITE Test 2: Should print 1791121103 989 twice 1791121103 989 1791121103 989 diff --git a/test/pamexec.test b/test/pamexec.test index acf162c3..44c11339 100755 --- a/test/pamexec.test +++ b/test/pamexec.test @@ -11,8 +11,8 @@ cat ${test_pbm}[0123456789] > ${combined_pbm} echo "Test 1 : Should print 10 stdin: PBM RAW 21 24 1 1 BLACKANDWHITE twice" -cat ${combined_pbm} | pamfile -all -mach | uniq -c -pamexec "pamfile -mach" ${combined_pbm} | uniq -c +cat ${combined_pbm} | pamfile -all -mach | uniq -c | sed 's/^ *//' +pamexec "pamfile -mach" ${combined_pbm} | uniq -c | sed 's/^ *//' echo "Test 2: Should print 1791121103 989 twice" diff --git a/test/pamfunc.ok b/test/pamfunc.ok new file mode 100644 index 00000000..4a531577 --- /dev/null +++ b/test/pamfunc.ok @@ -0,0 +1,70 @@ +Test 1 +P2 16 1 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +P2 16 1 15 3 4 5 6 7 8 9 10 11 12 13 14 15 15 15 15 +P2 16 1 15 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 +P2 16 1 15 0 3 6 9 12 15 15 15 15 15 15 15 15 15 15 15 +P2 16 1 15 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 +P2 16 1 15 0 1 2 3 4 5 6 6 6 6 6 6 6 6 6 6 +P2 16 1 15 5 5 5 5 5 5 6 7 8 9 10 11 12 13 14 15 +P2 16 1 15 0 2 4 6 8 10 12 14 0 2 4 6 8 10 12 14 +P2 16 1 15 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 +P2 16 1 15 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 +P2 16 1 15 0 0 2 2 4 4 6 6 8 8 10 10 12 12 14 14 +Test 2 +P1 8 1 01010101 +P1 8 1 00000000 +P1 8 1 11111111 +P1 8 1 01010101 +P1 8 1 01010101 +P1 8 1 01010101 +P1 8 1 00000000 +P1 8 1 11111111 +P1 8 1 11111111 +P1 8 1 11111111 +P1 8 1 11111111 +Test 3 (-changemaxval) +P2 16 1 30 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +P2 16 1 60 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +P1 8 1 01010101 +P1 8 1 11111111 +Test 4: Should print 1926073387 101484 eight times +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +Test 5: Should print 2425386270 41 six times +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +Test Invalid +Expected failure 1 1 +Expected failure 2 1 +Expected failure 3 1 +Expected failure 4 1 +Expected failure 5 1 +Expected failure 6 1 +Expected failure 7 1 +Expected failure 8 1 +Expected failure 9 1 +Expected failure 10 1 +Expected failure 11 1 +Expected failure 12 1 +Expected failure 13 1 +Expected failure 14 1 +Expected failure 15 1 +Expected failure 16 1 +Expected failure 17 1 +Expected failure 18 1 +Expected failure 19 1 +Expected failure 20 1 +Expected failure 21 1 +Expected failure 22 1 +Expected failure 23 1 +Expected failure 24 1 diff --git a/test/pamfunc.test b/test/pamfunc.test new file mode 100755 index 00000000..f9a8a33e --- /dev/null +++ b/test/pamfunc.test @@ -0,0 +1,166 @@ +#! /bin/bash +# This script tests: pamfunc +# Also requires: pamseq pamtopnm pbmmake + +tmpdir=${tmpdir:-/tmp} +input_pgm=${tmpdir}/input.pgm + +echo "Test 1" + +pamseq 1 15 | pamtopnm -assume > ${input_pgm} +pamtopnm -plain ${input_pgm} | tr '\n' ' '; echo + +pamfunc -adder=3 -plain ${input_pgm} | tr '\n' ' '; echo +pamfunc -subtractor=3 -plain ${input_pgm} | tr '\n' ' '; echo +pamfunc -multiplier=3 -plain ${input_pgm} | tr '\n' ' '; echo +pamfunc -divisor=2 -plain ${input_pgm} | tr '\n' ' '; echo +pamfunc -max=6 -plain ${input_pgm} | tr '\n' ' '; echo +pamfunc -min=5 -plain ${input_pgm} | tr '\n' ' '; echo + +pamfunc -shiftleft 1 -plain ${input_pgm} | tr '\n' ' '; echo +pamfunc -shiftright 1 -plain ${input_pgm} | tr '\n' ' '; echo +pamfunc -shiftleft 1 ${input_pgm} | pamfunc -shiftright 1 -plain | \ + tr '\n' ' '; echo +pamfunc -shiftright 1 ${input_pgm} | pamfunc -shiftleft 1 -plain | \ + tr '\n' ' '; echo + + +input_pbm=${tmpdir}/input.pbm + +echo "Test 2" + +pbmmake -g 8 1 > ${input_pbm} +pamtopnm -plain ${input_pbm} | tr '\n' ' '; echo + +pamfunc -adder=1 -plain ${input_pbm} | tr '\n' ' '; echo +pamfunc -subtractor=1 -plain ${input_pbm} | tr '\n' ' '; echo +pamfunc -multiplier=1 -plain ${input_pbm} | tr '\n' ' '; echo +pamfunc -divisor=1 -plain ${input_pbm} | tr '\n' ' '; echo +pamfunc -max=1 -plain ${input_pbm} | tr '\n' ' '; echo +pamfunc -min=1 -plain ${input_pbm} | tr '\n' ' '; echo + +pamfunc -shiftleft 1 -plain ${input_pbm} | tr '\n' ' '; echo +pamfunc -shiftright 1 -plain ${input_pbm} | tr '\n' ' '; echo +pamfunc -shiftleft 1 ${input_pbm} | pamfunc -shiftright 1 -plain | \ + tr '\n' ' '; echo +pamfunc -shiftright 1 ${input_pbm} | pamfunc -shiftleft 1 -plain | \ + tr '\n' ' '; echo + + +echo "Test 3 (-changemaxval)" + +pamfunc -divisor 2 -changemaxval ${input_pgm} -plain | \ + tr '\n' ' '; echo +pamfunc -multiplier 0.25 -changemaxval ${input_pgm} -plain | \ + tr '\n' ' '; echo +pamfunc -divisor 2 -changemaxval ${input_pbm} -plain | \ + tr '\n' ' '; echo +pamfunc -multiplier 0.25 -changemaxval ${input_pbm} -plain | \ + tr '\n' ' '; echo + +rm ${input_pgm} ${input_pbm} + +echo "Test 4: Should print 1926073387 101484 eight times" + +cat testimg.ppm | cksum + +pamfunc -not testimg.ppm | pamfunc -not | cksum +pamfunc -andmask 0xff testimg.ppm | cksum +pamfunc -ormask 0x00 testimg.ppm | cksum +pamfunc -xormask 0x00 testimg.ppm | cksum +pamfunc -xormask 0xff testimg.ppm | pamfunc -xormask 0xff | cksum +pamfunc -shiftleft 0 testimg.ppm | cksum +pamfunc -shiftright 0 testimg.ppm | cksum + + +echo "Test 5: Should print 2425386270 41 six times" + +cat testgrid.pbm | cksum + +pamfunc -andmask 0x1 testgrid.pbm | cksum +pamfunc -ormask 0x0 testgrid.pbm | cksum +pamfunc -xormask 0x1 testgrid.pbm | pamfunc -xormask 0x1 | cksum + +pamfunc -shiftleft 0 testgrid.pbm | cksum +pamfunc -shiftright 0 testgrid.pbm | cksum + +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +echo "Test Invalid" + +output_ppm=${tmpdir}/output.ppm + +pamfunc -multiplier testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 1" + test -s ${output_ppm}; echo " "$? +pamfunc -multiplier=-1 testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 2" + test -s ${output_ppm}; echo " "$? +pamfunc -divisor testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 3" + test -s ${output_ppm}; echo " "$? +pamfunc -divisor=-20 testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 4" + test -s ${output_ppm}; echo " "$? +pamfunc -adder testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 5" + test -s ${output_ppm}; echo " "$? +pamfunc -adder 0.5 testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 6" + test -s ${output_ppm}; echo " "$? +pamfunc -subtractor testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 7" + test -s ${output_ppm}; echo " "$? +pamfunc -subtractor 0.1 testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 8" + test -s ${output_ppm}; echo " "$? +pamfunc -multiplier=1 -divisor=2 testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 9" + test -s ${output_ppm}; echo " "$? +pamfunc -adder=2 -subtractor=3 testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 10" + test -s ${output_ppm}; echo " "$? +pamfunc -min testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 11" + test -s ${output_ppm}; echo " "$? +pamfunc -max testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 12" + test -s ${output_ppm}; echo " "$? +pamfunc -andmask testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 13" + test -s ${output_ppm}; echo " "$? +pamfunc -ormask testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 14" + test -s ${output_ppm}; echo " "$? +pamfunc -xormask testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 15" + test -s ${output_ppm}; echo " "$? +pamfunc -not 1 testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 16" + test -s ${output_ppm}; echo " "$? +pamfunc -min=1 -max=2 testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 17" + test -s ${output_ppm}; echo " "$? +pamfunc -andmask=1 -ormask=0 testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 18" + test -s ${output_ppm}; echo " "$? +pamfunc -andmask=0xffff testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 19" + test -s ${output_ppm}; echo " "$? +pamfunc -shiftleft testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 20" + test -s ${output_ppm}; echo " "$? +pamfunc -shiftright testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 21" + test -s ${output_ppm}; echo " "$? +pamfunc -changemaxval testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 22" + test -s ${output_ppm}; echo " "$? +pamfunc -shiftleft=1 -shiftright=1 testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 23" + test -s ${output_ppm}; echo " "$? +pamfunc -multiplier=0.5 -changemaxval=65535 testimg.ppm > ${output_ppm} || \ + echo -n "Expected failure 24" + test -s ${output_ppm}; echo " "$? diff --git a/test/pamtopdbimg.test b/test/pamtopdbimg.test index 8de78a70..9afee8f1 100755 --- a/test/pamtopdbimg.test +++ b/test/pamtopdbimg.test @@ -21,7 +21,7 @@ echo high compression pgmmake 0.5 -maxval=15 160 160 > ${mono_pgm} for flag in "-compressed" "-maybecompressed" "-uncompressed" do - pamtopdbimg $flag ${mono_pgm} | wc -c + pamtopdbimg $flag ${mono_pgm} | wc -c | tr -d ' ' done | uniq -c | awk '{print $1}' rm ${mono_pgm} diff --git a/test/pamvalidate.test b/test/pamvalidate.test index 46dd1bfa..4cabc7df 100755 --- a/test/pamvalidate.test +++ b/test/pamvalidate.test @@ -6,12 +6,15 @@ echo "valid" echo -e "P1\n5 5\n01010\n10101\n01010\n00000\n11111\n" | pamvalidate -plain echo "not valid: Should print 0 four times" -echo -e "P1\n5 5\n01010\n10101\n01010\n00000\n1111\n" | pamvalidate | wc -c +echo -e "P1\n5 5\n01010\n10101\n01010\n00000\n1111\n" | pamvalidate | \ + wc -c | tr -d ' ' -echo -e "P1\n5 5\n01010\n10102\n01010\n00001\n11111\n" | pamvalidate | wc -c +echo -e "P1\n5 5\n01010\n10102\n01010\n00001\n11111\n" | pamvalidate | \ + wc -c | tr -d ' ' -echo -e "P1\n5\n01010\n10101\n01010\n00000\n11111\n" | pamvalidate | wc -c +echo -e "P1\n5\n01010\n10101\n01010\n00000\n11111\n" | pamvalidate | \ + wc -c | tr -d ' ' -echo -e "P1\n5 5" | pamvalidate | wc -c +echo -e "P1\n5 5" | pamvalidate | wc -c | tr -d ' ' diff --git a/test/pbmtext-utf8.test b/test/pbmtext-utf8.test index 1db7d849..8ebb6e31 100755 --- a/test/pbmtext-utf8.test +++ b/test/pbmtext-utf8.test @@ -125,7 +125,7 @@ long_txt=${tmpdir}/long.txt test_out=${tmpdir}/test_out head -c 4999 /dev/zero | sed 's@\x00@\xc2\xbe@g' > ${long_txt} -cat ${long_txt} | wc -c +cat ${long_txt} | wc -c | tr -d ' ' cat ${long_txt} | \ LC_ALL=${locale_for_test} pbmtext -nomargins -builtin fixed -wchar | cksum @@ -136,7 +136,7 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 echo -n "z" >> ${long_txt} -cat ${long_txt} | wc -c +cat ${long_txt} | wc -c | tr -d ' ' cat ${long_txt} | \ LC_ALL=${locale_for_test} \ diff --git a/test/pj-roundtrip.ok b/test/pj-roundtrip.ok index a13b01a7..195443ba 100644 --- a/test/pj-roundtrip.ok +++ b/test/pj-roundtrip.ok @@ -1,4 +1,4 @@ Test 1. Should print: 0 0 0 0 : 0 0 0 0 0 : 0 -Test 2. Should print: 0 0 0 0 0 : 0 -0 0 0 0 0 : 0 +Test 2. Should print: 0 0 : 0 +0 0 : 0 diff --git a/test/pj-roundtrip.test b/test/pj-roundtrip.test index 3394a4d2..2b0d61e5 100755 --- a/test/pj-roundtrip.test +++ b/test/pj-roundtrip.test @@ -1,6 +1,6 @@ #! /bin/bash # This script tests: ppmtopj pjtoppm -# Also requires: pamseq pnmremap pamtopnm pamdepth ppmtopgm pgmtopbm +# Also requires: pamseq pnmremap pamtopnm pamdepth ppmtoppm echo "Test 1. Should print: 0 0 0 0 : 0" @@ -15,8 +15,12 @@ ppmtopj ${test8_ppm} | pjtoppm | pamdepth 1 | \ rm ${test8_ppm} -echo "Test 2. Should print: 0 0 0 0 0 : 0" +echo "Test 2. Should print: 0 0 : 0" -ppmtopj testgrid.pbm | pjtoppm | ppmtopgm | pgmtopbm | \ - cmp -s - testgrid.pbm > /dev/null +testout_ppm=${tmpdir}/testout.ppm + +ppmtopj testgrid.pbm | pjtoppm > ${testout_ppm} + ppmtoppm < testgrid.pbm | cmp -s - ${testout_ppm} > /dev/null echo ${PIPESTATUS[@]} ":" $? + +rm ${testout_ppm} diff --git a/test/ppmbrighten.ok b/test/ppmbrighten.ok index 376e71d3..3895dbd0 100644 --- a/test/ppmbrighten.ok +++ b/test/ppmbrighten.ok @@ -1,3 +1,11 @@ +Test 1: Should print 1969633344 101484 1969633344 101484 -3688219243 101484 +Test 2: Should print 295150171 101484 295150171 101484 +Test 3: Should print 1 +1 +Test Error: Should print 1 four times +1 +1 +1 +1 diff --git a/test/ppmbrighten.test b/test/ppmbrighten.test index 46c5cab5..40fe08f6 100755 --- a/test/ppmbrighten.test +++ b/test/ppmbrighten.test @@ -1,12 +1,38 @@ #! /bin/bash # This script tests: ppmbrighten -# Also requires: +# Also requires: pnmnorm pambrighten pamsumm # Failure message ## Ppmbrighten is sensitive to subtle differences in floating point math. ## If this test fails, please run the program and visually examine ## the output. +echo "Test 1: Should print 1969633344 101484" + ppmbrighten -v 100 testimg.ppm | cksum -ppmbrighten -v 100 -normalize testimg.ppm | cksum + +echo "Test 2: Should print 295150171 101484" + ppmbrighten -s 100 -v -50 testimg.ppm | cksum + +echo "Test 3: Should print 1" + +ppmbrighten -v 100 -normalize testimg.ppm | pamsumm --mean | \ + awk '{print ($NF > 132.0) && ($NF < 132.2)}' + +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +echo "Test Error: Should print 1 four times" + +output_ppm=${tmpdir}/output.ppm + +pambrighten -v -120 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? +pambrighten -s -120 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? diff --git a/test/winicon-roundtrip.ok b/test/winicon-roundtrip.ok index 8334ff4e..4ba2606e 100644 --- a/test/winicon-roundtrip.ok +++ b/test/winicon-roundtrip.ok @@ -1,2 +1,12 @@ -71846281 6925 -326197919 137 +Test 1. Should print 4241318573 6973 four times +4241318573 6973 +4241318573 6973 +4241318573 6973 +4241318573 6973 +Test 1. Should print 819454437 1093 six times +819454437 1093 +819454437 1093 +819454437 1093 +819454437 1093 +819454437 1093 +819454437 1093 diff --git a/test/winicon-roundtrip.test b/test/winicon-roundtrip.test index b37a33e1..00c78400 100755 --- a/test/winicon-roundtrip.test +++ b/test/winicon-roundtrip.test @@ -1,13 +1,37 @@ #! /bin/bash -# This script tests: pamtowinicon winicontopam -# Also requires: pamcut pnmtile pamtopnm ppmtopgm pgmtopbm +# This script tests: pamtowinicon ppmtowinicon winicontopam +# Also requires: pamchannel pamcut pamdepth pamtopam pngtopam pnmtile pnmtopng +tmpdir=${tmpdir:-/tmp} +test_pam=${tmpdir}/testimg.pam -pamcut --left=30 --width=48 --height=48 testimg.ppm | \ -pamtowinicon | winicontopam | \ - pamtopnm | cksum +echo "Test 1. Should print 4241318573 6973 four times" -pnmtile 32 32 testgrid.pbm | \ -pamtowinicon | winicontopam | \ - pamtopnm | ppmtopgm | \ - pgmtopbm -th -val=0.5 | cksum +pamcut --left=30 --width=48 --height=48 testimg.ppm | pamtopam | \ + tee ${test_pam} | cksum +pamtowinicon ${test_pam} | winicontopam | \ + pamchannel -tupletype="RGB" 0 1 2 | cksum +pamtowinicon -pngthreshold=300 ${test_pam} | winicontopam | \ + pamchannel -tupletype="RGB" 0 1 2 | cksum +pamtowinicon -pngthreshold=1 ${test_pam} | winicontopam | \ + pamchannel -tupletype="RGB" 0 1 2 | cksum + +rm ${test_pam} + +echo "Test 1. Should print 819454437 1093 six times" + +pnmtile 32 32 testgrid.pbm | pamtopam | \ + tee ${test_pam} | cksum +pamtowinicon ${test_pam} | winicontopam | \ + pamdepth 1 | pamchannel -tupletype="BLACKANDWHITE" 0 | cksum +pamtowinicon -pngthreshold=300 ${test_pam} | winicontopam | \ + pamdepth 1 | pamchannel -tupletype="BLACKANDWHITE" 0 | cksum +pamtowinicon -pngthreshold=1 ${test_pam} | winicontopam | + pamdepth 1 | pamchannel -tupletype="BLACKANDWHITE" 0 | cksum +pamtowinicon -pngthreshold=1 ${test_pam} | winicontopam | + pamchannel -tupletype="BLACKANDWHITE" 0 | cksum + +rm ${test_pam} + +pnmtile 32 32 testgrid.pbm | ppmtowinicon | winicontopam | \ + pamdepth 1 | pamchannel -tupletype="BLACKANDWHITE" 0 | cksum diff --git a/test/winicon-roundtrip2.ok b/test/winicon-roundtrip2.ok new file mode 100644 index 00000000..bb8c77d8 --- /dev/null +++ b/test/winicon-roundtrip2.ok @@ -0,0 +1,80 @@ +16 24 32 48 64 : 1 plane +Should print 2588356089 8591 or 3783949470 69390 four times +2588356089 8591 +2588356089 8591 +2588356089 8591 +2588356089 8591 +16 24 32 48 64 : 2 planes +Should print 3357739334 16877 or 3331485515 138534 four times +3357739334 16877 +3357739334 16877 +3357739334 16877 +3357739334 16877 +16 24 32 48 64 : 3 planes +Should print 3734212737 25073 or 56221695 207606 four times +3734212737 25073 +3734212737 25073 +3734212737 25073 +3734212737 25073 +16 24 32 48 64 : 4 planes +Should print 1294260080 33359 or 732184466 276750 four times +1294260080 33359 +1294260080 33359 +1294260080 33359 +1294260080 33359 +16 24 32 48 64 : 5 planes: output 3 +Should print 3734212737 25073 or 56221695 207606 four times +3734212737 25073 +3734212737 25073 +3734212737 25073 +3734212737 25073 +16 24 32 48 64 : 5 planes : output 4 +Should print 2704877198 33359 or 1699833476 276750 four times +2704877198 33359 +2704877198 33359 +2704877198 33359 +2704877198 33359 +16 24 32 48 64 : 5 planes : output 5 +Should print 2567279592 41655 or 4154838752 345902 twice +2567279592 41655 +2567279592 41655 +16 32 48 256 : 1 plane +Should print 2588356089 8591 or 3783949470 69390 four times +3783949470 69390 +3783949470 69390 +3783949470 69390 +3783949470 69390 +16 32 48 256 : 2 planes +Should print 3357739334 16877 or 3331485515 138534 four times +3331485515 138534 +3331485515 138534 +3331485515 138534 +3331485515 138534 +16 32 48 256 : 3 planes +Should print 3734212737 25073 or 56221695 207606 four times +56221695 207606 +56221695 207606 +56221695 207606 +56221695 207606 +16 32 48 256 : 4 planes +Should print 1294260080 33359 or 732184466 276750 four times +732184466 276750 +732184466 276750 +732184466 276750 +732184466 276750 +16 32 48 256 : 5 planes: output 3 +Should print 3734212737 25073 or 56221695 207606 four times +56221695 207606 +56221695 207606 +56221695 207606 +56221695 207606 +16 32 48 256 : 5 planes : output 4 +Should print 2704877198 33359 or 1699833476 276750 four times +1699833476 276750 +1699833476 276750 +1699833476 276750 +1699833476 276750 +16 32 48 256 : 5 planes : output 5 +Should print 2567279592 41655 or 4154838752 345902 twice +4154838752 345902 +4154838752 345902 diff --git a/test/winicon-roundtrip2.test b/test/winicon-roundtrip2.test new file mode 100755 index 00000000..ec074055 --- /dev/null +++ b/test/winicon-roundtrip2.test @@ -0,0 +1,150 @@ +#! /bin/bash +# This script tests: pamtowinicon winicontopam +# Also requires: pamchannel pamdepth pamstack pamtopam pbmmake pngtopam +# Also requires: pnmtopng ppmpat + +tmpdir=${tmpdir:-/tmp} +test_pam=${tmpdir}/testimg.pam +test1_pam=${tmpdir}/testimg1.pam +test2_pam=${tmpdir}/testimg2.pam +#test3_pam=${tmpdir}/testimg3.pam +test4_pam=${tmpdir}/testimg4.pam +test5_pam=${tmpdir}/testimg5.pam +black_pam=${tmpdir}/black.pam +white_pam=${tmpdir}/white.pam +gray_pam=${tmpdir}/gray.pam + +# classic: 16 24 32 48 64 +# full: 16 32 48 256 + +for sizes in "16 24 32 48 64" "16 32 48 256" + do + + for size in ${sizes} + do + ppmpat -tartan -color=rgb:1f/1f/1f,rgb:7f/ff/00,rgb:00/ff/3f \ + ${size} ${size} + done | pamtopam > ${test_pam} + + for size in ${sizes} + do + pbmmake -black ${size} ${size} | pamdepth 255 + done | pamtopam > ${black_pam} + + for size in ${sizes} + do + pbmmake -white ${size} ${size} | pamdepth 255 + done | pamtopam > ${white_pam} + + for size in ${sizes} + do + pbmmake -gray ${size} ${size} | pamdepth 255 + done | pamtopam > ${gray_pam} + +# 1 plane + + echo ${sizes} ": 1 plane" + echo "Should print 2588356089 8591 or 3783949470 69390 four times" + + pamchannel -tupletype="GRAYSCALE" 0 < ${test_pam} | \ + tee ${test1_pam} | cksum + pamtowinicon ${test1_pam} | winicontopam -allimages | \ + pamchannel -tupletype="GRAYSCALE" 0 | cksum + pamtowinicon -pngthreshold=300 ${test1_pam} | winicontopam -allimages | \ + pamchannel -tupletype="GRAYSCALE" 0 | cksum + pamtowinicon -pngthreshold=1 ${test1_pam} | winicontopam -allimages | \ + pamchannel -tupletype="GRAYSCALE" 0 | cksum + + rm ${test1_pam} + +# 2 planes + + echo ${sizes} ": 2 planes" + echo "Should print 3357739334 16877 or 3331485515 138534 four times" + + pamstack ${gray_pam} ${gray_pam} | \ + pamchannel -tupletype="GRAYSCALE_ALPHA" 0 1 | tee ${test2_pam} | cksum + pamtowinicon ${test2_pam} | winicontopam -allimages | \ + pamchannel -tupletype="GRAYSCALE_ALPHA" 0 1 | cksum + pamtowinicon -pngthreshold=300 ${test2_pam} | winicontopam -allimages | \ + pamchannel -tupletype="GRAYSCALE_ALPHA" 0 1 | cksum + pamtowinicon -pngthreshold=1 ${test2_pam} | winicontopam -allimages | \ + pamchannel -tupletype="GRAYSCALE_ALPHA" 0 1 | cksum + + rm ${test2_pam} + +# 3 planes + + echo ${sizes} ": 3 planes" + echo "Should print 3734212737 25073 or 56221695 207606 four times" + + pamchannel -tupletype="RGB" 0 1 2 < ${test_pam} | cksum + pamtowinicon ${test_pam} | winicontopam -allimages | \ + pamchannel -tupletype="RGB" 0 1 2 | cksum + pamtowinicon -pngthreshold=300 ${test_pam} | winicontopam -allimages | \ + pamchannel -tupletype="RGB" 0 1 2 | cksum + pamtowinicon -pngthreshold=1 ${test_pam} | winicontopam -allimages | \ + pamchannel -tupletype="RGB" 0 1 2 | cksum + +# 4 planes + + echo ${sizes} ": 4 planes" + echo "Should print 1294260080 33359 or 732184466 276750 four times" + + pamdepth 255 ${black_pam} | pamstack ${test_pam} - | \ + pamchannel -tupletype="RGB_ALPHA" 0 1 2 3 | tee ${test4_pam} | cksum + pamtowinicon ${test4_pam} | winicontopam -allimages | \ + pamchannel -tupletype="RGB_ALPHA" 0 1 2 3 | cksum + pamtowinicon -pngthreshold=300 ${test4_pam} | winicontopam -allimages | \ + pamchannel -tupletype="RGB_ALPHA" 0 1 2 3 | cksum + pamtowinicon -pngthreshold=1 ${test4_pam} | winicontopam -allimages | \ + pamchannel -tupletype="RGB_ALPHA" 0 1 2 3 | cksum + + rm ${test4_pam} + +# 5 planes + + echo ${sizes} ": 5 planes: output 3" + echo "Should print 3734212737 25073 or 56221695 207606 four times" + + pamstack ${test_pam} ${gray_pam} ${white_pam} | \ + pamchannel -tupletype="RGB" 0 1 2 | \ + tee ${test5_pam} | cksum + pamtowinicon ${test5_pam} | winicontopam -allimages -andmasks | \ + pamchannel -tupletype="RGB" 0 1 2 | cksum + pamtowinicon -pngthreshold=300 ${test5_pam} | \ + winicontopam -allimages -andmasks | \ + pamchannel -tupletype="RGB" 0 1 2 | cksum + pamtowinicon -pngthreshold=1 ${test5_pam} | \ + winicontopam -allimages -andmasks | \ + pamchannel -tupletype="RGB" 0 1 2 | cksum + + echo ${sizes} ": 5 planes : output 4" + echo "Should print 2704877198 33359 or 1699833476 276750 four times" + + pamstack ${test_pam} ${gray_pam} ${white_pam} | \ + pamchannel -tupletype="RGB_ALPHA" 0 1 2 3 | \ + tee ${test5_pam} | cksum + pamtowinicon ${test5_pam} | winicontopam -allimages -andmasks | \ + pamchannel -tupletype="RGB_ALPHA" 0 1 2 3 | cksum + pamtowinicon -pngthreshold=300 ${test5_pam} | \ + winicontopam -allimages -andmasks | \ + pamchannel -tupletype="RGB_ALPHA" 0 1 2 3 | cksum + pamtowinicon -pngthreshold=1 ${test5_pam} | \ + winicontopam -allimages -andmasks | \ + pamchannel -tupletype="RGB_ALPHA" 0 1 2 3 | cksum + + echo ${sizes} ": 5 planes : output 5" + echo "Should print 2567279592 41655 or 4154838752 345902 twice" + + pamstack ${test_pam} ${gray_pam} ${white_pam} | \ + pamchannel -tupletype="RGB_ALPHA_ANDMASK" 0 1 2 3 4 | \ + tee ${test5_pam} | cksum + pamtowinicon -pngthreshold=300 ${test5_pam} | \ + winicontopam -allimages -andmasks | \ + pamchannel -tupletype="RGB_ALPHA_ANDMASK" 0 1 2 3 4 | cksum + + rm ${test5_pam} + + rm ${test_pam} ${gray_pam} ${white_pam} ${black_pam} +done |