about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Test-Order1
-rwxr-xr-xtest/cut-cat-roundtrip.test18
-rw-r--r--test/ilbm-roundtrip.ok2
-rwxr-xr-xtest/ilbm-roundtrip.test2
-rwxr-xr-xtest/lps-roundtrip.test2
-rw-r--r--test/pamarith.ok2
-rwxr-xr-xtest/pamarith.test2
-rwxr-xr-xtest/pamcat2.test10
-rw-r--r--test/pamcat3.ok19
-rwxr-xr-xtest/pamcat3.test97
-rwxr-xr-xtest/stdin-pam3.test2
11 files changed, 141 insertions, 16 deletions
diff --git a/test/Test-Order b/test/Test-Order
index 214cf4ba..6aab22bd 100644
--- a/test/Test-Order
+++ b/test/Test-Order
@@ -74,6 +74,7 @@ pbmclean.test
 pamcut.test
 pamcat1.test
 pamcat2.test
+pamcat3.test
 pnmcat.test
 pamdice.test
 pamundice.test
diff --git a/test/cut-cat-roundtrip.test b/test/cut-cat-roundtrip.test
index c2799a7b..274cb865 100755
--- a/test/cut-cat-roundtrip.test
+++ b/test/cut-cat-roundtrip.test
@@ -1,6 +1,6 @@
 #! /bin/sh
 # This script tests: pamcut
-# Also requires: pamfile pnmcat pnmpad pnmcrop
+# Also requires: pamfile pamcat pnmpad pnmcrop
 
 tmpdir=${tmpdir:-/tmp}
 
@@ -23,7 +23,7 @@ for i in 0 1 128 224 225
   do
   pamcut -left=$((i+1)) testimg.ppm > ${right_ppm}
   pamcut -right=$i      testimg.ppm > ${left_ppm}
-  pnmcat -lr ${left_ppm} ${right_ppm} | \
+  pamcat -lr ${left_ppm} ${right_ppm} | \
     pamcut -left=0 -width=${width} | cksum
   rm ${left_ppm} ${right_ppm}
   done
@@ -38,7 +38,7 @@ for border in 0 1 128 224 225
   do
   pamcut -left=$((${border}+1)) -width=${width} -pad testimg.ppm > ${right_ppm}
   pamcut -right=${border} -width=${width} -pad testimg.ppm > ${left_ppm}
-  pnmcat -lr ${left_ppm} ${right_ppm} ${left_ppm} | \
+  pamcat -lr ${left_ppm} ${right_ppm} ${left_ppm} | \
     pamcut -left=$((${width}-${border}-1))  -width=$((${width}*2)) | \
     tee ${padded_ppm} | cksum | tr '\n' ' '
   pnmcrop -black -right ${padded_ppm} | cksum
@@ -53,7 +53,7 @@ for border in 0 1 70 147
   do
   pamcut -top=$((${border}+1)) testimg.ppm > ${bottom_ppm}
   pamcut -bottom=${border}     testimg.ppm > ${top_ppm}
-  pnmcat -tb ${top_ppm} ${bottom_ppm} | \
+  pamcat -tb ${top_ppm} ${bottom_ppm} | \
     pamcut -top=0 -height=${height} | cksum
   rm ${top_ppm} ${bottom_ppm}
   done
@@ -68,7 +68,7 @@ for border in 0 1 70 147
   pamcut -top=$((${border}+1)) -height=${height} -pad testimg.ppm \
     > ${bottom_ppm}
   pamcut -bottom=${border}     -height=${height} -pad testimg.ppm > ${top_ppm}
-  pnmcat -tb ${top_ppm} ${bottom_ppm} ${top_ppm} | \
+  pamcat -tb ${top_ppm} ${bottom_ppm} ${top_ppm} | \
     pamcut -top=$((${height}-${border}-1))  -height=$((${height}*2)) | \
     tee ${padded_ppm} | cksum | tr '\n' ' 'cksum
   pnmcrop -black -bottom ${padded_ppm} | cksum
@@ -94,7 +94,7 @@ for i in 0 1 10 30 50
   do
   pamcut -left=$((i+1)) maze.pbm > ${right_ppm}
   pamcut -right=$i      maze.pbm > ${left_ppm}
-  pnmcat -lr ${left_ppm} ${right_ppm} | \
+  pamcat -lr ${left_ppm} ${right_ppm} | \
     pamcut -left=0 -width=${width} | cksum
   rm ${left_ppm} ${right_ppm}
   done
@@ -110,7 +110,7 @@ for border in 0 1 10 30 50
   do
   pamcut -left=$((${border}+1)) -width=${width} -pad maze.pbm > ${right_ppm}
   pamcut -right=${border} -width=${width} -pad maze.pbm > ${left_ppm}
-  pnmcat -lr ${left_ppm} ${right_ppm} ${left_ppm} | \
+  pamcat -lr ${left_ppm} ${right_ppm} ${left_ppm} | \
     pamcut -left=$((${width}-${border}-1))  -width=$((${width}*2)) | \
     tee ${padded_ppm} | cksum | tr '\n' ' '
   pnmcrop -black -right ${padded_ppm} | cksum
@@ -125,7 +125,7 @@ for border in 0 1 12 21 31 44
   do
   pamcut -top=$((${border}+1)) maze.pbm > ${bottom_ppm}
   pamcut -bottom=${border}     maze.pbm > ${top_ppm}
-  pnmcat -tb ${top_ppm} ${bottom_ppm} | \
+  pamcat -tb ${top_ppm} ${bottom_ppm} | \
     pamcut -top=0 -height=${height} | cksum
   rm ${top_ppm} ${bottom_ppm}
   done
@@ -139,7 +139,7 @@ for border in 0 1 10 50
   do
   pamcut -top=$((${border}+1)) -height=${height} -pad maze.pbm > ${bottom_ppm}
   pamcut -bottom=${border}     -height=${height} -pad maze.pbm > ${top_ppm}
-  pnmcat -tb ${top_ppm} ${bottom_ppm} ${top_ppm} | \
+  pamcat -tb ${top_ppm} ${bottom_ppm} ${top_ppm} | \
     pamcut -top=$((${height}-${border}-1))  -height=$((${height}*2)) | \
     tee ${padded_ppm} | cksum | tr '\n' ' 'cksum
   pnmcrop -black -bottom ${padded_ppm} | cksum
diff --git a/test/ilbm-roundtrip.ok b/test/ilbm-roundtrip.ok
index 07c44515..2d6fcff0 100644
--- a/test/ilbm-roundtrip.ok
+++ b/test/ilbm-roundtrip.ok
@@ -1,4 +1,4 @@
-Test 1.  Should produce 669206373 10102 five times
+Test 1.  Should produce 669206373 10102 four times
 669206373 10102
 669206373 10102
 669206373 10102
diff --git a/test/ilbm-roundtrip.test b/test/ilbm-roundtrip.test
index c0b684ed..e7a1a4e5 100755
--- a/test/ilbm-roundtrip.test
+++ b/test/ilbm-roundtrip.test
@@ -2,7 +2,7 @@
 # This script tests: ppmtoilbm ilbmtoppm
 # Also requires: pamseq pamdepth pamtopnm pnmremap pnmcolormap
 
-echo "Test 1.  Should produce 669206373 10102 five times"
+echo "Test 1.  Should produce 669206373 10102 four times"
 #Output is PPM raw, 57 by 59  maxval 255
 
 ppmtoilbm maze.pbm | ilbmtoppm | cksum
diff --git a/test/lps-roundtrip.test b/test/lps-roundtrip.test
index 78350d71..24076ef1 100755
--- a/test/lps-roundtrip.test
+++ b/test/lps-roundtrip.test
@@ -30,4 +30,4 @@ pbmtolps -dpi 72 < testgrid.pbm | sed 's/noname/testgrid.pbm/' | \
     cmp -s ${test_ps} -
     echo $?
   
-rm ${test_pgm}
+rm ${test_pgm} ${test_ps}
diff --git a/test/pamarith.ok b/test/pamarith.ok
index 973b8d1b..c2d34dea 100644
--- a/test/pamarith.ok
+++ b/test/pamarith.ok
@@ -193,7 +193,7 @@ Test 3
 3072492814 913
 3072492814 913
 Test 4 (input = output)
-Prints 281226646 481 five times, then 2921940274 59 five times
+Prints 281226646 481 six times, then 2921940274 59 six times
 input image
 281226646 481
 -minimum
diff --git a/test/pamarith.test b/test/pamarith.test
index 34922a90..061f9488 100755
--- a/test/pamarith.test
+++ b/test/pamarith.test
@@ -88,7 +88,7 @@ for fn in "-subtract" "-divide" "-compare" "-shiftleft" "-shiftright"
 rm ${input3_ppm} ${input4_ppm} ${input4_pgm}
 
 echo "Test 4 (input = output)"
-echo "Prints 281226646 481 five times, then 2921940274 59 five times"
+echo "Prints 281226646 481 six times, then 2921940274 59 six times"
 
 for image in maze.pbm ${input1_ppm}
   do
diff --git a/test/pamcat2.test b/test/pamcat2.test
index 6c76568d..ecc7ee5e 100755
--- a/test/pamcat2.test
+++ b/test/pamcat2.test
@@ -28,6 +28,8 @@ 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
 
+rm ${dotw_pbm}
+
 echo "Test 3."
 pbmmake -b 1 1 > ${dotb_pbm}
 
@@ -39,6 +41,10 @@ pamcat -tb -jl -white ${dotb_pbm} ${check5x5_pbm} ${dotb_pbm} |\
 pamcat -tb -jr -white ${dotb_pbm} ${check5x5_pbm} ${dotb_pbm} |\
   pamflip -cw | cksum
 
+rm ${dotb_pbm}
+rm ${check5x5_pbm}
+
+
 echo "Test 4."
 ppmmake rgb:20/40/d0 1 1 | tee ${dot_ppm} | pamcat -lr | cksum
 pamcat -tb  ${dot_ppm} | cksum
@@ -53,4 +59,6 @@ for just in -jleft -jcenter -jright
 do
 pamcat -tb ${just} ${dot_ppm} maze.pbm ${dot_ppm} | cksum
 done
- 
\ No newline at end of file
+
+rm ${dot_ppm}
+
diff --git a/test/pamcat3.ok b/test/pamcat3.ok
new file mode 100644
index 00000000..5dbb2cbc
--- /dev/null
+++ b/test/pamcat3.ok
@@ -0,0 +1,19 @@
+Test 1.   Should print 585134073 133221 four times
+585134073 133221
+585134073 133221
+585134073 133221
+585134073 133221
+Test 2.   Should print 1331083756 152559 three times
+1331083756 152559
+1331083756 152559
+1331083756 152559
+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
diff --git a/test/pamcat3.test b/test/pamcat3.test
new file mode 100755
index 00000000..3aed0131
--- /dev/null
+++ b/test/pamcat3.test
@@ -0,0 +1,97 @@
+#! /bin/sh
+# This script tests: pamcat
+# Also requires:
+
+tmpdir=${tmpdir:-/tmp}
+list=${tmpdir}/list
+list2=${tmpdir}/list2
+list3=${tmpdir}/list3
+liste1=${tmpdir}/liste1
+liste2=${tmpdir}/liste2
+liste3=${tmpdir}/liste3
+files="maze.pbm testgrid.pbm testimg.ppm"
+
+ls ${files} | tee ${list} | awk '{print ""; print $0; print ""}' > ${list3}
+sed 's/maze.pbm/-/' ${list} > ${list2}
+
+echo "Test 1.   Should print 585134073 133221 four times"
+pamcat -lr -jt ${files} | cksum
+pamcat -lr -jt -listfile=${list} | cksum
+cat maze.pbm | pamcat -lr -jt -listfile=${list2} | cksum
+pamcat -lr -jt -listfile=${list3} | cksum
+
+echo "Test 2.   Should print 1331083756 152559 three times"
+pamcat -tb -jl ${files} | cksum
+pamcat -tb -jl -listfile=${list} | cksum
+cat ${list} | pamcat -tb -jl -listfile=- | cksum
+
+echo "Test Invalid"
+
+test_out=${tmpdir}/test_out
+
+echo 1>&2
+echo "Invalid command-line argument combinations & listfile content." 1>&2
+echo "Error messages should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
+
+# listfile not specified
+pamcat -lr -listfile > ${test_out} || \
+  printf "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+# listfile does not exist
+pamcat -lr -listfile=`mktemp -u` > ${test_out} || \
+  printf "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+# listfile empty
+pamcat -lr -listfile=/dev/null > ${test_out} || \
+  printf "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+# listfile from stdin, empty
+cat /dev/null | pamcat -lr -listfile=- > ${test_out} || \
+  printf "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+# Files provided from command line in addition to listfile
+pamcat -lr -listfile=${list} testgrid.pbm testgrid.pbm > ${test_out} || \
+  printf "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+# "-" (stdin) provided from command line in addition to listfile
+pamcat -lr -listfile=${list} - > ${test_out} || \
+  printf "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+# listfile has nothing but blank lines
+sed 's/^.*$//' ${list3} > ${liste1}  
+pamcat -lr -listfile=${liste1} > ${test_out} || \
+  printf "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out} ${liste1}
+
+# Non-existing file in listfile
+( cat ${list} ; mktemp -u ) > ${liste2}
+pamcat -lr -listfile=${liste2} > ${test_out} || \
+  printf "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out} ${liste2}
+
+# Multiple instances of "-" in listfile
+( echo "-"; cat ${list}; echo "-"; echo "-" ) > ${liste3}
+pamcat -lr -listfile=${liste3} > ${test_out} || \
+  printf "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out} ${liste3}
+
+
+rm ${list} ${list2} ${list3}
+
+
diff --git a/test/stdin-pam3.test b/test/stdin-pam3.test
index 02257942..40155671 100755
--- a/test/stdin-pam3.test
+++ b/test/stdin-pam3.test
@@ -72,4 +72,4 @@ for fmt in \
   echo ${testprog2}": "${status4} ${status5} ${status6} $?
   done
 
-rm ${test_pgm}
+rm ${test_pgm} ${out1} ${out2} ${out3} ${out4}