about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-03-15 01:08:56 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-03-15 01:08:56 +0000
commit7c693525f2e51e7ac4089dd95f5d1210d86bfbc8 (patch)
tree180a9f967c24b5cd0884e0dbde9bd926f6281f1f /test
parent4d1f58c55c54071ddc85785a9da42674f7485880 (diff)
downloadnetpbm-mirror-7c693525f2e51e7ac4089dd95f5d1210d86bfbc8.tar.gz
netpbm-mirror-7c693525f2e51e7ac4089dd95f5d1210d86bfbc8.tar.xz
netpbm-mirror-7c693525f2e51e7ac4089dd95f5d1210d86bfbc8.zip
New tests
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3761 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r--test/Test-Order5
-rw-r--r--test/pamchannel.ok7
-rwxr-xr-xtest/pamchannel.test29
-rw-r--r--test/pamcrater.ok7
-rwxr-xr-xtest/pamcrater.test37
-rw-r--r--test/pamcut.ok17
-rwxr-xr-xtest/pamcut.test66
-rw-r--r--test/pamdepth.ok14
-rwxr-xr-xtest/pamdepth.test38
-rw-r--r--test/pamditherbw.ok2
-rwxr-xr-xtest/pamditherbw.test13
-rwxr-xr-xtest/pamfind.test2
-rw-r--r--test/pamhue.ok11
-rwxr-xr-xtest/pamhue.test40
-rwxr-xr-xtest/pamundice.test2
-rw-r--r--test/pbmclean.ok2
-rwxr-xr-xtest/pbmclean.test17
-rw-r--r--test/pbmpscale.ok3
-rwxr-xr-xtest/pbmpscale.test18
-rw-r--r--test/pbmtopgm.ok25
-rwxr-xr-xtest/pbmtopgm.test32
-rw-r--r--test/pgmminkowski.ok17
-rwxr-xr-xtest/pgmminkowski.test10
-rw-r--r--test/pgmnoise-parameters.ok5
-rwxr-xr-xtest/pgmnoise-parameters.test26
-rw-r--r--test/pnmcat.ok16
-rwxr-xr-xtest/pnmcat.test61
-rw-r--r--test/pnmquantall.ok6
-rwxr-xr-xtest/pnmquantall.test20
-rw-r--r--test/pnmtile.ok4
-rwxr-xr-xtest/pnmtile.test21
-rw-r--r--test/ppmwheel.ok6
-rwxr-xr-xtest/ppmwheel.test26
-rwxr-xr-xtest/ps-alt-roundtrip.test2
34 files changed, 585 insertions, 22 deletions
diff --git a/test/Test-Order b/test/Test-Order
index 729d124c..a696529b 100644
--- a/test/Test-Order
+++ b/test/Test-Order
@@ -27,6 +27,7 @@ ppmforge-parameters.test
 # Generators with random components
 
 pgmnoise.test
+pgmnoise-parameters.test
 ppmpat-random.test
 ppmforge.test
 ppmrough.test
@@ -41,12 +42,14 @@ ppmhist.test
 pamsumm.test
 pnmpsnr.test
 pbmminkowski.test
+pgmminkowski.test
 
 pnmcolormap.test
 
 # Basic (internal) converter tests
 
 pamtopam.test
+pbmtopgm.test
 pgmtopgm.test
 ppmtoppm.test
 pgmtoppm.test
@@ -55,6 +58,8 @@ pnmtopnm-plain.test
 
 # Editor tests
 
+pamdepth.test
+
 pamditherbw.test
 pamhue.test
 
diff --git a/test/pamchannel.ok b/test/pamchannel.ok
index 79317f03..41d3f890 100644
--- a/test/pamchannel.ok
+++ b/test/pamchannel.ok
@@ -1,3 +1,10 @@
+Test 1
 1571496937 33838
+Test 2
 394856971 33838
+Test 3
 3164158573 33838
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
diff --git a/test/pamchannel.test b/test/pamchannel.test
index 3529f4fe..2e017ef2 100755
--- a/test/pamchannel.test
+++ b/test/pamchannel.test
@@ -1,7 +1,6 @@
 #! /bin/bash
 # This script tests: pamchannel
-# Also requires: pamtopnm
-
+# Also requires: pamtopam pamtopnm
 
 # Extract planes one by one.
 # Convert output to pgm to make it identical to ppmtorgb3 output.
@@ -15,18 +14,44 @@
 
 # Test 1. red channel
 # Should produce 1571496937 33838
+echo "Test 1"
 
 pamchannel -infile testimg.ppm 0 | \
   pamtopnm --assume | cksum
 
 # Test 2. green channel
 # Should produce  394856971 33838
+echo "Test 2"
 
 pamchannel -infile testimg.ppm -tupletype="GRAYSCALE" 1 | \
   pamtopnm | cksum
 
 # Test 3. blue channel
 # Should produce 3164158573 33838
+echo "Test 3"
 
 pamchannel -infile testimg.ppm 2 | \
   pamtopnm --assume | cksum
+
+# Test invalid: specified channel does not exist
+
+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
+
+echo "Test Invalid"
+
+pamchannel  -infile testgrid.pbm 1 > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+
+pamchannel  -infile testimg.ppm 3 > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+
+pamtopam testimg.ppm | pamchannel -infile=- 4 > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
\ No newline at end of file
diff --git a/test/pamcrater.ok b/test/pamcrater.ok
index cfb186a6..a5571f35 100644
--- a/test/pamcrater.ok
+++ b/test/pamcrater.ok
@@ -1,6 +1,13 @@
+Test 1.
 4
 4
 4
+Test 2.
 2
 2
 2
+Test Invalid.
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
diff --git a/test/pamcrater.test b/test/pamcrater.test
index 4d3858b9..ba10ca24 100755
--- a/test/pamcrater.test
+++ b/test/pamcrater.test
@@ -3,8 +3,8 @@
 # Also requires: pamstack pamvalidate pamcut pamflip
 
 
-# We use the undocumented --test and --radius options of pamcrater.
-# pamcrater --test --radius=N
+# We use the undocumented -test and -radius options of pamcrater.
+# pamcrater -test -radius=N
 # The above draws a single crater of radius N.
 # The resulting image should be symmetric.
 
@@ -18,11 +18,12 @@ test100_pam=${tmpdir}/test100.pam
 test150_pam=${tmpdir}/test150.pam
 
 # Test 1.  Should print 4 three times
+echo "Test 1."
 
-pamcrater --test --radius=10 > $test10_pam
-pamcrater --test --radius=50 > $test50_pam
-pamcrater --test --radius=100 > $test100_pam
-pamcrater --test --radius=150 > $test150_pam
+pamcrater -test -radius=10 > $test10_pam
+pamcrater -test -radius=50 > $test50_pam
+pamcrater -test -radius=100 > $test100_pam
+pamcrater -test -radius=150 > $test150_pam
 
 pamstack ${test10_pam} ${test50_pam} ${test100_pam} ${test150_pam} |
   pamvalidate > ${test_pam}
@@ -39,6 +40,7 @@ for i in 1 10 70
 rm ${test_pam} ${test10_pam} ${test50_pam}
 
 # Test 2.  Should print 2 three times
+echo "Test 2."
 
 pamshadedrelief ${test100_pam} > ${testshaded_pam}
 
@@ -51,3 +53,26 @@ pamshadedrelief ${test100_pam} > ${testshaded_pam}
 ) | uniq -c | awk '{print $1}'
 
 rm ${testshaded_pam} ${test100_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
+
+pamcrater -width 0 > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+
+pamcrater -height 0 > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+
+pamcrater -number 0 > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+
+pamcrater -test -radius=10 | pamshadedrelief -gamma 0 > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+
+rm -f ${test_out}
\ No newline at end of file
diff --git a/test/pamcut.ok b/test/pamcut.ok
index b08bc531..3d5c5a7f 100644
--- a/test/pamcut.ok
+++ b/test/pamcut.ok
@@ -15,5 +15,22 @@ Test 5.
 2425386270 41
 2425386270 41
 2425386270 41
+2425386270 41
 Test 6.
 3412257956 129
+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 6 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/pamcut.test b/test/pamcut.test
index 9971b1a5..e4d8c62f 100755
--- a/test/pamcut.test
+++ b/test/pamcut.test
@@ -31,7 +31,7 @@ pamcut -top 10 -left 10 -bottom -11 -right -11 testimg.ppm | cksum
 pamcut -top 10 -left 10 -width 207 -height 129 testimg.ppm | cksum
 
 
-# Test 5. Should print 2425386270 41 four times
+# Test 5. Should print 2425386270 41 five times
 echo Test 5.
 
 pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 testgrid.pbm | \
@@ -39,9 +39,71 @@ pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 testgrid.pbm | \
 pamcut -top 0 -left 0 -bottom 15 -right 13 testgrid.pbm | cksum
 pamcut -top 0 -left 0 -bottom -1 -right -1 testgrid.pbm | cksum
 pamcut -top 0 -left 0 -width 14 -height 16 testgrid.pbm | cksum
-
+pamcut testgrid.pbm | cksum
 
 # Test 6.  Should print 3412257956 129
 echo Test 6.
 
 pbmmake -g 50 50 | pamcut 5 5 30 30 | cksum
+
+
+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
+
+# overspecification
+pamcut -left=1 -right=1 -width=14 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+
+pamcut -top=1 -bottom=1 -height=16 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+
+pamcut -right=1 -cropright=1 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+
+pamcut -top=1 -croptop=1 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+
+pamcut -bottom=1 -cropbottom=1 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+
+pamcut -left=1 -cropleft=1 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+
+# excessive cropping
+pamcut -cropleft=7 -cropright=8 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+
+pamcut -left=7 -right=6 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+
+pamcut -croptop=8 -cropbottom=8 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+
+pamcut -top=10 -bottom=9 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+
+# pad absent
+pamcut -cropleft=1 -width=14 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+
+pamcut -croptop=1  -height=16 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+
+# legacy style: insufficient number of positional parameters
+pamcut 5 testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
+
+pamcut 5 4 testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 13"; test -s ${test_out}; echo " "$?
+
+pamcut 5 5 30 testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 14"; test -s ${test_out}; echo " "$?
+
+rm -f ${test_out}
\ No newline at end of file
diff --git a/test/pamdepth.ok b/test/pamdepth.ok
new file mode 100644
index 00000000..1bd897ac
--- /dev/null
+++ b/test/pamdepth.ok
@@ -0,0 +1,14 @@
+Test 1
+538848130 235
+stdin: PGM RAW 14 16 1 1 GRAYSCALE
+538848130 235
+stdin: PGM RAW 14 16 1 1 GRAYSCALE
+831461512 289
+stdin: PAM RAW 14 16 1 1 GRAYSCALE
+831461512 289
+stdin: PAM RAW 14 16 1 1 GRAYSCALE
+Test 2
+0 0 : 0
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
diff --git a/test/pamdepth.test b/test/pamdepth.test
new file mode 100755
index 00000000..da198973
--- /dev/null
+++ b/test/pamdepth.test
@@ -0,0 +1,38 @@
+#! /bin/bash
+# This script tests: pamdepth
+# Also requires: pbmtopgm pamtopam pamfile
+
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
+# Test 1
+echo "Test 1"
+pamdepth 1 testgrid.pbm | tee ${test_out} | cksum
+  cat ${test_out} | pamfile -machine
+pbmtopgm 1 1 testgrid.pbm | pamdepth 1 | tee ${test_out} | cksum
+  cat ${test_out} | pamfile -machine
+pamdepth 1 testgrid.pbm | pamtopam | tee ${test_out} | cksum
+  cat ${test_out} | pamfile -machine
+pbmtopgm 1 1 testgrid.pbm | pamtopam | pamdepth 1 | tee ${test_out} | cksum
+  cat ${test_out} | pamfile -machine
+
+# Test 2
+echo "Test 2"
+pamdepth 255 testimg.ppm | cmp -s - testimg.ppm
+  echo ${PIPESTATUS[@]} ":" $?
+
+# Test Invalid
+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
+
+pamdepth 0 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+
+pamdepth 65536 testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+
+rm ${test_out}
\ No newline at end of file
diff --git a/test/pamditherbw.ok b/test/pamditherbw.ok
index 156b9f07..02200d0f 100644
--- a/test/pamditherbw.ok
+++ b/test/pamditherbw.ok
@@ -3,7 +3,6 @@ Test: simple threshold
 Test: Hilbert
 3342429190 33894
 2905156049 33894
-4294967295 0
 339841328 33894
 1633267750 33894
 Test: Dither-8
@@ -26,3 +25,4 @@ Expected failure 8 1
 Expected failure 9 1
 Expected failure 10 1
 Expected failure 11 1
+Expected failure 12 1
diff --git a/test/pamditherbw.test b/test/pamditherbw.test
index 76e175d7..40eb0a4d 100755
--- a/test/pamditherbw.test
+++ b/test/pamditherbw.test
@@ -17,7 +17,6 @@ pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \
 echo "Test: Hilbert"
 pamditherbw -hilbert ${test_red} | cksum
 pamditherbw -hilbert -clump=4   ${test_red} | cksum
-pamditherbw -hilbert -clump=4 -threshold -value=0.5  ${test_red} | cksum
 pamditherbw -hilbert -clump=16  ${test_red} | cksum
 pamditherbw -hilbert -clump=100 ${test_red} | cksum
 
@@ -59,15 +58,17 @@ 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} || \
+pamditherbw -hilbert -threshold ${test_red} > ${test_out} || \
  echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
-pamditherbw -fs -clump=8        ${test_red} > ${test_out} || \
+pamditherbw -clump=8            ${test_red} > ${test_out} || \
  echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
-pamditherbw -hilbert -clump=1   ${test_red} > ${test_out} || \
+pamditherbw -fs -clump=8        ${test_red} > ${test_out} || \
  echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
-pamditherbw -th -value=-1       ${test_red} > ${test_out} || \
+pamditherbw -hilbert -clump=1   ${test_red} > ${test_out} || \
  echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
-pamditherbw -th -value=1.1      ${test_red} > ${test_out} || \
+pamditherbw -th -value=-1       ${test_red} > ${test_out} || \
  echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+pamditherbw -th -value=1.1      ${test_red} > ${test_out} || \
+ echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
 
 rm ${test_red} ${test_out}
diff --git a/test/pamfind.test b/test/pamfind.test
index 3b4ffb81..074dde5c 100755
--- a/test/pamfind.test
+++ b/test/pamfind.test
@@ -37,7 +37,7 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 echo 1>&2
-echo "Invalid command-line argument combination." 1>&2
+echo "Invalid command-line argument combinations." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
diff --git a/test/pamhue.ok b/test/pamhue.ok
index dbef973d..5935cc5e 100644
--- a/test/pamhue.ok
+++ b/test/pamhue.ok
@@ -1,4 +1,7 @@
+Test 1
 1213482165 83
+1213482165 83
+Test 2
  Summary: 8 colors: 1 black, 1 white, 0 gray, 6 color
 
    r     g     b   	 lum 	 count  
@@ -23,3 +26,11 @@
    255     0   255	  105	      1 
    255   255     0	  226	      1 
    255   255   255	  255	      1 
+Test 3
+0 0 : 0
+0 0 : 0
+Test 4
+0 0 : 0
+0 0 : 0
+Test Invalid
+Expected failure 1 1
diff --git a/test/pamhue.test b/test/pamhue.test
index 18240959..d81a0acb 100755
--- a/test/pamhue.test
+++ b/test/pamhue.test
@@ -2,9 +2,47 @@
 # This script tests: pamhue
 # Also requires: pamseq ppmhist pamdepth
 
+echo "Test 1"
+# Should print 1213482165 83 twice
+
 pamseq -tupletype=RGB 3 1 | pamdepth 255 | pamhue -huechange=60 | cksum
+pamseq -tupletype=RGB 3 1 | pamdepth 255 | pamhue -huechange=-300 | cksum
+
+echo "Test 2"
 
 pamseq -tupletype=RGB 3 1 | pamdepth 255 | ppmhist -sort=rgb
-pamseq -tupletype=RGB 3 1 | pamdepth 255 | pamhue -huechange=60 | ppmhist -sort=rgb
+pamseq -tupletype=RGB 3 1 | pamdepth 255 | pamhue -huechange=60 | \
+  ppmhist -sort=rgb
+
+echo "Test 3"
+# pamhue has no effect on monotone images
+# Should print 2425386270 41 twice
+
+pamhue -huechange=45  testgrid.pbm | cmp -s - testgrid.pbm
+  echo ${PIPESTATUS[@]} ":" $?
+pamhue -huechange=180 testgrid.pbm | cmp -s - testgrid.pbm
+  echo ${PIPESTATUS[@]} ":" $?
+
+echo "Test 4"
+# spinning the color wheel by multiples of 360 leaves the image unchanged
+# Should print 1926073387 101484 twice
+
+pamhue -huechange=0 testimg.ppm   | cmp -s - testimg.ppm
+  echo ${PIPESTATUS[@]} ":" $?
+pamhue -huechange=360 testimg.ppm | cmp -s - testimg.ppm
+  echo ${PIPESTATUS[@]} ":" $?
+
+echo "Test Invalid"
+
+tmpdir=${tmpdir:-/tmp}
+test_out=${tmpdir}/test_out
+
+echo 1>&2
+echo "Omission of mandatory argument." 1>&2
+echo "An error message should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
 
+pamhue testimg.ppm  > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
 
+rm -f ${test_out}
diff --git a/test/pamundice.test b/test/pamundice.test
index c49b9b2a..e8add587 100755
--- a/test/pamundice.test
+++ b/test/pamundice.test
@@ -1,6 +1,6 @@
 #! /bin/bash
 # This script tests: pamundice
-# Also requires: pbmmake pgmmake pnmtile pnmcat pnmpad
+# Also requires: pgmmake pnmtile pnmcat pnmpad
 
 tmpdir=${tmpdir:-/tmp}
 fname_stem=${tmpdir}/part
diff --git a/test/pbmclean.ok b/test/pbmclean.ok
index 47d6c07d..17ee0338 100644
--- a/test/pbmclean.ok
+++ b/test/pbmclean.ok
@@ -84,3 +84,5 @@ Test 3
 2571756059 5051
 436062787 5051
 4188415575 5051
+Test Invalid
+Expected failure 1 1
diff --git a/test/pbmclean.test b/test/pbmclean.test
index b9ea0937..c0c3a759 100755
--- a/test/pbmclean.test
+++ b/test/pbmclean.test
@@ -34,3 +34,20 @@ for n in 1 2 3 4 5 6 7 8 9 10
   done
 
 rm ${sheet_pbm}
+
+echo "Test Invalid"
+
+test_out=${tmpdir}/test_out
+
+echo 1>&2
+echo "Invalid command-line argument combination." 1>&2
+echo "An error message should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
+
+# overspecification
+pbmclean -black -white -min=1 -extended testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+
+# note that without -extended the above is valid.
+
+rm -f ${test_out}
\ No newline at end of file
diff --git a/test/pbmpscale.ok b/test/pbmpscale.ok
index e25d4027..c26ffef3 100644
--- a/test/pbmpscale.ok
+++ b/test/pbmpscale.ok
@@ -48,3 +48,6 @@ P1
 2150868536 457
 3761734242 1065
 3462719777 1803
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
diff --git a/test/pbmpscale.test b/test/pbmpscale.test
index 42046c74..9c34734a 100755
--- a/test/pbmpscale.test
+++ b/test/pbmpscale.test
@@ -10,3 +10,21 @@ do
 pamenlarge 2 testgrid.pbm | \
   pbmpscale $i | cksum
 done
+
+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
+
+pbmpscale testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+
+pbmpscale 0 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+
+pbmpscale 2 3 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+
+rm -f ${test_out}
\ No newline at end of file
diff --git a/test/pbmtopgm.ok b/test/pbmtopgm.ok
new file mode 100644
index 00000000..6ccf9c64
--- /dev/null
+++ b/test/pbmtopgm.ok
@@ -0,0 +1,25 @@
+Test 1
+P2
+14 16
+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
+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
+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
+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
+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
+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
+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
+0 0 0 0 0 0 0 0 0 0 0 0 0 0
+Test Invalid
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
diff --git a/test/pbmtopgm.test b/test/pbmtopgm.test
new file mode 100755
index 00000000..a7ba6f7c
--- /dev/null
+++ b/test/pbmtopgm.test
@@ -0,0 +1,32 @@
+#! /bin/bash
+# This script tests: pbmtopgm
+# Also requires:
+
+#Test 1
+echo "Test 1"
+
+pbmtopgm -plain 1 1 testgrid.pbm
+
+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
+
+pbmtopgm 5 0 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+
+pbmtopgm 0 9 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+
+pbmtopgm 15 5 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+
+pbmtopgm 5 17 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+
+rm -f ${test_out}
diff --git a/test/pgmminkowski.ok b/test/pgmminkowski.ok
new file mode 100644
index 00000000..86f43207
--- /dev/null
+++ b/test/pgmminkowski.ok
@@ -0,0 +1,17 @@
+#threshold	 tiles	x-edges	y-edges	vertices
+#---------	 -----	-------	-------	--------
+0.000000	     9	     12	     12	      16	1	1	     1
+0.501961	     1	      2	      2	       4	0.111111	0.333333	     1
+#  check:	     0	      0	      0	       0
+
+#threshold	 tiles	x-edges	y-edges	vertices
+#---------	 -----	-------	-------	--------
+0.000000	     9	     12	     12	      16	1	1	     1
+1.000000	     5	     10	     10	      16	0.555556	1.66667	     1
+#  check:	     0	      0	      0	       0
+
+#threshold	 tiles	x-edges	y-edges	vertices
+#---------	 -----	-------	-------	--------
+0.000000	   224	    240	    238	     255	1	1	     1
+1.000000	    56	    112	    112	     224	0.25	3.73333	    56
+#  check:	     0	      0	      0	       0
diff --git a/test/pgmminkowski.test b/test/pgmminkowski.test
new file mode 100755
index 00000000..52e02e19
--- /dev/null
+++ b/test/pgmminkowski.test
@@ -0,0 +1,10 @@
+#! /bin/bash
+# This script tests: pgmminkowski
+# Also requires: pbmmake pgmmake pnmmargin pnmpad
+
+pgmmake .5 1 1 | pnmmargin -b 1 | \
+  pgmminkowski
+echo
+pbmmake -g 3 3 | pgmminkowski
+echo
+pgmminkowski testgrid.pbm
diff --git a/test/pgmnoise-parameters.ok b/test/pgmnoise-parameters.ok
new file mode 100644
index 00000000..1bb1cd59
--- /dev/null
+++ b/test/pgmnoise-parameters.ok
@@ -0,0 +1,5 @@
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
+Expected failure 5 1
diff --git a/test/pgmnoise-parameters.test b/test/pgmnoise-parameters.test
new file mode 100755
index 00000000..1682afca
--- /dev/null
+++ b/test/pgmnoise-parameters.test
@@ -0,0 +1,26 @@
+#! /bin/bash
+# This script tests: pgmnoise
+# Also requires:
+
+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
+
+pgmnoise -maxval=255  -randomseed=1 > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+
+pgmnoise 100 -randomseed=1 > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+
+pgmnoise 100 0 -randomseed=1 > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+
+pgmnoise 0 100 -randomseed=1 > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+
+pgmnoise 100 100 100 -randomseed=1 > ${test_out} || \
+   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
diff --git a/test/pnmcat.ok b/test/pnmcat.ok
index 68052957..b92a1420 100644
--- a/test/pnmcat.ok
+++ b/test/pnmcat.ok
@@ -1,4 +1,20 @@
+Test 1.
 1704087873 73
 4150323653 73
 1522490272 202953
 2862441566 202953
+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/pnmcat.test b/test/pnmcat.test
index c643320d..40c29f50 100755
--- a/test/pnmcat.test
+++ b/test/pnmcat.test
@@ -2,9 +2,70 @@
 # This script tests: pnmcat
 # Also requires:
 
+echo "Test 1."
 
 pnmcat -lr testgrid.pbm testgrid.pbm | cksum
 pnmcat -tb testgrid.pbm testgrid.pbm | cksum
 
 pnmcat -lr testimg.ppm testimg.ppm | cksum
 pnmcat -tb testimg.ppm testimg.ppm | cksum
+
+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
+
+# direction not specified
+pnmcat testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+
+# both directions specified
+pnmcat -topbottom -leftright testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+
+# both pad colors specified
+pnmcat -topbottom -white -black testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+
+# justification parameters overspecified
+pnmcat -lr -jtop -jbottom testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+
+pnmcat -lr -jtop -jcenter testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+
+pnmcat -lr -jcenter -jbottom testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+
+pnmcat -tb -jleft -jright testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+
+pnmcat -tb -jleft -jcenter testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+
+pnmcat -tb -jcenter -jright testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+
+# justification parameter in the wrong direction
+pnmcat -lr -jleft    testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+
+pnmcat -lr -jright   testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+
+pnmcat -tb -jtop     testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
+
+pnmcat -tb -jbottom  testgrid.pbm testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 13"; test -s ${test_out}; echo " "$?
+
+# more than one input image from standard input
+cat testgrid.pbm | pnmcat -lr - - testimg.ppm > ${test_out} || \
+   echo -n "Expected failure 14"; test -s ${test_out}; echo " "$?
+
+rm -f ${test_out}
diff --git a/test/pnmquantall.ok b/test/pnmquantall.ok
index 172eb0aa..5885d370 100644
--- a/test/pnmquantall.ok
+++ b/test/pnmquantall.ok
@@ -1,5 +1,9 @@
-got color map
 2373957371 33838
 3892560659 33838
 1383839923 33838
 1
+Expected failure 1
+Expected failure 1.rm
+Expected failure 2
+Expected failure 2.rm
+Expected failure 3
diff --git a/test/pnmquantall.test b/test/pnmquantall.test
index b735b623..4c1bb77f 100755
--- a/test/pnmquantall.test
+++ b/test/pnmquantall.test
@@ -24,4 +24,24 @@ done
 pnmcat ${test_red} ${test_grn} ${test_blu} -tb | \
     pgmhist -m | awk '$2>0 {s++}; END { print (s<=20) }'
 
+
+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
+
+pnmquantall -ext xx 0 ${test_red} ${test_grn} ${test_blu} || \
+   echo "Expected failure 1"
+rm ${test_red}xx ${test_grn}xx ${test_blu}xx || \
+   echo "Expected failure 1.rm"
+pnmquantall -ext xx 1 ${test_red} ${test_grn} ${test_blu} || \
+   echo "Expected failure 2"
+rm ${test_red}xx ${test_grn}xx ${test_blu}xx || \
+   echo "Expected failure 2.rm"
+pnmquantall -ext xx 2 || \
+   echo "Expected failure 3"
+
 rm ${test_red} ${test_grn} ${test_blu} ${test_ppm}
\ No newline at end of file
diff --git a/test/pnmtile.ok b/test/pnmtile.ok
index 4a29e0dc..279251b8 100644
--- a/test/pnmtile.ok
+++ b/test/pnmtile.ok
@@ -1,2 +1,6 @@
 4228632379 259
 0 0 : 0
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
diff --git a/test/pnmtile.test b/test/pnmtile.test
index e297da66..11f576bd 100755
--- a/test/pnmtile.test
+++ b/test/pnmtile.test
@@ -20,3 +20,24 @@ cmp -s - ${testimg4_ppm}
 echo ${PIPESTATUS[@]} ":" $?
 
 rm ${testimg2_ppm} ${testimg4_ppm}
+
+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
+
+pnmtile 100 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+
+pnmtile 100 0 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+
+pnmtile 0 100 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+
+pnmtile 100 100 100 testgrid.pbm > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+
+rm -f ${test_out}
\ No newline at end of file
diff --git a/test/ppmwheel.ok b/test/ppmwheel.ok
index 24756d1e..0b0a7746 100644
--- a/test/ppmwheel.ok
+++ b/test/ppmwheel.ok
@@ -1,2 +1,8 @@
+Test 1.
 1537578995 59
 875938089 86
+Test Invalid.
+Expected failure 1 1
+Expected failure 2 1
+Expected failure 3 1
+Expected failure 4 1
diff --git a/test/ppmwheel.test b/test/ppmwheel.test
index f528e209..fd401951 100755
--- a/test/ppmwheel.test
+++ b/test/ppmwheel.test
@@ -6,6 +6,8 @@
 # For values 6 and above, x86(-32) and x86-64 produce different output.
 # SSE floating-point math is the probable cause.
 
+echo "Test 1."
+
 for i in 4 5
 do
 ppmwheel $i | cksum
@@ -108,3 +110,27 @@ done
 #  98:  4086203619 28825    1961862620 28825
 #  99:  3656777902 29416    2475351252 29416
 # 100:  2246720411 30015    4055518595 30015
+
+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
+
+ppmwheel 10 -huevalue -huesaturation > ${test_out} || \
+   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+
+ppmwheel 0 > ${test_out} || \
+   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+
+ppmwheel > ${test_out} || \
+   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+
+ppmwheel 10 10 > ${test_out} || \
+   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+
+rm -f ${test_out}
\ No newline at end of file
diff --git a/test/ps-alt-roundtrip.test b/test/ps-alt-roundtrip.test
index af7f7222..8fc08f2b 100755
--- a/test/ps-alt-roundtrip.test
+++ b/test/ps-alt-roundtrip.test
@@ -5,7 +5,7 @@
 
 # This script is for testing alternative (or minor) utilities that
 # read/write Postscript and encapsulated Postscript:
-# pbmtoepsi, pbmtopsg3, pbmtolps and psidtopgm.
+# pbmtoepsi, pbmtopsg3 and psidtopgm.
 #
 # We keep these tests separate from those for pnmtops and pstopnm
 # which are far more popular.