diff options
Diffstat (limited to 'test')
85 files changed, 1674 insertions, 478 deletions
diff --git a/test/Execute-Tests b/test/Execute-Tests index 9b51cfd5..3c231d98 100755 --- a/test/Execute-Tests +++ b/test/Execute-Tests @@ -186,7 +186,7 @@ elif [ $VALGRIND_TESTS = "on" ] for i in awk basename cat cksum cmp comm cp cut date dirname \ egrep fgrep file grep gs head iconv ls mkdir mktemp perl \ - printf rm sed seq sh sort tee tr uniq wc \ + printf rm sed seq sh sort tail tee tr uniq wc \ testrandom Available-Testprog # Tell valgrind not to probe execution of the above programs. diff --git a/test/Test-Order b/test/Test-Order index eafcb974..214cf4ba 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -16,6 +16,8 @@ pbmtext.test pbmtext-bdf.test pbmtext-iso88591.test pbmtext-utf8.test +pbmtextps-dump.test +pbmtextps.test pbmupc.test pgmramp.test pamgauss.test @@ -70,6 +72,8 @@ pamhue.test pbmclean.test pamcut.test +pamcat1.test +pamcat2.test pnmcat.test pamdice.test pamundice.test @@ -232,6 +236,7 @@ pj-roundtrip.test ps-roundtrip.test ps-flate-roundtrip.test ps-alt-roundtrip.test +qoi-roundtrip.test sgi-roundtrip.test sbig-roundtrip.test st4-roundtrip.test diff --git a/test/all-in-place.ok b/test/all-in-place.ok index 0af78737..31854728 100644 --- a/test/all-in-place.ok +++ b/test/all-in-place.ok @@ -41,6 +41,7 @@ pamarith: ok pambackground: ok pambayer: ok pambrighten: ok +pamcat: ok pamchannel: ok pamcomp: ok pamcrater: ok @@ -202,7 +203,6 @@ pjtoppm: ok pktopbm: ok pngtopam: ok pnmalias: ok -pnmcat: ok pnmcolormap: ok pnmconvol: ok pnmcrop: ok diff --git a/test/all-in-place.test b/test/all-in-place.test index c2b99328..386d2872 100755 --- a/test/all-in-place.test +++ b/test/all-in-place.test @@ -83,6 +83,7 @@ ordinary_testprogs="\ pambackground \ pambayer \ pambrighten \ + pamcat \ pamchannel \ pamcomp \ pamcrater \ @@ -244,7 +245,6 @@ ordinary_testprogs="\ pktopbm \ pngtopam \ pnmalias \ - pnmcat \ pnmcolormap \ pnmconvol \ pnmcrop \ @@ -438,4 +438,4 @@ testExitStatus anytopnm 0 $? manweb --help > /dev/null testExitStatus manweb 0 $? -# We do not test vidtoppm. \ No newline at end of file +# We do not test vidtoppm. diff --git a/test/gif-roundtrip.test b/test/gif-roundtrip.test index a30be1aa..13ff595e 100755 --- a/test/gif-roundtrip.test +++ b/test/gif-roundtrip.test @@ -10,40 +10,40 @@ tmpdir=${tmpdir:-/tmp} echo "Test 1. Should print 1926073387 101484" -rose_ppm=${tmpdir}/rose.ppm +test_ppm=${tmpdir}/testimg.ppm -cp testimg.ppm ${rose_ppm} && -ppmtorgb3 ${rose_ppm} +cp testimg.ppm ${tmpdir} && +ppmtorgb3 ${test_ppm} -rose_red=${tmpdir}/rose.red -rose_grn=${tmpdir}/rose.grn -rose_blu=${tmpdir}/rose.blu +test_red=${tmpdir}/testimg.red +test_grn=${tmpdir}/testimg.grn +test_blu=${tmpdir}/testimg.blu out_red=${tmpdir}/out.red out_grn=${tmpdir}/out.grn #out_blu=${tmpdir}/out.blu -pamtogif ${rose_red} | giftopnm > ${out_red} && -pamtogif ${rose_grn} | giftopnm > ${out_grn} && -pamtogif ${rose_blu} | giftopnm | \ +pamtogif ${test_red} | giftopnm > ${out_red} && +pamtogif ${test_grn} | giftopnm > ${out_grn} && +pamtogif ${test_blu} | giftopnm | \ rgb3toppm ${out_red} ${out_grn} - | \ cksum -rm ${rose_ppm} ${rose_grn} ${rose_blu} ${out_red} ${out_grn} +rm ${test_ppm} ${test_grn} ${test_blu} ${out_red} ${out_grn} echo "Test 2. Should produce 1571496937 33838 six times" -rose_gif=${tmpdir}/rose.gif +test_gif=${tmpdir}/testimg.gif -cat ${rose_red} | cksum -pamtogif ${rose_red} | giftopnm | cksum -pamtogif -interlace ${rose_red} | giftopnm | cksum -pamtogif -noclear ${rose_red} | giftopnm | cksum -pamtogif -sort ${rose_red} | tee ${rose_gif} | \ +cat ${test_red} | cksum +pamtogif ${test_red} | giftopnm | cksum +pamtogif -interlace ${test_red} | giftopnm | cksum +pamtogif -noclear ${test_red} | giftopnm | cksum +pamtogif -sort ${test_red} | tee ${test_gif} | \ giftopnm | cksum -echo "junk" >> ${rose_gif} && \ - giftopnm -image=1 -quitearly ${rose_gif} | cksum +echo "junk" >> ${test_gif} && \ + giftopnm -image=1 -quitearly ${test_gif} | cksum -rm ${rose_gif} ${rose_red} +rm ${test_gif} ${test_red} echo "Test 3. Should produce 281226646 481 six times" # maze.pbm is too small for -noclear to take effect @@ -78,7 +78,7 @@ echo "" echo "Test 5. Should produce: N : 0 0 0 0 : 0 , N : 0 0 0 0 : 0" echo "(N=238, 239, 240, 241, 255, 256, 257, 4030, 4031, 4097)" -rose_pgm=${tmpdir}/rose.pgm +test_pgm=${tmpdir}/testimg.pgm # The following awk scripts produce a PGM file with no repeated # sequences. Obviously this cannot be compressed at all; the codes @@ -114,14 +114,14 @@ awk -v maxval=${maxval} 'BEGIN \ for size in 238 239 240 241 255 256 257 do - pamcut -height=${size} ${test257_pgm} > ${rose_pgm} && - pamtogif -verbose ${rose_pgm} | giftopnm | pamdepth ${maxval} | \ - cmp - ${rose_pgm} - echo -n ${size} ":" ${PIPESTATUS[@]} ":" $? ", " - pamtogif -nolzw -verbose ${rose_pgm} | giftopnm | pamdepth ${maxval} | \ - cmp - ${rose_pgm} - echo ${size} ":" ${PIPESTATUS[@]} ":" $? - rm ${rose_pgm} + pamcut -height=${size} ${test257_pgm} > ${test_pgm} && + pamtogif -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ + cmp - ${test_pgm} + printf "${size} : ${PIPESTATUS[*]} : $? , " + pamtogif -nolzw -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ + cmp - ${test_pgm} + printf "${size} : ${PIPESTATUS[*]} : $?\n" + rm ${test_pgm} done rm ${test257_pgm} @@ -144,16 +144,16 @@ awk -v maxval=${maxval} 'BEGIN \ for size in 4030 4031 4097 do - pamcut -height ${size} ${test4097_pgm} > ${rose_pgm} && - pamtogif -verbose ${rose_pgm} | giftopnm | pamdepth ${maxval} | \ - cmp - ${rose_pgm} + pamcut -height ${size} ${test4097_pgm} > ${test_pgm} && + pamtogif -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ + cmp - ${test_pgm} # pamdepth ${maxval} is necessary because # giftopnm output is maxval 255 - echo -n ${size} ":" ${PIPESTATUS[@]} ":" $? ", " - pamtogif -nolzw ${rose_pgm} | giftopnm | pamdepth ${maxval} | \ - cmp - ${rose_pgm} - echo ${size} ":" ${PIPESTATUS[@]} ":" $? - rm ${rose_pgm} + printf "${size} : ${PIPESTATUS[*]} : $? , " + pamtogif -nolzw ${test_pgm} | giftopnm | pamdepth ${maxval} | \ + cmp - ${test_pgm} + printf "${size} : ${PIPESTATUS[*]} : $?\n" + rm ${test_pgm} done rm ${test4097_pgm} diff --git a/test/gif-transparent1.test b/test/gif-transparent1.test index c2da5468..74496787 100755 --- a/test/gif-transparent1.test +++ b/test/gif-transparent1.test @@ -52,7 +52,7 @@ i=1 for test_pnm in ${argyle_ppm} ${gingham_ppm} ${madras_ppm} \ ${alpha0_pbm} ${alpha1_pbm} do - echo -n "Image $i: "; i=$((i+1)); + printf "Image $i: "; i=$((i+1)); pamtogif ${test_pnm} | giftopnm | tee ${out_pnm} | \ cmp -s - ${test_pnm}; result=$? diff --git a/test/legacy-names.ok b/test/legacy-names.ok index 27baf672..f491a1ff 100644 --- a/test/legacy-names.ok +++ b/test/legacy-names.ok @@ -12,6 +12,7 @@ pgmoil: ok pgmslice: ok pngtopnm: ok pnmarith: ok +pnmcat: ok pnmcomp: ok pnmcut: ok pnmdepth: ok diff --git a/test/legacy-names.test b/test/legacy-names.test index e20dde76..9c0c5697 100755 --- a/test/legacy-names.test +++ b/test/legacy-names.test @@ -69,6 +69,7 @@ ordinary_testprogs="\ pgmslice \ pngtopnm \ pnmarith \ + pnmcat \ pnmcomp \ pnmcut \ pnmdepth \ diff --git a/test/pamarith.ok b/test/pamarith.ok index c9fc49db..973b8d1b 100644 --- a/test/pamarith.ok +++ b/test/pamarith.ok @@ -2,8 +2,8 @@ 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 +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 diff --git a/test/pamarith.test b/test/pamarith.test index 9c95db80..34922a90 100755 --- a/test/pamarith.test +++ b/test/pamarith.test @@ -1,6 +1,6 @@ #! /bin/sh # This script tests: pamarith -# Also requires: pamtopnm rgb3toppm pamenlarge pnmcat pamseq pbmmake pgmmake +# Also requires: pamtopnm rgb3toppm pamenlarge pamcat pamseq pbmmake pgmmake # Also requires: ppmpat pamchannel tmpdir=${tmpdir:-/tmp} @@ -18,7 +18,7 @@ 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} +pamcat -tb ${input1_pgm} ${input2_pgm} -plain for fn in "-add" "-subtract" "-multiply" "-divide" "-difference" \ "-minimum" "-maximum" "-mean" "-compare" "-equal" \ @@ -43,7 +43,7 @@ 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} +pamcat -tb -plain ${input1_pbm} ${input2_pbm} for fn in "-add" "-subtract" "-multiply" "-divide" "-difference" \ "-minimum" "-maximum" "-mean" "-compare" "-equal" \ @@ -127,80 +127,80 @@ test_out=${tmpdir}/test_out # multiple functions pamarith -add -subtract testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -multiply -divide testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -difference -minimum testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -maximum -mean testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -compare -and testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -compare -equal testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -or -nand testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -nor -xor testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -shiftleft -shiftright testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} # -add does not take a value pamarith -add=1 testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 10" + printf "Expected failure 10" test -s ${test_out}; echo " "$? rm -f ${test_out} # No function pamarith -plain testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 11" + printf "Expected failure 11" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 12" + printf "Expected failure 12" test -s ${test_out}; echo " "$? rm -f ${test_out} # Just one input image file pamarith -add testimg.ppm > ${test_out} || \ - echo -n "Expected failure 13" + printf "Expected failure 13" test -s ${test_out}; echo " "$? rm -f ${test_out} # No input image file pamarith -add > ${test_out} || \ - echo -n "Expected failure 14" + printf "Expected failure 14" test -s ${test_out}; echo " "$? rm -f ${test_out} @@ -208,48 +208,48 @@ pamarith -add > ${test_out} || \ pamchannel -infile testimg.ppm 0 1 | \ pamarith -add testimg.ppm - > ${test_out} || \ - echo -n "Expected failure 15" + printf "Expected failure 15" test -s ${test_out}; echo " "$? rm -f ${test_out} # Input images with different x/y dimensions pamarith -add testimg.ppm testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 16" + printf "Expected failure 16" test -s ${test_out}; echo " "$? rm -f ${test_out} pamenlarge -xscale=2 testgrid.pbm | \ pamarith -add testgrid.pbm - > ${test_out} || \ - echo -n "Expected failure 17" + printf "Expected failure 17" test -s ${test_out}; echo " "$? rm -f ${test_out} pamenlarge -yscale=3 testgrid.pbm | \ pamarith -add testgrid.pbm - > ${test_out} || \ - echo -n "Expected failure 18" + printf "Expected failure 18" test -s ${test_out}; echo " "$? rm -f ${test_out} # Invalid usage of -closeness pamarith -equal -closeness=100.1 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 19" + printf "Expected failure 19" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -equal -closeness=-10 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 20" + printf "Expected failure 20" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -closeness -equal testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 21" + printf "Expected failure 21" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -compare -closeness=10 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 22" + printf "Expected failure 22" test -s ${test_out}; echo " "$? rm -f ${test_out} @@ -267,64 +267,64 @@ pgmmake -maxval=8191 1.0 3 1 > ${input5_pgm} # Bit string functions - Maxval must match pamarith -and ${input3_pgm} ${input5_pgm} > ${test_out} || \ - echo -n "Expected failure 23" + printf "Expected failure 23" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -or ${input3_pgm} ${input5_pgm} > ${test_out} || \ - echo -n "Expected failure 24" + printf "Expected failure 24" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -nand ${input3_pgm} ${input5_pgm} > ${test_out} || \ - echo -n "Expected failure 25" + printf "Expected failure 25" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -nor ${input3_pgm} ${input5_pgm} > ${test_out} || \ - echo -n "Expected failure 26" + printf "Expected failure 26" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -xor ${input3_pgm} ${input5_pgm} > ${test_out} || \ - echo -n "Expected failure 27" + printf "Expected failure 27" test -s ${test_out}; echo " "$? rm -f ${test_out} # Bit string functions - Maxval must be 2^n -1 pamarith -and ${input4_pgm} ${input4_pgm} > ${test_out} || \ - echo -n "Expected failure 28" + printf "Expected failure 28" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -or ${input4_pgm} ${input4_pgm} > ${test_out} || \ - echo -n "Expected failure 29" + printf "Expected failure 29" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -nand ${input4_pgm} ${input4_pgm} > ${test_out} || \ - echo -n "Expected failure 30" + printf "Expected failure 30" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -nor ${input4_pgm} ${input4_pgm} > ${test_out} || \ - echo -n "Expected failure 31" + printf "Expected failure 31" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -xor ${input4_pgm} ${input4_pgm} > ${test_out} || \ - echo -n "Expected failure 32" + printf "Expected failure 32" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -shiftleft ${input4_pgm} ${input4_pgm} > ${test_out} || \ - echo -n "Expected failure 33" + printf "Expected failure 33" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -shiftright ${input4_pgm} ${input4_pgm} > ${test_out} || \ - echo -n "Expected failure 34" + printf "Expected failure 34" test -s ${test_out}; echo " "$? rm -f ${test_out} @@ -335,32 +335,32 @@ rm ${input3_pgm} ${input4_pgm} ${input5_pgm} # three or more inputs. pamarith -subtract testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 35" + printf "Expected failure 35" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -divide testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 36" + printf "Expected failure 36" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -compare testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 37" + printf "Expected failure 37" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -difference testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 38" + printf "Expected failure 38" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -shiftleft testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 39" + printf "Expected failure 39" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -shiftright testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 40" + printf "Expected failure 40" test -s ${test_out}; echo " "$? rm -f ${test_out} @@ -368,11 +368,11 @@ pamarith -shiftright testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \ # These two cases should be removed once improvements are made. pamarith -equal testgrid.pbm testgrid.pbm testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 41" + printf "Expected failure 41" test -s ${test_out}; echo " "$? rm -f ${test_out} pamarith -mean testgrid.pbm testgrid.pbm testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 42" + printf "Expected failure 42" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamcat1.ok b/test/pamcat1.ok new file mode 100644 index 00000000..4e23666f --- /dev/null +++ b/test/pamcat1.ok @@ -0,0 +1,150 @@ +Test 1. Should print 15135078 29, then 0 fourteen times +15135078 29 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +Test 2. Should print 1957849403 59, 0 six times, 1 once +1957849403 59 +0 +0 +0 +0 +0 +0 +1 +Test 3. Should print 2673197404 69, 0 six times, 1 once +2673197404 69 +0 +0 +0 +0 +0 +0 +1 +Test 4. Should print 2285402562 36, then 0 twelve times +2285402562 36 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +Test 5. Should print 1836757613 62, 0 six times, 1 once +1836757613 62 +0 +0 +0 +0 +0 +0 +1 +Test 6. Should print 3601245348 137, 0 six times, 1 once +3601245348 137 +0 +0 +0 +0 +0 +0 +1 +Test 7. Should print 1572996771 71, then 0 twelve times +1572996771 71 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +Test 8. Should print 270413826 252, 0 six times, 1 once +270413826 252 +0 +0 +0 +0 +0 +0 +1 +Test 9. Should print 2942772630 192, 0 six times, 1 once +2942772630 192 +0 +0 +0 +0 +0 +0 +1 +Test 10. Should print 2700536985 95, then 0 twelve times +2700536985 95 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +Test 11. Should print 2193235886 195, 0 eight times, 1 once +2193235886 195 +0 +0 +0 +0 +0 +0 +0 +0 +1 +Test 12. Should print 2773166369 245, 0 nine times, 1 once +2773166369 245 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1 +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 diff --git a/test/pamcat1.test b/test/pamcat1.test new file mode 100755 index 00000000..67d941cc --- /dev/null +++ b/test/pamcat1.test @@ -0,0 +1,271 @@ +#! /bin/sh +# This script tests: pamcat +# Also requires: pbmmake pgmmake ppmmake pamseq pamrestack + +tmpdir=${tmpdir:-/tmp} +check10x10_pbm=${tmpdir}/check10x10.pbm +check40x10_pbm=${tmpdir}/check40x10.pbm +check10x30_pbm=${tmpdir}/check10x30.pbm + +gray5x5_pgm=${tmpdir}/gray5x5.pgm +gray10x5_pgm=${tmpdir}/gray10x5.pgm +gray5x25_pgm=${tmpdir}/gray5x25.pgm + +yellow4x5_ppm=${tmpdir}/yellow4x5.ppm +yellow16x5_ppm=${tmpdir}/yellow16x5.ppm +yellow4x15_ppm=${tmpdir}/yellow4x15.ppm + +seq2_4h_pam=${tmpdir}/seq2_4h.pam +seq2_4h4_pam=${tmpdir}/seq2_4h4.pam +seq2_4v_pam=${tmpdir}/seq2_4v.pam +seq2_4v3_pam=${tmpdir}/seq2_4v3.pam + + +echo "Test 1. Should print 15135078 29, then 0 fourteen times" + +pbmmake -g 10 10 | tee ${check10x10_pbm} | cksum +for opt in "-leftright" "-lr" "-lr -jtop" "-lr -jcenter" "-lr -jbottom" \ + "-lr -white" "-lr -black" \ + "-topbottom" "-tb" "-tb -jleft" "-tb -jcenter" "-tb --jright" \ + "-tb -white" "-tb -black" + do + pamcat ${opt} ${check10x10_pbm} | cmp -s ${check10x10_pbm} - ; echo $? + done + + +echo "Test 2. Should print 1957849403 59, 0 six times, 1 once" +pbmmake -g 40 10 | tee ${check40x10_pbm} | cksum +for opt in "-leftright" "-lr -jtop" "-lr -jcenter" "-lr -jbottom" \ + "-lr -white" "-lr -black" \ + "-tb" + do + pamcat ${opt} ${check10x10_pbm} ${check10x10_pbm} \ + ${check10x10_pbm} ${check10x10_pbm} | \ + cmp -s ${check40x10_pbm} - ; echo $? + done + + +echo "Test 3. Should print 2673197404 69, 0 six times, 1 once" +pbmmake -g 10 30 | tee ${check10x30_pbm} | cksum +for opt in "-topbottom" "-tb -jleft" "-tb -jcenter" "-tb --jright" \ + "-tb -white" "-tb -black" \ + "-lr" + do + pamcat ${opt} ${check10x10_pbm} ${check10x10_pbm} ${check10x10_pbm} |\ + cmp -s ${check10x30_pbm} - ; echo $? + done + +rm ${check10x10_pbm} ${check40x10_pbm} ${check10x30_pbm} + + +echo "Test 4. Should print 2285402562 36, then 0 twelve times" + +pgmmake 0.125 5 5 | tee ${gray5x5_pgm} | cksum +for opt in "-leftright" "-lr -jtop" "-lr -jcenter" "-lr -jbottom" \ + "-lr -white" "-lr -black" \ + "-topbottom" "-tb -jleft" "-tb -jcenter" "-tb --jright" \ + "-tb -white" "-tb -black" + do + pamcat ${opt} ${gray5x5_pgm} | cmp -s ${gray5x5_pgm} - ; echo $? + done + + +echo "Test 5. Should print 1836757613 62, 0 six times, 1 once" +pgmmake 0.125 10 5 | tee ${gray10x5_pgm} | cksum +for opt in "-leftright" "-lr -jtop" "-lr -jcenter" "-lr -jbottom" \ + "-lr -white" "-lr -black" \ + "-tb" + do + pamcat ${opt} ${gray5x5_pgm} ${gray5x5_pgm} |\ + cmp -s ${gray10x5_pgm} - ; echo $? + done + + +echo "Test 6. Should print 3601245348 137, 0 six times, 1 once" +pgmmake 0.125 5 25 | tee ${gray5x25_pgm} | cksum +for opt in "-topbottom" "-tb -jleft" "-tb -jcenter" "-tb --jright" \ + "-tb -white" "-tb -black" \ + "-lr" + do + pamcat ${opt} ${gray5x5_pgm} ${gray5x5_pgm} ${gray5x5_pgm} \ + ${gray5x5_pgm} ${gray5x5_pgm} |\ + cmp -s ${gray5x25_pgm} - ; echo $? + done + + +rm ${gray5x5_pgm} ${gray10x5_pgm} ${gray5x25_pgm} + + +echo "Test 7. Should print 1572996771 71, then 0 twelve times" +ppmmake rgb:255/255/1 4 5 | tee ${yellow4x5_ppm} | cksum +for opt in "-leftright" "-lr -jtop" "-lr -jcenter" "-lr -jbottom" \ + "-lr -white" "-lr -black" \ + "-topbottom" "-tb -jleft" "-tb -jcenter" "-tb --jright" \ + "-tb -white" "-tb -black" + do + pamcat ${opt} ${yellow4x5_ppm} |\ + cmp -s ${yellow4x5_ppm} - ; echo $? + done + + +echo "Test 8. Should print 270413826 252, 0 six times, 1 once" +ppmmake rgb:255/255/1 16 5 | tee ${yellow16x5_ppm} | cksum +for opt in "-leftright" "-lr -jtop" "-lr -jcenter" "-lr -jbottom" \ + "-lr -white" "-lr -black" \ + "-tb" + do + pamcat ${opt} ${yellow4x5_ppm} ${yellow4x5_ppm} \ + ${yellow4x5_ppm} ${yellow4x5_ppm} |\ + cmp -s ${yellow16x5_ppm} - ; echo $? + done + + +echo "Test 9. Should print 2942772630 192, 0 six times, 1 once" +ppmmake rgb:255/255/1 4 15 | tee ${yellow4x15_ppm} | cksum +for opt in "-topbottom" "-tb -jleft" "-tb -jcenter" "-tb --jright" \ + "-tb -white" "-tb -black" \ + "-lr" + do + pamcat ${opt} ${yellow4x5_ppm} ${yellow4x5_ppm} ${yellow4x5_ppm} |\ + cmp -s ${yellow4x15_ppm} - ; echo $? + done + +rm ${yellow4x5_ppm} ${yellow16x5_ppm} ${yellow4x15_ppm} + + +echo "Test 10. Should print 2700536985 95, then 0 twelve times" +pamseq 2 4 | tee ${seq2_4h_pam} | cksum +for opt in "-leftright" "-lr -jtop" "-lr -jcenter" "-lr -jbottom" \ + "-lr -white" "-lr -black" \ + "-topbottom" "-tb -jleft" "-tb -jcenter" "-tb --jright" \ + "-tb -white" "-tb -black" + do + pamcat ${opt} ${seq2_4h_pam} |\ + cmp -s ${seq2_4h_pam} - ; echo $? + done + + +echo "Test 11. Should print 2193235886 195, 0 eight times, 1 once" +pamrestack -width=1 ${seq2_4h_pam} | tee ${seq2_4v_pam} |\ + pamenlarge -xscale=3 |\ + tee ${seq2_4v3_pam} | cksum +pamcat -lr ${seq2_4v_pam} ${seq2_4v_pam} | pamcat -lr - ${seq2_4v_pam} |\ + cmp -s ${seq2_4v3_pam} - ; echo $? +pamcat -lr ${seq2_4v_pam} | pamcat -lr - ${seq2_4v_pam} ${seq2_4v_pam} |\ + cmp -s ${seq2_4v3_pam} - ; echo $? +for opt in "-leftright" "-lr -jtop" "-lr -jcenter" "-lr -jbottom" \ + "-lr -white" "-lr -black" \ + "-topbottom" + do + pamcat ${opt} ${seq2_4v_pam} ${seq2_4v_pam} ${seq2_4v_pam} |\ + cmp -s ${seq2_4v3_pam} - ; echo $? + done + + +echo "Test 12. Should print 2773166369 245, 0 nine times, 1 once" +pamenlarge -yscale 4 ${seq2_4h_pam} | tee ${seq2_4h4_pam} | cksum +pamcat -tb ${seq2_4h_pam} |\ + pamcat -tb - ${seq2_4h_pam} ${seq2_4h_pam} ${seq2_4h_pam} |\ + cmp -s ${seq2_4h4_pam} - ; echo $? +pamcat -tb ${seq2_4h_pam} ${seq2_4h_pam} |\ + pamcat -tb - ${seq2_4h_pam} ${seq2_4h_pam} |\ + cmp -s ${seq2_4h4_pam} - ; echo $? +pamcat -tb ${seq2_4h_pam} ${seq2_4h_pam} ${seq2_4h_pam}|\ + pamcat -tb - ${seq2_4h_pam} |\ + cmp -s ${seq2_4h4_pam} - ; echo $? +for opt in "-topbottom" "-tb -jleft" "-tb -jcenter" "-tb --jright" \ + "-tb -white" "-tb -black" \ + "-leftright" + do + pamcat ${opt} ${seq2_4h_pam} ${seq2_4h_pam} ${seq2_4h_pam} ${seq2_4h_pam} |\ + cmp -s ${seq2_4h4_pam} - ; echo $? + done + +rm ${seq2_4h_pam} ${seq2_4v_pam} ${seq2_4v3_pam} ${seq2_4h4_pam} + + + +echo "Test Invalid" + +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +# direction not specified +pamcat testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 1" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +# both directions specified +pamcat -topbottom -leftright testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 2" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +# both pad colors specified +pamcat -topbottom -white -black testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 3" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +# justification parameters overspecified +pamcat -lr -jtop -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 4" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pamcat -lr -jtop -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 5" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pamcat -lr -jcenter -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 6" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pamcat -tb -jleft -jright testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 7" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pamcat -tb -jleft -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 8" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pamcat -tb -jcenter -jright testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 9" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +# justification parameter in the wrong direction +pamcat -lr -jleft testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 10" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pamcat -lr -jright testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 11" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pamcat -tb -jtop testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 12" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pamcat -tb -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ + printf "Expected failure 13" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +# more than one input image from standard input +cat testgrid.pbm | pamcat -lr - - testimg.ppm > ${test_out} || \ + printf "Expected failure 14" + test -s ${test_out}; echo " "$? + rm -f ${test_out} diff --git a/test/pamcat2.ok b/test/pamcat2.ok new file mode 100644 index 00000000..549fe97a --- /dev/null +++ b/test/pamcat2.ok @@ -0,0 +1,93 @@ +Test 1. +P1 +1 1 +0 +P1 +1 1 +0 +P1 +1 1 +1 +P1 +1 1 +0 +Test 2. +P1 +7 5 +0000000 +1000001 +1000001 +1000001 +1000001 +P1 +7 5 +1000001 +1000001 +0000000 +1000001 +1000001 +P1 +7 5 +1000001 +1000001 +1000001 +1000001 +0000000 +P1 +7 5 +1000001 +1000001 +0000000 +1000001 +1000001 +P1 +5 7 +01111 +00000 +00000 +00000 +00000 +00000 +01111 +P1 +5 7 +11011 +00000 +00000 +00000 +00000 +00000 +11011 +P1 +5 7 +11110 +00000 +00000 +00000 +00000 +00000 +11110 +P1 +5 7 +11011 +00000 +00000 +00000 +00000 +00000 +11011 +Test 3. +1715060535 12 +1715060535 12 +3621575043 12 +3621575043 12 +Test 4. +1972597727 14 +1972597727 14 +Test 5. +2175144709 10456 +2175144709 10456 +2175144709 10456 +609107534 10444 +609107534 10444 +609107534 10444 diff --git a/test/pamcat2.test b/test/pamcat2.test new file mode 100755 index 00000000..6c76568d --- /dev/null +++ b/test/pamcat2.test @@ -0,0 +1,56 @@ +#! /bin/sh +# This script tests: pamcat +# Also requires: pbmmake pamflip + +tmpdir=${tmpdir:-/tmp} +dotw_pbm=${tmpdir}/dotw.pbm +dotb_pbm=${tmpdir}/dotb.pbm +check5x5_pbm=${tmpdir}/check5x5.pbm +dot_ppm=${tmpdir}/dot.ppm + +echo "Test 1." +pbmmake -w 1 1 | tee ${dotw_pbm} | pamcat -tb -plain +pamcat -lr -plain ${dotw_pbm} +pbmmake -b 1 1 | tee ${dotb_pbm} | pamcat -tb -plain +pamcat -tb -plain ${dotw_pbm} + +echo "Test 2." + +pbmmake -w 5 5 > ${check5x5_pbm} + +pamcat -lr -jt -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -lr -jc -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -lr -jb -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -lr -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain + +pamcat -tb -jl -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -tb -jc -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -tb -jr -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain +pamcat -tb -black ${dotw_pbm} ${check5x5_pbm} ${dotw_pbm} -plain + +echo "Test 3." +pbmmake -b 1 1 > ${dotb_pbm} + +pamcat -lr -jt -white ${dotb_pbm} ${check5x5_pbm} ${dotb_pbm} | cksum +pamcat -lr -jb -white ${dotb_pbm} ${check5x5_pbm} ${dotb_pbm} |\ + pamflip -tb | cksum +pamcat -tb -jl -white ${dotb_pbm} ${check5x5_pbm} ${dotb_pbm} |\ + pamflip -ccw | cksum +pamcat -tb -jr -white ${dotb_pbm} ${check5x5_pbm} ${dotb_pbm} |\ + pamflip -cw | cksum + +echo "Test 4." +ppmmake rgb:20/40/d0 1 1 | tee ${dot_ppm} | pamcat -lr | cksum +pamcat -tb ${dot_ppm} | cksum + +echo "Test 5." +for just in -jtop -jcenter -jbottom +do +pamcat -lr ${just} ${dot_ppm} maze.pbm ${dot_ppm} | cksum +done + +for just in -jleft -jcenter -jright +do +pamcat -tb ${just} ${dot_ppm} maze.pbm ${dot_ppm} | cksum +done + \ No newline at end of file diff --git a/test/pamchannel.test b/test/pamchannel.test index f72725ee..f2662706 100755 --- a/test/pamchannel.test +++ b/test/pamchannel.test @@ -42,17 +42,17 @@ test_out=${tmpdir}/test_out echo "Test Invalid" pamchannel -infile testgrid.pbm 1 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamchannel -infile testimg.ppm 3 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamtopam testimg.ppm | pamchannel -infile=- 4 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamcrater.test b/test/pamcrater.test index 61414480..e0c98afb 100755 --- a/test/pamcrater.test +++ b/test/pamcrater.test @@ -64,21 +64,21 @@ echo "Error messages should appear below the line." 1>&2 echo "------------------------------" 1>&2 pamcrater -width 0 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcrater -height 0 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcrater -number 0 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcrater -test -radius=10 | pamshadedrelief -gamma 0 > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamcut.test b/test/pamcut.test index 2299b4bc..a489635a 100755 --- a/test/pamcut.test +++ b/test/pamcut.test @@ -56,79 +56,79 @@ echo "-----------------------------------------------------------" 1>&2 # overspecification pamcut -left=1 -right=1 -width=14 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcut -top=1 -bottom=1 -height=16 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcut -right=1 -cropright=1 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcut -top=1 -croptop=1 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcut -bottom=1 -cropbottom=1 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcut -left=1 -cropleft=1 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} # excessive cropping pamcut -cropleft=7 -cropright=8 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcut -left=7 -right=6 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcut -croptop=8 -cropbottom=8 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcut -top=10 -bottom=9 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} # pad absent pamcut -cropleft=1 -width=14 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 10" + printf "Expected failure 10" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcut -croptop=1 -height=16 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 11" + printf "Expected failure 11" test -s ${test_out}; echo " "$? rm -f ${test_out} # legacy style: insufficient number of positional parameters pamcut 5 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 12" + printf "Expected failure 12" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcut 5 4 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 13" + printf "Expected failure 13" test -s ${test_out}; echo " "$? rm -f ${test_out} pamcut 5 5 30 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 14" + printf "Expected failure 14" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamdepth.test b/test/pamdepth.test index 86f6c952..7ff73f41 100755 --- a/test/pamdepth.test +++ b/test/pamdepth.test @@ -30,11 +30,11 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamdepth 0 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamdepth 65536 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamditherbw.test b/test/pamditherbw.test index 3f37f117..be560089 100755 --- a/test/pamditherbw.test +++ b/test/pamditherbw.test @@ -47,62 +47,62 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamditherbw -fs -atkinson ${test_red} > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamditherbw -floyd -atkinson ${test_red} > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamditherbw -dither8 -cluster3 ${test_red} > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pamditherbw -cluster3 -cluster4 ${test_red} > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pamditherbw -cluster3 -cluster8 ${test_red} > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pamditherbw -cluster4 -cluster8 ${test_red} > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pamditherbw -hilbert -threshold ${test_red} > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pamditherbw -clump=8 ${test_red} > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} pamditherbw -fs -clump=8 ${test_red} > ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} pamditherbw -hilbert -clump=1 ${test_red} > ${test_out} || \ - echo -n "Expected failure 10" + printf "Expected failure 10" test -s ${test_out}; echo " "$? rm -f ${test_out} pamditherbw -th -value=-1 ${test_red} > ${test_out} || \ - echo -n "Expected failure 11" + printf "Expected failure 11" test -s ${test_out}; echo " "$? rm -f ${test_out} pamditherbw -th -value=1.1 ${test_red} > ${test_out} || \ - echo -n "Expected failure 12" + printf "Expected failure 12" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamenlarge-pbm.test b/test/pamenlarge-pbm.test index fbb2eced..bea740c6 100755 --- a/test/pamenlarge-pbm.test +++ b/test/pamenlarge-pbm.test @@ -18,7 +18,8 @@ LC_ALL=C awk 'BEGIN { print "P4"; # header # Test 1. echo "test 1" -for xs in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 # for xs in `seq 23` +for xs in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 + # for xs in `seq 23` do pamenlarge -xscale=${xs} ${complete256_pbm} | cksum done @@ -26,7 +27,8 @@ for xs in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 # for xs i # Test 2. echo "test 2" -for xs1 in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # for xs in `seq 15` +for xs1 in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + # for xs1 in `seq 15` do xs2=$((30-${xs1})) pamenlarge -xscale=${xs1} ${complete256_pbm} | \ @@ -52,7 +54,7 @@ for width in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # for width in `seq 16` done for xscale in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # for xscale in `seq 16` - do echo -n ${xscale} " " + do printf "%d " ${xscale} for width in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # for width in `seq 16` do pamenlarge -xscale=${xscale} ${test3_pbm}.${width} ; done | cksum # diff --git a/test/pamfile.test b/test/pamfile.test index a0a5c65b..260d0b27 100755 --- a/test/pamfile.test +++ b/test/pamfile.test @@ -31,16 +31,16 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamfile -size -machine testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfile -count -machine testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} head -n1 testimg.ppm | pamfile > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamfind.test b/test/pamfind.test index 87ef5f9f..9165fbdf 100755 --- a/test/pamfind.test +++ b/test/pamfind.test @@ -44,21 +44,21 @@ echo "-----------------------------------------------------------" 1>&2 echo "Test Invalid" pamfind -color=black -target=1,1,1 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfind -target=0,0 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfind -target=0,0,0,0 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfind testimg.ppm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamfix.test b/test/pamfix.test index 89d3beb6..a18cae10 100755 --- a/test/pamfix.test +++ b/test/pamfix.test @@ -54,16 +54,16 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 printf "P2\n3 2\n7\n0 1 2\n6 7 8\n" | pamfix -change -clip > ${test_out} || \ - echo -n "Expected failure 1"; + printf "Expected failure 1"; test -s ${test_out}; echo " "$? rm -f ${test_out} printf "P1\n5 5\n" | pamfix -truncate -plain > ${test_out} || \ - echo -n "Expected failure 2"; + printf "Expected failure 2"; test -s ${test_out}; echo " "$? rm -f ${test_out} printf "P2\n3 3\255\n" | pamfix -truncate -plain > ${test_out} || \ - echo -n "Expected failure 3"; + printf "Expected failure 3"; test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamfunc.test b/test/pamfunc.test index 0d1a4f3c..fe142be7 100755 --- a/test/pamfunc.test +++ b/test/pamfunc.test @@ -93,121 +93,121 @@ echo "Test Invalid" test_out=${tmpdir}/test_out pamfunc -multiplier testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -multiplier=-1 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -divisor testimg.ppm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -divisor=-20 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -adder testimg.ppm > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -adder 0.5 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -subtractor testimg.ppm > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -subtractor 0.1 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -multiplier=1 -divisor=2 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -adder=2 -subtractor=3 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 10" + printf "Expected failure 10" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -min testimg.ppm > ${test_out} || \ - echo -n "Expected failure 11" + printf "Expected failure 11" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -max testimg.ppm > ${test_out} || \ - echo -n "Expected failure 12" + printf "Expected failure 12" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -andmask testimg.ppm > ${test_out} || \ - echo -n "Expected failure 13" + printf "Expected failure 13" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -ormask testimg.ppm > ${test_out} || \ - echo -n "Expected failure 14" + printf "Expected failure 14" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -xormask testimg.ppm > ${test_out} || \ - echo -n "Expected failure 15" + printf "Expected failure 15" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -not 1 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 16" + printf "Expected failure 16" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -min=1 -max=2 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 17" + printf "Expected failure 17" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -andmask=1 -ormask=0 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 18" + printf "Expected failure 18" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -andmask=0xffff testimg.ppm > ${test_out} || \ - echo -n "Expected failure 19" + printf "Expected failure 19" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -shiftleft testimg.ppm > ${test_out} || \ - echo -n "Expected failure 20" + printf "Expected failure 20" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -shiftright testimg.ppm > ${test_out} || \ - echo -n "Expected failure 21" + printf "Expected failure 21" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -changemaxval testimg.ppm > ${test_out} || \ - echo -n "Expected failure 22" + printf "Expected failure 22" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -shiftleft=1 -shiftright=1 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 23" + printf "Expected failure 23" test -s ${test_out}; echo " "$? rm -f ${test_out} pamfunc -multiplier=0.5 -changemaxval=65535 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 24" + printf "Expected failure 24" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamgauss.test b/test/pamgauss.test index 6c3eff78..9400e928 100755 --- a/test/pamgauss.test +++ b/test/pamgauss.test @@ -28,26 +28,26 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pamgauss 3 3 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamgauss 3 3 -sigma=0 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamgauss 3 3 -sigma=-1.5 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pamgauss 3 -sigma=0.5 > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pamgauss 3 3 3 -sigma=0.5 > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamhue.test b/test/pamhue.test index cd5430a8..5979e414 100755 --- a/test/pamhue.test +++ b/test/pamhue.test @@ -16,7 +16,7 @@ pamseq -tupletype=RGB 3 1 | pamdepth 255 | pamhue -huechange=60 | \ echo "Test 3" # pamhue has no effect on monotone images -# Should print 0 0 : 0 twice +# Should print 281226646 481 twice pamhue -huechange=45 maze.pbm | cmp -s - maze.pbm echo ${PIPESTATUS[@]} ":" $? @@ -25,7 +25,7 @@ pamhue -huechange=180 maze.pbm | cmp -s - maze.pbm echo "Test 4" # spinning the color wheel by multiples of 360 leaves the image unchanged -# Should print 0 0 : 0 twice +# Should print 1926073387 101484 twice pamhue -huechange=0 testimg.ppm | cmp -s - testimg.ppm echo ${PIPESTATUS[@]} ":" $? @@ -43,6 +43,6 @@ echo "An error message should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamhue testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamrecolor.test b/test/pamrecolor.test index 0ba35b66..a5fecc1f 100755 --- a/test/pamrecolor.test +++ b/test/pamrecolor.test @@ -1,6 +1,6 @@ #! /bin/sh # This script tests: pamrecolor -# Also requires: pgmmake +# Also requires: ppmtopgm pgmmake tmpdir=${tmpdir:-/tmp} base_pgm=${tmpdir}/base.pgm @@ -28,34 +28,34 @@ echo "-----------------------------------------------------------" 1>&2 pamrecolor --targetcolor=rgb:00/11/22 \ --colorfile=${base1_pgm} testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamrecolor --rmult=0.3 --gmult=0.3 --bmult=0.3 \ --colorfile=${base1_pgm} testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamrecolor --colorspace=void \ --targetcolor=rgb:80/80/80 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pamrecolor --targetcolor=vague testimg.ppm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pamrecolor --colorfile=${truncated_file} testimg.ppm > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pamrecolor --rmult=0.2989 --gmult=0.5866 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamrestack.test b/test/pamrestack.test index 17e42e30..2ebee49f 100755 --- a/test/pamrestack.test +++ b/test/pamrestack.test @@ -64,28 +64,28 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamrestack testgrid.pbm maze.pbm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamrestack -abort \ -width=$((pixels * 2 + 1 )) maze.pbm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamrestack -crop \ -width=$((pixels * 2 + 1)) maze.pbm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pamrestack -width=0 maze.pbm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pamrestack -width maze.pbm > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamscale-reportonly.test b/test/pamscale-reportonly.test index f65bcb93..924fb7c2 100755 --- a/test/pamscale-reportonly.test +++ b/test/pamscale-reportonly.test @@ -31,36 +31,36 @@ echo "-----------------------------------------------------------" 1>&2 pamscale -reportonly -xsize=640 -ysize=400 -xscale=2 testimg.ppm > \ ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamscale -reportonly -xsize=640 -xscale=2 -yscale=3 testimg.ppm > \ ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -pixels=200000 testimg.ppm \ > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -xysize 640 400 testimg.ppm \ > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -xyfit 640 400 testimg.ppm \ > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pamscale -reportonly -xsize=640 -ysize=400 -xyfill 640 400 testimg.ppm \ > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamseq.test b/test/pamseq.test index 3fe0fc31..ce3d4995 100755 --- a/test/pamseq.test +++ b/test/pamseq.test @@ -17,17 +17,17 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pamseq 1 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamseq 0 255 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamseq 3 0 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} @@ -37,6 +37,6 @@ c256=${c64}${c64}${c64}${c64} # Tupletype string length=256 pamseq -tupletype="${c256}" 3 15 > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamshuffle.test b/test/pamshuffle.test index 5582ce3b..2941a9bc 100755 --- a/test/pamshuffle.test +++ b/test/pamshuffle.test @@ -52,16 +52,16 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamshuffle testimg.ppm testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamshuffle -randomseed -column testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamshuffle -randomseed=null testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamsumm.test b/test/pamsumm.test index fb15c0c4..f482911a 100755 --- a/test/pamsumm.test +++ b/test/pamsumm.test @@ -35,21 +35,21 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pamsumm -sum -min testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pamsumm -sum -max testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pamsumm -mean -max testimg.ppm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pamsumm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pamtable.ok b/test/pamtable.ok index c8db6002..d63c7720 100644 --- a/test/pamtable.ok +++ b/test/pamtable.ok @@ -1,3 +1,4 @@ +Test 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 @@ -15,10 +16,66 @@ 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +Test 2 0 0 0|0 0 1|0 0 2|0 1 0|0 1 1|0 1 2|0 2 0|0 2 1|0 2 2|1 0 0|1 0 1|1 0 2|1 1 0|1 1 1|1 1 2|1 2 0|1 2 1|1 2 2|2 0 0|2 0 1|2 0 2|2 1 0|2 1 1|2 1 2|2 2 0|2 2 1|2 2 2 +Test 3 0 0 0 0|0 0 0 1|0 0 1 0|0 0 1 1|0 1 0 0|0 1 0 1|0 1 1 0|0 1 1 1|1 0 0 0|1 0 0 1|1 0 1 0|1 0 1 1|1 1 0 0|1 1 0 1|1 1 1 0|1 1 1 1 +Test 4 +(1) (0) (1) (0) (1) + +Test 5 +(1) +(0) +(1) +(0) +(1) +(0) +(1) +(0) +(1) +(0) + +Test 6 +(0,0,0) (0,0,1) (0,0,2) +(0,0,3) (0,1,0) (0,1,1) +(0,1,2) (0,1,3) (0,2,0) +(0,2,1) (0,2,2) (0,2,3) +(0,3,0) (0,3,1) (0,3,2) +(0,3,3) (1,0,0) (1,0,1) +(1,0,2) (1,0,3) (1,1,0) +(1,1,1) (1,1,2) (1,1,3) +(1,2,0) (1,2,1) (1,2,2) +(1,2,3) (1,3,0) (1,3,1) +(1,3,2) (1,3,3) (2,0,0) +(2,0,1) (2,0,2) (2,0,3) +(2,1,0) (2,1,1) (2,1,2) +(2,1,3) (2,2,0) (2,2,1) +(2,2,2) (2,2,3) (2,3,0) +(2,3,1) (2,3,2) (2,3,3) +(3,0,0) (3,0,1) (3,0,2) +(3,0,3) (3,1,0) (3,1,1) +(3,1,2) (3,1,3) (3,2,0) +(3,2,1) (3,2,2) (3,2,3) +(3,3,0) (3,3,1) (3,3,2) +(3,3,3) (0,0,0) (0,0,0) + +Test 7 +00 00|00 11|00 22|00 33|00 44|00 55|00 66|00 77 +00 88|00 99|00 aa|00 bb|00 cc|00 dd|00 ee|00 ff +0a 00|0a 11|0a 22|0a 33|0a 44|0a 55|0a 66|0a 77 +0a 88|0a 99|0a aa|0a bb|0a cc|0a dd|0a ee|0a ff +14 00|14 11|14 22|14 33|14 44|14 55|14 66|14 77 +14 88|14 99|14 aa|14 bb|14 cc|14 dd|14 ee|14 ff +1e 00|1e 11|1e 22|1e 33|1e 44|1e 55|1e 66|1e 77 +1e 88|1e 99|1e aa|1e bb|1e cc|1e dd|1e ee|1e ff +28 00|28 11|28 22|28 33|28 44|28 55|28 66|28 77 +28 88|28 99|28 aa|28 bb|28 cc|28 dd|28 ee|28 ff +32 00|32 11|32 22|32 33|32 44|32 55|32 66|32 77 +32 88|32 99|32 aa|32 bb|32 cc|32 dd|32 ee|32 ff + +Test 8 9 0 0 9 @@ -64,3 +121,6 @@ 65535 0 0| 0 0 65535| 0 0 65535| 0 65535 0 65535 0 0| 0 0 65535| 0 0 65535| 0 65535 0 +Test Invalid +Should print: Expected failure 1 +Expected failure 1 diff --git a/test/pamtable.test b/test/pamtable.test index 037d3b07..e948ad0c 100755 --- a/test/pamtable.test +++ b/test/pamtable.test @@ -1,13 +1,37 @@ #! /bin/sh # This script tests: pamtable -# Also requires: pamseq pamdepth pbmmake ppmrainbow +# Also requires: pamseq pamrestack pamdepth pbmmake ppmrainbow +echo "Test 1" pamtable testgrid.pbm + echo +echo "Test 2" pamseq 3 2 -tupletype=RGB | pamtable + echo +echo "Test 3" pamseq 4 1 -tupletype=RGBA | pamtable + +echo +echo "Test 4" +pbmmake -gray 5 1 | pamtable -tuple + +echo +echo "Test 5" +pbmmake -gray 1 10 | pamtable -tuple + +echo +echo "Test 6" +pamseq 3 3 -tupletype=RGB | pamrestack -width=3 | pamtable -tuple + +echo +echo "Test 7" +pamseq 2 255 -max=50,255 -step=10,17 | pamrestack -width=8 | \ + pamtable -hex + echo +echo "Test 8" for maxval in 9 10 9999 10000 65535 do pbmmake -g 2 2 | pamdepth ${maxval} | pamtable @@ -19,3 +43,20 @@ for maxval in 9 10 9999 10000 65535 pamdepth ${maxval} | pamtable echo done + +echo "Test Invalid" + +test_out=${tmpdir}/test.out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +echo "Should print: Expected failure 1" + +pamseq -tupletype="void" 1 1 | pamtable -tuple -hex > \ + ${test_out} || \ + printf "Expected failure" + test -s ${test_out}; echo " "$? + rm -f ${test_out} diff --git a/test/pamundice.test b/test/pamundice.test index 14b43dfb..ba532c30 100755 --- a/test/pamundice.test +++ b/test/pamundice.test @@ -1,6 +1,6 @@ #! /bin/sh # This script tests: pamundice -# Also requires: pamfile pgmmake pnmtile pnmcat +# Also requires: pamfile pgmmake pnmtile pamcat tmpdir=${tmpdir:-/tmp} fname_stem=${tmpdir}/part @@ -28,7 +28,7 @@ for y in 0 1 2 3 4 pamundice -across=3 ${fname_stem}"_"$y"_%1a".pgm > ${tempfile}_"$y" done -pnmcat -tb ${tempfile}_[01234] | cksum +pamcat -tb ${tempfile}_[01234] | cksum rm ${tempfile}_[01234] # Note: the following 2 are valid. There should not be warning messages. @@ -38,7 +38,7 @@ for x in 0 1 2 pamundice -down=5 ${fname_stem}"_%1d_"$x.pgm > ${tempfile}"_"$x done -pnmcat -lr ${tempfile}_[012] | cksum +pamcat -lr ${tempfile}_[012] | cksum rm ${tempfile}_[012] rm ${fname_stem}_?_?.pgm @@ -123,63 +123,63 @@ echo "-----------------------------------------------------------" 1>&2 # No input file pattern specified pamundice -down=5 -across=2 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} # -down=0 pamundice -down=0 -across=2 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} # -across=0 pamundice -down=5 -across=0 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} # -down too large pamundice -down=6 -across=2 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} # -across too large pamundice -down=5 -across=3 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} # precision does not match pamundice -down=5 -across=2 ${fname_stem}_"%2d"_"%2a".pbm > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} # precision set to zero pamundice -down=5 -across=2 ${fname_stem}_"%0d"_"%0a".pbm > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} # no precision pamundice -down=5 -across=2 ${fname_stem}_"%d"_"%a".pbm > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} # -hoverlap too large pamundice -down=5 -across=2 -hoverlap=$((${mw}+1)) \ ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} # -voverlap too large pamundice -down=5 -across=2 -voverlap=$((${mh}+1)) \ ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \ - echo -n "Expected failure 10" + printf "Expected failure 10" test -s ${test_out}; echo " "$? rm -f ${test_out} @@ -188,14 +188,14 @@ for i in 0 1 2 3 4 5 6 7 8 9 do mktemp -u XXXXXXXXXX.${i} || echo ":::::::::::"${i}":::::::::::" done | pamundice -down=5 -across=2 -listfile=- > ${test_out} || \ - echo -n "Expected failure 11" + printf "Expected failure 11" test -s ${test_out}; echo " "$? rm -f ${test_out} # listfile with insufficient lines (insufficient file entries) ls ${fname_stem}_*_*.pbm | head -n 9 | \ pamundice -down=5 -across=2 -listfile=- > ${test_out} || \ - echo -n "Expected failure 12" + printf "Expected failure 12" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pbmclean.test b/test/pbmclean.test index 7c0c4d6d..5eba68e0 100755 --- a/test/pbmclean.test +++ b/test/pbmclean.test @@ -46,7 +46,7 @@ echo "-----------------------------------------------------------" 1>&2 # overspecification pbmclean -black -white -min=1 -extended testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pbmmake.test b/test/pbmmake.test index c3691b80..1d1c682b 100755 --- a/test/pbmmake.test +++ b/test/pbmmake.test @@ -33,41 +33,41 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pbmmake -b -w -plain 1 1 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmmake -b -g -plain 1 1 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmmake -white -gray -plain 1 1 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmmake -white -plain > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmmake -white -plain 1 > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmmake -white -plain 1 0 > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmmake -white -plain 0 1 > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmmake -white -plain 1 1 1 > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pbmnoise-parameters.test b/test/pbmnoise-parameters.test index e467bfd5..17d2c76b 100755 --- a/test/pbmnoise-parameters.test +++ b/test/pbmnoise-parameters.test @@ -13,130 +13,130 @@ test_out=${tmpdir}/test_out # Invalid -ratio arguments pbmnoise -ratio 100 100 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio 0 1 100 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=1.1 100 100 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=-1 100 100 > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=half 100 100 > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=0/1/1 100 100 > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=-1/2 100 100 > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=1/0 100 100 > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=/2 100 100 > ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=4/2 100 100 > ${test_out} || \ - echo -n "Expected failure 10" + printf "Expected failure 10" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=6/ 100 100 > ${test_out} || \ - echo -n "Expected failure 11" + printf "Expected failure 11" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=1.0/2.0 100 100 > ${test_out} || \ - echo -n "Expected failure 12" + printf "Expected failure 12" test -s ${test_out}; echo " "$? rm -f ${test_out} # denominator must be power of 2 pbmnoise -ratio=3/9 100 100 > ${test_out} || \ - echo -n "Expected failure 13" + printf "Expected failure 13" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=a/2 100 100 > ${test_out} || \ - echo -n "Expected failure 14" + printf "Expected failure 14" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=2/a 100 100 > ${test_out} || \ - echo -n "Expected failure 15" + printf "Expected failure 15" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=1/-2 100 100 > ${test_out} || \ - echo -n "Expected failure 16" + printf "Expected failure 16" test -s ${test_out}; echo " "$? rm -f ${test_out} # Denominator must be 65536 or less pbmnoise -ratio=1/65537 100 100 > ${test_out} || \ - echo -n "Expected failure 17" + printf "Expected failure 17" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -ratio=1/131072 100 100 > ${test_out} || \ - echo -n "Expected failure 17" + printf "Expected failure 17" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -endian=large 100 100 > ${test_out} || \ - echo -n "Expected failure 18" + printf "Expected failure 18" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -randomseed 100 100 > ${test_out} || \ - echo -n "Expected failure 19" + printf "Expected failure 19" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -randomseed=-1 100 100 > ${test_out} || \ - echo -n "Expected failure 20" + printf "Expected failure 20" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise -randomseed=0.1 100 100 > ${test_out} || \ - echo -n "Expected failure 21" + printf "Expected failure 21" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise > ${test_out} || \ - echo -n "Expected failure 22" + printf "Expected failure 22" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise 100 > ${test_out} || \ - echo -n "Expected failure 23" + printf "Expected failure 23" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmnoise 100 200 300 > ${test_out} || \ - echo -n "Expected failure 24" + printf "Expected failure 24" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pbmpage.test b/test/pbmpage.test index 2805ec97..4f15452d 100755 --- a/test/pbmpage.test +++ b/test/pbmpage.test @@ -20,16 +20,16 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pbmpage -a3 1 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmpage 0 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmpage 4 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pbmpscale.test b/test/pbmpscale.test index 9c38bb2e..efa5bfb5 100755 --- a/test/pbmpscale.test +++ b/test/pbmpscale.test @@ -36,16 +36,16 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pbmpscale testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmpscale 0 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmpscale 2 3 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pbmtext-utf8.test b/test/pbmtext-utf8.test index 0677d161..9203607f 100755 --- a/test/pbmtext-utf8.test +++ b/test/pbmtext-utf8.test @@ -135,20 +135,20 @@ echo "Test input text which exceeds length limit" 1>&2 echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 -echo -n "z" >> ${long_txt} +printf "z" >> ${long_txt} cat ${long_txt} | wc -c | tr -d ' ' cat ${long_txt} | \ LC_ALL=${locale_for_test} \ pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \ - echo -n "Expected failure 1"; + printf "Expected failure 1"; test -s ${test_out}; echo " "$? rm -f ${test_out} cat ${long_txt} | \ LC_ALL=${locale_for_test} \ pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \ - echo -n "Expected failure 2"; + printf "Expected failure 2"; test -s ${test_out}; echo " "$? rm -f ${test_out} @@ -169,41 +169,41 @@ echo "Test 6 Invalid" awk 'BEGIN { printf("%c%c",128,129); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - echo -n "6-1:" ${PIPESTATUS[@]} ":" $? + printf "6-1: ${PIPESTATUS[*]} : $?" test -s ${test_out}; echo " "$? rm -f ${test_out} awk 'BEGIN { printf("ABC%c%c",192, 193); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - echo -n "6-2:" ${PIPESTATUS[@]} ":" $? + printf "6-2: ${PIPESTATUS[*]} : $?" test -s ${test_out}; echo " "$? rm -f ${test_out} awk 'BEGIN { printf("abcde%c%c", 254, 253); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - echo -n "6-3:" ${PIPESTATUS[@]} ":" $? + printf "6-3: ${PIPESTATUS[*]} : $?" test -s ${test_out}; echo " "$? rm -f ${test_out} awk 'BEGIN { printf("abcdefg%c%c", 195, 15); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - echo -n "6-4:" ${PIPESTATUS[@]} ":" $? + printf "6-4: ${PIPESTATUS[*]} : $?" test -s ${test_out}; echo " "$? rm -f ${test_out} awk 'BEGIN { printf("123456789%c%c%c", 224, 143 ,0); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - echo -n "6-5:" ${PIPESTATUS[@]} ":" $? + printf "6-5: ${PIPESTATUS[*]} : $?" test -s ${test_out}; echo " "$? rm -f ${test_out} awk 'BEGIN { printf("abcdefg123ABCDEFG%c%c%c%c",247, 135, 135, 7); print ""}' | \ LC_ALL=${locale_for_test} \ pbmtext -builtin bdf -wchar -text-dump > ${test_out} - echo -n "6-6:" ${PIPESTATUS[@]} ":" $? + printf "6-6: ${PIPESTATUS[*]} : $?" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pbmtext.test b/test/pbmtext.test index b82b0771..247f76c5 100755 --- a/test/pbmtext.test +++ b/test/pbmtext.test @@ -10,13 +10,13 @@ echo "Test 1" # Should print 3898818212 967 twice pbmtext UNIX Philosophy: Do one thing and do it well. | cksum -echo -n "UNIX Philosophy: Do one thing and do it well." | pbmtext | cksum +printf "UNIX Philosophy: Do one thing and do it well." | pbmtext | cksum # Should print 2506052117 1354 twice pbmtext -builtin fixed \ For truth is always strange. Stranger than fiction. Lord Byron | cksum -echo -n "For truth is always strange. Stranger than fiction. Lord Byron" | \ +printf "For truth is always strange. Stranger than fiction. Lord Byron" | \ pbmtext -builtin fixed | cksum @@ -112,42 +112,42 @@ echo "Test 6 Invalid" test_out=${tmpdir}/test_out pbmtext -font=testgrid.pbm foo > ${test_out} || \ - echo -n "Expected failure 1"; + printf "Expected failure 1"; test -s ${test_out}; echo " "$? rm -f ${test_out} pbmtext -font=testimg.ppm foo > ${test_out} || \ - echo -n "Expected failure 2"; + printf "Expected failure 2"; test -s ${test_out}; echo " "$? rm -f ${test_out} pbmtext -builtin=void foo > ${test_out} || \ - echo -n "Expected failure 3"; + printf "Expected failure 3"; test -s ${test_out}; echo " "$? rm -f ${test_out} pbmtext -font=${font_pbm} -builtin=fixed foo > ${test_out} || \ - echo -n "Expected failure 4"; + printf "Expected failure 4"; test -s ${test_out}; echo " "$? rm -f ${test_out} pbmtext -dry-run -text-dump foo > ${test_out} || \ - echo -n "Expected failure 5"; + printf "Expected failure 5"; test -s ${test_out}; echo " "$? rm -f ${test_out} pbmtext -dump-sheet -text-dump foo > ${test_out} || \ - echo -n "Expected failure 6"; + printf "Expected failure 6"; test -s ${test_out}; echo " "$? rm -f ${test_out} pbmtext -dry-run -dump-sheet foo > ${test_out} || \ - echo -n "Expected failure 7"; + printf "Expected failure 7"; test -s ${test_out}; echo " "$? rm -f ${test_out} pbmtext -wchar foo > ${test_out} || \ - echo -n "Expected failure 8"; + printf "Expected failure 8"; test -s ${test_out}; echo " "$? rm -f ${test_out} @@ -168,7 +168,7 @@ cat ${long_txt} | pbmtext -nomargins -builtin fixed | cksum echo "Test 8 Invalid" -echo -n "z" >> ${long_txt} +printf "z" >> ${long_txt} awk '{print "text length:", length($0)}' ${long_txt} echo 1>&2 @@ -177,18 +177,18 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pbmtext -nomargins -builtin fixed `cat ${long_txt}` > ${test_out} || \ - echo -n "Expected failure 1"; + printf "Expected failure 1"; test -s ${test_out}; echo " "$? rm -f ${test_out} cat ${long_txt} | pbmtext -nomargins -builtin fixed > ${test_out} || \ - echo -n "Expected failure 2"; + printf "Expected failure 2"; test -s ${test_out}; echo " "$? rm -f ${test_out} cat ${long_txt} | \ LC_ALL=C pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \ - echo -n "Expected failure 3"; + printf "Expected failure 3"; test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pbmtextps-dump.ok b/test/pbmtextps-dump.ok new file mode 100644 index 00000000..9fe3b2ea --- /dev/null +++ b/test/pbmtextps-dump.ok @@ -0,0 +1,65 @@ +Test 1 +-font=ZQUEl8eS38RlsvEahHGNfnrbSswrcJKFwvlCdEttwcheuXvCN49MvWmndqj4 +< /FindFont {/Times-Roman findfont} def +> /FindFont {/ZQUEl8eS38RlsvEahHGNfnrbSswrcJKFwvlCdEttwcheuXvCN49MvWmndqj4 findfont} def +-fontsize 2000 +< /fontsize 24.000000 def +> /fontsize 2000.000000 def +< /descent 36.000000 def +< /leftmargin 12.000000 def +> /descent 3000.000000 def +> /leftmargin 1000.000000 def +-resolution 7200 +-leftmargin=15 +< /leftmargin 12.000000 def +> /leftmargin 15.000000 def +-rightmargin=20 +< /rightmargin 0.000000 def +> /rightmargin 20.000000 def +-topmargin=10 +< /topmargin 0.000000 def +> /topmargin 10.000000 def +-bottommargin=14 +< /descent 36.000000 def +> /descent 0.000000 def +< /bottommargin 0.000000 def +> /bottommargin 14.000000 def +-ascent=30 +< /ascent 0.000000 def +> /ascent 30.000000 def +-descent=20 +< /descent 36.000000 def +> /descent 20.000000 def +-pad +< /descent 36.000000 def +> /descent 0.000000 def +< /pad false def +> /pad true def +-crop +< /descent 36.000000 def +< /leftmargin 12.000000 def +> /descent 0.000000 def +> /leftmargin 0.000000 def +-stroke 1 +< /pensize -1.000000 def +> /pensize 1.000000 def +Test Invalid +Expected failure 1 (-fontsize) 1 +Expected failure 2 (-fontsize 0) 1 +Expected failure 3 (-resolution) 1 +Expected failure 4 (-resolution=0) 1 +Expected failure 5 (-leftmargin) 1 +Expected failure 6 (-leftmargin -1) 1 +Expected failure 7 (-rightmargin) 1 +Expected failure 8 (-rightmargin -1) 1 +Expected failure 9 (-topmargin) 1 +Expected failure 10 (-topmargin -1) 1 +Expected failure 11 (-bottommargin) 1 +Expected failure 12 (-bottommargin -1) 1 +Expected failure 13 (-ascent) 1 +Expected failure 14 (-ascent -1) 1 +Expected failure 15 (-descent) 1 +Expected failure 16 (-descent -1) 1 +Expected failure 17 (-stroke=A) 1 +Expected failure 18 (-pad -crop) 1 +Expected failure 19 (-font="") 1 diff --git a/test/pbmtextps-dump.test b/test/pbmtextps-dump.test new file mode 100755 index 00000000..3b3fbadd --- /dev/null +++ b/test/pbmtextps-dump.test @@ -0,0 +1,84 @@ +#! /bin/sh +# This script tests: pbmtextps +# Also requires: + +# Dump several variants of the ps file and compare against default. +# Ghostscript is not required. + +tmpdir=${tmpdir:-/tmp} +text_pbm=${tmpdir}/text.pbm +text_ps=${tmpdir}/text.ps + +text="UNIX Philosophy: Do one thing and do it well." + +# Test 1: +echo "Test 1" + +pbmtextps -dump-ps ${text} > ${text_ps} + +# Font name is random sequence of alphanumerical characters. +# Should not match any real name. + +for flag in \ + "-font=ZQUEl8eS38RlsvEahHGNfnrbSswrcJKFwvlCdEttwcheuXvCN49MvWmndqj4" \ + "-fontsize 2000" \ + "-resolution 7200" \ + "-leftmargin=15" \ + "-rightmargin=20" \ + "-topmargin=10" \ + "-bottommargin=14" \ + "-ascent=30" \ + "-descent=20" \ + "-pad" \ + "-crop" \ + "-stroke 1" + do + echo ${flag} + pbmtextps -dump-ps ${flag} ${text} | diff ${text_ps} - | grep "^[<>]" + done + +rm ${text_ps} + + +echo "Test Invalid" + +echo 1>&2 +echo "Invalid command line arguments" 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +test_out=${tmpdir}/test.out + +n=1 + +for error_flag in \ + "-fontsize" \ + "-fontsize 0" \ + "-resolution" \ + "-resolution=0" \ + "-leftmargin" \ + "-leftmargin -1" \ + "-rightmargin" \ + "-rightmargin -1" \ + "-topmargin" \ + "-topmargin -1" \ + "-bottommargin" \ + "-bottommargin -1" \ + "-ascent" \ + "-ascent -1" \ + "-descent" \ + "-descent -1" \ + "-stroke=A" \ + "-pad -crop" + do + pbmtextps ${error_flag} -dump-ps ${text} >${test_out} || \ + printf "Expected failure $n (${error_flag})"; + test -s ${test_out}; echo " "$? + rm -f ${test_out} + n=$((n + 1)) + done + + pbmtextps -font="" -dump-ps ${text} >${test_out} || \ + printf "Expected failure $n (-font=\"\")"; + test -s ${test_out}; echo " "$? + rm -f ${test_out} diff --git a/test/pbmtextps.ok b/test/pbmtextps.ok new file mode 100644 index 00000000..d407cb0a --- /dev/null +++ b/test/pbmtextps.ok @@ -0,0 +1,16 @@ +Test 1. Should print 0 five times. +0 +0 +0 +0 +0 +Test 2. Should print P1 1 1 0 three times +P1 1 1 0 +P1 1 1 0 +P1 1 1 0 +Test 3. Should print eulerchi: N + eulerchi: 1 + eulerchi: 2 + eulerchi: 3 + eulerchi: 4 + eulerchi: 5 diff --git a/test/pbmtextps.test b/test/pbmtextps.test new file mode 100755 index 00000000..975f960c --- /dev/null +++ b/test/pbmtextps.test @@ -0,0 +1,53 @@ +#! /bin/sh +# This script tests: pbmtextps pbmminkowski +# Also requires: gs pnmcrop + +tmpdir=${tmpdir:-/tmp} +text_pbm=${tmpdir}/text.pbm + +text="Do one thing and do it well." + +echo "Test 1. Should print 0 five times." +# -ascent -descent values too small to have effect + +pbmtextps -descent=1 ${text} > ${text_pbm} + echo $? + test -s ${text_pbm} + echo $? +pbmtextps -ascent=10 -descent=1 ${text} | cmp -s - ${text_pbm} + echo $? +pbmtextps -ascent=1 -descent=1 ${text} | cmp -s - ${text_pbm} + echo $? +pbmtextps -descent=2 ${text} | cmp -s - ${text_pbm} + echo $? + +rm ${text_pbm} + + +echo "Test 2. Should print P1 1 1 0 three times" +# blank images + +pbmtextps " " | pnmcrop -plain -blank-image=minimize |\ + tr '\n' ' ' ; echo +pbmtextps -fontsize=12 " " | pnmcrop -plain -blank-image=minimize |\ + tr '\n' ' ' ; echo +pbmtextps -resolution=50 " " | pnmcrop -plain -blank-image=minimize |\ + tr '\n' ' ' ; echo + + + +echo "Test 3. Should print eulerchi: N" +# Test with characters known to produce stable eulerchi values +# accross various fonts + +pbmtextps " " | pbmminkowski | grep "eulerchi" + +pbmtextps "+" | pbmminkowski | grep "eulerchi" + +pbmtextps "+" | pnmcrop -left -right | pbmminkowski | grep "eulerchi" + +pbmtextps "+" | pnmcrop | pbmminkowski | grep "eulerchi" + +pbmtextps "o" | pnmcrop | pbmminkowski | grep "eulerchi" + + diff --git a/test/pbmtopgm.test b/test/pbmtopgm.test index 46c04705..02f2bb21 100755 --- a/test/pbmtopgm.test +++ b/test/pbmtopgm.test @@ -18,21 +18,21 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pbmtopgm 5 0 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmtopgm 0 9 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmtopgm 15 5 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmtopgm 5 17 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pbmupc.test b/test/pbmupc.test index 8d726de5..f8343dd7 100755 --- a/test/pbmupc.test +++ b/test/pbmupc.test @@ -20,46 +20,46 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pbmupc -s3 0 72890 00011 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmupc -s1 72890 00011 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmupc -s1 0 72890 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmupc -s1 10 72890 00011 > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmupc -s1 0 172890 00011 > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmupc -s1 0 2890 00011 > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmupc -s1 0 72890 100011 > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmupc -s1 0 72890 0011 > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmupc -s1 0 72890 100011 1 > ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pgmhist.test b/test/pgmhist.test index 83f3c52e..c141627d 100755 --- a/test/pgmhist.test +++ b/test/pgmhist.test @@ -35,21 +35,21 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pgmhist -median -quartile testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmhist -median -decile testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmhist -quartile -decile testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmhist testimg.ppm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pgmmake.test b/test/pgmmake.test index 84c03778..3c96d99e 100755 --- a/test/pgmmake.test +++ b/test/pgmmake.test @@ -19,41 +19,41 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pgmmake 100 5 5 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmmake 1.01 5 5 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmmake .5 5 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmmake .5 > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmmake -maxval=5 5 5 > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmmake -maxval=0 .5 5 5 > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmmake -maxval=-1 .5 5 5 > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmmake -maxval=65536 .5 5 5 > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pgmnoise-parameters.test b/test/pgmnoise-parameters.test index 2615c8e8..c5e6ada5 100755 --- a/test/pgmnoise-parameters.test +++ b/test/pgmnoise-parameters.test @@ -11,26 +11,26 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pgmnoise -maxval=255 -randomseed=1 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise 100 -randomseed=1 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise 100 0 -randomseed=1 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise 0 100 -randomseed=1 > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise 100 100 100 -randomseed=1 > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pgmnoise.test b/test/pgmnoise.test index 45374793..6141121a 100755 --- a/test/pgmnoise.test +++ b/test/pgmnoise.test @@ -29,7 +29,7 @@ echo "Test 4." for maxval in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \ 30 31 32 254 255 256 65534 65535 do - echo -n ${maxval} " " + printf "%d " ${maxval} pgmnoise -maxval=${maxval} -randomseed=1 -plain ${maxval} 10 | \ pamvalidate | pamfile done @@ -78,51 +78,51 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pgmnoise 0 0 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise 0 1 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise 1 0 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise 1 > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise 100 -1 > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise -randomseed=-1 100 100 > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise -maxval=-1 100 100 > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise -maxval=0 100 100 > ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmnoise -maxval=$((256 * 256 * 256 * 256)) 10 10 > ${test_out} || \ - echo -n "Expected failure 10" + printf "Expected failure 10" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pgmramp.test b/test/pgmramp.test index c3b0ad1c..b4dbb3cd 100755 --- a/test/pgmramp.test +++ b/test/pgmramp.test @@ -31,17 +31,17 @@ test_out=${tmpdir}/test_out for combination in "-lr -tb" "-lr -rectangle" "-rectangle -ellipse" do pgmramp $combination 10 10 > ${test_out} || \ - echo -n "Expected failure: $combination" + printf "Expected failure: $combination" test -s ${test_out}; echo " "$? rm -f ${test_out} done pgmramp -lr 1 > ${test_out} || \ - echo -n "Expected failure: insufficient parameters"; \ + printf "Expected failure: insufficient parameters"; \ test -s ${test_out}; echo " "$? rm -f ${test_out} pgmramp -tb 1 1 1 > ${test_out} || \ - echo -n "Expected failure: excessive parameters"; \ + printf "Expected failure: excessive parameters"; \ test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pgmtoppm.test b/test/pgmtoppm.test index d98418b8..36f63de7 100755 --- a/test/pgmtoppm.test +++ b/test/pgmtoppm.test @@ -66,73 +66,73 @@ echo "-----------------------------------------------------------" 1>&2 pgmtoppm white testimg.ppm > \ ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmtoppm -map=/dev/null testgrid.pbm > \ ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmtoppm black white testgrid.pbm > \ ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmtoppm hwite testgrid.pbm > \ ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmtoppm off-color testgrid.pbm > \ ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmtoppm rgb-255:7/7/7 testgrid.pbm > \ ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmtoppm -black=black -white=white white testgrid.pbm > \ ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmtoppm -black=rgb:0/0/0 -map=${palette_ppm} testgrid.pbm > \ ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmtoppm -white=rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmtoppm rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ ${test_out} || \ - echo -n "Expected failure 10" + printf "Expected failure 10" test -s ${test_out}; echo " "$? rm -f ${test_out} pgmtoppm rgb:00/00/00-rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ ${test_out} || \ - echo -n "Expected failure 11" + printf "Expected failure 11" test -s ${test_out}; echo " "$? rm -f ${test_out} #pgmtoppm rgb-255:7/7/7 testgrid.pbm > \ # ${test_out} || \ -# echo -n "Expected failure 12" +# printf "Expected failure 12" # test -s ${test_out}; echo " "$? # rm -f ${test_out} diff --git a/test/pnmcat.ok b/test/pnmcat.ok index 57769353..96e2b884 100644 --- a/test/pnmcat.ok +++ b/test/pnmcat.ok @@ -1,4 +1,8 @@ -Test 1. Should print a simple PBM image four times +Test 1. Should print a simple PBM image five times +P1 +2 2 +01 +10 P1 2 2 01 diff --git a/test/pnmcat.test b/test/pnmcat.test index 173aa608..bf40ada2 100755 --- a/test/pnmcat.test +++ b/test/pnmcat.test @@ -1,6 +1,12 @@ #! /bin/sh # This script tests: pnmcat -# Also requires: pbmmake pgmramp ppmtoppm +# Also requires: pbmmake pgmramp ppmtoppm pamcat + +if [ ${CHECK_TYPE} = tree ] + then echo "Skipping." 1>&2 + echo "Running \"make package; make check\" is recommended." 1>&2 + exit 80; +fi tmpdir=${tmpdir:-/tmp} check2x2_pbm=${tmpdir}/check2x2.pbm @@ -11,9 +17,13 @@ diag_ppm=${tmpdir}/diag.ppm diag2lr_ppm=${tmpdir}/diag2lr.ppm diag2tb_ppm=${tmpdir}/diag2tb.ppm -echo "Test 1. Should print a simple PBM image four times" +echo "Test 1. Should print a simple PBM image five times" +# Check input from stdin and from designated input file +# Similar to tests in stdin-p?m.test + pbmmake -g 2 2 | tee ${check2x2_pbm} | pnmcat -lr -plain pnmcat -tb -plain ${check2x2_pbm} +pnmcat -tb -plain < ${check2x2_pbm} pnmcat -lr -black -plain ${check2x2_pbm} cat ${check2x2_pbm} | pnmcat -tb -white -plain @@ -39,9 +49,13 @@ cat maze.pbm | pnmcat -tb - ${maze2tb_pbm} | cksum rm ${maze2lr_pbm} ${maze2tb_pbm} echo "Test 6. Should print a simple PGM image three times" -pgmramp -diag 4 4 -maxval=3 | tee ${diag_pgm} | pnmcat -lr -plain -pnmcat -tb -plain ${diag_pgm} -cat ${diag_pgm} | pnmcat -tb -plain +# Use sed to scrape off space at line end for compatibility +# with older versions of pnmcat + +pgmramp -diag 4 4 -maxval=3 | tee ${diag_pgm} | pnmcat -lr -plain |\ + sed 's/ *$//' +pnmcat -tb -plain ${diag_pgm} | sed 's/ *$//' +cat ${diag_pgm} | pnmcat -tb -plain | sed 's/ *$//' rm ${diag_pgm} @@ -95,76 +109,76 @@ echo "-----------------------------------------------------------" 1>&2 # direction not specified pnmcat testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} # both directions specified pnmcat -topbottom -leftright testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} # both pad colors specified pnmcat -topbottom -white -black testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} # justification parameters overspecified pnmcat -lr -jtop -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcat -lr -jtop -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcat -lr -jcenter -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcat -tb -jleft -jright testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcat -tb -jleft -jcenter testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcat -tb -jcenter -jright testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} # justification parameter in the wrong direction pnmcat -lr -jleft testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 10" + printf "Expected failure 10" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcat -lr -jright testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 11" + printf "Expected failure 11" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcat -tb -jtop testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 12" + printf "Expected failure 12" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcat -tb -jbottom testgrid.pbm testimg.ppm > ${test_out} || \ - echo -n "Expected failure 13" + printf "Expected failure 13" test -s ${test_out}; echo " "$? rm -f ${test_out} # more than one input image from standard input cat testgrid.pbm | pnmcat -lr - - testimg.ppm > ${test_out} || \ - echo -n "Expected failure 14" + printf "Expected failure 14" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pnmcolormap.test b/test/pnmcolormap.test index 089e0d1e..1a7ec266 100755 --- a/test/pnmcolormap.test +++ b/test/pnmcolormap.test @@ -15,37 +15,37 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pnmcolormap 0 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcolormap -1 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcolormap 0.1 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcolormap -center -meancolor 16 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcolormap -center -meanpixel 16 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcolormap -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmcolormap -spreadbrightness -spreadluminosity 16 \ testimg.ppm > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pnmcrop1.test b/test/pnmcrop1.test index 00d5ee80..3c86efd7 100755 --- a/test/pnmcrop1.test +++ b/test/pnmcrop1.test @@ -78,7 +78,7 @@ for option in "-reportfull -reportsize" \ "-bg-color=black -closeness=101" do pnmcrop -reportfull ${option} testgrid.pbm > ${test_out} || \ - echo -n "Expected failure: " ${option} + printf "Expected failure: %s" "${option}" test -s ${test_out}; echo " "$? rm ${test_out} done diff --git a/test/pnmcrop3.test b/test/pnmcrop3.test index 04cf6f52..1e8da345 100755 --- a/test/pnmcrop3.test +++ b/test/pnmcrop3.test @@ -68,12 +68,12 @@ echo "Error messages should appear below the line." 1>&2 echo "--------------------------------------------" 1>&2 pnmcrop -borderfile=${border_ppm} ${test_pbm} > ${test_out} || \ - echo -n "Expected failure 1"; + printf "Expected failure 1"; test -s ${test_out}; echo " "$? rm ${test_out} pnmcrop -borderfile=${border_pbm} ${test_ppm} > ${test_out} || \ - echo -n "Expected failure 2"; + printf "Expected failure 2"; test -s ${test_out}; echo " "$? rm ${test_out} diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test index 3223f86d..ae6ba3cc 100755 --- a/test/pnmpsnr.test +++ b/test/pnmpsnr.test @@ -36,22 +36,22 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pnmpsnr ${b_pbm} ${w_pbm} ${b_pbm} > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmpsnr ${b_pbm} > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmpsnr ${b_pbm} ${w_pbm} -target1=100 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmpsnr -machine > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pnmquant.test b/test/pnmquant.test index 100fb52e..cbe69f5c 100755 --- a/test/pnmquant.test +++ b/test/pnmquant.test @@ -42,41 +42,41 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pnmquant 0 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmquant testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmquant 10.5 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmquant -center -meancolor 16 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmquant -center -meanpixel 16 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmquant -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmquant -spreadbrightness -spreadluminosity 16 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmquant -randomseed 1 -norandom 10 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pnmquantall.test b/test/pnmquantall.test index f3594c0f..f047e856 100755 --- a/test/pnmquantall.test +++ b/test/pnmquantall.test @@ -1,6 +1,6 @@ #! /bin/sh # This script tests: pnmquantall -# Also requires: ppmtorgb3 pgmhist pnmcat +# Also requires: ppmtorgb3 pgmhist pamcat tmpdir=${tmpdir:-/tmp} rose_ppm=${tmpdir}/rose.ppm @@ -21,7 +21,7 @@ done # Should print 1 -pnmcat ${rose_red} ${rose_grn} ${rose_blu} -tb | \ +pamcat ${rose_red} ${rose_grn} ${rose_blu} -tb | \ pgmhist -m | awk '$2>0 {s++}; END { print (s<=20) }' @@ -44,4 +44,4 @@ rm ${rose_red}xx ${rose_grn}xx ${rose_blu}xx || \ pnmquantall -ext xx 2 || \ echo "Expected failure 3" -rm ${rose_red} ${rose_grn} ${rose_blu} ${rose_ppm} \ No newline at end of file +rm ${rose_red} ${rose_grn} ${rose_blu} ${rose_ppm} diff --git a/test/pnmremap1.test b/test/pnmremap1.test index fcd382a7..8626c50f 100755 --- a/test/pnmremap1.test +++ b/test/pnmremap1.test @@ -33,32 +33,32 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pnmremap -mapfile=/dev/null testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmremap -mapfile=/dev/zero testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmremap testimg.ppm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmremap -fs -nofs testimg.ppm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmremap -mapfile=testgrid.pbm -missingcolor=rgb:00/ff/00 testimg.ppm \ > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmremap -mapfile=testgrid.pbm -firstisdefault testimg.ppm > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/pnmtile.ok b/test/pnmtile.ok index 279251b8..d28fafa3 100644 --- a/test/pnmtile.ok +++ b/test/pnmtile.ok @@ -1,5 +1,5 @@ 4228632379 259 -0 0 : 0 +0 0 0 : 0 Expected failure 1 1 Expected failure 2 1 Expected failure 3 1 diff --git a/test/pnmtile.test b/test/pnmtile.test index b9597467..b72ef946 100755 --- a/test/pnmtile.test +++ b/test/pnmtile.test @@ -1,6 +1,6 @@ #! /bin/bash # This script tests: pnmtile -# Also requires: pnmcat +# Also requires: pamcat # Test 1. Should print 4228632379 259 @@ -8,14 +8,14 @@ pnmtile 40 50 testgrid.pbm | cksum tmpdir=${tmpdir:-/tmp} -# Test 2. Compare 2x2 tile images produced by pnmtile and pnmcat +# Test 2. Compare 2x2 tile images produced by pnmtile and pamcat # Should print 0 testimg2_ppm=${tmpdir}/testimg2.ppm testimg4_ppm=${tmpdir}/testimg4.ppm pnmtile 454 298 testimg.ppm > ${testimg4_ppm} && -pnmcat -lr testimg.ppm testimg.ppm > ${testimg2_ppm} && -pnmcat -tb ${testimg2_ppm} ${testimg2_ppm} | \ +pamcat -lr testimg.ppm testimg.ppm > ${testimg2_ppm} && +pamcat -tb ${testimg2_ppm} ${testimg2_ppm} | pamtopnm --assume |\ cmp -s - ${testimg4_ppm} echo ${PIPESTATUS[@]} ":" $? @@ -29,21 +29,21 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 pnmtile 100 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmtile 100 0 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmtile 0 100 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} pnmtile 100 100 100 testgrid.pbm > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/ppmforge-parameters.test b/test/ppmforge-parameters.test index 83758213..e5822673 100755 --- a/test/ppmforge-parameters.test +++ b/test/ppmforge-parameters.test @@ -30,36 +30,36 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 ppmforge -night -dimension=0 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmforge -dimension=10 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmforge -dimension=-1 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmforge -clouds -mesh=1.99 > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmforge -clouds -power=0 > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmforge -ice=-1 > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmforge -glaciers=-1 > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/ppmforge.test b/test/ppmforge.test index e83ad553..75de7cf7 100755 --- a/test/ppmforge.test +++ b/test/ppmforge.test @@ -47,6 +47,6 @@ ppmforge -seed 1 -stars 0 -ice 0.01 \ -inclination 9 -hour 12 -power 200 > ${test_ppm} ppmforge -seed 1 -stars 0 -ice 0.01 \ -inclination 10 -hour 12 -power 200 | \ - pnmpsnr -target1=53.89 -target2=49.38 -target3=65.15 - ${test_ppm} + pnmpsnr -target1=46.07 -target2=52.00 -target3=67.77 - ${test_ppm} rm ${test_ppm} diff --git a/test/ppmhist.test b/test/ppmhist.test index 34eb0ea0..8c2eedbc 100755 --- a/test/ppmhist.test +++ b/test/ppmhist.test @@ -36,16 +36,16 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 ppmhist -hexcolor -float testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmhist -hexcolor -map testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmhist -float -map testimg.ppm > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/ppmmake.test b/test/ppmmake.test index 714573b2..30eb596a 100755 --- a/test/ppmmake.test +++ b/test/ppmmake.test @@ -19,51 +19,51 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 ppmmake rgb:gg/00/00 2 2 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmmake rgb:ff/ff/00 2 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmmake rgbi:1.1/0/0 2 2 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmmake rgbi:1.0/.5 2 2 > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmmake rainbow 2 2 > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmmake 2 2 > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmmake blue -maxval=0 2 2 > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmmake blue -maxval=-1 2 2 > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmmake blue -maxval=65536 2 2 > ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} RGBDEF=/dev/null ppmmake red 2 2 > ${test_out} || \ - echo -n "Expected failure 10" + printf "Expected failure 10" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/ppmpat.test b/test/ppmpat.test index 8f00b9f5..ced2e64a 100755 --- a/test/ppmpat.test +++ b/test/ppmpat.test @@ -50,47 +50,47 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 ppmpat -g2 -g3 10 10 > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -madras -tartan 10 10 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -poles -squig 10 10 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -camo -anticamo 10 10 > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -argyle1 -argyle2 10 10 > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat 10 10 > ${test_out} || \ - echo -n "Expected failure 6" + printf "Expected failure 6" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -g2 10 > ${test_out} || \ - echo -n "Expected failure 7" + printf "Expected failure 7" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -g2 10 10 10 > ${test_out} || \ - echo -n "Expected failure 8" + printf "Expected failure 8" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -g2 10 > ${test_out} || \ - echo -n "Expected failure 9" + printf "Expected failure 9" test -s ${test_out}; echo " "$? rm -f ${test_out} @@ -101,89 +101,89 @@ clist4="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff,rgb:ff/ff/ff" # These patterns require exactly 2 colors ppmpat -gingham2 ${clist1} 10 10 > ${test_out} || \ - echo -n "Expected failure 10" + printf "Expected failure 10" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -argyle1 ${clist1} 10 10 > ${test_out} || \ - echo -n "Expected failure 11" + printf "Expected failure 11" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -gingham2 ${clist3} 10 10 > ${test_out} || \ - echo -n "Expected failure 12" + printf "Expected failure 12" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -argyle1 ${clist3} 10 10 > ${test_out} || \ - echo -n "Expected failure 13" + printf "Expected failure 13" test -s ${test_out}; echo " "$? rm -f ${test_out} # These require exactly 3 colors ppmpat -gingham3 ${clist2} 10 10 > ${test_out} || \ - echo -n "Expected failure 14" + printf "Expected failure 14" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -argyle2 ${clist2} 10 10 > ${test_out} || \ - echo -n "Expected failure 15" + printf "Expected failure 15" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -madras ${clist2} 10 10 > ${test_out} || \ - echo -n "Expected failure 16" + printf "Expected failure 16" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -tartan ${clist2} 10 10 > ${test_out} || \ - echo -n "Expected failure 17" + printf "Expected failure 17" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -gingham3 ${clist4} 10 10 > ${test_out} || \ - echo -n "Expected failure 18" + printf "Expected failure 18" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -argyle2 ${clist4} 10 10 > ${test_out} || \ - echo -n "Expected failure 19" + printf "Expected failure 19" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -madras ${clist4} 10 10 > ${test_out} || \ - echo -n "Expected failure 20" + printf "Expected failure 20" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -tartan ${clist4} 10 10 > ${test_out} || \ - echo -n "Expected failure 21" + printf "Expected failure 21" test -s ${test_out}; echo " "$? rm -f ${test_out} # These require at least 3 colors ppmpat -squig ${clist2} 10 10 > ${test_out} || \ - echo -n "Expected failure 22" + printf "Expected failure 22" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -camo ${clist2} 10 10 > ${test_out} || \ - echo -n "Expected failure 23" + printf "Expected failure 23" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -anticamo ${clist2} 10 10 > ${test_out} || \ - echo -n "Expected failure 24" + printf "Expected failure 24" test -s ${test_out}; echo " "$? rm -f ${test_out} # The squig pattern has an aspect ratio restriction ppmpat -squig ${clist3} 10 250 > ${test_out} || \ - echo -n "Expected failure 25" + printf "Expected failure 25" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmpat -squig ${clist3} 500 20 > ${test_out} || \ - echo -n "Expected failure 26" + printf "Expected failure 26" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/ppmtoapplevol.test b/test/ppmtoapplevol.test index 6b109251..4964ede8 100755 --- a/test/ppmtoapplevol.test +++ b/test/ppmtoapplevol.test @@ -15,16 +15,16 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pbmmake 10 11 | ppmtoapplevol > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmmake 10 13 | ppmtoapplevol > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} pbmmake 256 12 | ppmtoapplevol > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/ppmwheel.test b/test/ppmwheel.test index fc390f26..c6583f97 100755 --- a/test/ppmwheel.test +++ b/test/ppmwheel.test @@ -122,26 +122,26 @@ echo "Error messages should appear below the line." 1>&2 echo "-----------------------------------------------------------" 1>&2 ppmwheel 10 -huevalue -huesaturation > ${test_out} || \ - echo -n "Expected failure 1" + printf "Expected failure 1" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmwheel 0 > ${test_out} || \ - echo -n "Expected failure 2" + printf "Expected failure 2" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmwheel 3 > ${test_out} || \ - echo -n "Expected failure 3" + printf "Expected failure 3" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmwheel > ${test_out} || \ - echo -n "Expected failure 4" + printf "Expected failure 4" test -s ${test_out}; echo " "$? rm -f ${test_out} ppmwheel 10 10 > ${test_out} || \ - echo -n "Expected failure 5" + printf "Expected failure 5" test -s ${test_out}; echo " "$? rm -f ${test_out} diff --git a/test/ps-roundtrip.test b/test/ps-roundtrip.test index 8b107315..5d7b7d65 100755 --- a/test/ps-roundtrip.test +++ b/test/ps-roundtrip.test @@ -1,6 +1,6 @@ #! /bin/sh # This script tests: pnmtops pstopnm -# Also requires: pamtopnm gs pbmmake pnmshear pnmpad pnmcat +# Also requires: pamtopnm gs pbmmake pnmshear pnmpad pamcat # Failure message @@ -37,7 +37,7 @@ pbmmake -g 2 2 > ${g_pbm} pbmmake -g 8 4 | \ pnmshear 45 -noantialias -background=black | \ pnmpad -right 60 | \ - pnmcat -tb -jright - ${g_pbm} > ${t_pbm} && + pamcat -tb -jright - ${g_pbm} > ${t_pbm} && for flag in "" "-rle" "-ps -rle -ascii" \ "-bitspersample=2 -rle" "-ps -bitspersample=4 -rle" \ "-bitspersample=8 -rle" "-ps -bitspersample=12 -rle -dict" diff --git a/test/qoi-roundtrip.ok b/test/qoi-roundtrip.ok new file mode 100644 index 00000000..faa7601f --- /dev/null +++ b/test/qoi-roundtrip.ok @@ -0,0 +1,34 @@ +Test 1. Should print 1.N 0 0 +1.0 0 0 +1.1 0 0 +1.2 0 0 +1.3 0 0 +1.4 0 0 +Test 2. Should print 2.N 0 0 +2.0 0 0 +2.1 0 0 +2.2 0 0 +2.3 0 0 +2.4 0 0 +Test 3. Should print 3.N 0 0 +3.0 0 0 +3.1 0 0 +3.2 0 0 +3.3 0 0 +3.4 0 0 +Test Invalid +Should print: Expected failure N 1 +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 +------------------------------ +Should print: Expected failure N 0 +Expected failure 9 0 +Expected failure 10 0 +Expected failure 11 0 +Expected failure 12 0 diff --git a/test/qoi-roundtrip.test b/test/qoi-roundtrip.test new file mode 100755 index 00000000..f758abcc --- /dev/null +++ b/test/qoi-roundtrip.test @@ -0,0 +1,254 @@ +#! /bin/bash +# This script tests: qoitopam pamtoqoi +# Also requires: pamdepth pamfile pamseq pamstack pamtopnm pbmmake +# Also requires: pgmnoise ppmpat ppmtopgm + +# Ensure that sed operates in original narrow-character mode + +LANG=C +LC_ALL=C +export LANG LC_ALL + +tmpdir=${tmpdir:-/tmp} + +maze_qoi=${tmpdir}/maze.qoi +maze_bw_alpha=${tmpdir}/maze_bw_alpha.pam +maze_rgb=${tmpdir}/maze_rgb.pam +maze_rgb_alpha=${tmpdir}/maze_rgb_alpha.pam + +echo "Test 1. Should print 1.N 0 0" + +pbmmake -g $(pamfile -size maze.pbm) |\ + pamstack -tupletype="BLACKANDWHITE_ALPHA" maze.pbm - > ${maze_bw_alpha} + +pbmmake -g $(pamfile -size maze.pbm) |\ + pamstack -tupletype="RGB" maze.pbm maze.pbm maze.pbm |\ + pamdepth 255 > ${maze_rgb} +printf "1.0 $? " + +pbmmake -g $(pamfile -size maze.pbm) |\ + pamstack -tupletype="RGB_ALPHA" maze.pbm maze.pbm maze.pbm - |\ + pamdepth 255 > ${maze_rgb_alpha} +echo $? + +# PBM, PBM + alpha + +pamtoqoi maze.pbm | tee ${maze_qoi} | qoitopam | cmp -s - ${maze_rgb} +printf "1.1 $? " +test -s ${maze_qoi} +echo $? + +pamdepth 8 maze.pbm | pamtoqoi | qoitopam | cmp -s - ${maze_rgb} +printf "1.2 $? " +test -s ${maze_rgb} +echo $? + +pamtoqoi ${maze_bw_alpha} | qoitopam | cmp -s - ${maze_rgb_alpha} +printf "1.3 $? " +test -s ${maze_bw_alpha} +echo $? + +pamdepth 2 ${maze_bw_alpha} | pamstack -tupletype="GRAYSCALE_ALPHA" |\ + pamtoqoi | qoitopam | cmp -s - ${maze_rgb_alpha} +printf "1.4 $? " +test -s ${maze_rgb_alpha} +echo $? + +rm ${maze_rgb} ${maze_rgb_alpha} ${maze_bw_alpha} + +echo "Test 2. Should print 2.N 0 0" + +# ---- PGM, PGM + alpha + +noise1_pgm=${tmpdir}/noise1.pgm +noise2_pgm=${tmpdir}/noise2.pgm +test_gray_alpha=${tmpdir}/test_gray_alpha.pam +res_gray_alpha=${tmpdir}/res_gray_alpha.pam + +pgmnoise --randomseed=0 20 20 > ${noise1_pgm} +pgmnoise --randomseed=1 20 20 | tee ${noise2_pgm} |\ + pamstack -tupletype="GRAYSCALE_ALPHA" ${noise1_pgm} - \ + > ${test_gray_alpha} +printf "2.0 $? " + +pamstack -tupletype="RGB_ALPHA" \ + ${noise1_pgm} ${noise1_pgm} ${noise1_pgm} ${noise2_pgm} > ${res_gray_alpha} +echo $? + +rm ${noise2_pgm} + +pamtoqoi ${noise1_pgm} | qoitopam | pamtopnm | ppmtopgm |\ + cmp -s - ${noise1_pgm} +printf "2.1 $? " +test -s ${noise1_pgm} +echo $? + + +pamdepth 65535 ${noise1_pgm} | pamtoqoi | qoitopam | pamtopnm | ppmtopgm |\ + cmp -s - ${noise1_pgm} +printf "2.2 $? " +test -s ${noise1_pgm} +echo $? + +pamtoqoi ${test_gray_alpha} | qoitopam | cmp -s - ${res_gray_alpha} +printf "2.3 $? " +test -s ${test_gray_alpha} +echo $? + +pamdepth 4095 ${test_gray_alpha} | pamtoqoi | qoitopam |\ + cmp -s - ${res_gray_alpha} +printf "2.4 $? " +test -s ${res_gray_alpha} +echo $? + +rm ${test_gray_alpha} ${res_gray_alpha} + +echo "Test 3. Should print 3.N 0 0" + +# rgb rgb-alpha + +tartan_ppm=${tmpdir}/tartan.ppm +tartan_qoi=${tmpdir}/tartan.qoi +test_rgb_alpha=${tmpdir}/test_rgb_alpha.pam + +ppmpat -tartan 20 20 | tee ${tartan_ppm} |\ + pamstack -tupletype="RGB_ALPHA" - ${noise1_pgm} > ${test_rgb_alpha} +printf "3.0 $? " +test -s ${tartan_ppm} +echo $? + +pamtoqoi ${tartan_ppm} | tee ${tartan_qoi} | qoitopam | pamtopnm |\ + cmp -s - ${tartan_ppm} +printf "3.1 $? " +test -s ${tartan_qoi} +echo $? +rm ${tartan_qoi} + +pamdepth 4095 ${tartan_ppm} | pamtoqoi | tee ${tartan_qoi} |\ + qoitopam | pamtopnm | cmp -s - ${tartan_ppm} +printf "3.2 $? " +test -s ${tartan_qoi} +echo $? +rm ${tartan_qoi} + +pamtoqoi ${test_rgb_alpha} | qoitopam | cmp -s - ${test_rgb_alpha} +printf "3.3 $? " +test -s ${test_rgb_alpha} +echo $? + +pamdepth 511 ${test_rgb_alpha} | pamtoqoi | qoitopam |\ + cmp -s - ${test_rgb_alpha} +printf "3.4 $? " +test -s ${test_rgb_alpha} +echo $? + +rm ${noise1_pgm} ${tartan_ppm} ${test_rgb_alpha} + + +echo "Test Invalid" + +test_out=${tmpdir}/test.out +maze_qoi_size=$(cat ${maze_qoi} | wc -c) + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +echo "Should print: Expected failure N 1" + +pamseq -tupletype="void" 1 1 | pamtoqoi > \ + ${test_out} || \ + printf "Expected failure 1" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +( echo "P1"; echo "400000001 1" ; + head -c 400000001 /dev/zero ) | pamtoqoi > \ + ${test_out} || \ + printf "Expected failure 2" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +# Replace fields in the qoi file header with invalid values + +( printf "qojf" + tail -c +5 ${maze_qoi} ) | qoitopam > \ + ${test_out} || \ + printf "Expected failure 3" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +( head -c 4 ${maze_qoi} + head -c 4 /dev/zero + tail -c +9 ${maze_qoi} ) | qoitopam > \ + ${test_out} || \ + printf "Expected failure 4" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +( head -c 8 ${maze_qoi} + head -c 4 /dev/zero + tail -c +13 ${maze_qoi} ) | qoitopam > \ + ${test_out} || \ + printf "Expected failure 5" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +# Following sed construct means: "replace first 8 bytes of input +# stream." echo -e -n and printf may be straightforward but +# unfortunately they are not portable. Is there any better solution? +# Suggestions welcome. + +( head -c 4 ${maze_qoi} + tail -c +5 ${maze_qoi} | \ + sed '1s/^......../\x00\x00\x4F\xFF\x00\x00\x4F\xFF/' ) | qoitopam > \ + ${test_out} || \ + printf "Expected failure 6" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +( head -c 12 ${maze_qoi} + tail -c +13 ${maze_qoi} | sed '1s/^./\x01/' ) | qoitopam > \ + ${test_out} || \ + printf "Expected failure 7" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +( head -c 13 ${maze_qoi} + tail -c +14 ${maze_qoi} | sed '1s/^./\x02/' ) | qoitopam > \ + ${test_out} || \ + printf "Expected failure 8" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +echo "------------------------------" +echo "Should print: Expected failure N 0" + +( head -c $(( ${maze_qoi_size} - 9 )) ${maze_qoi} + tail -c 9 ${maze_qoi} | sed '1s/^./\xfd/' ) | qoitopam > \ + ${test_out} || \ + printf "Expected failure 9" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +head -c $(( ${maze_qoi_size} - 1 )) ${maze_qoi} | qoitopam > \ + ${test_out} || \ + printf "Expected failure 10" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +( head -c $(( ${maze_qoi_size} - 1 )) ${maze_qoi} + printf '1' ) | qoitopam > \ + ${test_out} || \ + printf "Expected failure 11" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +( cat ${maze_qoi}; printf '1' ) | qoitopam > \ + ${test_out} || \ + printf "Expected failure 12" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +rm ${maze_qoi} diff --git a/test/stdin-pam1.ok b/test/stdin-pam1.ok index e66da036..10e48622 100644 --- a/test/stdin-pam1.ok +++ b/test/stdin-pam1.ok @@ -3,6 +3,7 @@ pamaltsat -strength=1: 0 0 0 0 pambackground: 0 0 0 0 pambayer -type=2: 0 0 0 0 pambrighten: 0 0 0 0 +pamcat -topbottom: 0 0 0 0 pamcut: 0 0 0 0 pamdeinterlace: 0 0 0 0 pamdepth 15: 0 0 0 0 diff --git a/test/stdin-pam1.test b/test/stdin-pam1.test index 1331abd0..7cb15dfc 100755 --- a/test/stdin-pam1.test +++ b/test/stdin-pam1.test @@ -1,6 +1,6 @@ #! /bin/bash # This script tests: pamaddnoise pamaltsat pambackground pambayer -# This script tests: pambrighten pamcut pamdeinterlace pamdepth pamditherbw +# This script tests: pambrighten pamcat pamcut pamdeinterlace pamdepth pamditherbw # This script tests: pamedge pamexec pamfile pamfind pamfix pamflip # This script tests: pamfunc pamhomography pamhue pamlevels # This script tests: pammixinterlace pammosaicknit pamoil @@ -24,6 +24,7 @@ for testprog in \ pambackground \ "pambayer -type=2" \ pambrighten \ + "pamcat -topbottom" \ pamcut \ pamdeinterlace \ "pamdepth 15" \ diff --git a/test/stdin-pam3.ok b/test/stdin-pam3.ok index 0ec9cf5d..516e9554 100644 --- a/test/stdin-pam3.ok +++ b/test/stdin-pam3.ok @@ -14,6 +14,8 @@ pamtopfm: 0 0 0 0 pfmtopam: 0 0 0 0 pamtopng: 0 0 0 0 pngtopam: 0 0 0 0 +pamtoqoi: 0 0 0 0 +qoitopam: 0 0 0 0 pamtosrf: 0 0 0 0 srftopam: 0 0 0 0 pamtosvg: 0 0 0 0 diff --git a/test/stdin-pam3.test b/test/stdin-pam3.test index e8c31781..02257942 100755 --- a/test/stdin-pam3.test +++ b/test/stdin-pam3.test @@ -5,6 +5,7 @@ # This script tests: pamtopdbimg pdbimgtopam # This script tests: pamtopfm pfmtopam # This script tests: pamtopng pngtopam +# This script tests: pamtoqoi qoitopam # This script tests: pamtosrf srftopam # This script tests: pamtosvg svgtopam # This script tests: pamtowinicon winicontopam @@ -36,6 +37,7 @@ for fmt in \ pdbimg \ pfm \ png \ + qoi \ srf \ svg \ winicon \ diff --git a/test/stdin-pnm1.ok b/test/stdin-pnm1.ok index 0a63558c..9f427b23 100644 --- a/test/stdin-pnm1.ok +++ b/test/stdin-pnm1.ok @@ -1,5 +1,4 @@ pnmalias: 0 0 0 0 -pnmcat -lr : 0 0 0 0 pnmcolormap all : 0 0 0 0 pnmconvol -matrix=-1,3,-1 : 0 0 0 0 pnmcrop: 0 0 0 0 diff --git a/test/stdin-pnm1.test b/test/stdin-pnm1.test index e692ceba..ae848752 100755 --- a/test/stdin-pnm1.test +++ b/test/stdin-pnm1.test @@ -1,5 +1,5 @@ #! /bin/sh -# This script tests: pnmalias pnmcat pnmcolormap pnmconvol pnmcrop pnmgamma +# This script tests: pnmalias pnmcolormap pnmconvol pnmcrop pnmgamma # This script tests: pnmhisteq pnmhistmap pnminvert pnmmargin pnmmercator # This script tests: pnmmontage pnmnlfilt pnmnorm pnmpad pnmquant pnmrotate # This script tests: pnmscalefixed pnmshear pnmsmooth pnmtile pnmtoddif @@ -15,7 +15,6 @@ ppmpat -g2 -color=rgb:00/00/ff,rgb:ff/00/00 -mesh 4 4 > ${small_ppm} for testprog in \ pnmalias \ - "pnmcat -lr " \ "pnmcolormap all " \ "pnmconvol -matrix=-1,3,-1 " \ pnmcrop \ @@ -57,4 +56,4 @@ rm ${small_ppm} # Pnmstitch: requires two input files # pnmmargin: uses pamflip -# pnmsmooth: uses pnmconvol \ No newline at end of file +# pnmsmooth: uses pnmconvol diff --git a/test/stdin-ppm2.ok b/test/stdin-ppm2.ok index e3fb4219..e1335bfb 100644 --- a/test/stdin-ppm2.ok +++ b/test/stdin-ppm2.ok @@ -1,11 +1,11 @@ ppmtoacad: 0 0 0 0 ppmtoapplevol: 0 0 0 0 ppmtoascii: 0 0 0 0 +ppmtoicr -windowname testimage: 0 0 0 0 ppmtolj: 0 0 0 0 ppmtomitsu: 0 0 0 0 ppmtopgm: 0 0 0 0 ppmtopuzz: 0 0 0 0 ppmtosixel: 0 0 0 0 ppmtoterm: 0 0 0 0 -ppmtoicr: 0 0 0 0 ppmtoyuvsplit: 0 0 0 0 diff --git a/test/stdin-ppm2.test b/test/stdin-ppm2.test index 81b3954e..e43b6d4c 100755 --- a/test/stdin-ppm2.test +++ b/test/stdin-ppm2.test @@ -17,6 +17,7 @@ for testprog in \ ppmtoacad \ ppmtoapplevol \ ppmtoascii \ + "ppmtoicr -windowname testimage" \ ppmtolj \ ppmtomitsu \ ppmtopgm \ @@ -34,17 +35,6 @@ for testprog in \ rm ${test_ppm} -testprog=ppmtoicr - -# File name embedded in output; "untitled" if no name - - ${testprog} testgrid.pbm > ${out1}; status1=$? - ${testprog} < testgrid.pbm > ${out2}; status2=$? - test -s ${out1}; status3=$? - sed 's/untitled/testgrid.pbm/g' ${out2} | cmp -s ${out1} - - echo ${testprog}": "${status1} ${status2} ${status3} $? - rm ${out1} ${out2} - testprog=ppmtoyuvsplit # Produces three output files diff --git a/test/stdin-ppm3.ok b/test/stdin-ppm3.ok index f7ba5623..42932e92 100644 --- a/test/stdin-ppm3.ok +++ b/test/stdin-ppm3.ok @@ -16,5 +16,5 @@ ppmtopj: 0 0 0 0 pjtoppm: 0 0 0 0 ppmtospu: 0 0 0 0 sputoppm: 0 0 0 0 -ppmtoxpm: 0 0 0 0 +ppmtoxpm -name small: 0 0 0 0 xpmtoppm: 0 0 0 0 diff --git a/test/stdin-ppm3.test b/test/stdin-ppm3.test index 605b535b..064e3e22 100755 --- a/test/stdin-ppm3.test +++ b/test/stdin-ppm3.test @@ -1,4 +1,4 @@ -#! /bin/sh +o#! /bin/sh # This script tests: ppmtobmp bmptopnm # This script tests: ppmtoilbm ilbmtoppm # This script tests: ppmtoleaf leaftoppm @@ -33,26 +33,24 @@ for fmt in \ pj \ spu \ xpm - do - testprog1="ppmto"${fmt} +do + if [ ${fmt} = "xpm" ] + then testprog1="ppmto${fmt} -name small"; + else testprog1="ppmto${fmt}"; + fi if [ ${fmt} = "bmp" ] then testprog2=${fmt}"topnm"; - else testprog2=${fmt}"toppm"; + else testprog2=${fmt}"toppm"; fi if [ ${fmt} = "spu" ] then test_ppm=${large_ppm}; - else test_ppm=${small_ppm}; + else test_ppm=${small_ppm}; fi ${testprog1} ${test_ppm} > ${out1}; status1=$? ${testprog1} < ${test_ppm} > ${out2}; status2=$? test -s ${out1}; status3=$? - if [ ${fmt} = "xpm" ] - then - sed -i '/^static char/s/static char .* = {/static char file/' \ - ${out1} ${out2}; - fi cmp -s ${out1} ${out2} echo ${testprog1}": "${status1} ${status2} ${status3} $? rm ${out2} |