about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-09-22 15:10:06 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-09-22 15:10:06 +0000
commit270c5f0ef4747ad5a1a418659213514be6cd1bda (patch)
treee09259abd808ac7e9a4c2494e1ccefa0d08ef991 /test
parent3e6bd495a661107cabb91df9e693151addae3f20 (diff)
downloadnetpbm-mirror-270c5f0ef4747ad5a1a418659213514be6cd1bda.tar.gz
netpbm-mirror-270c5f0ef4747ad5a1a418659213514be6cd1bda.tar.xz
netpbm-mirror-270c5f0ef4747ad5a1a418659213514be6cd1bda.zip
Miscellaneous test updates
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3686 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r--test/Test-Order3
-rw-r--r--test/pamditherbw.ok22
-rwxr-xr-xtest/pamditherbw.test39
-rw-r--r--test/pamfile.ok8
-rwxr-xr-xtest/pamfile.test16
-rw-r--r--test/pamfind.ok7
-rwxr-xr-xtest/pamfind.test24
-rw-r--r--test/pamgauss.ok12
-rwxr-xr-xtest/pamgauss.test22
-rw-r--r--test/pamscale-reportonly.ok14
-rwxr-xr-xtest/pamscale-reportonly.test42
-rw-r--r--test/pamseq.ok10
-rwxr-xr-xtest/pamseq.test19
-rw-r--r--test/pamsumm.ok10
-rwxr-xr-xtest/pamsumm.test19
-rw-r--r--test/pbmmake.ok32
-rwxr-xr-xtest/pbmmake.test38
-rw-r--r--test/pbmpage.ok8
-rwxr-xr-xtest/pbmpage.test16
-rw-r--r--test/pbmtext-bdf.ok3
-rwxr-xr-xtest/pbmtext-bdf.test10
-rw-r--r--test/pbmtext-iso88591.ok2
-rwxr-xr-xtest/pbmtext-iso88591.test63
-rw-r--r--test/pbmtext-utf8.ok18
-rwxr-xr-xtest/pbmtext-utf8.test174
-rw-r--r--test/pbmtext.ok23
-rwxr-xr-xtest/pbmtext.test83
-rw-r--r--test/pbmupc.ok20
-rwxr-xr-xtest/pbmupc.test34
-rw-r--r--test/pgmhist.ok10
-rwxr-xr-xtest/pgmhist.test19
-rw-r--r--test/pgmmake.ok20
-rwxr-xr-xtest/pgmmake.test32
-rw-r--r--test/pgmramp.ok12
-rwxr-xr-xtest/pgmramp.test18
-rw-r--r--test/pnmcolormap.ok16
-rwxr-xr-xtest/pnmcolormap.test33
-rw-r--r--test/pnmcrop1.ok24
-rwxr-xr-xtest/pnmcrop1.test8
-rw-r--r--test/pnmpsnr.ok10
-rwxr-xr-xtest/pnmpsnr.test19
-rw-r--r--test/pnmquant.ok18
-rwxr-xr-xtest/pnmquant.test61
-rw-r--r--test/pnmremap1.ok6
-rwxr-xr-xtest/pnmremap1.test25
-rw-r--r--test/ppmforge-parameters.ok12
-rwxr-xr-xtest/ppmforge-parameters.test22
-rw-r--r--test/ppmhist.ok8
-rwxr-xr-xtest/ppmhist.test15
-rw-r--r--test/ppmmake.ok24
-rwxr-xr-xtest/ppmmake.test39
-rw-r--r--test/ppmpat.ok54
-rwxr-xr-xtest/ppmpat.test85
53 files changed, 1011 insertions, 370 deletions
diff --git a/test/Test-Order b/test/Test-Order
index ab193a54..2548e501 100644
--- a/test/Test-Order
+++ b/test/Test-Order
@@ -42,6 +42,8 @@ pamsumm.test
 pnmpsnr.test
 pbmminkowski.test
 
+pnmcolormap.test
+
 # Basic (internal) converter tests
 
 pamtopam.test
@@ -70,6 +72,7 @@ pnmpaste-pbm.test
 pbmpscale.test
 pnmremap1.test
 pnmremap2.test
+pnmquant.test
 pnmquantall.test
 pnmtile.test
 ppmbrighten.test
diff --git a/test/pamditherbw.ok b/test/pamditherbw.ok
index eba3c44c..156b9f07 100644
--- a/test/pamditherbw.ok
+++ b/test/pamditherbw.ok
@@ -15,14 +15,14 @@ Test: Cluster-4
 Test: Cluster-8
 3493215477 33894
 Test: Invalid
-Expected failure 1
-Expected failure 2
-Expected failure 3
-Expected failure 4
-Expected failure 5
-Expected failure 6
-Expected failure 7
-Expected failure 8
-Expected failure 9
-Expected failure 10
-Expected failure 11
+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
diff --git a/test/pamditherbw.test b/test/pamditherbw.test
index 7b646a88..76e175d7 100755
--- a/test/pamditherbw.test
+++ b/test/pamditherbw.test
@@ -40,21 +40,34 @@ pamditherbw -cluster8 ${test_red} | cksum
 
 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
 
-pamditherbw -fs -atkinson       ${test_red} || echo "Expected failure 1"
-pamditherbw -floyd -atkinson    ${test_red} || echo "Expected failure 2"
-pamditherbw -dither8  -cluster3 ${test_red} || echo "Expected failure 3"
-pamditherbw -cluster3 -cluster4 ${test_red} || echo "Expected failure 4"
-pamditherbw -cluster3 -cluster8 ${test_red} || echo "Expected failure 5"
-pamditherbw -cluster4 -cluster8 ${test_red} || echo "Expected failure 6"
-pamditherbw -clump=8            ${test_red} || echo "Expected failure 7"
-pamditherbw -fs -clump=8        ${test_red} || echo "Expected failure 8"
-pamditherbw -hilbert -clump=1   ${test_red} || echo "Expected failure 9"
-pamditherbw -th -value=-1       ${test_red} || echo "Expected failure 10"
-pamditherbw -th -value=1.1      ${test_red} || echo "Expected failure 11"
-
-rm ${test_red}
\ No newline at end of file
+pamditherbw -fs -atkinson       ${test_red} > ${test_out} || \
+ echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pamditherbw -floyd -atkinson    ${test_red} > ${test_out} || \
+ echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pamditherbw -dither8  -cluster3 ${test_red} > ${test_out} || \
+ echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pamditherbw -cluster3 -cluster4 ${test_red} > ${test_out} || \
+ echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+pamditherbw -cluster3 -cluster8 ${test_red} > ${test_out} || \
+ echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+pamditherbw -cluster4 -cluster8 ${test_red} > ${test_out} || \
+ echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+pamditherbw -clump=8            ${test_red} > ${test_out} || \
+ echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+pamditherbw -fs -clump=8        ${test_red} > ${test_out} || \
+ echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+pamditherbw -hilbert -clump=1   ${test_red} > ${test_out} || \
+ echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+pamditherbw -th -value=-1       ${test_red} > ${test_out} || \
+ echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+pamditherbw -th -value=1.1      ${test_red} > ${test_out} || \
+ echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+
+rm ${test_red} ${test_out}
diff --git a/test/pamfile.ok b/test/pamfile.ok
index b1d68ae1..e222592c 100644
--- a/test/pamfile.ok
+++ b/test/pamfile.ok
@@ -13,7 +13,7 @@ Test 3
 227 149
 testimg.ppm: PPM RAW 227 149 3 255 RGB
 stdin: PBM RAW 14 16 1 1 BLACKANDWHITE
-Test 4
-Expected failure 1
-Expected failure 2
-Expected failure 3
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
diff --git a/test/pamfile.test b/test/pamfile.test
index 32771bfe..aa3e2895 100755
--- a/test/pamfile.test
+++ b/test/pamfile.test
@@ -20,13 +20,21 @@ pamfile -size testimg.ppm
 pamfile -machine testimg.ppm
 cat testgrid.pbm testimg.ppm testgrid.pbm | pamfile -machine
 
-echo "Test 4"
+echo "Test Invalid"
+
+tmpdir=${tmpdir:-/tmp}
+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
 
-pamfile -size -machine  testimg.ppm || echo "Expected failure 1"
-pamfile -count -machine testimg.ppm || echo "Expected failure 2"
-head -n1 testimg.ppm | pamfile || echo "Expected failure 3"
\ No newline at end of file
+pamfile -size -machine  testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pamfile -count -machine testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+head -n1 testimg.ppm | pamfile > ${test_out} || \
+  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pamfind.ok b/test/pamfind.ok
index 9ddddced..de53166e 100644
--- a/test/pamfind.ok
+++ b/test/pamfind.ok
@@ -257,5 +257,8 @@ Locations containing tuple (1)/1:
 Test 3
 okay
 okay
-Test 4
-expected error
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
diff --git a/test/pamfind.test b/test/pamfind.test
index e55f290c..3b4ffb81 100755
--- a/test/pamfind.test
+++ b/test/pamfind.test
@@ -7,19 +7,19 @@ sorted0_res=${tmpdir}/pamfind_sorted0.res
 sorted1_res=${tmpdir}/pamfind_sorted1.res
 
 # Test 1
-echo Test 1
+echo "Test 1"
 pamfind -color=grey17     testimg.ppm 
 pamfind -target=210,57,41 testimg.ppm
 pamfind -target=50,55,49 -machine testimg.ppm
 
 # Test 2
-echo Test 2
+echo "Test 2"
 pamfind -target=1 testgrid.pbm
 pamfind -target=0 -machine testgrid.pbm
 
 # Test 3
 # The two outputs should be disjoint
-echo Test 3
+echo "Test 3"
 pamfind -target=0 testgrid.pbm | sort > ${sorted0_res}
 pamfind -target=1 testgrid.pbm | sort > ${sorted1_res}
 comm -3 ${sorted0_res}  ${sorted1_res}  |
@@ -33,11 +33,23 @@ rm ${sorted0_res} ${sorted1_res}
 
 # Test 4
 
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
 echo 1>&2
 echo "Invalid command-line argument combination." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
-echo Test 4
-pamfind -color=black -target=1 testimg.ppm || \
-  echo expected error
+echo "Test Invalid"
+
+pamfind -color=black -target=1,1,1 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pamfind -target=0,0 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pamfind -target=0,0,0,0 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pamfind testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pamgauss.ok b/test/pamgauss.ok
index eaef2570..e31a2ee8 100644
--- a/test/pamgauss.ok
+++ b/test/pamgauss.ok
@@ -83,9 +83,9 @@ Test 1
 Test 2
 stdin:	PAM, 3 by 3 by 1 maxval 255
     Tuple type: GRAYSCALE
-Test 3.
-Expected error 1
-Expected error 2
-Expected error 3
-Expected error 4
-Expected error 5
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
+Expected failure 5 1
diff --git a/test/pamgauss.test b/test/pamgauss.test
index 392b5179..bb006ce9 100755
--- a/test/pamgauss.test
+++ b/test/pamgauss.test
@@ -17,15 +17,25 @@ echo "Test 2"
 pamgauss 3 3 -sigma=0.5 -tupletype="GRAYSCALE" | pamfile
 
 
-echo "Test 3."
+echo "Test Invalid"
 
 echo 1>&2
 echo "Invalid command-line argument combinations." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
-pamgauss 3 3               | echo "Expected error 1"
-pamgauss 3 3   -sigma=0    | echo "Expected error 2"
-pamgauss 3 3   -sigma=-1.5 | echo "Expected error 3"
-pamgauss 3     -sigma=0.5  | echo "Expected error 4"
-pamgauss 3 3 3 -sigma=0.5  | echo "Expected error 5"
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
+pamgauss 3 3               > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pamgauss 3 3   -sigma=0    > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pamgauss 3 3   -sigma=-1.5 > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pamgauss 3     -sigma=0.5  > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+pamgauss 3 3 3 -sigma=0.5  > ${test_out} || \
+   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pamscale-reportonly.ok b/test/pamscale-reportonly.ok
index 00152411..bf5cde99 100644
--- a/test/pamscale-reportonly.ok
+++ b/test/pamscale-reportonly.ok
@@ -1,3 +1,4 @@
+Test 1
 227 149 3.000000 3.000000 681 447
 227 149 5.000000 5.000000 1135 745
 227 149 2.682819 2.684564 609 400
@@ -10,9 +11,10 @@
 227 149 2.819383 2.000000 640 298
 227 149 1.400881 2.684564 318 400
 227 149 1.000000 1.000000 227 149
-expected error
-expected error
-expected error
-expected error
-expected error
-expected error
+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
diff --git a/test/pamscale-reportonly.test b/test/pamscale-reportonly.test
index 7205be2f..45a38687 100755
--- a/test/pamscale-reportonly.test
+++ b/test/pamscale-reportonly.test
@@ -2,6 +2,8 @@
 # This script tests: pamscale
 # Also requires:
 
+echo "Test 1"
+
 pamscale -reportonly 3 testimg.ppm
 pamscale -reportonly 5 testimg.ppm
 pamscale -reportonly -xysize 640 400 testimg.ppm
@@ -15,21 +17,35 @@ pamscale -reportonly -width=640 -yscale=2 testimg.ppm
 pamscale -reportonly -xscale=1.4 -height=400 testimg.ppm
 pamscale -reportonly -pixels=45000 testimg.ppm
 
-# expected error cases
+echo "Test Invalid"
+
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
+# Expected failure cases
+
 echo 1>&2
 echo "Invalid command-line argument combinations." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
-pamscale -reportonly -xsize=640 -ysize=400 -xscale=2 testimg.ppm || \
-  echo expected error
-pamscale -reportonly -xsize=640 -xscale=2 -yscale=3 testimg.ppm || \
-  echo expected error
-pamscale -reportonly -xsize=640 -ysize=400 -pixels=200000 testimg.ppm || \
-  echo expected error
-pamscale -reportonly -xsize=640 -ysize=400 -xysize 640 400 testimg.ppm || \
-  echo expected error
-pamscale -reportonly -xsize=640 -ysize=400 -xyfit  640 400 testimg.ppm || \
-  echo expected error
-pamscale -reportonly -xsize=640 -ysize=400 -xyfill 640 400 testimg.ppm || \
-  echo expected error
 
+pamscale -reportonly -xsize=640 -ysize=400 -xscale=2 testimg.ppm > \
+  ${test_out} \
+  || echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pamscale -reportonly -xsize=640 -xscale=2 -yscale=3 testimg.ppm > \
+  ${test_out} \
+  || echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pamscale -reportonly -xsize=640 -ysize=400 -pixels=200000 testimg.ppm \
+  > ${test_out} || \
+  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pamscale -reportonly -xsize=640 -ysize=400 -xysize 640 400 testimg.ppm \
+  > ${test_out} || \
+  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+pamscale -reportonly -xsize=640 -ysize=400 -xyfit  640 400 testimg.ppm \
+  > ${test_out} || \
+  echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+pamscale -reportonly -xsize=640 -ysize=400 -xyfill 640 400 testimg.ppm \
+  > ${test_out} || \
+  echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pamseq.ok b/test/pamseq.ok
index b0455449..654596fb 100644
--- a/test/pamseq.ok
+++ b/test/pamseq.ok
@@ -1,7 +1,7 @@
 Test 1
 3929266994 304
-Test 2
-Expected error 1
-Expected error 2
-Expected error 3
-Expected error 4
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
diff --git a/test/pamseq.test b/test/pamseq.test
index ea19013b..0681d396 100755
--- a/test/pamseq.test
+++ b/test/pamseq.test
@@ -6,20 +6,29 @@ echo "Test 1"
 
 pamseq 1 255 | cksum
 
-echo "Test 2"
+echo "Test Invalid"
 
 echo 1>&2
 echo "Invalid command-line argument combinations." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
-pamseq 1 || echo "Expected error 1"
-pamseq 0 255 || echo "Expected error 2"
-pamseq 3 0   || echo "Expected error 3"
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
+pamseq 1 > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pamseq 0 255 > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pamseq 3 0   > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
 
 c64="0123456789012345678901234567890123456789012345678901234567890123"
 c256=${c64}${c64}${c64}${c64}
 
 # Tupletype string length=256
 
-pamseq -tupletype="${c256}" 3 15 || echo "Expected error 4"
+pamseq -tupletype="${c256}" 3 15 > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pamsumm.ok b/test/pamsumm.ok
index 61125b7a..63b5f6bd 100644
--- a/test/pamsumm.ok
+++ b/test/pamsumm.ok
@@ -8,8 +8,8 @@ Test 2
 15
 255
 106.164760
-Test 3
-Expected failure 1
-Expected failure 2
-Expected failure 3
-Expected failure 4
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
diff --git a/test/pamsumm.test b/test/pamsumm.test
index 882b1b14..5b4fdb17 100755
--- a/test/pamsumm.test
+++ b/test/pamsumm.test
@@ -17,14 +17,23 @@ for type in -sum -min -max -mean
   done
 
 
-echo "Test 3"
+echo "Test Invalid"
+
+tmpdir=${tmpdir:-/tmp}
+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
 
-pamsumm -sum -min  testimg.ppm || echo "Expected failure 1"
-pamsumm -sum -max  testimg.ppm || echo "Expected failure 2"
-pamsumm -mean -max testimg.ppm || echo "Expected failure 3"
-pamsumm            testimg.ppm || echo "Expected failure 4"
+pamsumm -sum -min  testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pamsumm -sum -max  testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pamsumm -mean -max testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pamsumm            testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pbmmake.ok b/test/pbmmake.ok
index 354106f0..e39f4cf8 100644
--- a/test/pbmmake.ok
+++ b/test/pbmmake.ok
@@ -1,36 +1,29 @@
-Test 1.
+Test 1
 P11 10
 P11 11
 P11 10
-Test 2.
 P12 20000
 P12 21111
 P12 20110
-Test 2.
 P13 3000000000
 P13 3111111111
 P13 3010101010
-Test 2.
 P14 40000000000000000
 P14 41111111111111111
 P14 40101101001011010
-Test 2.
 P15 50000000000000000000000000
 P15 51111111111111111111111111
 P15 50101010101010101010101010
-Test 2.
 P16 6000000000000000000000000000000000000
 P16 6111111111111111111111111111111111111
 P16 6010101101010010101101010010101101010
-Test 2.
 P17 70000000000000000000000000000000000000000000000000
 P17 71111111111111111111111111111111111111111111111111
 P17 70101010101010101010101010101010101010101010101010
-Test 2.
 P18 80000000000000000000000000000000000000000000000000000000000000000
 P18 81111111111111111111111111111111111111111111111111111111111111111
 P18 80101010110101010010101011010101001010101101010100101010110101010
-Test 2.
+Test 2
 4058563256 45
 3969089344 105
 702117756 189
@@ -50,15 +43,12 @@ Test 2.
 1824232358 2931
 3651864954 3375
 3302595397 3849
-Test 3.
-Expected error 1
-Expected error 2
-Expected error 3
-Expected error 4
-Expected error 5
-Expected error 6
-Expected error 7
-Expected error 8
-P1
-1 1
-0
+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
diff --git a/test/pbmmake.test b/test/pbmmake.test
index eb4be6ea..3f815617 100755
--- a/test/pbmmake.test
+++ b/test/pbmmake.test
@@ -2,7 +2,7 @@
 # This script tests: pbmmake
 # Also requires:
 
-echo "Test 1."
+echo "Test 1"
 
 for i in `seq 1 8`
 do
@@ -10,10 +10,10 @@ for color in -white -black -gray
 do
 pbmmake -plain $color $i $i | tr -d '\n'; echo
 done
+done
 
-echo "Test 2."
+echo "Test 2"
 
-done
 for i in `seq 8 5 98`
 do
  ( pbmmake -w $i $i ;
@@ -21,19 +21,31 @@ do
   pbmmake  -g $i $i ) | cksum
 done
 
-echo "Test 3."
+echo "Test Invalid"
 
 echo 1>&2
 echo "Invalid command-line argument combinations." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
-pbmmake -b -w -plain 1 1 || echo "Expected error 1"
-pbmmake -b -g -plain 1 1 || echo "Expected error 2"
-pbmmake -white -gray -plain 1 1 || echo "Expected error 3"
-pbmmake -white -plain   || echo "Expected error 4"
-pbmmake -white -plain 1 || echo "Expected error 5"
-pbmmake -white -plain 1 0 || echo "Expected error 6"
-pbmmake -white -plain 0 1 || echo "Expected error 7"
-pbmmake -white -plain 1 1 1 || echo "Expected error 8"
-pbmmake -plain 1 1 ||  echo "Expected error 9"
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
+pbmmake -b -w -plain 1 1 > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pbmmake -b -g -plain 1 1 > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pbmmake -white -gray -plain 1 1 > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pbmmake -white -plain   > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+pbmmake -white -plain 1 > ${test_out} || \
+   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+pbmmake -white -plain 1 0 > ${test_out} || \
+   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+pbmmake -white -plain 0 1 > ${test_out} || \
+   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+pbmmake -white -plain 1 1 1 > ${test_out} || \
+   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pbmpage.ok b/test/pbmpage.ok
index b41d7cf3..8013f2f2 100644
--- a/test/pbmpage.ok
+++ b/test/pbmpage.ok
@@ -3,7 +3,7 @@ Test 1
 4142746975 4210813
 2347597649 4210813
 3453559794 4349933
-Test 2
-Expected error 1
-Expected error 2
-Expected error 3
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
diff --git a/test/pbmpage.test b/test/pbmpage.test
index 7cabcc7f..50570e3e 100755
--- a/test/pbmpage.test
+++ b/test/pbmpage.test
@@ -9,13 +9,21 @@ pbmpage 2     | cksum
 pbmpage 3     | cksum
 pbmpage -a4 2 | cksum
 
-echo "Test 2"
+echo "Test Invalid"
 
 echo 1>&2
 echo "Invalid command-line argument combinations." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
-pbmpage -a3 1 || echo "Expected error 1"
-pbmpage 0 || echo "Expected error 2"
-pbmpage 4 || echo "Expected error 3"
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
+pbmpage -a3 1 > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pbmpage 0 > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pbmpage 4 > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pbmtext-bdf.ok b/test/pbmtext-bdf.ok
index b1486493..eab8a4bd 100644
--- a/test/pbmtext-bdf.ok
+++ b/test/pbmtext-bdf.ok
@@ -1,4 +1,6 @@
+Test 1
 386826492 35
+Test 2
 1
 1
 1
@@ -17,5 +19,6 @@
 1
 1
 1
+Test 3
 0
 0
diff --git a/test/pbmtext-bdf.test b/test/pbmtext-bdf.test
index 50df7b75..b12c10bf 100755
--- a/test/pbmtext-bdf.test
+++ b/test/pbmtext-bdf.test
@@ -65,8 +65,10 @@ EOF
 
 # Test 1
 # This should succeed and produce 386826492 35
-pbmtext -font ${font_bdf} ABC | cksum
 
+echo "Test 1"
+
+pbmtext -font ${font_bdf} ABC | cksum
 
 # Test 2
 # These should all fail.  Writes 1 eightteen times.
@@ -75,6 +77,8 @@ echo "Test whether corrupted BDF font files are properly handled." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
+echo "Test 2"
+
 pbmtext -font ${font_bdf} BCD
 echo $?
 
@@ -154,10 +158,12 @@ for delete_line in 14 16 18 20
   done
 
 
-# Test 2
+# Test 3
 # These should succeed.  Warning messages will be displayed.
 # Writes 1 two times.
 
+echo "Test 3"
+
 for token in "CHARSET_ENCODING" "CHARSET_REGISTRY"
 do
   font_corrupt_bdf=${font_corrupt}.naked_${token}.bdf
diff --git a/test/pbmtext-iso88591.ok b/test/pbmtext-iso88591.ok
index 6cc1a856..b48fb277 100644
--- a/test/pbmtext-iso88591.ok
+++ b/test/pbmtext-iso88591.ok
@@ -1,4 +1,6 @@
+Test 1
 3806607098 5110
 3806607098 5110
+Test 2
 2858870527 192
 2858870527 192
diff --git a/test/pbmtext-iso88591.test b/test/pbmtext-iso88591.test
index bc5e83ab..96b286ac 100755
--- a/test/pbmtext-iso88591.test
+++ b/test/pbmtext-iso88591.test
@@ -2,45 +2,76 @@
 # This script tests: pbmtext
 # Also requires:
 
-# This test requires the following locale:
-#   LC_ALL en_US.iso88591
-# Skip this test if it is not available
+# This test requires the iconv command and an iso-8859-1 locale
+# Skip this test if they are not available
+
+LANG=C
+LC_ALL=C
+export LANG LC_ALL
 
 iconv /dev/null
 if [ $? -ne 0  ]
   then echo "iconv command not available." 1>&2
        echo "Skipping." 1>&2
-  exit 80;
+       exit 80;
 fi
 
-echo "A" | LC_ALL=en_US.iso88591 pbmtext -wchar > /dev/null
-if [ $? -ne 0  ]
-  then echo "LC_ALL could not be set to en_US.iso88591" 1>&2
+tmpdir=${tmpdir:-/tmp}
+iso88591_locale_list=${tmpdir}/iso88591_locale_list
+
+
+locale_to_test="en_US.iso88591"  # Initial value
+# Edit the above value if necessary
+  
+# Make a list of available locales which end in "iso88591"
+locale -a | grep "\.iso88591$" > ${iso88591_locale_list}
+
+# Hunt for a valid iso-8859-1 locale  
+# Submit each candidate to a trial pbmtext run until one that works is
+# encountered
+
+i=0
+until [ -z ${locale_to_test} ] || \
+  echo "A" | LC_ALL=${locale_to_test} pbmtext -wchar > /dev/null
+  do
+    let i=$(($i+1));
+    locale_to_test=`sed "$i"p -n  ${iso88591_locale_list}`;
+  done;
+
+rm ${iso88591_locale_list};
+if [ -z  ${locale_to_test} ]
+  then echo "No iso-8859-1 locale available." 1>&2
        echo "Skipping." 1>&2
-  exit 80;
-fi
+       exit 80;
+else
+       echo "Testing with locale set to ${locale_to_test}" 1>&2
+fi;
+
+locale_for_test=${locale_to_test};
+
 
 # Two rows
 # Should print 3806607098 5110 twice
-LC_ALL=C \
+
+echo "Test 1"
+
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
              for (i=160;i<=255;++i) printf("%c",i); }' | \
     pbmtext -builtin bdf | cksum
 
-
-LC_ALL=C \
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
              for (i=160;i<=255;++i) printf("%c",i); }' | \
-    LC_ALL=en_US.iso88591 pbmtext -builtin bdf -wchar | cksum
+    LC_ALL=${locale_for_test} pbmtext -builtin bdf -wchar | cksum
 
 
 # Two rows
 # Should print 2858870527 192 twice
-LC_ALL=C \
+
+echo "Test 2"
+
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
              for (i=161;i<=255;++i) printf("%c",i); print "" }' | cksum
 
-LC_ALL=C \
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
              for (i=161;i<=255;++i) printf("%c",i); print ""}' | \
-    LC_ALL=en_US.iso88591 pbmtext -builtin bdf -wchar -text-dump | cksum
\ No newline at end of file
+    LC_ALL=${locale_for_test} pbmtext -builtin bdf -wchar -text-dump | cksum
diff --git a/test/pbmtext-utf8.ok b/test/pbmtext-utf8.ok
index 588bf617..4bc7b00d 100644
--- a/test/pbmtext-utf8.ok
+++ b/test/pbmtext-utf8.ok
@@ -1,8 +1,24 @@
+Test 1
 2066913605 5110
 2066913605 5110
+Test 2
 2920616515 2301
 2920616515 2301
+Test 3
 0 0 0 0 : 0
+Test 4
  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
-0 1 : 1
+Test 5 Invalid
+9998
+989454365 52512
+9999
+Expected failure 1 1
+Expected failure 2 1
+Test 6 Invalid
+6-1: 0 1 : 1 1
+6-2: 0 1 : 1 1
+6-3: 0 1 : 1 1
+6-4: 0 1 : 1 1
+6-5: 0 1 : 1 1
+6-6: 0 1 : 1 1
diff --git a/test/pbmtext-utf8.test b/test/pbmtext-utf8.test
index cf495b7c..c92dd38a 100755
--- a/test/pbmtext-utf8.test
+++ b/test/pbmtext-utf8.test
@@ -2,68 +2,100 @@
 # This script tests: pbmtext
 # Also requires:
 
-# This test requires the en_US.utf8 locale
-# Skip this test if it is not available
+LANG=C
+LC_ALL=C
+export LANG LC_ALL
+
+
+# This test requires the iconv command and a working UTF-8 locale 
+# Skip this test if they are not available
 
 iconv /dev/null
 if [ $? -ne 0  ]
   then echo "iconv command not available." 1>&2
        echo "Skipping." 1>&2
-  exit 80;
+       exit 80;
 fi
 
-echo "A" | LC_ALL=en_US.utf8 pbmtext -wchar > /dev/null
-if [ $? -ne 0  ]
-  then echo "LC_ALL could not be set to en_US.utf8." 1>&2
+tmpdir=${tmpdir:-/tmp}
+utf_locale_list=${tmpdir}/utf_locale_list
+
+locale_to_test="en_US.utf8"  # Initial value
+# Edit the above value if necessary
+  
+# Make a list of available locales which end in "utf8"
+locale -a | grep "\.utf8$" > ${utf_locale_list}
+
+# Hunt for a valid utf8 locale  
+# Submit each candidate to a trial pbmtext run until one that works is
+# encountered
+
+i=0
+until [ -z ${locale_to_test} ] || \
+  echo "A" | LC_ALL=${locale_to_test} pbmtext -wchar > /dev/null
+    do
+      let i=$(($i+1));
+      locale_to_test=`sed "$i"p -n  ${utf_locale_list}`;
+    done;
+
+rm ${utf_locale_list};
+if [ -z  ${locale_to_test} ]
+  then echo "No utf-8 locale available." 1>&2
        echo "Skipping." 1>&2
-  exit 80;
-fi
+       exit 80;
+  else
+       echo "Testing with locale set to ${locale_to_test}" 1>&2
+fi;
+
+locale_for_test=${locale_to_test}
+
 
 # Test 1.
 # Two rows
 # Should print 2066913605 5110 twice
-LC_ALL=C \
+
+echo "Test 1"
+
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
              for (i=161;i<=255;++i) printf("%c",i); }' | \
     pbmtext -builtin bdf | cksum
 
-LC_ALL=C \
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
              for (i=161;i<=255;++i) printf("%c",i);  }' | \
     iconv -f iso8859-1 -t utf-8 | \
-    LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar | cksum
+    LC_ALL=${locale_for_test} pbmtext -builtin bdf -wchar | cksum
 
 
 # Test 2.
 # One row
 # Should print 2920616515 2301 twice
-LC_ALL=C \
+
+echo "Test 2"
+
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print "" }' | \
     pbmtext -builtin bdf | cksum
 
-LC_ALL=C \
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i);  print ""}' | \
-    LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar | cksum
+    LC_ALL=${locale_for_test} pbmtext -builtin bdf -wchar | cksum
 
-
-tmpdir=${tmpdir:-/tmp}
 output=${tmpdir}/output
 
 
 # Test 3.
 # Two rows
-# Output may be affected by locale.  Compare with cmp.
+# Compare with cmp.
 # Should print 0
-LC_ALL=C \
+
+echo "Test 3"
+
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
              for (i=161;i<=255;++i) printf("%c",i); print "" }' | \
     iconv -f iso8859-1 -t utf-8 > ${output}
 
-LC_ALL=C \
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \
              for (i=161;i<=255;++i) printf("%c",i); print "" }' | \
     iconv -f iso8859-1 -t utf-8 | \
-    LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar -text-dump | \
+    LC_ALL=${locale_for_test} pbmtext -builtin bdf -wchar -text-dump | \
     cmp --quiet - ${output}
 
 echo ${PIPESTATUS[@]} ":" $?
@@ -71,25 +103,101 @@ rm ${output}
 
 
 # Test 4.
-# One row
+# One row  ASCII 7-bit range
 # Should print the following twice:
 # !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
-LC_ALL=C \
+
+echo "Test 4"
+
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print "" } '
 
-LC_ALL=C \
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""}' | \
-        LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar -text-dump
+        LC_ALL=${locale_for_test} pbmtext -builtin bdf -wchar -text-dump
+
+# Test 5.
+# Long input text
+
 
+echo "Test 5 Invalid"
 
-echo "Invalid utf-8 sequence as input." 1>&2
-echo "An error message should appear below the line." 1>&2
+long_txt=${tmpdir}/long.txt
+test_out=${tmpdir}/test_out
+
+head -c 4999 /dev/zero | tr '\0' '\276' | \
+  iconv -f iso-8859-1 -t utf-8 > ${long_txt}
+cat ${long_txt} | wc -c
+
+cat ${long_txt} | \
+  LC_ALL=${locale_for_test} pbmtext -nomargins -builtin fixed -wchar | cksum
+
+echo 1>&2
+echo "Test input text which exceeds length limit" 1>&2
+echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
-# Test 5.
-# Invalid utf-8 sequence
-# Should print 1
-LC_ALL=C \
-awk 'BEGIN { for (i=128; i<=129;++i) printf("%c",i);  print ""}' | \
-        LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar -text-dump
-echo ${PIPESTATUS[@]} ":" $?
+echo -n "z" >> ${long_txt}
+cat ${long_txt} | wc -c
+
+cat ${long_txt} | \
+  LC_ALL=${locale_for_test} \
+  pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \
+  echo -n "Expected failure 1";
+  test -s ${test_out}; echo " "$? 
+cat ${long_txt} | \
+  LC_ALL=${locale_for_test} \
+  pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \
+  echo -n "Expected failure 2";
+  test -s ${test_out}; echo " "$?  
+
+rm ${long_txt}
+
+
+# Test 6.
+# Invalid utf-8 sequences
+# For each case output should be:
+# 6-x : 0 1 : 1 1
+
+echo "Invalid utf-8 sequences as input." 1>&2
+echo "Errors message should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
+
+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[@]} ":" $?
+  test -s ${test_out}; echo " "$?  
+  
+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[@]} ":" $?
+  test -s ${test_out}; echo " "$?  
+
+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[@]} ":" $?
+  test -s ${test_out}; echo " "$?  
+  
+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[@]} ":" $?
+  test -s ${test_out}; echo " "$?  
+
+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[@]} ":" $?
+  test -s ${test_out}; echo " "$?  
+
+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[@]} ":" $?
+  test -s ${test_out}; echo " "$? 
+  
+rm ${test_out}
+  
diff --git a/test/pbmtext.ok b/test/pbmtext.ok
index 96e351f9..68ed40d8 100644
--- a/test/pbmtext.ok
+++ b/test/pbmtext.ok
@@ -1,16 +1,39 @@
+Test 1
 3898818212 967
 3898818212 967
 2506052117 1354
 2506052117 1354
+Test 2
 1028079028 967
 1888680721 445
 1305436978 1018
+Test 3
 1028079028 967
 1028079028 967
 1305436978 1018
 1305436978 1018
+Test 4
 1647614653 2027
 1647614653 2027
 1647614653 2027
+Test 5
 2547645687 4564
 1174281741 5741
+Test 6 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
+Test 7
+text length: 4999
+1854691667 52512
+1854691667 52512
+Test 8 Invalid
+text length: 5000
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
diff --git a/test/pbmtext.test b/test/pbmtext.test
index 38578636..fdecf453 100755
--- a/test/pbmtext.test
+++ b/test/pbmtext.test
@@ -5,6 +5,7 @@
 tmpdir=${tmpdir:-/tmp}
 
 # Test 1:
+echo "Test 1"
 
 # Should print 3898818212 967 twice
 
@@ -22,6 +23,7 @@ echo -n "For truth is always strange. Stranger than fiction. Lord Byron" | \
 text="The quick brown fog jumps over the lazy docs."
 
 # Test 2:
+echo "Test 2"
 
 for flags in "" "-nomargins" "-builtin fixed"
 do
@@ -33,6 +35,7 @@ temp_pbm=${tmpdir}/temp.pbm
 
 # Test 3: Check if image is produced unaltered when -width is specified
 # Should print 1028079028 967 twice, then 1305436978 1018 twice
+echo "Test 3"
 
 for flags in "" "-builtin fixed"
 do
@@ -71,13 +74,16 @@ _ PQRSTUVWXYZ[ _
 M ",/^_[\`jpqy| M
 EOF
 
+echo "Test 4"
+
 pbmtext -dump-sheet -builtin fixed | tee ${font_pbm}      | cksum
 cat ${fontRectangle_txt} | pbmtext -nom -builtin fixed    | cksum
 cat ${fontRectangle_txt} | pbmtext -nom -font ${font_pbm} | cksum
-rm ${fontRectangle_txt} ${font_pbm}
+rm ${fontRectangle_txt}
 
 
 # Test 5: Print all characters defined in the built-in bdf font
+echo "Test 5"
 
 # One long row
 # Should print 3233136020 4535
@@ -92,3 +98,78 @@ LC_ALL=C \
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c\n",i);
              for (i=160;i<=255;++i) printf("%c\n",i); }' | \
     pbmtext -nomargins -builtin bdf | cksum
+
+
+# Test 6
+
+echo 1>&2
+echo "Invalid font file specifications & command-line argument combinations." 1>&2
+echo "Error messages should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
+
+echo "Test 6 Invalid"
+
+test_out=${tmpdir}/test_out
+
+pbmtext -font=testgrid.pbm foo > ${test_out} || \
+  echo -n "Expected failure 1";
+  test -s ${test_out}; echo " "$?
+pbmtext -font=testimg.ppm  foo > ${test_out} || \
+  echo -n "Expected failure 2";
+  test -s ${test_out}; echo " "$?
+pbmtext -builtin=void      foo > ${test_out} || \
+  echo -n "Expected failure 3";  
+  test -s ${test_out}; echo " "$?
+pbmtext -font=${font_pbm} -builtin=fixed foo > ${test_out}  || \
+  echo -n "Expected failure 4";
+  test -s ${test_out}; echo " "$?  
+pbmtext -dry-run    -text-dump  foo > ${test_out} || \
+  echo -n "Expected failure 5";
+  test -s ${test_out}; echo " "$?
+pbmtext -dump-sheet -text-dump  foo > ${test_out} || \
+  echo -n "Expected failure 6";
+  test -s ${test_out}; echo " "$?
+pbmtext -dry-run    -dump-sheet foo > ${test_out} || \
+  echo -n "Expected failure 7";
+  test -s ${test_out}; echo " "$?
+pbmtext -wchar foo > ${test_out} || \
+  echo -n "Expected failure 8";
+  test -s ${test_out}; echo " "$?
+
+rm ${font_pbm}
+
+# Test 7
+# Text to render in very long single line
+
+echo "Test 7"
+
+long_txt=${tmpdir}/long.txt
+
+head -c 4999 /dev/zero | tr '\0' 'A' > ${long_txt}
+awk '{print "text length:", length($0)}' ${long_txt}
+
+pbmtext -nomargins -builtin fixed `cat ${long_txt}`  | cksum
+cat ${long_txt} | pbmtext -nomargins -builtin fixed  | cksum
+
+echo "Test 8 Invalid"
+
+echo -n "z" >> ${long_txt}
+awk '{print "text length:", length($0)}' ${long_txt}
+
+echo 1>&2
+echo "Test input text which exceeds length limit" 1>&2
+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";
+  test -s ${test_out}; echo " "$?
+cat ${long_txt} | pbmtext -nomargins -builtin fixed > ${test_out}  || \
+  echo -n "Expected failure 2";
+  test -s ${test_out}; echo " "$?
+cat ${long_txt} | \
+  LC_ALL=C pbmtext -nomargins -builtin fixed -wchar > ${test_out}  || \
+  echo -n "Expected failure 3";
+  test -s ${test_out}; echo " "$?
+
+rm ${long_txt} ${test_out}
diff --git a/test/pbmupc.ok b/test/pbmupc.ok
index c5753609..f1b91e99 100644
--- a/test/pbmupc.ok
+++ b/test/pbmupc.ok
@@ -1,12 +1,12 @@
 Test 1
 2619309127 10172
-Test 2
-Exptected error 1
-Exptected error 2
-Exptected error 3
-Exptected error 4
-Exptected error 5
-Exptected error 6
-Exptected error 7
-Exptected error 8
-Exptected error 9
+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/pbmupc.test b/test/pbmupc.test
index aee380b0..fb9ec90e 100755
--- a/test/pbmupc.test
+++ b/test/pbmupc.test
@@ -9,19 +9,33 @@ do
 pbmupc $type 0 72890 00011
 done | cksum
 
-echo "Test 2"
+echo "Test Invalid"
+
+tmpdir=${tmpdir:-/tmp}
+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
 
-pbmupc -s3 0 72890 00011     || echo "Exptected error 1"
-pbmupc -s1   72890 00011     || echo "Exptected error 2"
-pbmupc -s1 0 72890           || echo "Exptected error 3"
-pbmupc -s1 10 72890 00011    || echo "Exptected error 4"
-pbmupc -s1 0 172890 00011    || echo "Exptected error 5"
-pbmupc -s1 0   2890 00011    || echo "Exptected error 6"
-pbmupc -s1 0 72890 100011    || echo "Exptected error 7"
-pbmupc -s1 0 72890   0011    || echo "Exptected error 8"
-pbmupc -s1 0 72890 100011 1  || echo "Exptected error 9"
+pbmupc -s3 0 72890 00011     > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pbmupc -s1   72890 00011     > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pbmupc -s1 0 72890           > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pbmupc -s1 10 72890 00011    > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+pbmupc -s1 0 172890 00011    > ${test_out} || \
+   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+pbmupc -s1 0   2890 00011    > ${test_out} || \
+   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+pbmupc -s1 0 72890 100011    > ${test_out} || \
+   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+pbmupc -s1 0 72890   0011    > ${test_out} || \
+   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+pbmupc -s1 0 72890 100011 1  > ${test_out} || \
+   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pgmhist.ok b/test/pgmhist.ok
index 6d9dfbe5..3be73ff9 100644
--- a/test/pgmhist.ok
+++ b/test/pgmhist.ok
@@ -29,8 +29,8 @@ Test 2
 204
 230
 255
-Test 3
-Expected failure 1
-Expected failure 2
-Expected failure 3
-Expected failure 4
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
diff --git a/test/pgmhist.test b/test/pgmhist.test
index c566c5cb..3be74898 100755
--- a/test/pgmhist.test
+++ b/test/pgmhist.test
@@ -24,14 +24,23 @@ pgmramp -lr 256 1 | pgmhist -machine -quartile | \
 pgmramp -lr 256 1 | pgmhist -machine -decile   | \
   sed -e 's/  */ /g' -e 's/ *$//'
 
-echo "Test 3"
+echo "Test Invalid"
+
+tmpdir=${tmpdir:-/tmp}
+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
 
-pgmhist -median   -quartile testgrid.pbm || echo "Expected failure 1"
-pgmhist -median   -decile   testgrid.pbm || echo "Expected failure 2"
-pgmhist -quartile -decile   testgrid.pbm || echo "Expected failure 3"
-pgmhist testimg.ppm || echo "Expected failure 4"
+pgmhist -median   -quartile testgrid.pbm > ${test_out} || \ 
+  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pgmhist -median   -decile   testgrid.pbm > ${test_out} || \
+  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pgmhist -quartile -decile   testgrid.pbm > ${test_out} || \
+  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pgmhist testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pgmmake.ok b/test/pgmmake.ok
index 9a88b9a6..8b242822 100644
--- a/test/pgmmake.ok
+++ b/test/pgmmake.ok
@@ -1,12 +1,12 @@
-Test 1.
+Test 1
 3662611538 2513
 3109612402 5012
-Test 2.
-Expected error 1
-Expected error 2
-Expected error 3
-Expected error 4
-Expected error 5
-Expected error 6
-Expected error 7
-Expected error 8
+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
diff --git a/test/pgmmake.test b/test/pgmmake.test
index 3823e36f..2fc63e72 100755
--- a/test/pgmmake.test
+++ b/test/pgmmake.test
@@ -2,25 +2,37 @@
 # This script tests: pgmmake
 # Also requires:
 
-echo "Test 1."
+echo "Test 1"
 
 pgmmake 1 50 50 | cksum
 pgmmake .2 50 100 -maxval=5 | cksum
 
 
-echo "Test 2."
+echo "Test Invalid"
 
 echo 1>&2
 echo "Invalid command-line argument combinations." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
-pgmmake 100  5 5 || echo "Expected error 1"
-pgmmake 1.01 5 5 || echo "Expected error 2"
-pgmmake .5   5   || echo "Expected error 3"
-pgmmake .5       || echo "Expected error 4"
-pgmmake -maxval=5        5 5 || echo "Expected error 5"
-pgmmake -maxval=0     .5 5 5 || echo "Expected error 6"
-pgmmake -maxval=-1    .5 5 5 || echo "Expected error 7"
-pgmmake -maxval=65536 .5 5 5 || echo "Expected error 8"
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
 
+pgmmake 100  5 5 > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pgmmake 1.01 5 5 > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pgmmake .5   5   > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pgmmake .5       > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+pgmmake -maxval=5        5 5 > ${test_out} || \
+   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+pgmmake -maxval=0     .5 5 5 > ${test_out} || \
+   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+pgmmake -maxval=-1    .5 5 5 > ${test_out} || \
+   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+pgmmake -maxval=65536 .5 5 5 > ${test_out} || \
+   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pgmramp.ok b/test/pgmramp.ok
index 309f5773..de0d9206 100644
--- a/test/pgmramp.ok
+++ b/test/pgmramp.ok
@@ -41,9 +41,9 @@ Test 2
 807973067 65551
 Test 3
 886972785 131087
-Test 4
-Expected error: -lr -tb
-Expected error: -lr -rectangle
-Expected error: -rectangle -ellipse
-Expected error: insufficient parameters
-Expected error: excessive parameters
+Test Invalid
+Expected failure: -lr -tb 1
+Expected failure: -lr -rectangle 1
+Expected failure: -rectangle -ellipse 1
+Expected failure: insufficient parameters 1
+Expected failure: excessive parameters 1
diff --git a/test/pgmramp.test b/test/pgmramp.test
index bd63e10d..3ec73749 100755
--- a/test/pgmramp.test
+++ b/test/pgmramp.test
@@ -19,16 +19,26 @@ echo "Test 3"
 
 pgmramp -diagonal -maxval=510 256 256 | cksum
 
-echo "Test 4"
+echo "Test Invalid"
 
 echo 1>&2
 echo "Invalid command-line argument combinations." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
 for combination in "-lr -tb" "-lr -rectangle" "-rectangle -ellipse"
-do pgmramp $combination 10 10 || echo "Expected error: $combination"
+do pgmramp $combination 10 10 > ${test_out} || \
+   echo -n "Expected failure: $combination" ; test -s ${test_out}; echo " "$?
 done
 
-pgmramp -lr     1 || echo "Expected error: insufficient parameters"
-pgmramp -tb 1 1 1 || echo "Expected error: excessive parameters"
+pgmramp -lr     1 > ${test_out} || \
+  echo -n "Expected failure: insufficient parameters"; \
+  test -s ${test_out}; echo " "$?
+pgmramp -tb 1 1 1 > ${test_out} || \
+  echo -n "Expected failure: excessive parameters"; \
+  test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pnmcolormap.ok b/test/pnmcolormap.ok
new file mode 100644
index 00000000..126dfea4
--- /dev/null
+++ b/test/pnmcolormap.ok
@@ -0,0 +1,16 @@
+P1
+2 1
+10
+P1
+2 1
+10
+P1
+2 1
+10
+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
diff --git a/test/pnmcolormap.test b/test/pnmcolormap.test
new file mode 100755
index 00000000..13be8a44
--- /dev/null
+++ b/test/pnmcolormap.test
@@ -0,0 +1,33 @@
+#! /bin/bash
+# This script tests: pnmcolormap
+# Also requires:
+
+pnmcolormap -plain -sort 2 testgrid.pbm
+pnmcolormap -plain -sort -square 2 testgrid.pbm 
+pnmcolormap -plain -sort all testgrid.pbm
+
+echo 1>&2
+echo "Invalid command-line arguments." 1>&2
+echo "Error messages should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
+
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
+pnmcolormap 0 testimg.ppm   > ${test_out} || \
+  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pnmcolormap -1 testimg.ppm  > ${test_out} || \
+  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pnmcolormap 0.1 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pnmcolormap -center -meancolor 16 testimg.ppm    > ${test_out} || \
+  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+pnmcolormap -center -meanpixel 16 testimg.ppm    > ${test_out} || \
+  echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+pnmcolormap -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+pnmcolormap -spreadbrightness -spreadluminosity 16 \
+  testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pnmcrop1.ok b/test/pnmcrop1.ok
index 25bc52ce..d02d14b3 100644
--- a/test/pnmcrop1.ok
+++ b/test/pnmcrop1.ok
@@ -78,26 +78,26 @@ test.ppm
 -top
 1435955776 120765
 1435955776 120765
-Test 3
+Test Invalid
 -reportfull -reportsize
-expected failure
+Expected failure:  -reportfull -reportsize 1
 -reportfull -borderfile=testgrid.pbm
-expected failure
+Expected failure:  -reportfull -borderfile=testgrid.pbm 1
 -reportsize -borderfile=testgrid.pbm
-expected failure
+Expected failure:  -reportsize -borderfile=testgrid.pbm 1
 -black -white
-expected failure
+Expected failure:  -black -white 1
 -black -sides
-expected failure
+Expected failure:  -black -sides 1
 -white -bg-color=red
-expected failure
+Expected failure:  -white -bg-color=red 1
 -white -bg-corner=topleft
-expected failure
+Expected failure:  -white -bg-corner=topleft 1
 -white -bg-corner=top
-expected failure
+Expected failure:  -white -bg-corner=top 1
 -blank-image=pasturize
-expected failure
+Expected failure:  -blank-image=pasturize 1
 -bg-color=black -closeness=-1
-expected failure
+Expected failure:  -bg-color=black -closeness=-1 1
 -bg-color=black -closeness=101
-expected failure
+Expected failure:  -bg-color=black -closeness=101 1
diff --git a/test/pnmcrop1.test b/test/pnmcrop1.test
index 6b37da23..34c7534a 100755
--- a/test/pnmcrop1.test
+++ b/test/pnmcrop1.test
@@ -51,13 +51,15 @@ for input_file in ${test_pbm} ${test_ppm}
 rm ${test_pbm} ${test_ppm}
 
 # Test 3
+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 Test 3
 for option in "-reportfull -reportsize" \
               "-reportfull -borderfile=testgrid.pbm" \
               "-reportsize -borderfile=testgrid.pbm" \
@@ -71,5 +73,7 @@ for option in "-reportfull -reportsize" \
               "-bg-color=black -closeness=101"
     do
     echo ${option}
-    pnmcrop -reportfull ${option} testgrid.pbm || echo expected failure
+    pnmcrop -reportfull ${option} testgrid.pbm > ${test_out} || \
+        echo -n "Expected failure: " ${option}; test -s ${test_out}; echo " "$?
+        rm ${test_out} 
     done
diff --git a/test/pnmpsnr.ok b/test/pnmpsnr.ok
index e8b5ebc2..7042f86c 100644
--- a/test/pnmpsnr.ok
+++ b/test/pnmpsnr.ok
@@ -7,8 +7,8 @@ Test 2
 300.00 300.00 300.00
 match
 match
-Test 3
-Expected failure 1
-Expected failure 2
-Expected failure 3
-Expected failure 4
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test
index c6520002..7603459b 100755
--- a/test/pnmpsnr.test
+++ b/test/pnmpsnr.test
@@ -25,16 +25,23 @@ pnmpsnr  testimg.ppm  testimg.ppm -target=1000
 pnmpsnr  testimg.ppm  testimg.ppm -target1=1000 -target2=1000 -target3=1000
 
 
-echo "Test 3"
+echo "Test Invalid"
+
+tmpdir=${tmpdir:-/tmp}
+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
 
-pnmpsnr ${b_pbm} ${w_pbm} ${b_pbm}     || echo "Expected failure 1"
-pnmpsnr ${b_pbm}                       || echo "Expected failure 2"
-pnmpsnr ${b_pbm} ${w_pbm} -target1=100 || echo "Expected failure 3"
-pnmpsnr                   -machine     || echo "Expected failure 4"
+pnmpsnr ${b_pbm} ${w_pbm} ${b_pbm}     > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pnmpsnr ${b_pbm}                       > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pnmpsnr ${b_pbm} ${w_pbm} -target1=100 > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pnmpsnr                   -machine     > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
 
-rm ${b_pbm} ${w_pbm}
\ No newline at end of file
+rm ${b_pbm} ${w_pbm} ${test_out}
diff --git a/test/pnmquant.ok b/test/pnmquant.ok
new file mode 100644
index 00000000..407d42a3
--- /dev/null
+++ b/test/pnmquant.ok
@@ -0,0 +1,18 @@
+Test 1
+1 1
+1 1
+1 1
+1 1
+1 1
+1 1
+1 1
+1 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
diff --git a/test/pnmquant.test b/test/pnmquant.test
new file mode 100755
index 00000000..1154cf84
--- /dev/null
+++ b/test/pnmquant.test
@@ -0,0 +1,61 @@
+#! /bin/bash
+# This script tests: pnmquant
+# Also requires: ppmhist
+
+echo "Test 1"
+
+# Count colors in output image.
+
+pnmquant 256 testimg.ppm | ppmhist | \
+  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' 
+
+pnmquant -center 256 testimg.ppm | ppmhist | \
+  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' 
+
+pnmquant -spreadbrightness 256 testimg.ppm | ppmhist | \
+  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' 
+
+pnmquant -spreadluminosity 128 testimg.ppm | ppmhist | \
+  awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}' 
+
+pnmquant -floyd -randomseed=0 128 testimg.ppm | ppmhist | \
+  awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}' 
+
+pnmquant 64 -meanpixel testimg.ppm | ppmhist | \
+  awk 'NR==1 {print ($2 <= 64) , ($2 > 64 * 0.9)}' 
+
+pnmquant 16 -meancolor testimg.ppm | ppmhist | \
+  awk 'NR==1 {print ($2 <= 16) , ($2 > 16 * 0.9)}' 
+
+
+pnmquant 2 testgrid.pbm | ppmhist | \
+  awk 'NR==1 {print ($2 <= 2) , ($2 == 2) }' 
+ 
+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
+
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
+pnmquant 0 testimg.ppm   > ${test_out} || \
+  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pnmquant testimg.ppm  > ${test_out} || \
+  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pnmquant 10.5 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pnmquant -center -meancolor 16 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+pnmquant -center -meanpixel 16 testimg.ppm    > ${test_out} || \
+  echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+pnmquant -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+pnmquant -spreadbrightness -spreadluminosity 16 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+pnmquant -floyd -nofloyd 16 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/pnmremap1.ok b/test/pnmremap1.ok
index 07954684..23a9dddd 100644
--- a/test/pnmremap1.ok
+++ b/test/pnmremap1.ok
@@ -1 +1,7 @@
 3602410851 101482
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
+Expected failure 5 1
+Expected failure 6 1
diff --git a/test/pnmremap1.test b/test/pnmremap1.test
index d7c5189c..18debcb8 100755
--- a/test/pnmremap1.test
+++ b/test/pnmremap1.test
@@ -2,7 +2,6 @@
 # This script tests: pnmremap
 # Also requires: pamseq pamtopnm
 
-
 tmpdir=${tmpdir:-/tmp}
 palette=${tmpdir}/palette
 #palette255=${tmpdir}/palette255
@@ -24,3 +23,27 @@ pnmremap -mapfile=${palette} -floyd -norandom \
 # testimg.ppm | cksum
 
 rm ${palette} # ${palette255}
+
+echo 1>&2
+echo "Invalid command-line arguments." 1>&2
+echo "Error messages should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
+
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
+pnmremap -mapfile=/dev/null testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+pnmremap -mapfile=/dev/zero testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+pnmremap testimg.ppm                    > ${test_out} || \
+  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pnmremap -fs -nofs testimg.ppm          > ${test_out} || \
+  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+pnmremap -mapfile=testgrid.pbm -missingcolor=rgb:00/ff/00 testimg.ppm \
+ > ${test_out} || \
+  echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+pnmremap -mapfile=testgrid.pbm -firstisdefault testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/ppmforge-parameters.ok b/test/ppmforge-parameters.ok
index 50e68390..37d89ccd 100644
--- a/test/ppmforge-parameters.ok
+++ b/test/ppmforge-parameters.ok
@@ -2,9 +2,9 @@ Test 1
 256 256
 100 90
 90 90
-Test 2
-Expected failure 1
-Expected failure 2
-Expected failure 3
-Expected failure 4
-Expected failure 5
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
+Expected failure 5 1
diff --git a/test/ppmforge-parameters.test b/test/ppmforge-parameters.test
index 48c4ae4c..28a92916 100755
--- a/test/ppmforge-parameters.test
+++ b/test/ppmforge-parameters.test
@@ -15,15 +15,25 @@ ppmforge -night -width=99 -height=90 | pamfile -size
 # brought up to 100 in this case
 ppmforge -night -width=80 -height=90 | pamfile -size
 
-echo "Test 2"
+echo "Test Invalid"
+
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
 
 echo 1>&2
 echo "Invalid command-line arguments." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
-ppmforge -night  -dimension=0  || echo "Expected failure 1"
-ppmforge -clouds -mesh=1.99    || echo "Expected failure 2"
-ppmforge -clouds -power=0      || echo "Expected failure 3"
-ppmforge         -ice=0        || echo "Expected failure 4"
-ppmforge         -glaciers=0   || echo "Expected failure 5"
+ppmforge -night  -dimension=0  > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+ppmforge -clouds -mesh=1.99    > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+ppmforge -clouds -power=0      > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+ppmforge         -ice=0        > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+ppmforge         -glaciers=0   > ${test_out} || \
+   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/ppmhist.ok b/test/ppmhist.ok
index 38b7770f..468bd317 100644
--- a/test/ppmhist.ok
+++ b/test/ppmhist.ok
@@ -19,7 +19,7 @@ Test 2
  Summary: 6 colors: 0 black, 0 white, 0 gray, 6 color
  Summary: 6 colors: 1 black, 0 white, 0 gray, 5 color
  Summary: 6 colors: 1 black, 1 white, 1 gray, 3 color
-Test 3
-Expected failure 1
-Expected failure 2
-Expected failure 3
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
diff --git a/test/ppmhist.test b/test/ppmhist.test
index c17bab5a..1983bd13 100755
--- a/test/ppmhist.test
+++ b/test/ppmhist.test
@@ -25,14 +25,21 @@ ppmpat -madras --color=rgb:00/00/00,rgb:31/58/a3,rgb:e9/5e/d4 25 25 | \
 ppmpat -madras --color=rgb:00/00/00,rgb:31/58/a3,rgb:ff/ff/ff 25 25 | \
   ppmhist | head -n1
 
-echo "Test 3"
+echo "Test Invalid"
+
+tmpdir=${tmpdir:-/tmp}
+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
 
-ppmhist -hexcolor -float testimg.ppm || echo "Expected failure 1"
-ppmhist -hexcolor -map   testimg.ppm || echo "Expected failure 2"
-ppmhist -float    -map   testimg.ppm || echo "Expected failure 3"
+ppmhist -hexcolor -float testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+ppmhist -hexcolor -map   testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+ppmhist -float    -map   testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
 
+rm ${test_out}
diff --git a/test/ppmmake.ok b/test/ppmmake.ok
index 8a2bedc7..6d559c8d 100644
--- a/test/ppmmake.ok
+++ b/test/ppmmake.ok
@@ -1,15 +1,15 @@
-Test 1.
+Test 1
 2477651508 15012
 4294967295 0
 2378991101 7513
-Test 2.
-Expected error 1
-Expected error 2
-Expected error 3
-Expected error 4
-Expected error 5
-Expected error 6
-Expected error 7
-Expected error 8
-Expected error 9
-Expected error 10
+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
diff --git a/test/ppmmake.test b/test/ppmmake.test
index edd6f251..f28249c7 100755
--- a/test/ppmmake.test
+++ b/test/ppmmake.test
@@ -2,26 +2,41 @@
 # This script tests: ppmmake
 # Also requires:
 
-echo "Test 1."
+echo "Test 1"
 
 ppmmake rgb:ff/80/80 50 100 -maxval=5 | cksum
 ppmmake rgbi:0.5/1.0/0 2   | cksum
 ppmmake red 50 50  | cksum
 
-echo "Test 2."
+echo "Test Invalid"
+
+tmpdir=${tmpdir:-/tmp}
+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
 
-ppmmake rgb:gg/00/00  2 2  || echo "Expected error 1"
-ppmmake rgb:ff/ff/00  2    || echo "Expected error 2"
-ppmmake rgbi:1.1/0/0  2 2  || echo "Expected error 3"
-ppmmake rgbi:1.0/.5   2 2  || echo "Expected error 4"
-ppmmake rainbow       2 2  || echo "Expected error 5"
-ppmmake               2 2  || echo "Expected error 6"
-ppmmake blue -maxval=0 2 2  || echo "Expected error 7"
-ppmmake blue -maxval=-1 2 2  || echo "Expected error 8"
-ppmmake blue -maxval=65536 2 2  || echo "Expected error 9"
-RGBDEF=/dev/null ppmmake red 2 2 || echo "Expected error 10"
+ppmmake rgb:gg/00/00  2 2  > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+ppmmake rgb:ff/ff/00  2    > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+ppmmake rgbi:1.1/0/0  2 2  > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+ppmmake rgbi:1.0/.5   2 2  > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+ppmmake rainbow       2 2  > ${test_out} || \
+   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+ppmmake               2 2  > ${test_out} || \
+   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+ppmmake blue -maxval=0 2 2  > ${test_out} || \
+   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+ppmmake blue -maxval=-1 2 2  > ${test_out} || \
+   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+ppmmake blue -maxval=65536 2 2  > ${test_out} || \
+   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+RGBDEF=/dev/null ppmmake red 2 2 > ${test_out} || \
+   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
diff --git a/test/ppmpat.ok b/test/ppmpat.ok
index 5493ba53..4a9cebd9 100644
--- a/test/ppmpat.ok
+++ b/test/ppmpat.ok
@@ -10,30 +10,30 @@ Test 5
 3057513592 661
 Test 6
 1861389287 661
-Test 7
-Expected failure 1
-Expected failure 2
-Expected failure 3
-Expected failure 4
-Expected failure 5
-Expected failure 6
-Expected failure 7
-Expected failure 8
-Expected failure 9
-Expected failure 10
-Expected failure 11
-Expected failure 12
-Expected failure 13
-Expected failure 14
-Expected failure 15
-Expected failure 16
-Expected failure 17
-Expected failure 18
-Expected failure 19
-Expected failure 20
-Expected failure 21
-Expected failure 22
-Expected failure 23
-Expected failure 24
-Expected failure 25
-Expected failure 26
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
+Expected failure 5 1
+Expected failure 6 1
+Expected failure 7 1
+Expected failure 8 1
+Expected failure 9 1
+Expected failure 10 1
+Expected failure 11 1
+Expected failure 12 1
+Expected failure 13 1
+Expected failure 14 1
+Expected failure 15 1
+Expected failure 16 1
+Expected failure 17 1
+Expected failure 18 1
+Expected failure 19 1
+Expected failure 20 1
+Expected failure 21 1
+Expected failure 22 1
+Expected failure 23 1
+Expected failure 24 1
+Expected failure 25 1
+Expected failure 26 1
diff --git a/test/ppmpat.test b/test/ppmpat.test
index c6647328..0a6127ca 100755
--- a/test/ppmpat.test
+++ b/test/ppmpat.test
@@ -27,23 +27,35 @@ echo "Test 6"
 ppmpat -argyle2 --color=rgb:00/00/00,rgb:ff/80/80,rgb:e0/e0/e0 12 18 | cksum
 
 # Test 7.
-echo "Test 7"
+echo "Test Invalid"
+
+tmpdir=${tmpdir:-/tmp}
+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
 
-ppmpat -g2 -g3 10 10 || echo "Expected failure 1"
-ppmpat -madras -tartan 10 10 || echo "Expected failure 2"
-ppmpat -poles -squig 10 10 || echo "Expected failure 3"
-ppmpat -camo -anticamo 10 10 || echo "Expected failure 4"
-ppmpat -argyle1 -argyle2 10 10 || echo "Expected failure 5"
+ppmpat -g2 -g3 10 10 > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+ppmpat -madras -tartan 10 10 > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+ppmpat -poles -squig 10 10 > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+ppmpat -camo -anticamo 10 10 > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+ppmpat -argyle1 -argyle2 10 10 > ${test_out} || \
+   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
 
-ppmpat 10 10 || echo "Expected failure 6"
-ppmpat -g2 10 || echo "Expected failure 7"
-ppmpat -g2 10 10 10 || echo "Expected failure 8"
-ppmpat -g2 10 || echo "Expected failure 9"
+ppmpat 10 10 > ${test_out} || \
+   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+ppmpat -g2 10 > ${test_out} || \
+   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+ppmpat -g2 10 10 10 > ${test_out} || \
+   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+ppmpat -g2 10 > ${test_out} || \
+   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
 
 clist1="-color=rgb:00/00/00"
 clist2="-color=rgb:00/00/00,rgb:00/00/ff"
@@ -51,26 +63,45 @@ clist3="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff"
 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 || echo "Expected failure 10"
-ppmpat -argyle1  ${clist1} 10 10 || echo "Expected failure 11"
-ppmpat -gingham2 ${clist3} 10 10 || echo "Expected failure 12"
-ppmpat -argyle1  ${clist3} 10 10 || echo "Expected failure 13"
+ppmpat -gingham2 ${clist1} 10 10 > ${test_out} || \
+   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+ppmpat -argyle1  ${clist1} 10 10 > ${test_out} || \
+   echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+ppmpat -gingham2 ${clist3} 10 10 > ${test_out} || \
+   echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
+ppmpat -argyle1  ${clist3} 10 10 > ${test_out} || \
+   echo -n "Expected failure 13"; test -s ${test_out}; echo " "$?
 
 # These require exactly 3 colors 
-ppmpat -gingham3 ${clist2} 10 10 || echo "Expected failure 14"
-ppmpat -argyle2  ${clist2} 10 10 || echo "Expected failure 15"
-ppmpat -madras   ${clist2} 10 10 || echo "Expected failure 16"
-ppmpat -tartan   ${clist2} 10 10 || echo "Expected failure 17"
-ppmpat -gingham3 ${clist4} 10 10 || echo "Expected failure 18"
-ppmpat -argyle2  ${clist4} 10 10 || echo "Expected failure 19"
-ppmpat -madras   ${clist4} 10 10 || echo "Expected failure 20"
-ppmpat -tartan   ${clist4} 10 10 || echo "Expected failure 21"
+ppmpat -gingham3 ${clist2} 10 10 > ${test_out} || \
+   echo -n "Expected failure 14"; test -s ${test_out}; echo " "$?
+ppmpat -argyle2  ${clist2} 10 10 > ${test_out} || \
+   echo -n "Expected failure 15"; test -s ${test_out}; echo " "$?
+ppmpat -madras   ${clist2} 10 10 > ${test_out} || \
+   echo -n "Expected failure 16"; test -s ${test_out}; echo " "$?
+ppmpat -tartan   ${clist2} 10 10 > ${test_out} || \
+   echo -n "Expected failure 17"; test -s ${test_out}; echo " "$?
+ppmpat -gingham3 ${clist4} 10 10 > ${test_out} || \
+   echo -n "Expected failure 18"; test -s ${test_out}; echo " "$?
+ppmpat -argyle2  ${clist4} 10 10 > ${test_out} || \
+   echo -n "Expected failure 19"; test -s ${test_out}; echo " "$?
+ppmpat -madras   ${clist4} 10 10 > ${test_out} || \
+   echo -n "Expected failure 20"; test -s ${test_out}; echo " "$?
+ppmpat -tartan   ${clist4} 10 10 > ${test_out} || \
+   echo -n "Expected failure 21"; test -s ${test_out}; echo " "$?
 
 # These require at least 3 colors 
-ppmpat -squig    ${clist2} 10 10 || echo "Expected failure 22"
-ppmpat -camo     ${clist2} 10 10 || echo "Expected failure 23"
-ppmpat -anticamo ${clist2} 10 10 || echo "Expected failure 24"
+ppmpat -squig    ${clist2} 10 10 > ${test_out} || \
+   echo -n "Expected failure 22"; test -s ${test_out}; echo " "$?
+ppmpat -camo     ${clist2} 10 10 > ${test_out} || \
+   echo -n "Expected failure 23"; test -s ${test_out}; echo " "$?
+ppmpat -anticamo ${clist2} 10 10 > ${test_out} || \
+   echo -n "Expected failure 24"; test -s ${test_out}; echo " "$?
 
 # The squig pattern has an aspect ratio restriction 
-ppmpat -squig ${clist3} 10 250  || echo "Expected failure 25"
-ppmpat -squig ${clist3} 500 20  || echo "Expected failure 26"
+ppmpat -squig ${clist3} 10 250  > ${test_out} || \
+   echo -n "Expected failure 25"; test -s ${test_out}; echo " "$?
+ppmpat -squig ${clist3} 500 20  > ${test_out} || \
+   echo -n "Expected failure 26"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}