about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--test/Test-Order1
-rwxr-xr-xtest/lps-roundtrip.test2
-rwxr-xr-xtest/pamcat2.test10
-rw-r--r--test/pamcat3.ok19
-rwxr-xr-xtest/pamcat3.test97
-rwxr-xr-xtest/stdin-pam3.test2
6 files changed, 128 insertions, 3 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/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/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}