about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-11-24 19:18:45 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-11-24 19:18:45 +0000
commit4296fe52a37736b7533b3bf447b29ad7933a3ab4 (patch)
tree87644c5b7e46fb333bcde7903f8dcf0de4964d3d
parentb3f62ef1f3fb72b5674c4481dd25148fbe51850b (diff)
downloadnetpbm-mirror-4296fe52a37736b7533b3bf447b29ad7933a3ab4.tar.gz
netpbm-mirror-4296fe52a37736b7533b3bf447b29ad7933a3ab4.tar.xz
netpbm-mirror-4296fe52a37736b7533b3bf447b29ad7933a3ab4.zip
New test framework, lots of tests
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1775 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/pbm/pbmtog3.test23
-rw-r--r--doc/HISTORY2
-rw-r--r--editor/pamcut.test10
-rw-r--r--editor/pamenlarge.test8
-rw-r--r--editor/pamflip/pamflip.test12
-rw-r--r--editor/pnminvert.test15
-rw-r--r--generator/pbmmake.test9
-rwxr-xr-xtest/Execute-Tests113
-rw-r--r--test/Test-Order89
-rw-r--r--test/all-in-place.ok351
-rwxr-xr-xtest/all-in-place.test104
-rw-r--r--test/bmp-roundtrip.ok2
-rwxr-xr-xtest/bmp-roundtrip.test6
-rw-r--r--test/cut-paste-roundtrip.ok1
-rwxr-xr-xtest/cut-paste-roundtrip.test6
-rw-r--r--test/g3-roundtrip.ok3
-rwxr-xr-xtest/g3-roundtrip.test13
-rw-r--r--test/gif-roundtrip.ok3
-rwxr-xr-xtest/gif-roundtrip.test30
-rw-r--r--test/hdiff-roundtrip.ok1
-rwxr-xr-xtest/hdiff-roundtrip.test6
-rw-r--r--test/pad-crop-roundtrip.ok2
-rwxr-xr-xtest/pad-crop-roundtrip.test8
-rw-r--r--test/pamcut.ok4
-rwxr-xr-xtest/pamcut.test14
-rw-r--r--test/pamdepth-roundtrip.ok8
-rwxr-xr-xtest/pamdepth-roundtrip.test12
-rw-r--r--test/pamdice-roundtrip.ok1
-rwxr-xr-xtest/pamdice-roundtrip.test9
-rw-r--r--test/pamditherbw.ok4
-rwxr-xr-xtest/pamditherbw.test31
-rw-r--r--test/pamedge.ok77
-rwxr-xr-xtest/pamedge.test7
-rw-r--r--test/pamenlarge.ok4
-rwxr-xr-xtest/pamenlarge.test12
-rw-r--r--test/pamfile.ok3
-rwxr-xr-xtest/pamfile.test7
-rw-r--r--test/pamflip-roundtrip.ok12
-rwxr-xr-xtest/pamflip-roundtrip.test34
-rw-r--r--test/pamflip.ok6
-rwxr-xr-xtest/pamflip.test16
-rw-r--r--test/pamseq.ok1
-rwxr-xr-xtest/pamseq.test5
-rw-r--r--test/pamslice-roundtrip.ok2
-rwxr-xr-xtest/pamslice-roundtrip.test29
-rw-r--r--test/pamsumm.ok8
-rwxr-xr-xtest/pamsumm.test13
-rw-r--r--test/pamtopam.ok16
-rwxr-xr-xtest/pamtopam.test9
-rw-r--r--test/pbmclean.ok73
-rwxr-xr-xtest/pbmclean.test16
-rw-r--r--test/pbmmake.ok43
-rwxr-xr-xtest/pbmmake.test18
-rw-r--r--test/pbmminkowski.ok23
-rwxr-xr-xtest/pbmminkowski.test10
-rw-r--r--test/pbmpage.ok3
-rwxr-xr-xtest/pbmpage.test7
-rw-r--r--test/pbmpscale.ok50
-rwxr-xr-xtest/pbmpscale.test11
-rw-r--r--test/pbmtext.ok21
-rwxr-xr-xtest/pbmtext.test11
-rw-r--r--test/pbmtog3.ok11
-rwxr-xr-xtest/pbmtog3.test28
-rw-r--r--test/pbmupc.ok1
-rwxr-xr-xtest/pbmupc.test8
-rw-r--r--test/pgmhist.ok14
-rwxr-xr-xtest/pgmhist.test6
-rw-r--r--test/pgmmake.ok2
-rwxr-xr-xtest/pgmmake.test10
-rw-r--r--test/pgmramp.ok32
-rwxr-xr-xtest/pgmramp.test12
-rw-r--r--test/pgmtopgm.ok1
-rwxr-xr-xtest/pgmtopgm.test5
-rw-r--r--test/pgmtoppm.ok3
-rwxr-xr-xtest/pgmtoppm.test18
-rw-r--r--test/png-roundtrip.ok2
-rwxr-xr-xtest/png-roundtrip.test7
-rw-r--r--test/pnm-pam-roundtrip.ok2
-rwxr-xr-xtest/pnm-pam-roundtrip.test7
-rw-r--r--test/pnm-plain-roundtrip.ok2
-rwxr-xr-xtest/pnm-plain-roundtrip.test9
-rw-r--r--test/pnmcat.ok4
-rwxr-xr-xtest/pnmcat.test9
-rw-r--r--test/pnminvert-roundtrip.ok2
-rwxr-xr-xtest/pnminvert-roundtrip.test6
-rw-r--r--test/pnminvert.ok7
-rwxr-xr-xtest/pnminvert.test20
-rw-r--r--test/pnmpsnr.ok2
-rwxr-xr-xtest/pnmpsnr.test11
-rw-r--r--test/pnmremap1.ok1
-rwxr-xr-xtest/pnmremap1.test19
-rw-r--r--test/pnmremap2.ok3
-rwxr-xr-xtest/pnmremap2.test21
-rw-r--r--test/pnmtile.ok2
-rwxr-xr-xtest/pnmtile.test12
-rw-r--r--test/pnmtopnm-plain.ok48
-rwxr-xr-xtest/pnmtopnm-plain.test10
-rw-r--r--test/ppmbrighten.ok3
-rwxr-xr-xtest/ppmbrighten.test7
-rw-r--r--test/ppmchange-roundtrip.ok2
-rwxr-xr-xtest/ppmchange-roundtrip.test11
-rw-r--r--test/ppmcie.ok1
-rw-r--r--test/ppmcie.out-641
-rwxr-xr-xtest/ppmcie.test20
-rw-r--r--test/ppmdim.ok13
-rwxr-xr-xtest/ppmdim.test19
-rw-r--r--test/ppmdither.ok3
-rwxr-xr-xtest/ppmdither.test7
-rw-r--r--test/ppmgauss.ok81
-rwxr-xr-xtest/ppmgauss.test11
-rw-r--r--test/ppmhist.ok11
-rwxr-xr-xtest/ppmhist.test7
-rw-r--r--test/ppmmake.ok2
-rwxr-xr-xtest/ppmmake.test13
-rw-r--r--test/ppmmix.ok17
-rwxr-xr-xtest/ppmmix.test29
-rw-r--r--test/ppmtopgm.ok1
-rwxr-xr-xtest/ppmtopgm.test7
-rw-r--r--test/ppmtoppm.ok1
-rwxr-xr-xtest/ppmtoppm.test5
-rw-r--r--test/ppmwheel.ok2
-rwxr-xr-xtest/ppmwheel.test113
-rw-r--r--test/ps-roundtrip.ok2
-rwxr-xr-xtest/ps-roundtrip.test21
-rw-r--r--test/rgb3-roundtrip.ok5
-rwxr-xr-xtest/rgb3-roundtrip.test31
-rw-r--r--test/testgrid.pbm (renamed from testgrid.pbm)0
-rw-r--r--test/testimg.ppm (renamed from testimg.ppm)0
-rw-r--r--test/tiff-roundtrip.ok4
-rwxr-xr-xtest/tiff-roundtrip.test20
-rw-r--r--test/xbm-roundtrip.ok2
-rwxr-xr-xtest/xbm-roundtrip.test6
-rw-r--r--test/xpm-roundtrip.ok1
-rwxr-xr-xtest/xpm-roundtrip.test8
-rw-r--r--test/xwd-roundtrip.ok3
-rwxr-xr-xtest/xwd-roundtrip.test14
136 files changed, 2231 insertions, 77 deletions
diff --git a/converter/pbm/pbmtog3.test b/converter/pbm/pbmtog3.test
deleted file mode 100644
index 9ca45079..00000000
--- a/converter/pbm/pbmtog3.test
+++ /dev/null
@@ -1,23 +0,0 @@
-echo Test 1.  Should print 3697098186 144
-./pbmtog3 ../../testgrid.pbm | cksum
-echo Test 2.  Should print 1248301383 122
-./pbmtog3 -nofixedwidth ../../testgrid.pbm | cksum
-echo Test 3.  Should print 686713716 144
-./pbmtog3 -reverse ../../testgrid.pbm | cksum
-echo Test 4.  Should print 215463240 122
-./pbmtog3 -nofixedwidth -reverse ../../testgrid.pbm | cksum
-echo Test 5.  Should print 28792587 47
-pbmmake -w 10 10 | ./pbmtog3 | cksum
-echo Test 6.  Should print 277456854 32
-pbmmake -w 10 10 | ./pbmtog3 -nofixedwidth | cksum
-echo Test 7.  Should print 28792587 47
-pbmmake -w 10000 10 | ./pbmtog3 | cksum
-echo Test 8.  Should print 871281767 162
-pbmmake -w 10000 10 | ./pbmtog3 -nofixedwidth | cksum
-echo Test 9.  Should print 3736247115 62
-pbmmake -b 10 10 | ./pbmtog3 | cksum
-echo Test 10.  Should print 2820255307 2191856
-pbmmake -g 1700 2286 | ./pbmtog3 | cksum
-echo Test 11.  Should print 4159089282 2226575
-pbmmake -g 1800 2286 | ./pbmtog3 | cksum
-echo Tests done.
diff --git a/doc/HISTORY b/doc/HISTORY
index 7952997a..1ff2ee71 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -35,6 +35,8 @@ not yet  BJH  Release 10.61.00
               pamgauss: Fix bug: erroneously says -maxval is too big on 64 bit
               system.  Always broken (Pamgauss was added in 10.23 (July 2004).
 
+              Add tests.  Thanks Prophet of the Way <afu@wta.att.ne.jp>.
+
 12.09.30 BJH  Release 10.60.00
 
               xpmtoppm: major speedup for 3-character-per pixel files,
diff --git a/editor/pamcut.test b/editor/pamcut.test
deleted file mode 100644
index be70f1fd..00000000
--- a/editor/pamcut.test
+++ /dev/null
@@ -1,10 +0,0 @@
-echo Test 1.  Should print 2958909756 124815
-./pamcut -top 0 -left 0 -width 260 -height 160 -pad ../testimg.ppm | cksum
-echo Test 2.  Should print 1550940962 10933
-./pamcut -top 200 -left 120 -width 40 -height 40 -pad ../testimg.ppm | cksum
-echo Test 3.  Should print 708474423 14
-./pamcut -top 5 -left 5 -bottom 5 -right 5 ../testimg.ppm | cksum
-echo Test 3.  Should print 3412257956 129
-pbmmake -g 50 50 | ./pamcut 5 5 30 30 | cksum
-
-
diff --git a/editor/pamenlarge.test b/editor/pamenlarge.test
deleted file mode 100644
index 7584af01..00000000
--- a/editor/pamenlarge.test
+++ /dev/null
@@ -1,8 +0,0 @@
-echo Test 1.  Should print 3424505894 913236
-./pamenlarge 3 ../testimg.ppm | cksum
-echo Test 2.  Should print 4152147096 304422
-ppmtopgm ../testimg.ppm | ./pamenlarge 3 | cksum
-echo Test 3.  Should print 3342398172 297
-./pamenlarge 3 ../testgrid.pbm | cksum
-echo Test 4.  Should print 237488670 3133413
-./pamenlarge 3 -plain ../testimg.ppm | cksum
diff --git a/editor/pamflip/pamflip.test b/editor/pamflip/pamflip.test
deleted file mode 100644
index 96e889ea..00000000
--- a/editor/pamflip/pamflip.test
+++ /dev/null
@@ -1,12 +0,0 @@
-echo Test 1.  Should print 2116496681 101484
-./pamflip -lr ../testimg.ppm | cksum 
-echo Test 2.  Should print 217037000 101484
-./pamflip -cw ../testimg.ppm | cksum
-echo Test 3.  Should print 2052917888 101484
-./pamflip -tb ../testimg.ppm | cksum
-echo Test 4.  Should print 3375384165 41
-./pamflip -lr ../testgrid.pbm | cksum
-echo Test 5.  Should print 604323149 41
-./pamflip -tb ../testgrid.pbm | cksum
-echo Test 6.  Should print 490797850 37
-./pamflip -cw ../testgrid.pbm | cksum
diff --git a/editor/pnminvert.test b/editor/pnminvert.test
deleted file mode 100644
index 5534f20d..00000000
--- a/editor/pnminvert.test
+++ /dev/null
@@ -1,15 +0,0 @@
-echo Test 1.  Should print 1240379484 41
-./pnminvert ../testgrid.pbm | cksum
-echo Test 2.  Should print 1416115901 101484
-./pnminvert ../testimg.ppm | cksum
-echo Test 3.  Should print 2961441369 33838
-ppmtopgm ../testimg.ppm | ./pnminvert | cksum
-echo Test 4.  Should print 2595564405 14
-pbmmake -w 7 7 | ./pnminvert | cksum
-echo Test 5.  Should print 2595564405 14
-pbmmake -b 7 7 | cksum
-echo Test 6.  Should print 2595564405 14
-pbmmake -b 7 7 | ./pnminvert | ./pnminvert | cksum
-echo Test 7.  Should print 2896726098 15
-pbmmake -g 8 8 | ./pnminvert | cksum
-
diff --git a/generator/pbmmake.test b/generator/pbmmake.test
deleted file mode 100644
index 0fd99ccd..00000000
--- a/generator/pbmmake.test
+++ /dev/null
@@ -1,9 +0,0 @@
-echo Test 1.  Should print 3892756435 12
-./pbmmake -white 16 2 | cksum
-echo Test 2.  Should print 1576602925 8
-./pbmmake -black 1 1  | cksum
-echo Test 3.  Should print 4272952448 14
-./pbmmake -gray 7 7   | cksum
-echo Test 4.  Should print 1634688086 15
-./pbmmake -grey 8 8   | cksum
-echo Tests done.
diff --git a/test/Execute-Tests b/test/Execute-Tests
new file mode 100755
index 00000000..104853e5
--- /dev/null
+++ b/test/Execute-Tests
@@ -0,0 +1,113 @@
+#! /bin/bash
+
+# Confirm that PBM_TESTPREFIX is set.
+# PBM_TESTPREFIX is the directory with the Netpbm programs you want to
+# test.  This can be null, but this is not recommended.
+#
+# You can set it here by decommenting and modifying the next line:
+# export PBM_TESTPREFIX="/usr/local/bin/"
+
+
+if [ -z $PBM_TESTPREFIX ]
+  then
+  echo "Warning: PBM_TESTPREFIX is not set."
+  echo "Programs in the default execution path:"
+  echo $PATH
+  echo "will be tested."
+elif [ ! -d $PBM_TESTPREFIX ]
+  then
+  echo "Error: No directory named $PBM_TESTPREFIX"
+  exit 1
+else
+  # append "/" to end of string if necessary
+  export PBM_TESTPREFIX=`echo $PBM_TESTPREFIX | sed '/\/$/!s@$@/@'`
+fi
+
+# Set PBM_BINPREFIX.
+# PBM_BINPREFIX is the directory where Netpbm programs which play
+# auxiliary roles in tests (such as image generators for producing
+# test images, analyzers to summarize output and so forth).
+#
+# If testing a fresh install, this should be the same as PBM_TESTPREFIX.
+# If you are developing a single Netpbm program, you may want to
+# set this to a directory with stable executables.
+# If set to null, executables in the default execution path will
+# be used.
+
+# export PBM_BINPREFIX="/usr/local/bin/"
+# export PBM_BINPREFIX=""
+export PBM_BINPREFIX=${PBM_TESTPREFIX}
+
+# Add PBM_BINPREFIX to PATH.
+# This is necessary for Netpbm programs (mosly scripts) that call
+# other Netpbm programs.
+
+if [ ! -z $PBM_BINPREFIX ]
+  then
+  export PATH=${PBM_BINPREFIX}:$PATH
+fi
+
+# Set tmpdir, which is used in some of the test scripts.
+# This must be an existing directory.
+
+if [ -z $tmpdir ]
+  then
+  if [ -z $TMPDIR ]
+    then
+    export tmpdir=/tmp/
+    else 
+    export tmpdir=$TMPDIR
+  fi
+fi
+
+# If necessary set the RGBDEF environment variable.
+#export RGBDEF=/etc/rgb.txt
+#export RGBDEF=/usr/local/netpbm/lib/rgb.txt
+#export RGBDEF=/usr/share/emacs/*/etc/rgb.txt
+
+# Declare arrays used to count and report test results.
+# For now only "SUCCESS" and "FAILURE" are used.
+declare -a array=(0 0 0 0 0)
+declare -a status=("SUCCESS" "FAILURE" "UNEXPECTED SUCCESS" \
+                   "EXPECTED FAILURE" "NOT SUPPORTED")
+
+# Execute the tests, as described in the "Test-Order" file.
+#
+# To execute just one test, or a few tests, replace the grep part
+# within backquotes with names of tests you want to run like this:
+# 
+# for t in pbmmake.test pgmmake.test ppmmake.test
+
+for t in `grep -v "^#" Test-Order | grep "."`
+do
+echo == $t ==
+./$t >  ${t%.test}.out ; let result=$?
+case $result in
+0)   cmp --quiet ${t%.test}.out ${t%.test}.ok ;
+     if [ $? -eq 0 ]
+        then let result=0;  rm  ${t%.test}.out ;
+        else let result=1;
+     fi ;;
+1 | 2 | 3 ) ;;
+*) let result=1 ;;
+esac
+
+# Print out a summary report.
+
+echo $t: ${status[${result}]}; echo
+let array[${result}]=${array[${result}]}+1
+done
+
+echo "Test summary:"
+echo ==================
+
+for s in 0 1 2 3 4
+do
+if [[ ${array[${s}]} -gt 0 || s -eq 1 ]]
+then
+echo ${status[${s}]} ${array[${s}]}
+fi
+done
+
+echo ==================
+echo "All tests done."
diff --git a/test/Test-Order b/test/Test-Order
new file mode 100644
index 00000000..2801878a
--- /dev/null
+++ b/test/Test-Order
@@ -0,0 +1,89 @@
+# General test
+
+all-in-place.test
+
+# Generator tests
+
+pbmmake.test
+pgmmake.test
+ppmmake.test
+pamseq.test
+
+pbmpage.test
+pbmtext.test
+pbmupc.test
+pgmramp.test
+ppmgauss.test
+ppmcie.test
+ppmwheel.test
+
+# Analyzer tests
+
+pamfile.test
+pgmhist.test
+ppmhist.test
+pamsumm.test
+pnmpsnr.test
+pbmminkowski.test
+
+# Basic (internal) converter tests
+
+pamtopam.test
+pgmtopgm.test
+ppmtoppm.test
+pgmtoppm.test
+ppmtopgm.test
+pnmtopnm-plain.test
+
+# Editor tests
+
+pamditherbw.test
+
+pbmclean.test
+pamcut.test
+pnmcat.test
+pamflip.test
+pamenlarge.test
+pnminvert.test
+
+pbmpscale.test
+pnmremap1.test
+pnmremap2.test
+pnmtile.test
+ppmbrighten.test
+ppmdither.test
+pamedge.test
+ppmdim.test
+
+ppmmix.test
+
+# Format converter tests
+
+pbmtog3.test
+
+# Round-trip tests : editors
+
+pnm-plain-roundtrip.test
+pnm-pam-roundtrip.test
+pnminvert-roundtrip.test
+pamflip-roundtrip.test
+pamdepth-roundtrip.test
+pad-crop-roundtrip.test
+cut-paste-roundtrip.test
+rgb3-roundtrip.test
+ppmchange-roundtrip.test
+pamdice-roundtrip.test
+pamslice-roundtrip.test
+
+# Round-trip tests : lossless converters
+
+g3-roundtrip.test
+bmp-roundtrip.test
+gif-roundtrip.test
+png-roundtrip.test
+ps-roundtrip.test
+tiff-roundtrip.test
+xbm-roundtrip.test
+xpm-roundtrip.test
+xwd-roundtrip.test
+hdiff-roundtrip.test
diff --git a/test/all-in-place.ok b/test/all-in-place.ok
new file mode 100644
index 00000000..52334382
--- /dev/null
+++ b/test/all-in-place.ok
@@ -0,0 +1,351 @@
+411toppm: ok
+asciitopgm: ok
+atktopbm: ok
+avstopam: ok
+bioradtopgm: ok
+bmptopnm: ok
+bmptoppm: ok
+brushtopbm: ok
+cameratopam: ok
+cistopbm: ok
+cmuwmtopbm: ok
+ddbugtopbm: ok
+escp2topbm: ok
+eyuvtoppm: ok
+fitstopnm: ok
+fstopgm: ok
+g3topbm: ok
+gemtopbm: ok
+gemtopnm: ok
+giftopnm: ok
+gouldtoppm: ok
+hdifftopam: ok
+hipstopgm: ok
+icontopbm: ok
+ilbmtoppm: ok
+imgtoppm: ok
+infotopam: ok
+jbigtopnm: ok
+jpeg2ktopam: ok
+jpegtopnm: ok
+leaftoppm: ok
+lispmtopgm: ok
+macptopbm: ok
+mdatopbm: ok
+mgrtopbm: ok
+mrftopbm: ok
+mtvtoppm: ok
+neotoppm: ok
+palmtopnm: ok
+pamaddnoise: ok
+pamarith: ok
+pambackground: ok
+pambayer: ok
+pamchannel: ok
+pamcomp: ok
+pamcut: ok
+pamdeinterlace: ok
+pamdepth: ok
+pamdice: ok
+pamditherbw: ok
+pamedge: ok
+pamendian: ok
+pamenlarge: ok
+pamexec: ok
+pamfile: ok
+pamfixtrunc: ok
+pamflip: ok
+pamfunc: ok
+pamgauss: ok
+pamgradient: ok
+pamlookup: ok
+pammasksharpen: ok
+pammixinterlace: ok
+pammosaicknit: ok
+pamoil: ok
+pampaintspill: ok
+pamperspective: ok
+pampick: ok
+pampop9: ok
+pamrecolor: ok
+pamrgbatopng: ok
+pamrubber: ok
+pamscale: ok
+pamseq: ok
+pamsharpmap: ok
+pamsharpness: ok
+pamsistoaglyph: ok
+pamslice: ok
+pamsplit: ok
+pamstack: ok
+pamstereogram: ok
+pamstretch: ok
+pamsumm: ok
+pamsummcol: ok
+pamthreshold: ok
+pamtilt: ok
+pamtoavs: ok
+pamtodjvurle: ok
+pamtofits: ok
+pamtogif: ok
+pamtohdiff: ok
+pamtohtmltbl: ok
+pamtojpeg2k: ok
+pamtompfont: ok
+pamtooctaveimg: ok
+pamtopam: ok
+pamtopdbimg: ok
+pamtopfm: ok
+pamtopnm: ok
+pamtosrf: ok
+pamtosvg: ok
+pamtotga: ok
+pamtotiff: ok
+pamtouil: ok
+pamtoxvmini: ok
+pamundice: ok
+pamwipeout: ok
+pamx: ok
+pbmclean: ok
+pbmlife: ok
+pbmmake: ok
+pbmmask: ok
+pbmminkowski: ok
+pbmpage: ok
+pbmpscale: ok
+pbmreduce: ok
+pbmtext: ok
+pbmtextps: ok
+pbmto10x: ok
+pbmto4425: ok
+pbmtoascii: ok
+pbmtoatk: ok
+pbmtobbnbg: ok
+pbmtocis: ok
+pbmtocmuwm: ok
+pbmtodjvurle: ok
+pbmtoepsi: ok
+pbmtoepson: ok
+pbmtoescp2: ok
+pbmtog3: ok
+pbmtogem: ok
+pbmtogo: ok
+pbmtoibm23xx: ok
+pbmtoicon: ok
+pbmtolj: ok
+pbmtoln03: ok
+pbmtolps: ok
+pbmtomacp: ok
+pbmtomatrixorbital: ok
+pbmtomda: ok
+pbmtomgr: ok
+pbmtomrf: ok
+pbmtonokia: ok
+pbmtopgm: ok
+pbmtopi3: ok
+pbmtopk: ok
+pbmtoplot: ok
+pbmtoppa: ok
+pbmtopsg3: ok
+pbmtoptx: ok
+pbmtosunicon: ok
+pbmtowbmp: ok
+pbmtoxbm: ok
+pbmtoybm: ok
+pbmtozinc: ok
+pbmupc: ok
+pc1toppm: ok
+pcxtoppm: ok
+pdbimgtopam: ok
+pfmtopam: ok
+pgmabel: ok
+pgmbentley: ok
+pgmcrater: ok
+pgmdeshadow: ok
+pgmedge: ok
+pgmenhance: ok
+pgmhist: ok
+pgmkernel: ok
+pgmmake: ok
+pgmmedian: ok
+pgmminkowski: ok
+pgmmorphconv: ok
+pgmnoise: ok
+pgmnorm: ok
+pgmoil: ok
+pgmramp: ok
+pgmslice: ok
+pgmtexture: ok
+pgmtofs: ok
+pgmtolispm: ok
+pgmtopbm: ok
+pgmtopgm: ok
+pgmtoppm: ok
+pi1toppm: ok
+pi3topbm: ok
+picttoppm: ok
+pjtoppm: ok
+pktopbm: ok
+pngtopam: ok
+pngtopnm: ok
+pnmalias: ok
+pnmarith: ok
+pnmcat: ok
+pnmcolormap: ok
+pnmcomp: ok
+pnmconvol: ok
+pnmcrop: ok
+pnmcut: ok
+pnmdepth: ok
+pnmenlarge: ok
+pnmfile: ok
+pnmflip: ok
+pnmgamma: ok
+pnmhisteq: ok
+pnmhistmap: ok
+pnmindex: ok
+pnminterp: ok
+pnminvert: ok
+pnmmercator: ok
+pnmmontage: ok
+pnmnlfilt: ok
+pnmnorm: ok
+pnmpad: ok
+pnmpaste: ok
+pnmpsnr: ok
+pnmremap: ok
+pnmrotate: ok
+pnmscale: ok
+pnmscalefixed: ok
+pnmshear: ok
+pnmsmooth: ok
+pnmsplit: ok
+pnmstitch: ok
+pnmtile: ok
+pnmtoddif: ok
+pnmtofiasco: ok
+pnmtofits: ok
+pnmtojbig: ok
+pnmtojpeg: ok
+pnmtopalm: ok
+pnmtopclxl: ok
+pnmtopng: ok
+pnmtopnm: ok
+pnmtops: ok
+pnmtorast: ok
+pnmtorle: ok
+pnmtosgi: ok
+pnmtosir: ok
+pnmtotiff: ok
+pnmtotiffcmyk: ok
+pnmtoxwd: ok
+ppm3d: ok
+ppmbrighten: ok
+ppmchange: ok
+ppmcie: ok
+ppmcolormask: ok
+ppmcolors: ok
+ppmdcfont: ok
+ppmddumpfont: ok
+ppmdim: ok
+ppmdist: ok
+ppmdither: ok
+ppmdmkfont: ok
+ppmdraw: ok
+ppmflash: ok
+ppmforge: ok
+ppmglobe: ok
+ppmhist: ok
+ppmlabel: ok
+ppmmake: ok
+ppmmix: ok
+ppmnorm: ok
+ppmntsc: ok
+ppmpat: ok
+ppmquant: ok
+ppmrelief: ok
+ppmrough: ok
+ppmshift: ok
+ppmspread: ok
+ppmtoacad: ok
+ppmtoapplevol: ok
+ppmtoarbtxt: ok
+ppmtoascii: ok
+ppmtobmp: ok
+ppmtoeyuv: ok
+ppmtogif: ok
+ppmtoicr: ok
+ppmtoilbm: ok
+ppmtojpeg: ok
+ppmtoleaf: ok
+ppmtolj: ok
+ppmtomitsu: ok
+ppmtompeg: ok
+ppmtoneo: ok
+ppmtopcx: ok
+ppmtopgm: ok
+ppmtopi1: ok
+ppmtopict: ok
+ppmtopj: ok
+ppmtopjxl: ok
+ppmtoppm: ok
+ppmtopuzz: ok
+ppmtorgb3: ok
+ppmtosixel: ok
+ppmtospu: ok
+ppmtoterm: ok
+ppmtouil: ok
+ppmtowinicon: ok
+ppmtoxpm: ok
+ppmtoyuv: ok
+ppmtoyuvsplit: ok
+ppmtv: ok
+ppmwheel: ok
+psidtopgm: ok
+pstopnm: ok
+qrttoppm: ok
+rasttopnm: ok
+rawtopgm: ok
+rawtoppm: ok
+rgb3toppm: ok
+rlatopam: ok
+rletopnm: ok
+sbigtopgm: ok
+sgitopnm: ok
+sirtopnm: ok
+sldtoppm: ok
+spctoppm: ok
+spottopgm: ok
+sputoppm: ok
+srftopam: ok
+sunicontopnm: ok
+svgtopam: ok
+tgatoppm: ok
+thinkjettopbm: ok
+tifftopnm: ok
+wbmptopbm: ok
+winicontoppm: ok
+xbmtopbm: ok
+ximtoppm: ok
+xpmtoppm: ok
+xvminitoppm: ok
+xwdtopnm: ok
+ybmtopbm: ok
+yuvsplittoppm: ok
+yuvtoppm: ok
+zeisstopnm: ok
+fiascotopnm: ok
+anytopnm: ok
+hpcdtoppm: ok
+manweb: ok
+pbmtox10bm: ok
+pnmmargin: ok
+pnmnoraw: ok
+pnmquant: ok
+pnmquantall: ok
+pnmtoplainpnm: ok
+ppmfade: ok
+ppmquantall: ok
+ppmrainbow: ok
+ppmshadow: ok
+ppmtomap: ok
diff --git a/test/all-in-place.test b/test/all-in-place.test
new file mode 100755
index 00000000..1726337b
--- /dev/null
+++ b/test/all-in-place.test
@@ -0,0 +1,104 @@
+#! /bin/bash
+# Tests whether the executable files listed below are in place.
+
+# See Netpbm Library Prerequisites
+# http://netpbm.sourceforge.net/prereq.html
+# if make succeeds but this test fails.
+
+# Test programs which support the --version flag.
+
+for i in \
+  411toppm asciitopgm atktopbm avstopam bioradtopgm \
+  bmptopnm bmptoppm brushtopbm cameratopam cistopbm \
+  cmuwmtopbm ddbugtopbm escp2topbm eyuvtoppm fitstopnm \
+  fstopgm g3topbm gemtopbm gemtopnm giftopnm gouldtoppm \
+  hdifftopam hipstopgm icontopbm ilbmtoppm imgtoppm infotopam \
+  jbigtopnm jpeg2ktopam jpegtopnm leaftoppm lispmtopgm \
+  macptopbm mdatopbm mgrtopbm mrftopbm mtvtoppm neotoppm \
+  palmtopnm pamaddnoise pamarith pambackground pambayer \
+  pamchannel pamcomp pamcut pamdeinterlace pamdepth \
+  pamdice pamditherbw pamedge pamendian pamenlarge \
+  pamexec pamfile pamfixtrunc pamflip pamfunc pamgauss \
+  pamgradient pamlookup pammasksharpen pammixinterlace \
+  pammosaicknit pamoil pampaintspill pamperspective pampick \
+  pampop9 pamrecolor pamrgbatopng pamrubber pamscale pamseq \
+  pamsharpmap pamsharpness pamsistoaglyph pamslice pamsplit \
+  pamstack pamstereogram pamstretch pamsumm pamsummcol \
+  pamthreshold pamtilt pamtoavs pamtodjvurle pamtofits \
+  pamtogif pamtohdiff pamtohtmltbl pamtojpeg2k pamtompfont \
+  pamtooctaveimg pamtopam pamtopdbimg pamtopfm pamtopnm \
+  pamtosrf pamtosvg pamtotga pamtotiff pamtouil pamtoxvmini \
+  pamundice pamwipeout pamx pbmclean pbmlife pbmmake pbmmask \
+  pbmminkowski pbmpage pbmpscale pbmreduce pbmtext pbmtextps \
+  pbmto10x pbmto4425 pbmtoascii pbmtoatk pbmtobbnbg pbmtocis \
+  pbmtocmuwm pbmtodjvurle pbmtoepsi pbmtoepson pbmtoescp2 \
+  pbmtog3 pbmtogem pbmtogo pbmtoibm23xx pbmtoicon pbmtolj \
+  pbmtoln03 pbmtolps pbmtomacp pbmtomatrixorbital pbmtomda \
+  pbmtomgr pbmtomrf pbmtonokia pbmtopgm pbmtopi3 pbmtopk \
+  pbmtoplot pbmtoppa pbmtopsg3 pbmtoptx pbmtosunicon \
+  pbmtowbmp pbmtoxbm pbmtoybm pbmtozinc pbmupc pc1toppm \
+  pcxtoppm pdbimgtopam pfmtopam pgmabel pgmbentley pgmcrater \
+  pgmdeshadow pgmedge pgmenhance pgmhist pgmkernel pgmmake \
+  pgmmedian pgmminkowski pgmmorphconv pgmnoise pgmnorm \
+  pgmoil pgmramp pgmslice pgmtexture pgmtofs pgmtolispm \
+  pgmtopbm pgmtopgm pgmtoppm pi1toppm pi3topbm picttoppm \
+  pjtoppm pktopbm pngtopam pngtopnm pnmalias pnmarith pnmcat \
+  pnmcolormap pnmcomp pnmconvol pnmcrop pnmcut pnmdepth \
+  pnmenlarge pnmfile pnmflip pnmgamma pnmhisteq pnmhistmap \
+  pnmindex pnminterp pnminvert pnmmercator pnmmontage \
+  pnmnlfilt pnmnorm pnmpad pnmpaste pnmpsnr pnmremap \
+  pnmrotate pnmscale pnmscalefixed pnmshear pnmsmooth \
+  pnmsplit pnmstitch pnmtile pnmtoddif pnmtofiasco pnmtofits \
+  pnmtojbig pnmtojpeg pnmtopalm pnmtopclxl pnmtopng pnmtopnm \
+  pnmtops pnmtorast pnmtorle pnmtosgi pnmtosir pnmtotiff \
+  pnmtotiffcmyk pnmtoxwd ppm3d ppmbrighten ppmchange \
+  ppmcie ppmcolormask ppmcolors ppmdcfont ppmddumpfont \
+  ppmdim ppmdist ppmdither ppmdmkfont ppmdraw ppmflash \
+  ppmforge ppmglobe ppmhist ppmlabel ppmmake ppmmix ppmnorm \
+  ppmntsc ppmpat ppmquant ppmrelief ppmrough ppmshift \
+  ppmspread ppmtoacad ppmtoapplevol ppmtoarbtxt ppmtoascii \
+  ppmtobmp ppmtoeyuv ppmtogif ppmtoicr ppmtoilbm ppmtojpeg \
+  ppmtoleaf ppmtolj ppmtomitsu ppmtompeg ppmtoneo ppmtopcx \
+  ppmtopgm ppmtopi1 ppmtopict ppmtopj ppmtopjxl ppmtoppm \
+  ppmtopuzz ppmtorgb3 ppmtosixel ppmtospu ppmtoterm ppmtouil \
+  ppmtowinicon ppmtoxpm ppmtoyuv ppmtoyuvsplit ppmtv ppmwheel \
+  psidtopgm pstopnm qrttoppm rasttopnm rawtopgm rawtoppm \
+  rgb3toppm rlatopam rletopnm sbigtopgm sgitopnm sirtopnm \
+  sldtoppm spctoppm spottopgm sputoppm srftopam sunicontopnm \
+  svgtopam tgatoppm thinkjettopbm tifftopnm wbmptopbm \
+  winicontoppm xbmtopbm ximtoppm xpmtoppm xvminitoppm \
+  xwdtopnm ybmtopbm yuvsplittoppm yuvtoppm zeisstopnm
+  do
+    ${PBM_TESTPREFIX}$i --version 2> /dev/null;
+    case $? in
+      0) echo $i": ok";;
+      127) echo $i": no such file";;
+      *) echo $i": error" $?;;
+    esac
+  done
+
+
+# Test fiascotopnm, which has a unique -v flag
+
+${PBM_TESTPREFIX}fiascotopnm -v 2> /dev/null
+  case $? in
+      2) echo fiascotopnm": ok";;
+      127) echo fiascotopnm": no such file";;
+      *) echo fiascotopnm": error" $?;;
+  esac
+
+
+# Test programs which do not have no --version flag.
+
+for i in \
+  anytopnm hpcdtoppm manweb pbmtox10bm pnmmargin \
+  pnmnoraw pnmquant pnmquantall pnmtoplainpnm ppmfade ppmquantall \
+  ppmrainbow ppmshadow ppmtomap
+  do
+    if [ -x ${PBM_TESTPREFIX}$i ]
+    then echo $i": ok"
+    elif [ -f ${PBM_TESTPREFIX}$i ]
+      then echo $i": not executable"
+      else echo $i": no such file"
+    fi
+ done
diff --git a/test/bmp-roundtrip.ok b/test/bmp-roundtrip.ok
new file mode 100644
index 00000000..67f7a1fe
--- /dev/null
+++ b/test/bmp-roundtrip.ok
@@ -0,0 +1,2 @@
+1926073387 101484
+2425386270 41
diff --git a/test/bmp-roundtrip.test b/test/bmp-roundtrip.test
new file mode 100755
index 00000000..af0e6948
--- /dev/null
+++ b/test/bmp-roundtrip.test
@@ -0,0 +1,6 @@
+#! /bin/bash
+# This script tests: bmptopnm ppmtobmp
+# Also requires: 
+
+${PBM_TESTPREFIX}ppmtobmp testimg.ppm | ${PBM_TESTPREFIX}bmptopnm | cksum
+${PBM_TESTPREFIX}ppmtobmp testgrid.pbm | ${PBM_TESTPREFIX}bmptopnm | cksum
\ No newline at end of file
diff --git a/test/cut-paste-roundtrip.ok b/test/cut-paste-roundtrip.ok
new file mode 100644
index 00000000..82eac5a8
--- /dev/null
+++ b/test/cut-paste-roundtrip.ok
@@ -0,0 +1 @@
+1926073387 101484
diff --git a/test/cut-paste-roundtrip.test b/test/cut-paste-roundtrip.test
new file mode 100755
index 00000000..cd81a1c6
--- /dev/null
+++ b/test/cut-paste-roundtrip.test
@@ -0,0 +1,6 @@
+#! /bin/bash
+# This script tests: pamcut pnmpaste
+# Also requires: 
+
+${PBM_TESTPREFIX}pamcut 50 40 100 70 ~/test-netpbm/testimg.ppm | \
+${PBM_TESTPREFIX}pnmpaste -replace - 50 40 ~/test-netpbm/testimg.ppm | cksum
diff --git a/test/g3-roundtrip.ok b/test/g3-roundtrip.ok
new file mode 100644
index 00000000..bb0b1cf6
--- /dev/null
+++ b/test/g3-roundtrip.ok
@@ -0,0 +1,3 @@
+0
+0
+0
diff --git a/test/g3-roundtrip.test b/test/g3-roundtrip.test
new file mode 100755
index 00000000..c5c21fa0
--- /dev/null
+++ b/test/g3-roundtrip.test
@@ -0,0 +1,13 @@
+#! /bin/bash
+# This script tests: g3topbm pbmtog3
+# Also requires: pnmcrop
+
+${PBM_TESTPREFIX}pbmtog3 -nofixedwidth testgrid.pbm | \
+${PBM_TESTPREFIX}g3topbm -width=14 | diff - testgrid.pbm ; echo $?
+
+${PBM_TESTPREFIX}pbmtog3 -nofixedwidth -reversebits testgrid.pbm | \
+${PBM_TESTPREFIX}g3topbm -width=14 -reversebits | diff - testgrid.pbm ; echo $?
+
+${PBM_TESTPREFIX}pbmtog3 testgrid.pbm | \
+${PBM_TESTPREFIX}g3topbm  | ${PBM_BINPREFIX}pnmcrop -white -right -bottom | \
+ diff - testgrid.pbm ; echo $?
diff --git a/test/gif-roundtrip.ok b/test/gif-roundtrip.ok
new file mode 100644
index 00000000..011ebd3a
--- /dev/null
+++ b/test/gif-roundtrip.ok
@@ -0,0 +1,3 @@
+2871603838 33838
+1926073387 101484
+2425386270 41
diff --git a/test/gif-roundtrip.test b/test/gif-roundtrip.test
new file mode 100755
index 00000000..73246705
--- /dev/null
+++ b/test/gif-roundtrip.test
@@ -0,0 +1,30 @@
+#! /bin/bash
+# This script tests: giftopnm pamtogif
+# Also requires: ppmtopgm ppmtorgb3 rgb3toppm
+
+# Test 1. Should produce 2871603838 33838
+# which is the result of ppmtopgm testimg.ppm | cksum
+
+${PBM_BINPREFIX}ppmtopgm testimg.ppm | \
+  ${PBM_TESTPREFIX}pamtogif | ${PBM_TESTPREFIX}giftopnm | cksum
+
+# Test 2. Break up input image into three monochrome planes,
+# maxval 255.  Transform each plane to gif and back to pgm.
+# Reassemble the planes.  Result should be identical to input.
+# Should print 1926073387 101484
+
+cp testimg.ppm ${tmpdir} &&
+${PBM_BINPREFIX}ppmtorgb3 ${tmpdir}/testimg.ppm &&
+${PBM_TESTPREFIX}pamtogif ${tmpdir}/testimg.red | \
+  ${PBM_TESTPREFIX}giftopnm > ${tmpdir}/out.red &&
+${PBM_TESTPREFIX}pamtogif ${tmpdir}/testimg.grn |
+  ${PBM_TESTPREFIX}giftopnm > ${tmpdir}/out.grn &&
+${PBM_TESTPREFIX}pamtogif ${tmpdir}/testimg.blu | \
+  ${PBM_TESTPREFIX}giftopnm | \
+  ${PBM_BINPREFIX}rgb3toppm ${tmpdir}/testimg.red ${tmpdir}/testimg.grn - | \
+  cksum
+
+rm ${tmpdir}/testimg.{ppm,red,grn,blu} ${tmpdir}/out.{red,grn}
+
+# Test 3. Should produce 2425386270 41
+${PBM_TESTPREFIX}pamtogif testgrid.pbm | ${PBM_TESTPREFIX}giftopnm | cksum
diff --git a/test/hdiff-roundtrip.ok b/test/hdiff-roundtrip.ok
new file mode 100644
index 00000000..82eac5a8
--- /dev/null
+++ b/test/hdiff-roundtrip.ok
@@ -0,0 +1 @@
+1926073387 101484
diff --git a/test/hdiff-roundtrip.test b/test/hdiff-roundtrip.test
new file mode 100755
index 00000000..dbe74701
--- /dev/null
+++ b/test/hdiff-roundtrip.test
@@ -0,0 +1,6 @@
+#! /bin/bash
+# This script tests: hdifftopam pamtohdiff
+# Also requires: 
+
+${PBM_TESTPREFIX}pamtohdiff testimg.ppm | \
+  ${PBM_TESTPREFIX}hdifftopam -pnm | cksum
\ No newline at end of file
diff --git a/test/pad-crop-roundtrip.ok b/test/pad-crop-roundtrip.ok
new file mode 100644
index 00000000..67f7a1fe
--- /dev/null
+++ b/test/pad-crop-roundtrip.ok
@@ -0,0 +1,2 @@
+1926073387 101484
+2425386270 41
diff --git a/test/pad-crop-roundtrip.test b/test/pad-crop-roundtrip.test
new file mode 100755
index 00000000..532b6cbd
--- /dev/null
+++ b/test/pad-crop-roundtrip.test
@@ -0,0 +1,8 @@
+#! /bin/bash
+# This script tests: pnmcrop pnmmargin
+# Also requires: 
+
+${PBM_TESTPREFIX}pnmmargin -white 10 testimg.ppm | \
+  ${PBM_TESTPREFIX}pnmcrop | cksum
+${PBM_TESTPREFIX}pnmmargin -white 10 testgrid.pbm | \
+  ${PBM_TESTPREFIX}pnmcrop | cksum
diff --git a/test/pamcut.ok b/test/pamcut.ok
new file mode 100644
index 00000000..61ef99bc
--- /dev/null
+++ b/test/pamcut.ok
@@ -0,0 +1,4 @@
+2958909756 124815
+1550940962 10933
+708474423 14
+3412257956 129
diff --git a/test/pamcut.test b/test/pamcut.test
new file mode 100755
index 00000000..080bcad8
--- /dev/null
+++ b/test/pamcut.test
@@ -0,0 +1,14 @@
+#! /bin/bash
+# This script tests: pamcut pbmmake
+# Also requires: 
+
+# Test 1.  Should print 2958909756 124815
+${PBM_TESTPREFIX}pamcut -top 0 -left 0 -width 260 -height 160 \
+  -pad testimg.ppm | cksum
+# Test 2.  Should print 1550940962 10933
+${PBM_TESTPREFIX}pamcut -top 200 -left 120 -width 40 -height 40 \
+  -pad testimg.ppm | cksum
+# Test 3.  Should print 708474423 14
+${PBM_TESTPREFIX}pamcut -top 5 -left 5 -bottom 5 -right 5 testimg.ppm | cksum
+# Test 3.  Should print 3412257956 129
+${PBM_TESTPREFIX}pbmmake -g 50 50 | ${PBM_TESTPREFIX}pamcut 5 5 30 30 | cksum
diff --git a/test/pamdepth-roundtrip.ok b/test/pamdepth-roundtrip.ok
new file mode 100644
index 00000000..89db1a57
--- /dev/null
+++ b/test/pamdepth-roundtrip.ok
@@ -0,0 +1,8 @@
+1926073387 101484
+1926073387 101484
+1926073387 101484
+1926073387 101484
+1926073387 101484
+1926073387 101484
+1926073387 101484
+2425386270 41
diff --git a/test/pamdepth-roundtrip.test b/test/pamdepth-roundtrip.test
new file mode 100755
index 00000000..2795d659
--- /dev/null
+++ b/test/pamdepth-roundtrip.test
@@ -0,0 +1,12 @@
+#! /bin/bash
+# This script tests: pamdepth pgmtopbm
+# Also requires: 
+
+for i in 300 500 1023 4095 5000 16383 65535
+do
+${PBM_TESTPREFIX}pamdepth $i testimg.ppm | \
+  ${PBM_TESTPREFIX}pamdepth 255 | cksum
+done
+
+${PBM_TESTPREFIX}pamdepth 255 testgrid.pbm | ${PBM_TESTPREFIX}pamdepth 1 | \
+  ${PBM_TESTPREFIX}pgmtopbm -th -val=0.5 | cksum
diff --git a/test/pamdice-roundtrip.ok b/test/pamdice-roundtrip.ok
new file mode 100644
index 00000000..82eac5a8
--- /dev/null
+++ b/test/pamdice-roundtrip.ok
@@ -0,0 +1 @@
+1926073387 101484
diff --git a/test/pamdice-roundtrip.test b/test/pamdice-roundtrip.test
new file mode 100755
index 00000000..06fef8b2
--- /dev/null
+++ b/test/pamdice-roundtrip.test
@@ -0,0 +1,9 @@
+#! /bin/bash
+# This script tests: pamdice pamundice
+# Also requires: 
+
+${PBM_TESTPREFIX}pamdice testimg.ppm -outstem=${tmpdir}/a -width=50 -height=40
+${PBM_TESTPREFIX}pamundice ${tmpdir}/a_%1d_%1a.ppm -down=4 -across=5 | cksum
+
+rm ${tmpdir}/a_?_?.ppm
+
diff --git a/test/pamditherbw.ok b/test/pamditherbw.ok
new file mode 100644
index 00000000..0711fa38
--- /dev/null
+++ b/test/pamditherbw.ok
@@ -0,0 +1,4 @@
+1421025574 33894
+164421928 33894
+486487763 33894
+3606822102 33894
diff --git a/test/pamditherbw.test b/test/pamditherbw.test
new file mode 100755
index 00000000..5335f12d
--- /dev/null
+++ b/test/pamditherbw.test
@@ -0,0 +1,31 @@
+#! /bin/bash
+# This script tests: pamditherbw
+# Also requires: ppmtopgm
+
+# Make test input
+${PBM_BINPREFIX}ppmtopgm testimg.ppm >${tmpdir}/testimg.pgm
+
+# Test 1.  Simple threshold
+${PBM_TESTPREFIX}pamditherbw -threshold -val=0.5 \
+   ${tmpdir}/testimg.pgm | cksum
+
+# Test 2.  Floyd-Steinberg
+#${PBM_TESTPREFIX}pamditherbw -floyd -val=0.5 ${tmpdir}/testimg.pgm | cksum
+
+# Test 3. Atkinson
+#${PBM_TESTPREFIX}pamditherbw -atkinson -val=0.5 ${tmpdir}/testimg.pgm | cksum
+
+# Test 4. Hilbert
+${PBM_TESTPREFIX}pamditherbw -hilbert ${tmpdir}/testimg.pgm | cksum
+
+# Test 5. Dither-8
+${PBM_TESTPREFIX}pamditherbw -dither8 ${tmpdir}/testimg.pgm | cksum
+
+# Test 6. Cluster4
+${PBM_TESTPREFIX}pamditherbw -cluster4 ${tmpdir}/testimg.pgm | cksum
+
+# Test 7. Atkinson
+#${PBM_TESTPREFIX}pamditherbw -atkinson -val=0.5 ${tmpdir}/testimg.pgm | cksum
+
+# Remove test file
+rm ${tmpdir}/testimg.pgm
diff --git a/test/pamedge.ok b/test/pamedge.ok
new file mode 100644
index 00000000..f1df7b80
--- /dev/null
+++ b/test/pamedge.ok
@@ -0,0 +1,77 @@
+P1
+60 75
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111000000000000000000000000000000000011111111111
+111111111111110000000000000000000000000000000000001111111111
+111111111111110001111111111111111111111111111110000111111111
+111111111111110011111111111111111111111111111111000111111111
+111111111111110001111111111111111111111111111111100111111111
+111111111111110000011111110000000000000000001111100111111111
+111111111111111000001111100000000000000000000111100111111111
+111111111111111110000111000011111111111111000011100111111111
+111111111111111111000111000111111111111111100011100111111111
+111111111111111111100111001111111111111111110001000111111111
+111111111111111111100111001111111111111111110000000111111111
+111111111111111111100111001111111111111111111000001111111111
+111111111111111111100111001111111111111111111111111111111111
+111111111111111111100111001111111111111111111111111111111111
+111111111111111111100111001111111111111111111111111111111111
+111111111111111111100111001111111111111100000111111111111111
+111111111111111111100111001111111111111000000011111111111111
+111111111111111111100111001111111111111000100011111111111111
+111111111111111111100111000111111111110001110011111111111111
+111111111111111111100111000011111111100001110011111111111111
+111111111111111111100111100000000000000011110011111111111111
+111111111111111111100111110000000000000111110011111111111111
+111111111111111111100111111111111111111111110011111111111111
+111111111111111111100111111111111111111111110011111111111111
+111111111111111111100111111111111111111111110011111111111111
+111111111111111111100111110000000000000111110011111111111111
+111111111111111111100111100000000000000011110011111111111111
+111111111111111111100111000011111111100001110011111111111111
+111111111111111111100111000111111111110001110011111111111111
+111111111111111111100111001111111111111000100011111111111111
+111111111111111111100111001111111111111000000011111111111111
+111111111111111111100111001111111111111100000111111111111111
+111111111111111111100111001111111111111111111111111111111111
+111111111111111111100111001111111111111111111111111111111111
+111111111111111111100111001111111111111111111111111111111111
+111111111111111111100111001111111111111111111111111111111111
+111111111111111111100111001111111111111111111111111111111111
+111111111111111111100111001111111111111111111111111111111111
+111111111111111111000111000111111111111111111111111111111111
+111111111111111110000111000011111111111111111111111111111111
+111111111111111000001111100000000001111111111111111111111111
+111111111111110000011111110000000000111111111111111111111111
+111111111111110001111111111111111000111111111111111111111111
+111111111111110011111111111111111100111111111111111111111111
+111111111111110001111111111111111000111111111111111111111111
+111111111111110000000000000000000000111111111111111111111111
+111111111111111000000000000000000001111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
diff --git a/test/pamedge.test b/test/pamedge.test
new file mode 100755
index 00000000..da1c0145
--- /dev/null
+++ b/test/pamedge.test
@@ -0,0 +1,7 @@
+#! /bin/bash
+# This script tests: pamedge
+# Also requires: pbmpscale pbmtext pgmtopbm pgmtopgm ppmtopgm
+
+${PBM_BINPREFIX}pbmtext " F " -nom | ${PBM_BINPREFIX}pbmpscale 5 | \
+${PBM_BINPREFIX}pgmtopgm | ${PBM_TESTPREFIX}pamedge | \
+${PBM_BINPREFIX}ppmtopgm | ${PBM_BINPREFIX}pgmtopbm -th -val=.5 -plain
diff --git a/test/pamenlarge.ok b/test/pamenlarge.ok
new file mode 100644
index 00000000..40be5918
--- /dev/null
+++ b/test/pamenlarge.ok
@@ -0,0 +1,4 @@
+3424505894 913236
+4152147096 304422
+3342398172 297
+237488670 3133413
diff --git a/test/pamenlarge.test b/test/pamenlarge.test
new file mode 100755
index 00000000..c3efc4b2
--- /dev/null
+++ b/test/pamenlarge.test
@@ -0,0 +1,12 @@
+#! /bin/bash
+# This script tests: pamenlarge
+# Also requires: ppmtopgm
+
+# Test 1.  Should print 3424505894 913236
+${PBM_TESTPREFIX}pamenlarge 3 testimg.ppm | cksum
+# Test 2.  Should print 4152147096 304422
+${PBM_BINPREFIX}ppmtopgm testimg.ppm | ${PBM_TESTPREFIX}pamenlarge 3 | cksum
+# Test 3.  Should print 3342398172 297
+${PBM_TESTPREFIX}pamenlarge 3 testgrid.pbm | cksum
+# Test 4.  Should print 237488670 3133413
+${PBM_TESTPREFIX}pamenlarge 3 -plain testimg.ppm | cksum
diff --git a/test/pamfile.ok b/test/pamfile.ok
new file mode 100644
index 00000000..6cdf0433
--- /dev/null
+++ b/test/pamfile.ok
@@ -0,0 +1,3 @@
+testimg.ppm:	PPM raw, 227 by 149  maxval 255
+testgrid.pbm:	PBM raw, 14 by 16
+stdin:	PGM raw, 227 by 149  maxval 255
diff --git a/test/pamfile.test b/test/pamfile.test
new file mode 100755
index 00000000..36ee557c
--- /dev/null
+++ b/test/pamfile.test
@@ -0,0 +1,7 @@
+#! /bin/bash
+# This script tests: pamfile
+# Also requires: ppmtopgm
+
+${PBM_TESTPREFIX}pamfile testimg.ppm
+${PBM_TESTPREFIX}pamfile testgrid.pbm
+${PBM_BINPREFIX}ppmtopgm testimg.ppm | ${PBM_TESTPREFIX}pamfile
diff --git a/test/pamflip-roundtrip.ok b/test/pamflip-roundtrip.ok
new file mode 100644
index 00000000..653ab007
--- /dev/null
+++ b/test/pamflip-roundtrip.ok
@@ -0,0 +1,12 @@
+1926073387 101484
+1926073387 101484
+1926073387 101484
+1926073387 101484
+1926073387 101484
+1926073387 101484
+2425386270 41
+2425386270 41
+2425386270 41
+2425386270 41
+2425386270 41
+2425386270 41
diff --git a/test/pamflip-roundtrip.test b/test/pamflip-roundtrip.test
new file mode 100755
index 00000000..7a17359f
--- /dev/null
+++ b/test/pamflip-roundtrip.test
@@ -0,0 +1,34 @@
+#! /bin/bash
+# This script tests: pamflip
+# Also requires: 
+
+${PBM_TESTPREFIX}pamflip -lr testimg.ppm | ${PBM_TESTPREFIX}pamflip -lr | cksum
+${PBM_TESTPREFIX}pamflip -tb testimg.ppm | ${PBM_TESTPREFIX}pamflip -tb | cksum
+${PBM_TESTPREFIX}pamflip -r180 testimg.ppm | \
+  ${PBM_TESTPREFIX}pamflip -r180 | cksum
+${PBM_TESTPREFIX}pamflip -xy testimg.ppm | ${PBM_TESTPREFIX}pamflip -xy | cksum
+${PBM_TESTPREFIX}pamflip -r90 testimg.ppm | \
+  ${PBM_TESTPREFIX}pamflip -r90 | \
+  ${PBM_TESTPREFIX}pamflip -r90 | \
+  ${PBM_TESTPREFIX}pamflip -r90 | cksum
+${PBM_TESTPREFIX}pamflip -r270 testimg.ppm | \
+  ${PBM_TESTPREFIX}pamflip -r270 | \
+  ${PBM_TESTPREFIX}pamflip -r270 | \
+  ${PBM_TESTPREFIX}pamflip -r270 | cksum
+
+${PBM_TESTPREFIX}pamflip -lr testgrid.pbm | \
+  ${PBM_TESTPREFIX}pamflip -lr | cksum
+${PBM_TESTPREFIX}pamflip -tb testgrid.pbm | \
+  ${PBM_TESTPREFIX}pamflip -tb | cksum
+${PBM_TESTPREFIX}pamflip -r180 testgrid.pbm | \
+  ${PBM_TESTPREFIX}pamflip -r180 | cksum
+${PBM_TESTPREFIX}pamflip -xy testgrid.pbm | \
+  ${PBM_TESTPREFIX}pamflip -xy | cksum
+${PBM_TESTPREFIX}pamflip -r90 testgrid.pbm | \
+  ${PBM_TESTPREFIX}pamflip -r90 | \
+  ${PBM_TESTPREFIX}pamflip -r90 | \
+  ${PBM_TESTPREFIX}pamflip -r90 | cksum
+${PBM_TESTPREFIX}pamflip -r270 testgrid.pbm | \
+  ${PBM_TESTPREFIX}pamflip -r270 | \
+  ${PBM_TESTPREFIX}pamflip -r270 | \
+  ${PBM_TESTPREFIX}pamflip -r270 | cksum
diff --git a/test/pamflip.ok b/test/pamflip.ok
new file mode 100644
index 00000000..c7427e46
--- /dev/null
+++ b/test/pamflip.ok
@@ -0,0 +1,6 @@
+2116496681 101484
+217037000 101484
+2052917888 101484
+3375384165 41
+604323149 41
+490797850 37
diff --git a/test/pamflip.test b/test/pamflip.test
new file mode 100755
index 00000000..59f8e639
--- /dev/null
+++ b/test/pamflip.test
@@ -0,0 +1,16 @@
+#! /bin/bash
+# This script tests: pamflip
+# Also requires: 
+
+# Test 1.  Should print 2116496681 101484
+${PBM_TESTPREFIX}pamflip -lr testimg.ppm | cksum 
+# Test 2.  Should print 217037000 101484
+${PBM_TESTPREFIX}pamflip -cw testimg.ppm | cksum
+# Test 3.  Should print 2052917888 101484
+${PBM_TESTPREFIX}pamflip -tb testimg.ppm | cksum
+# Test 4.  Should print 3375384165 41
+${PBM_TESTPREFIX}pamflip -lr testgrid.pbm | cksum
+# Test 5.  Should print 604323149 41
+${PBM_TESTPREFIX}pamflip -tb testgrid.pbm | cksum
+# Test 6.  Should print 490797850 37
+${PBM_TESTPREFIX}pamflip -cw testgrid.pbm | cksum
diff --git a/test/pamseq.ok b/test/pamseq.ok
new file mode 100644
index 00000000..52bb3dd8
--- /dev/null
+++ b/test/pamseq.ok
@@ -0,0 +1 @@
+3929266994 304
diff --git a/test/pamseq.test b/test/pamseq.test
new file mode 100755
index 00000000..1c6ae44b
--- /dev/null
+++ b/test/pamseq.test
@@ -0,0 +1,5 @@
+#! /bin/bash
+# This script tests: pamseq
+# Also requires: 
+
+${PBM_TESTPREFIX}pamseq 1 255 | cksum
diff --git a/test/pamslice-roundtrip.ok b/test/pamslice-roundtrip.ok
new file mode 100644
index 00000000..f9fe0bb4
--- /dev/null
+++ b/test/pamslice-roundtrip.ok
@@ -0,0 +1,2 @@
+2425386270 41
+1926073387 101484
diff --git a/test/pamslice-roundtrip.test b/test/pamslice-roundtrip.test
new file mode 100755
index 00000000..fd125500
--- /dev/null
+++ b/test/pamslice-roundtrip.test
@@ -0,0 +1,29 @@
+#! /bin/bash
+# This script tests: pamslice
+# Also requires: pnmtopnm
+
+# Slice rows, one by one, out of testgrid.pbm.
+# Add header and reconstruct pbm image.
+# Note that in pamslice output 0 is white and 1 is black: opposite of PBM
+# Should print 2425386270 41
+
+(echo "P1"
+ echo "14 16"
+ seq 0 15 | while read i; 
+     do
+     ${PBM_TESTPREFIX}pamslice -row=$i testgrid.pbm  | \
+      awk '{print $2}' | sed 'y/01/10/'; 
+     done ) |  ${PBM_BINPREFIX}pnmtopnm | cksum
+
+# Slice rows, one by one, out of testimg.ppm.
+# Add header and reconstruct pbm image.
+# Should print 1926073387 101484
+
+(echo "P3"
+ echo "227 149"
+ echo "255"
+ seq 0 148 | while read i; 
+     do
+     ${PBM_TESTPREFIX}pamslice -row=$i testimg.ppm  | awk '{print $2, $3, $4}'; 
+     done ) |  ${PBM_BINPREFIX}pnmtopnm | cksum
+
diff --git a/test/pamsumm.ok b/test/pamsumm.ok
new file mode 100644
index 00000000..0643081b
--- /dev/null
+++ b/test/pamsumm.ok
@@ -0,0 +1,8 @@
+56
+0
+1
+0.250000
+10772432
+15
+255
+106.164760
diff --git a/test/pamsumm.test b/test/pamsumm.test
new file mode 100755
index 00000000..9c5f1b84
--- /dev/null
+++ b/test/pamsumm.test
@@ -0,0 +1,13 @@
+#! /bin/bash
+# This script tests: pamsumm
+# Also requires: 
+
+for type in -sum -min -max -mean
+  do
+  ${PBM_TESTPREFIX}pamsumm -brief $type testgrid.pbm
+  done
+
+for type in -sum -min -max -mean
+  do
+  ${PBM_TESTPREFIX}pamsumm -brief $type testimg.ppm
+  done
diff --git a/test/pamtopam.ok b/test/pamtopam.ok
new file mode 100644
index 00000000..dcb597d3
--- /dev/null
+++ b/test/pamtopam.ok
@@ -0,0 +1,16 @@
+P7
+WIDTH 227
+HEIGHT 149
+DEPTH 3
+MAXVAL 255
+TUPLTYPE RGB
+ENDHDR
+P7
+WIDTH 14
+HEIGHT 16
+DEPTH 1
+MAXVAL 1
+TUPLTYPE BLACKANDWHITE
+ENDHDR
+1873848880 101532
+2260748250 293
diff --git a/test/pamtopam.test b/test/pamtopam.test
new file mode 100755
index 00000000..1a4cdff6
--- /dev/null
+++ b/test/pamtopam.test
@@ -0,0 +1,9 @@
+#! /bin/bash
+# This script tests: pamtopam
+# Also requires: 
+
+${PBM_TESTPREFIX}pamtopam < testimg.ppm  | sed '/ENDHDR/q'
+${PBM_TESTPREFIX}pamtopam < testgrid.pbm | sed '/ENDHDR/q'
+
+${PBM_TESTPREFIX}pamtopam < testimg.ppm   | cksum
+${PBM_TESTPREFIX}pamtopam < testgrid.pbm  | cksum
diff --git a/test/pbmclean.ok b/test/pbmclean.ok
new file mode 100644
index 00000000..71b622d0
--- /dev/null
+++ b/test/pbmclean.ok
@@ -0,0 +1,73 @@
+P1
+7 7
+1111111
+1111111
+1101011
+1110111
+1101011
+1111111
+1111111
+P1
+7 7
+1111111
+1111111
+1101011
+1110111
+1101011
+1111111
+1111111
+P1
+7 7
+1111111
+1111111
+1101011
+1110111
+1101011
+1111111
+1111111
+P1
+7 7
+0111110
+1111111
+1101011
+1110111
+1101011
+1111111
+0111110
+P1
+7 7
+0111110
+1111111
+1101011
+1110111
+1101011
+1111111
+0111110
+P1
+7 7
+0000000
+0111110
+0100010
+0100010
+0100010
+0111110
+0000000
+P1
+7 7
+0000000
+0110110
+0100010
+0000000
+0100010
+0110110
+0000000
+P1
+7 7
+0000000
+0000000
+0000000
+0000000
+0000000
+0000000
+0000000
+760076056 4210813
diff --git a/test/pbmclean.test b/test/pbmclean.test
new file mode 100755
index 00000000..05fe9338
--- /dev/null
+++ b/test/pbmclean.test
@@ -0,0 +1,16 @@
+#! /bin/bash
+# This script tests: pbmclean
+# Also requires: pbmmake pbmpage pnmmargin
+
+${PBM_BINPREFIX}pbmmake -g 3 3 | ${PBM_BINPREFIX}pnmmargin -black 2 \
+ >${tmpdir}/test.pbm
+
+for n in 1 2 3 4 5 6 7 8
+do
+${PBM_TESTPREFIX}pbmclean -min=$n -black -plain ${tmpdir}/test.pbm
+done
+
+rm ${tmpdir}/test.pbm
+
+# Should print 760076056 4210813
+${PBM_BINPREFIX}pbmpage 1 | ${PBM_TESTPREFIX}pbmclean -black | cksum
diff --git a/test/pbmmake.ok b/test/pbmmake.ok
new file mode 100644
index 00000000..754eefdf
--- /dev/null
+++ b/test/pbmmake.ok
@@ -0,0 +1,43 @@
+P11 10
+P11 11
+P11 10
+P12 20000
+P12 21111
+P12 20110
+P13 3000000000
+P13 3111111111
+P13 3010101010
+P14 40000000000000000
+P14 41111111111111111
+P14 40101101001011010
+P15 50000000000000000000000000
+P15 51111111111111111111111111
+P15 50101010101010101010101010
+P16 6000000000000000000000000000000000000
+P16 6111111111111111111111111111111111111
+P16 6010101101010010101101010010101101010
+P17 70000000000000000000000000000000000000000000000000
+P17 71111111111111111111111111111111111111111111111111
+P17 70101010101010101010101010101010101010101010101010
+P18 80000000000000000000000000000000000000000000000000000000000000000
+P18 81111111111111111111111111111111111111111111111111111111111111111
+P18 80101010110101010010101011010101001010101101010100101010110101010
+4058563256 45
+3969089344 105
+702117756 189
+1343035453 234
+2621551326 363
+1487646353 522
+3096107498 597
+2833028503 801
+4244475883 891
+294944575 1140
+244734977 1419
+2956143361 1539
+2229243214 1863
+1123259599 2217
+3622140854 2367
+194247095 2766
+1824232358 2931
+3651864954 3375
+3302595397 3849
diff --git a/test/pbmmake.test b/test/pbmmake.test
new file mode 100755
index 00000000..82fdb941
--- /dev/null
+++ b/test/pbmmake.test
@@ -0,0 +1,18 @@
+#! /bin/bash
+# This script tests: pbmmake
+# Also requires: 
+
+for i in `seq 1 8`
+do
+for color in -w -b -g
+do
+${PBM_TESTPREFIX}pbmmake -plain $color $i $i | tr -d '\n'; echo
+done
+done
+for i in `seq 8 5 98`
+do
+ ( ${PBM_TESTPREFIX}pbmmake -w $i $i ;
+  ${PBM_TESTPREFIX}pbmmake -b $i $i ;
+  ${PBM_TESTPREFIX}pbmmake  -g $i $i ) | cksum
+done
+
diff --git a/test/pbmminkowski.ok b/test/pbmminkowski.ok
new file mode 100644
index 00000000..71a909ce
--- /dev/null
+++ b/test/pbmminkowski.ok
@@ -0,0 +1,23 @@
+   tiles:	1
+ x-edges:	2
+ y-edges:	2
+vertices:	4
+    area:	1
+perimeter:	4
+ eulerchi:	1
+
+   tiles:	5
+ x-edges:	10
+ y-edges:	10
+vertices:	16
+    area:	5
+perimeter:	20
+ eulerchi:	1
+
+   tiles:	56
+ x-edges:	112
+ y-edges:	112
+vertices:	224
+    area:	56
+perimeter:	224
+ eulerchi:	56
diff --git a/test/pbmminkowski.test b/test/pbmminkowski.test
new file mode 100755
index 00000000..d0376e9e
--- /dev/null
+++ b/test/pbmminkowski.test
@@ -0,0 +1,10 @@
+#! /bin/bash
+# This script tests: pbmminkowski
+# Also requires: pbmmake pnmmargin
+
+${PBM_BINPREFIX}pbmmake -w 1 1 | ${PBM_BINPREFIX}pnmmargin -b 1 | \
+  ${PBM_TESTPREFIX}pbmminkowski
+echo
+${PBM_BINPREFIX}pbmmake -g 3 3 | ${PBM_TESTPREFIX}pbmminkowski
+echo
+${PBM_TESTPREFIX}pbmminkowski testgrid.pbm
\ No newline at end of file
diff --git a/test/pbmpage.ok b/test/pbmpage.ok
new file mode 100644
index 00000000..7f68da74
--- /dev/null
+++ b/test/pbmpage.ok
@@ -0,0 +1,3 @@
+550172004 4210813
+4142746975 4210813
+2347597649 4210813
diff --git a/test/pbmpage.test b/test/pbmpage.test
new file mode 100755
index 00000000..dcf8e688
--- /dev/null
+++ b/test/pbmpage.test
@@ -0,0 +1,7 @@
+#! /bin/bash
+# This script tests: pbmpage 
+# Also requires: 
+
+${PBM_TESTPREFIX}pbmpage 1 | cksum
+${PBM_TESTPREFIX}pbmpage 2 | cksum
+${PBM_TESTPREFIX}pbmpage 3 | cksum
\ No newline at end of file
diff --git a/test/pbmpscale.ok b/test/pbmpscale.ok
new file mode 100644
index 00000000..e25d4027
--- /dev/null
+++ b/test/pbmpscale.ok
@@ -0,0 +1,50 @@
+P1
+21 45
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+111111111111111111110
+111111111111111111111
+111111111111111111111
+001111100000000001111
+000111000000000000111
+000111000000000000111
+000111000000000000000
+000111000000000000000
+000111000000000000000
+000111000000000111000
+000111000000000111000
+000111100000001111000
+000111111111111111000
+000111111111111111000
+000111111111111111000
+000111100000001111000
+000111000000000111000
+000111000000000111000
+000111000000000000000
+000111000000000000000
+000111000000000000000
+000111000000000000000
+000111000000000000000
+001111100000000000000
+111111111111000000000
+111111111111000000000
+111111111111000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+000000000000000000000
+2150868536 457
+3761734242 1065
+3462719777 1803
diff --git a/test/pbmpscale.test b/test/pbmpscale.test
new file mode 100755
index 00000000..e1125fc7
--- /dev/null
+++ b/test/pbmpscale.test
@@ -0,0 +1,11 @@
+#! /bin/bash
+# This script tests: pbmpscale
+# Also requires: pamenlarge pbmtext
+
+${PBM_BINPREFIX}pbmtext -nomargin "F" | ${PBM_TESTPREFIX}pbmpscale 3 -plain 
+
+for i in 2 3 4
+do
+${PBM_BINPREFIX}pamenlarge 2 testgrid.pbm | \
+  ${PBM_TESTPREFIX}pbmpscale $i | cksum
+done
diff --git a/test/pbmtext.ok b/test/pbmtext.ok
new file mode 100644
index 00000000..438fe7b8
--- /dev/null
+++ b/test/pbmtext.ok
@@ -0,0 +1,21 @@
+1427751145 328
+1975911793 129
+3145408696 273
+2662867350 328
+3630387453 129
+1251480181 297
+1522829573 299
+1333433014 114
+4128014259 249
+2350105502 270
+2044333794 84
+2845861861 177
+2754777566 416
+3452484090 174
+2294575230 297
+67558248 387
+1647907430 159
+2846042958 249
+307551150 328
+584153820 114
+3355717231 177
diff --git a/test/pbmtext.test b/test/pbmtext.test
new file mode 100755
index 00000000..69fa9b23
--- /dev/null
+++ b/test/pbmtext.test
@@ -0,0 +1,11 @@
+#! /bin/bash
+# This script tests: pbmtext
+# Also requires: 
+
+for i in 0123456789 abcdefghijk lmnopqrst uzwxyz ABCDEFGHIJK LMNOPQRST UVWXYZ
+do
+for flags in "" "-nom" "-builtin fixed"
+do
+echo $i | ${PBM_TESTPREFIX}pbmtext $flags | cksum
+done
+done
diff --git a/test/pbmtog3.ok b/test/pbmtog3.ok
new file mode 100644
index 00000000..a0768f95
--- /dev/null
+++ b/test/pbmtog3.ok
@@ -0,0 +1,11 @@
+3697098186 144
+1248301383 122
+686713716 144
+215463240 122
+28792587 47
+277456854 32
+28792587 47
+871281767 162
+3736247115 62
+2820255307 2191856
+4159089282 2226575
diff --git a/test/pbmtog3.test b/test/pbmtog3.test
new file mode 100755
index 00000000..09b5d784
--- /dev/null
+++ b/test/pbmtog3.test
@@ -0,0 +1,28 @@
+#! /bin/bash
+# This script tests: pbmtog3
+# Also requires: pbmmake
+
+# Test 1.  Should print 3697098186 144
+${PBM_TESTPREFIX}pbmtog3 testgrid.pbm | cksum
+# Test 2.  Should print 1248301383 122
+${PBM_TESTPREFIX}pbmtog3 -nofixedwidth testgrid.pbm | cksum
+# Test 3.  Should print 686713716 144
+${PBM_TESTPREFIX}pbmtog3 -reverse testgrid.pbm | cksum
+# Test 4.  Should print 215463240 122
+${PBM_TESTPREFIX}pbmtog3 -nofixedwidth -reverse testgrid.pbm | cksum
+# Test 5.  Should print 28792587 47
+${PBM_BINPREFIX}pbmmake -w 10 10 | ${PBM_TESTPREFIX}pbmtog3 | cksum
+# Test 6.  Should print 277456854 32
+${PBM_BINPREFIX}pbmmake -w 10 10 | \
+  ${PBM_TESTPREFIX}pbmtog3 -nofixedwidth | cksum
+# Test 7.  Should print 28792587 47
+${PBM_BINPREFIX}pbmmake -w 10000 10 | ${PBM_TESTPREFIX}pbmtog3 | cksum
+# Test 8.  Should print 871281767 162
+${PBM_BINPREFIX}pbmmake -w 10000 10 | \
+  ${PBM_TESTPREFIX}pbmtog3 -nofixedwidth | cksum
+# Test 9.  Should print 3736247115 62
+${PBM_BINPREFIX}pbmmake -b 10 10 | ${PBM_TESTPREFIX}pbmtog3 | cksum
+# Test 10.  Should print 2820255307 2191856
+${PBM_BINPREFIX}pbmmake -g 1700 2286 | ${PBM_TESTPREFIX}pbmtog3 | cksum
+# Test 11.  Should print 4159089282 2226575
+${PBM_BINPREFIX}pbmmake -g 1800 2286 | ${PBM_TESTPREFIX}pbmtog3 | cksum
diff --git a/test/pbmupc.ok b/test/pbmupc.ok
new file mode 100644
index 00000000..3e58f409
--- /dev/null
+++ b/test/pbmupc.ok
@@ -0,0 +1 @@
+2619309127 10172
diff --git a/test/pbmupc.test b/test/pbmupc.test
new file mode 100755
index 00000000..6fa772d7
--- /dev/null
+++ b/test/pbmupc.test
@@ -0,0 +1,8 @@
+#! /bin/bash
+# This script tests: pbmupc
+# Also requires: 
+
+for type in -s1 -s2
+do
+${PBM_TESTPREFIX}pbmupc $type 0 72890 00011
+done | cksum
diff --git a/test/pgmhist.ok b/test/pgmhist.ok
new file mode 100644
index 00000000..d98c2244
--- /dev/null
+++ b/test/pgmhist.ok
@@ -0,0 +1,14 @@
+value  count  b%      w%   
+-----  -----  ------  ------
+    0      2   12.5%    100%
+    1      2     25%   87.5%
+    2      2   37.5%     75%
+    3      2     50%   62.5%
+    4      2   62.5%     50%
+    5      2     75%   37.5%
+    6      2   87.5%     25%
+    8      2    100%   12.5%
+value  count  b%      w%   
+-----  -----  ------  ------
+    0    168     75%    100%
+  255     56    100%     25%
diff --git a/test/pgmhist.test b/test/pgmhist.test
new file mode 100755
index 00000000..b5e7ef7d
--- /dev/null
+++ b/test/pgmhist.test
@@ -0,0 +1,6 @@
+#! /bin/bash
+# This script tests: pgmhist
+# Also requires: pgmramp
+
+${PBM_BINPREFIX}pgmramp -maxval=8 -lr 8 2 | ${PBM_TESTPREFIX}pgmhist
+${PBM_TESTPREFIX}pgmhist testgrid.pbm
\ No newline at end of file
diff --git a/test/pgmmake.ok b/test/pgmmake.ok
new file mode 100644
index 00000000..b9a03af2
--- /dev/null
+++ b/test/pgmmake.ok
@@ -0,0 +1,2 @@
+3662611538 2513
+3109612402 5012
diff --git a/test/pgmmake.test b/test/pgmmake.test
new file mode 100755
index 00000000..0180b502
--- /dev/null
+++ b/test/pgmmake.test
@@ -0,0 +1,10 @@
+#! /bin/bash
+# This script tests: pgmmake
+# Also requires: 
+
+${PBM_TESTPREFIX}pgmmake 1 50 50 | cksum
+${PBM_TESTPREFIX}pgmmake .2 50 100 -maxval=5 | cksum 
+
+
+
+ 
\ No newline at end of file
diff --git a/test/pgmramp.ok b/test/pgmramp.ok
new file mode 100644
index 00000000..0971ccd7
--- /dev/null
+++ b/test/pgmramp.ok
@@ -0,0 +1,32 @@
+P2
+4 4
+3
+0 1 2 3
+0 1 2 3
+0 1 2 3
+0 1 2 3
+P2
+4 4
+3
+0 0 0 0
+1 1 1 1
+2 2 2 2
+3 3 3 3
+P2
+4 4
+3
+0 0 1 0
+0 1 2 1
+1 2 3 2
+0 1 2 1
+P2
+4 4
+3
+0 0 0 0
+0 1 2 1
+0 2 3 2
+0 1 2 1
+1777787286 65551
+2046889993 65551
+1975520432 65551
+807973067 65551
diff --git a/test/pgmramp.test b/test/pgmramp.test
new file mode 100755
index 00000000..cf3d91d7
--- /dev/null
+++ b/test/pgmramp.test
@@ -0,0 +1,12 @@
+#! /bin/bash
+# This script tests: pgmramp
+# Also requires: 
+
+for type in -lr -tb -rect -ell
+do
+${PBM_TESTPREFIX}pgmramp -maxval=3 $type 4 4 -plain
+done
+
+for type in -lr -tb -rect -ell
+do ${PBM_TESTPREFIX}pgmramp $type 256 256 | cksum
+done
diff --git a/test/pgmtopgm.ok b/test/pgmtopgm.ok
new file mode 100644
index 00000000..53c25a44
--- /dev/null
+++ b/test/pgmtopgm.ok
@@ -0,0 +1 @@
+729348909 237
diff --git a/test/pgmtopgm.test b/test/pgmtopgm.test
new file mode 100755
index 00000000..638cb68b
--- /dev/null
+++ b/test/pgmtopgm.test
@@ -0,0 +1,5 @@
+#! /bin/bash
+# This script tests: pgmtopgm
+# Also requires: 
+
+${PBM_TESTPREFIX}pgmtopgm < testgrid.pbm | cksum
diff --git a/test/pgmtoppm.ok b/test/pgmtoppm.ok
new file mode 100644
index 00000000..55e5af95
--- /dev/null
+++ b/test/pgmtoppm.ok
@@ -0,0 +1,3 @@
+1767073524 779
+1676700883 779
+718580145 779
diff --git a/test/pgmtoppm.test b/test/pgmtoppm.test
new file mode 100755
index 00000000..b93d7867
--- /dev/null
+++ b/test/pgmtoppm.test
@@ -0,0 +1,18 @@
+#! /bin/bash
+# This script tests: pgmtoppm
+# Also requires: pamseq pamtopnm pgmramp
+
+${PBM_BINPREFIX}pgmramp -maxval=5 -lr 256 1 >${tmpdir}/test.pgm
+${PBM_BINPREFIX}pamseq 3 5 -tupletype=RGB | ${PBM_BINPREFIX}pamtopnm \
+  >${tmpdir}/palette
+
+# Test 1.
+${PBM_TESTPREFIX}pgmtoppm green ${tmpdir}/test.pgm | cksum
+
+${PBM_TESTPREFIX}pgmtoppm yellow-blue ${tmpdir}/test.pgm | cksum
+
+${PBM_TESTPREFIX}pgmtoppm -map=${tmpdir}/palette ${tmpdir}/test.pgm | cksum
+
+rm ${tmpdir}/test.pgm ${tmpdir}/palette
+
+
diff --git a/test/png-roundtrip.ok b/test/png-roundtrip.ok
new file mode 100644
index 00000000..67f7a1fe
--- /dev/null
+++ b/test/png-roundtrip.ok
@@ -0,0 +1,2 @@
+1926073387 101484
+2425386270 41
diff --git a/test/png-roundtrip.test b/test/png-roundtrip.test
new file mode 100755
index 00000000..6f25d1c3
--- /dev/null
+++ b/test/png-roundtrip.test
@@ -0,0 +1,7 @@
+#! /bin/bash
+# This script tests: pngtopnm pnmtopng
+# Also requires: 
+
+${PBM_TESTPREFIX}pnmtopng testimg.ppm | ${PBM_TESTPREFIX}pngtopnm | cksum
+${PBM_TESTPREFIX}pnmtopng testgrid.pbm | ${PBM_TESTPREFIX}pngtopnm | cksum
+
diff --git a/test/pnm-pam-roundtrip.ok b/test/pnm-pam-roundtrip.ok
new file mode 100644
index 00000000..67f7a1fe
--- /dev/null
+++ b/test/pnm-pam-roundtrip.ok
@@ -0,0 +1,2 @@
+1926073387 101484
+2425386270 41
diff --git a/test/pnm-pam-roundtrip.test b/test/pnm-pam-roundtrip.test
new file mode 100755
index 00000000..1aef986c
--- /dev/null
+++ b/test/pnm-pam-roundtrip.test
@@ -0,0 +1,7 @@
+#! /bin/bash
+# This script tests: pamtopam pamtopnm
+# Also requires: 
+
+${PBM_TESTPREFIX}pamtopam < testimg.ppm | ${PBM_TESTPREFIX}pamtopnm | cksum
+${PBM_TESTPREFIX}pamtopam < testgrid.pbm | ${PBM_TESTPREFIX}pamtopnm | cksum
+
diff --git a/test/pnm-plain-roundtrip.ok b/test/pnm-plain-roundtrip.ok
new file mode 100644
index 00000000..67f7a1fe
--- /dev/null
+++ b/test/pnm-plain-roundtrip.ok
@@ -0,0 +1,2 @@
+1926073387 101484
+2425386270 41
diff --git a/test/pnm-plain-roundtrip.test b/test/pnm-plain-roundtrip.test
new file mode 100755
index 00000000..eab0b0d7
--- /dev/null
+++ b/test/pnm-plain-roundtrip.test
@@ -0,0 +1,9 @@
+#! /bin/bash
+# This script tests: pnmtopnm
+# Also requires: 
+
+${PBM_TESTPREFIX}pnmtopnm -plain testimg.ppm | \
+  ${PBM_TESTPREFIX}pnmtopnm | cksum
+${PBM_TESTPREFIX}pnmtopnm -plain testgrid.pbm | \
+  ${PBM_TESTPREFIX}pnmtopnm | cksum
+
diff --git a/test/pnmcat.ok b/test/pnmcat.ok
new file mode 100644
index 00000000..68052957
--- /dev/null
+++ b/test/pnmcat.ok
@@ -0,0 +1,4 @@
+1704087873 73
+4150323653 73
+1522490272 202953
+2862441566 202953
diff --git a/test/pnmcat.test b/test/pnmcat.test
new file mode 100755
index 00000000..35efd515
--- /dev/null
+++ b/test/pnmcat.test
@@ -0,0 +1,9 @@
+#! /bin/bash
+# This script tests: pnmcat
+# Also requires: 
+
+${PBM_TESTPREFIX}pnmcat -lr testgrid.pbm testgrid.pbm | cksum
+${PBM_TESTPREFIX}pnmcat -tb testgrid.pbm testgrid.pbm | cksum
+
+${PBM_TESTPREFIX}pnmcat -lr testimg.ppm testimg.ppm | cksum
+${PBM_TESTPREFIX}pnmcat -tb testimg.ppm testimg.ppm | cksum
diff --git a/test/pnminvert-roundtrip.ok b/test/pnminvert-roundtrip.ok
new file mode 100644
index 00000000..67f7a1fe
--- /dev/null
+++ b/test/pnminvert-roundtrip.ok
@@ -0,0 +1,2 @@
+1926073387 101484
+2425386270 41
diff --git a/test/pnminvert-roundtrip.test b/test/pnminvert-roundtrip.test
new file mode 100755
index 00000000..8cdb6c25
--- /dev/null
+++ b/test/pnminvert-roundtrip.test
@@ -0,0 +1,6 @@
+#! /bin/bash
+# This script tests: pnminvert
+# Also requires: 
+
+${PBM_TESTPREFIX}pnminvert testimg.ppm | ${PBM_TESTPREFIX}pnminvert | cksum
+${PBM_TESTPREFIX}pnminvert testgrid.pbm | ${PBM_TESTPREFIX}pnminvert | cksum
diff --git a/test/pnminvert.ok b/test/pnminvert.ok
new file mode 100644
index 00000000..081e53ee
--- /dev/null
+++ b/test/pnminvert.ok
@@ -0,0 +1,7 @@
+1240379484 41
+1416115901 101484
+2961441369 33838
+2595564405 14
+2595564405 14
+2595564405 14
+2896726098 15
diff --git a/test/pnminvert.test b/test/pnminvert.test
new file mode 100755
index 00000000..7fc8523c
--- /dev/null
+++ b/test/pnminvert.test
@@ -0,0 +1,20 @@
+#! /bin/bash
+# This script tests: pnminvert
+# Also requires: pbmmake ppmtopgm
+
+# Test 1.  Should print 1240379484 41
+${PBM_TESTPREFIX}pnminvert testgrid.pbm | cksum
+# Test 2.  Should print 1416115901 101484
+${PBM_TESTPREFIX}pnminvert testimg.ppm | cksum
+# Test 3.  Should print 2961441369 33838
+# printed 4215652354 33838 with older ppmtopgm
+${PBM_BINPREFIX}ppmtopgm testimg.ppm | ${PBM_TESTPREFIX}pnminvert | cksum
+# Test 4.  Should print 2595564405 14
+${PBM_BINPREFIX}pbmmake -w 7 7 | ${PBM_TESTPREFIX}pnminvert | cksum
+# Test 5.  Should print 2595564405 14
+${PBM_BINPREFIX}pbmmake -b 7 7 | cksum
+# Test 6.  Should print 2595564405 14
+${PBM_BINPREFIX}pbmmake -b 7 7 | ${PBM_TESTPREFIX}pnminvert | \
+  ${PBM_TESTPREFIX}pnminvert | cksum
+# Test 7.  Should print 2896726098 15
+${PBM_BINPREFIX}pbmmake -g 8 8 | ${PBM_TESTPREFIX}pnminvert | cksum
diff --git a/test/pnmpsnr.ok b/test/pnmpsnr.ok
new file mode 100644
index 00000000..eff18efa
--- /dev/null
+++ b/test/pnmpsnr.ok
@@ -0,0 +1,2 @@
+0.00 dB
+don't differ.
diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test
new file mode 100755
index 00000000..d5aa07f3
--- /dev/null
+++ b/test/pnmpsnr.test
@@ -0,0 +1,11 @@
+#! /bin/bash
+# This script tests: pnmpsnr
+# Also requires: pbmmake
+
+${PBM_BINPREFIX}pbmmake -w 10 10 > ${tmpdir}/w.pbm
+${PBM_BINPREFIX}pbmmake -b 10 10 > ${tmpdir}/b.pbm
+${PBM_TESTPREFIX}pnmpsnr  ${tmpdir}/w.pbm  ${tmpdir}/b.pbm 2>&1 | \
+ awk '{print $(NF-1),$NF}'
+${PBM_TESTPREFIX}pnmpsnr  ${tmpdir}/w.pbm  ${tmpdir}/w.pbm 2>&1 | \
+ awk '{print $(NF-1),$NF}'
+rm ${tmpdir}/b.pbm ${tmpdir}/w.pbm
diff --git a/test/pnmremap1.ok b/test/pnmremap1.ok
new file mode 100644
index 00000000..a6cfc2bd
--- /dev/null
+++ b/test/pnmremap1.ok
@@ -0,0 +1 @@
+2667816854 101482
diff --git a/test/pnmremap1.test b/test/pnmremap1.test
new file mode 100755
index 00000000..1e68c8ad
--- /dev/null
+++ b/test/pnmremap1.test
@@ -0,0 +1,19 @@
+#! /bin/bash
+# This script tests: pnmremap
+# Also requires: pamdepth pamseq pamtopnm
+
+${PBM_BINPREFIX}pamseq 3 5 -tupletype=RGB | ${PBM_BINPREFIX}pamtopnm \
+ > ${tmpdir}/palette
+${PBM_BINPREFIX}pamdepth 255 ${tmpdir}/palette > ${tmpdir}/palette255
+
+# Test 1. Floyd-Steinberg
+# This fails with older versions of Netpbm and x86-64.
+# May also fail on other non-Intel architectures.
+# v. 10.59.2
+# x86-32: 2667816854 101482 
+# x86-64: 3602410851 101482
+
+${PBM_TESTPREFIX}pnmremap -mapfile=${tmpdir}/palette -floyd -norandom \
+ testimg.ppm | cksum
+
+rm ${tmpdir}/palette{,255}
diff --git a/test/pnmremap2.ok b/test/pnmremap2.ok
new file mode 100644
index 00000000..a2d1c0dc
--- /dev/null
+++ b/test/pnmremap2.ok
@@ -0,0 +1,3 @@
+3224011488 101482
+2325696119 101484
+2325696119 101484
diff --git a/test/pnmremap2.test b/test/pnmremap2.test
new file mode 100755
index 00000000..f2fd92e0
--- /dev/null
+++ b/test/pnmremap2.test
@@ -0,0 +1,21 @@
+#! /bin/bash
+# This script tests: pnmremap
+# Also requires: pamdepth pamseq pamtopnm
+
+${PBM_BINPREFIX}pamseq 3 5 -tupletype=RGB | ${PBM_BINPREFIX}pamtopnm \
+ > ${tmpdir}/palette
+${PBM_BINPREFIX}pamdepth 255 ${tmpdir}/palette > ${tmpdir}/palette255
+
+# Test 2. Default (unmodified quantization)
+${PBM_TESTPREFIX}pnmremap -mapfile=${tmpdir}/palette -nofloyd \
+testimg.ppm | cksum
+
+# Test 3. Use first color in palette for missing colors
+${PBM_TESTPREFIX}pnmremap -mapfile=${tmpdir}/palette255 -nofloyd \
+ -firstisdefault testimg.ppm | cksum
+
+# Test 4. Use black for missing colors
+${PBM_TESTPREFIX}pnmremap -mapfile=${tmpdir}/palette255 -nofloyd \
+-missingcolor=black testimg.ppm | cksum
+
+rm ${tmpdir}/palette{,255}
diff --git a/test/pnmtile.ok b/test/pnmtile.ok
new file mode 100644
index 00000000..559d0f65
--- /dev/null
+++ b/test/pnmtile.ok
@@ -0,0 +1,2 @@
+4228632379 259
+0
diff --git a/test/pnmtile.test b/test/pnmtile.test
new file mode 100755
index 00000000..b0c14ca6
--- /dev/null
+++ b/test/pnmtile.test
@@ -0,0 +1,12 @@
+#! /bin/bash
+# This script tests: pnmtile
+# Also requires: pnmcat
+
+${PBM_TESTPREFIX}pnmtile 40 50 testgrid.pbm | cksum
+
+${PBM_TESTPREFIX}pnmtile 454 298 testimg.ppm > ${tmpdir}/testimg4.ppm &&
+${PBM_BINPREFIX}pnmcat -lr testimg.ppm testimg.ppm > ${tmpdir}/testimg2.ppm &&
+${PBM_BINPREFIX}pnmcat -tb ${tmpdir}/testimg2.ppm ${tmpdir}/testimg2.ppm | \
+diff - ${tmpdir}/testimg4.ppm && echo $?
+
+rm ${tmpdir}/testimg{2,4}.ppm
diff --git a/test/pnmtopnm-plain.ok b/test/pnmtopnm-plain.ok
new file mode 100644
index 00000000..02d99f1e
--- /dev/null
+++ b/test/pnmtopnm-plain.ok
@@ -0,0 +1,48 @@
+P1
+14 16
+10101010101010
+11111111111111
+10101010101010
+11111111111111
+10101010101010
+11111111111111
+10101010101010
+11111111111111
+10101010101010
+11111111111111
+10101010101010
+11111111111111
+10101010101010
+11111111111111
+10101010101010
+11111111111111
+P2
+14 16
+255
+0 255 0 255 0 255 0 255 0 255 0 255 0 255 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+0 255 0 255 0 255 0 255 0 255 0 255 0 255 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+0 255 0 255 0 255 0 255 0 255 0 255 0 255 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+0 255 0 255 0 255 0 255 0 255 0 255 0 255 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+0 255 0 255 0 255 0 255 0 255 0 255 0 255 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+0 255 0 255 0 255 0 255 0 255 0 255 0 255 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+0 255 0 255 0 255 0 255 0 255 0 255 0 255 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+0 255 0 255 0 255 0 255 0 255 0 255 0 255 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+P3
+14 16
+255
+0 0 0 255 255 255 0 0 0 255 255 255 0 0 0 255 255 255 0 0 0 255 255 255 
+0 0 0 255 255 255 0 0 0 255 255 255 0 0 0 255 255 255 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+0 0 0 255 255 255 0 0 0 255 255 255 0 0 0 255 255 255 0 0 0 255 255 255 
+0 0 0 255 255 255 0 0 0 255 255 255 0 0 0 255 255 255 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
diff --git a/test/pnmtopnm-plain.test b/test/pnmtopnm-plain.test
new file mode 100755
index 00000000..3cbd5752
--- /dev/null
+++ b/test/pnmtopnm-plain.test
@@ -0,0 +1,10 @@
+#! /bin/bash
+# This script tests: pnmtopnm
+# Also requires: pgmtopgm ppmtoppm
+
+${PBM_TESTPREFIX}pnmtopnm -plain testgrid.pbm
+
+${PBM_BINPREFIX}pgmtopgm < testgrid.pbm | ${PBM_TESTPREFIX}pnmtopnm -plain
+
+${PBM_BINPREFIX}ppmtoppm < testgrid.pbm | ${PBM_TESTPREFIX}pnmtopnm -plain | \
+  head -n11
diff --git a/test/ppmbrighten.ok b/test/ppmbrighten.ok
new file mode 100644
index 00000000..65feb812
--- /dev/null
+++ b/test/ppmbrighten.ok
@@ -0,0 +1,3 @@
+2737989845 101484
+1059247992 101484
+32344911 101484
diff --git a/test/ppmbrighten.test b/test/ppmbrighten.test
new file mode 100755
index 00000000..72bebff4
--- /dev/null
+++ b/test/ppmbrighten.test
@@ -0,0 +1,7 @@
+#! /bin/bash
+# This script tests: ppmbrighten
+# Also requires: 
+
+${PBM_TESTPREFIX}ppmbrighten -v 100 testimg.ppm | cksum
+${PBM_TESTPREFIX}ppmbrighten -v 100 -normalize testimg.ppm | cksum
+${PBM_TESTPREFIX}ppmbrighten -s 100 -v -50 testimg.ppm | cksum
diff --git a/test/ppmchange-roundtrip.ok b/test/ppmchange-roundtrip.ok
new file mode 100644
index 00000000..a676a1f2
--- /dev/null
+++ b/test/ppmchange-roundtrip.ok
@@ -0,0 +1,2 @@
+2425386270 41
+2425386270 41
diff --git a/test/ppmchange-roundtrip.test b/test/ppmchange-roundtrip.test
new file mode 100755
index 00000000..c303c11b
--- /dev/null
+++ b/test/ppmchange-roundtrip.test
@@ -0,0 +1,11 @@
+#! /bin/bash
+# This script tests: ppmchange
+# Also requires: pgmtopbm pnminvert ppmtopgm
+
+${PBM_TESTPREFIX}ppmchange black white white black testgrid.pbm | \
+${PBM_BINPREFIX}pnminvert | ${PBM_BINPREFIX}ppmtopgm | \
+${PBM_BINPREFIX}pgmtopbm -th -val=0.5 | cksum
+
+${PBM_TESTPREFIX}ppmchange  black white white black testgrid.pbm | \
+${PBM_TESTPREFIX}ppmchange  black white white black -plain  | \
+${PBM_BINPREFIX}ppmtopgm | ${PBM_BINPREFIX}pgmtopbm -th -val=0.5 | cksum
diff --git a/test/ppmcie.ok b/test/ppmcie.ok
new file mode 100644
index 00000000..3398b2f7
--- /dev/null
+++ b/test/ppmcie.ok
@@ -0,0 +1 @@
+955840041 786447
diff --git a/test/ppmcie.out-64 b/test/ppmcie.out-64
new file mode 100644
index 00000000..3d8ca13a
--- /dev/null
+++ b/test/ppmcie.out-64
@@ -0,0 +1 @@
+2583941766 786447
diff --git a/test/ppmcie.test b/test/ppmcie.test
new file mode 100755
index 00000000..cd84536a
--- /dev/null
+++ b/test/ppmcie.test
@@ -0,0 +1,20 @@
+#! /bin/bash
+# This script tests: ppmcie
+# Also requires: 
+
+# Test 1. Should print 955840041 786447
+# Without -nolabel -noaxes -nowpoint -noblack older versions of
+# Netpbm produce slightly different charts.
+# Output from "ppmcie | cksum" :
+# v. 10.35.86: 288356530 786447   
+# v. 10.59.2 : 2292601420 786447  
+#
+# This test fails when ppmcie is compiled with SSE features are turned on.
+# Note that Gcc turns on SSE,SSE2 on by default for x86-64.
+
+# v. 10.59.2
+# x86 32 bit: 955840041 786447
+# x86 64 bit: 4208660683 786447
+
+${PBM_TESTPREFIX}ppmcie -nolabel -noaxes -nowpoint -noblack  | cksum
+
diff --git a/test/ppmdim.ok b/test/ppmdim.ok
new file mode 100644
index 00000000..9c55e064
--- /dev/null
+++ b/test/ppmdim.ok
@@ -0,0 +1,13 @@
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
+ok
diff --git a/test/ppmdim.test b/test/ppmdim.test
new file mode 100755
index 00000000..27bbc4e1
--- /dev/null
+++ b/test/ppmdim.test
@@ -0,0 +1,19 @@
+#! /bin/bash
+# This script tests: ppmdim
+# Also requires: pamfunc pamarith pamsumm
+
+# Compare ppmdim and pamfunc with various dim factors
+# Due to the difference rounding methods, pamfunc produces slightly
+# brighter images, by about 0.5 per pixel.
+# If the mean difference is between 0 and 0.75 we consider the output
+# normal.  This works for dim values up to 0.994 .
+
+for i in  0.125 0.25 0.5 0.75 0.1 0.0117 0.2 0.4 0.333 0.666 0.8 0.9 0.95
+  do
+  ${PBM_TESTPREFIX}ppmdim $i testimg.ppm > ${tmpdir}/dim1.ppm
+  ${PBM_BINPREFIX}pamfunc -mult=$i testimg.ppm > ${tmpdir}/dim2.ppm
+  ${PBM_BINPREFIX}pnmarith -diff ${tmpdir}/dim1.ppm ${tmpdir}/dim2.ppm | \
+    ${PBM_BINPREFIX}pamsumm -mean -brief | \
+    awk '{print $1<0.75 ? "ok" : "fail"}'
+  done
+rm ${tmpdir}/dim[12].ppm
diff --git a/test/ppmdither.ok b/test/ppmdither.ok
new file mode 100644
index 00000000..3159f17e
--- /dev/null
+++ b/test/ppmdither.ok
@@ -0,0 +1,3 @@
+1519741676 101482
+3886084802 101482
+3737986353 101482
diff --git a/test/ppmdither.test b/test/ppmdither.test
new file mode 100755
index 00000000..5fea0bb4
--- /dev/null
+++ b/test/ppmdither.test
@@ -0,0 +1,7 @@
+#! /bin/bash
+# This script tests: ppmdither
+# Also requires: 
+
+${PBM_TESTPREFIX}ppmdither testimg.ppm | cksum
+${PBM_TESTPREFIX}ppmdither -red 2 -green 2 -blue 2 testimg.ppm | cksum
+${PBM_TESTPREFIX}ppmdither -dim 2 testimg.ppm | cksum
diff --git a/test/ppmgauss.ok b/test/ppmgauss.ok
new file mode 100644
index 00000000..cf708d64
--- /dev/null
+++ b/test/ppmgauss.ok
@@ -0,0 +1,81 @@
+3712518499 55
+3712518499 55
+1147844094 55
+731871722 55
+1259293616 55
+4234223225 55
+171732531 55
+448293386 55
+3030522957 55
+757204806 62
+757204806 62
+2890088558 62
+4276668903 62
+1462902064 62
+4161772187 62
+2741154810 62
+417660035 62
+1026188683 62
+1236982144 71
+1236982144 71
+2668915323 71
+499504068 71
+3377926681 71
+1877781725 71
+1741784255 71
+2975827721 71
+185899480 71
+1890880170 82
+1890880170 82
+2007282168 82
+2290578407 82
+3295586348 82
+3202728672 82
+3794283497 82
+1136760947 82
+2659761303 82
+3268058875 95
+3268058875 95
+4112134785 95
+3700010306 95
+909823480 95
+2336604848 95
+3042873446 95
+299128630 95
+1852505233 95
+3614879265 110
+3614879265 110
+3727088180 110
+3861671574 110
+952180714 110
+1393452065 110
+1551903756 110
+2198775655 110
+3231547603 110
+3184597171 127
+3184597171 127
+406519147 127
+1836966508 127
+1796467962 127
+1932274161 127
+1852779549 127
+1734420920 127
+2400421918 127
+3252995941 148
+3252995941 148
+2022176119 148
+473753498 148
+3178129210 148
+2278608777 148
+3169785704 148
+85136480 148
+2396646133 148
+1871459418 169
+1871459418 169
+639002491 169
+1810927285 169
+4218372313 169
+1320749835 169
+4102007360 169
+3022719594 169
+1769176609 169
diff --git a/test/ppmgauss.test b/test/ppmgauss.test
new file mode 100755
index 00000000..a75d272c
--- /dev/null
+++ b/test/ppmgauss.test
@@ -0,0 +1,11 @@
+#! /bin/bash
+# This script tests: pamgauss
+# Also requires: 
+
+for i in `seq 3 11`
+do
+for s in `seq 1 9`
+do
+${PBM_TESTPREFIX}pamgauss $i $i -sigma=.$s | cksum
+done
+done
diff --git a/test/ppmhist.ok b/test/ppmhist.ok
new file mode 100644
index 00000000..91731d4b
--- /dev/null
+++ b/test/ppmhist.ok
@@ -0,0 +1,11 @@
+value  count  b%      w%   
+-----  -----  ------  ------
+    0      2   12.5%    100%
+    1      2     25%   87.5%
+    2      2   37.5%     75%
+    3      2     50%   62.5%
+    4      2   62.5%     50%
+    5      2     75%   37.5%
+    6      2   87.5%     25%
+    8      2    100%   12.5%
+3438989921 711087
diff --git a/test/ppmhist.test b/test/ppmhist.test
new file mode 100755
index 00000000..29bba206
--- /dev/null
+++ b/test/ppmhist.test
@@ -0,0 +1,7 @@
+#! /bin/bash
+# This script tests: ppmhist
+# Also requires: pgmhist pgmramp
+
+${PBM_BINPREFIX}pgmramp -maxval=8 -lr 8 2 | ${PBM_BINPREFIX}pgmhist
+${PBM_TESTPREFIX}ppmhist -map -sort=rgb testimg.ppm | cksum
+
diff --git a/test/ppmmake.ok b/test/ppmmake.ok
new file mode 100644
index 00000000..0e871732
--- /dev/null
+++ b/test/ppmmake.ok
@@ -0,0 +1,2 @@
+2477651508 15012
+2378991101 7513
diff --git a/test/ppmmake.test b/test/ppmmake.test
new file mode 100755
index 00000000..02e747ab
--- /dev/null
+++ b/test/ppmmake.test
@@ -0,0 +1,13 @@
+#! /bin/bash
+# This script tests: ppmmake
+# Also requires: 
+
+#export RGBDEF=/usr/share/emacs/23.2/etc/rgb.txt
+
+${PBM_TESTPREFIX}ppmmake rgb:ff/80/80 50 100 -maxval=5 | cksum
+${PBM_TESTPREFIX}ppmmake red 50 50  | cksum
+
+
+
+
+ 
\ No newline at end of file
diff --git a/test/ppmmix.ok b/test/ppmmix.ok
new file mode 100644
index 00000000..88bcef4a
--- /dev/null
+++ b/test/ppmmix.ok
@@ -0,0 +1,17 @@
+P2
+8 8
+3
+3 2 3 2 1 0 1 0 
+2 3 2 3 0 1 0 1 
+3 2 3 2 1 0 1 0 
+2 3 2 3 0 1 0 1 
+1 0 1 0 3 2 3 2 
+0 1 0 1 2 3 2 3 
+1 0 1 0 3 2 3 2 
+0 1 0 1 2 3 2 3 
+1926073387 101484
+1926073387 101484
+1926073387 101484
+1926073387 101484
+127
+127
diff --git a/test/ppmmix.test b/test/ppmmix.test
new file mode 100755
index 00000000..0f9deedc
--- /dev/null
+++ b/test/ppmmix.test
@@ -0,0 +1,29 @@
+#! /bin/bash
+# This script tests: ppmmix
+# Also requires: pamdepth pamenlarge pamsumm pbmmake
+# Also requires: pgmtopgm pnminvert ppmtopgm
+
+# Print a pretty checkerboard pattern
+${PBM_BINPREFIX}pbmmake -g 8 8 | \
+ ${PBM_BINPREFIX}pgmtopgm > ${tmpdir}/a1.pgm &&
+${PBM_BINPREFIX}pbmmake -g 2 2 | ${PBM_BINPREFIX}pamenlarge 4 | \
+ ${PBM_BINPREFIX}pgmtopgm > ${tmpdir}/a2.pgm &&
+${PBM_TESTPREFIX}ppmmix 0.75 ${tmpdir}/a1.pgm ${tmpdir}/a2.pgm -plain | \
+ ${PBM_BINPREFIX}ppmtopgm | ${PBM_BINPREFIX}pamdepth 3 -plain &&
+rm ${tmpdir}/a1.pgm ${tmpdir}/a2.pgm
+
+# Mix image with itself.
+# Output should match input regardless of ratio. 
+for i in 0 0.5 0.6 1
+do 
+${PBM_TESTPREFIX}ppmmix $i testimg.ppm testimg.ppm | cksum
+done
+
+# Mix image with its own inverse.
+# Output should be a monotone gray sheet.
+${PBM_BINPREFIX}pnminvert testimg.ppm | ${PBM_TESTPREFIX}ppmmix .5 \
+    testimg.ppm - | tee ${tmpdir}/a3.ppm | \
+  ${PBM_BINPREFIX}pamsumm -brief -max &&
+  ${PBM_BINPREFIX}pamsumm -brief -min ${tmpdir}/a3.ppm &&
+
+rm ${tmpdir}/a3.ppm
diff --git a/test/ppmtopgm.ok b/test/ppmtopgm.ok
new file mode 100644
index 00000000..32a4743b
--- /dev/null
+++ b/test/ppmtopgm.ok
@@ -0,0 +1 @@
+2871603838 33838
diff --git a/test/ppmtopgm.test b/test/ppmtopgm.test
new file mode 100755
index 00000000..7ab481c6
--- /dev/null
+++ b/test/ppmtopgm.test
@@ -0,0 +1,7 @@
+#! /bin/bash
+# This script tests: ppmtopgm
+# Also requires: 
+
+# Test 1. Should produce 2871603838 33838
+${PBM_TESTPREFIX}ppmtopgm testimg.ppm | cksum
+
diff --git a/test/ppmtoppm.ok b/test/ppmtoppm.ok
new file mode 100644
index 00000000..764a3464
--- /dev/null
+++ b/test/ppmtoppm.ok
@@ -0,0 +1 @@
+829921912 685
diff --git a/test/ppmtoppm.test b/test/ppmtoppm.test
new file mode 100755
index 00000000..c073ecff
--- /dev/null
+++ b/test/ppmtoppm.test
@@ -0,0 +1,5 @@
+#! /bin/bash
+# This script tests: ppmtoppm
+# Also requires: 
+
+${PBM_TESTPREFIX}ppmtoppm < testgrid.pbm | cksum
\ No newline at end of file
diff --git a/test/ppmwheel.ok b/test/ppmwheel.ok
new file mode 100644
index 00000000..24756d1e
--- /dev/null
+++ b/test/ppmwheel.ok
@@ -0,0 +1,2 @@
+1537578995 59
+875938089 86
diff --git a/test/ppmwheel.test b/test/ppmwheel.test
new file mode 100755
index 00000000..4d786f26
--- /dev/null
+++ b/test/ppmwheel.test
@@ -0,0 +1,113 @@
+#! /bin/bash
+# This script tests: ppmwheel
+# Also requires: 
+
+# For values 6 and above, x86(-32) and x86-64 produce different output.
+# SSE floating-point math is the probable cause.
+
+for i in 4 5
+do
+${PBM_TESTPREFIX}ppmwheel $i | cksum
+done
+
+#   i    32 bit              64 bit
+#
+#   6:   343122583   119     142348877   119
+#   7:  3572780137   158    3220488357   158
+#   8:  3078449954   203    1413542034   203
+#   9:  3437862278   254     311501249   254
+#  10:  1111245327   313     582960969   313
+#  11:   548273236   376    3726921442   376
+#  12:  2741456118   445    3696607391   445
+#  13:   673636665   520    1059273944   520
+#  14:  2445730101   601    3445053713   601
+#  15:   592850912   688    1691004230   688
+#  16:  3302887123   781      86998539   781
+#  17:  1786065899   880    2476986124   880
+#  18:   186804914   985    2853442889   985
+#  19:  1453260662  1096    3182405636  1096
+#  20:  1467480434  1213    4040494227  1213
+#  21:  1062903055  1336     810283715  1336
+#  22:  2638704989  1465     338245948  1465
+#  23:  3441453532  1600    2213581565  1600
+#  24:  1836362684  1741    2056241218  1741
+#  25:  3423398348  1888    3519123827  1888
+#  26:  3262548375  2041     684292199  2041
+#  27:  3598993221  2200    1577275941  2200
+#  28:  3728319498  2365    1061803162  2365
+#  29:  3729945629  2536     133069086  2536
+#  30:  3645113424  2713    3302414477  2713
+#  31:  2873651818  2896    3660671646  2896
+#  32:  1408491813  3085    2010949125  3085
+#  33:  3781351758  3280    1548995986  3280
+#  34:  3242345057  3481    3082631326  3481
+#  35:  2550511376  3688    1038419921  3688
+#  36:  1028065649  3901    2532290776  3901
+#  37:  1140380377  4120    2428435544  4120
+#  38:  1066850059  4345    3102961014  4345
+#  39:  3620700071  4576    1898018896  4576
+#  40:   504158758  4813     272658385  4813
+#  41:  1349365217  5056     270227718  5056
+#  42:    41774986  5305     509262620  5305
+#  43:  2655322328  5560    4133072843  5560
+#  44:  2318607206  5821    3294034402  5821
+#  45:  2178510518  6088    3314361750  6088
+#  46:  3285054002  6361    2469557621  6361
+#  47:  3047461329  6640    3629344726  6640
+#  48:   137286416  6925    4222495543  6925
+#  49:  2115001463  7216    2668575184  7216
+#  50:  1677997300  7513    2978221605  7513
+#  51:  1365174489  7816    3575061958  7816
+#  52:  2863311036  8125    1791798959  8125
+#  53:  3791281707  8440    3482008958  8440
+#  54:  2687508733  8761    4163388707  8761
+#  55:  2593010606  9088    3561733531  9088
+#  56:  2976537803  9421    3234561645  9421
+#  57:  2850729115  9760    1244925692  9760
+#  58:   224433311 10105    3825098819 10105
+#  59:   547683536 10456    3988409437 10456
+#  60:   369722519 10813    2020750234 10813
+#  61:   745454697 11176    1184600938 11176
+#  62:  1380472574 11545    1044589924 11545
+#  63:  1812671001 11920     238104621 11920
+#  64:  2833858343 12301     228306790 12301
+#  65:   957265138 12688     470109697 12688
+#  66:   895413590 13081     944950937 13081
+#  67:  3724154793 13480     126668527 13480
+#  68:   741064239 13885    1930273504 13885
+#  69:   785023636 14296    3279987135 14296
+#  70:  3649222232 14713    2854788625 14713
+#  71:  1997467987 15136    1689264112 15136
+#  72:  3469507186 15565     682126673 15565
+#  73:  2831204610 16000    1826370607 16000
+#  74:  3154512856 16441    1843713601 16441
+#  75:  1469123916 16888    3700274597 16888
+#  76:  2909139778 17341    2769322155 17341
+#  77:  2945643808 17800    1176063119 17800
+#  78:  3334870474 18265    2274153840 18265
+#  79:  1788316629 18736    1170513638 18736
+#  80:  1236198778 19213     780491458 19213
+#  81:  1946474293 19696    2989417839 19696
+#  82:  1479086076 20185    1500511762 20185
+#  83:  3510147444 20680    1990564736 20680
+#  84:  4044688071 21181    2820276538 21181
+#  85:  1293455808 21688    1335142677 21688
+#  86:  3408774244 22201    2664774438 22201
+#  87:  3591290969 22720    1236374968 22720
+#  88:  3814759633 23245    2889543826 23245
+#  89:  4157749717 23776    4033323913 23776
+#  90:  3512276083 24313    1722273029 24313
+#  91:   797424413 24856    1737843448 24856
+#  92:  3480584612 25405    1304329442 25405
+#  93:  2445523895 25960    1260847516 25960
+#  94:  3157009888 26521    1120864660 26521
+#  95:   103872014 27088    2076594208 27088
+#  96:  1584398684 27661     213099822 27661
+#  97:  3586313190 28240     944151015 28240
+#  98:  4086203619 28825    1961862620 28825
+#  99:  3656777902 29416    2475351252 29416
+# 100:  2246720411 30015    4055518595 30015
+
+
+
+ 
\ No newline at end of file
diff --git a/test/ps-roundtrip.ok b/test/ps-roundtrip.ok
new file mode 100644
index 00000000..67f7a1fe
--- /dev/null
+++ b/test/ps-roundtrip.ok
@@ -0,0 +1,2 @@
+1926073387 101484
+2425386270 41
diff --git a/test/ps-roundtrip.test b/test/ps-roundtrip.test
new file mode 100755
index 00000000..6d6935af
--- /dev/null
+++ b/test/ps-roundtrip.test
@@ -0,0 +1,21 @@
+#! /bin/bash
+# This script tests: pnmtops pstopnm
+# Also requires: pnmtopnm
+
+${PBM_TESTPREFIX}pnmtops -nocenter -equalpixels -dpi 72 -noturn testimg.ppm \
+  > ${tmpdir}/testimg.ps
+xysize=`awk  '/BoundingBox/ {print "-xsize="$4,"-ysize="$5}' \
+  ${tmpdir}/testimg.ps` 
+${PBM_TESTPREFIX}pstopnm -xborder=0 -yborder=0 $xysize -stdout \
+  -quiet ${tmpdir}/testimg.ps | \
+  ${PBM_BINPREFIX}pnmtopnm | cksum
+
+${PBM_TESTPREFIX}pnmtops -nocenter -equalpixels -dpi 72 -noturn testgrid.pbm \
+  > ${tmpdir}/testgrid.ps
+xysize=`awk  '/BoundingBox/ {print "-xsize="$4,"-ysize="$5}' \
+  ${tmpdir}/testgrid.ps`
+${PBM_TESTPREFIX}pstopnm -xborder=0 -yborder=0 $xysize -stdout \
+  -quiet ${tmpdir}/testgrid.ps -pbm | \
+  ${PBM_BINPREFIX}pnmtopnm | cksum
+
+rm  ${tmpdir}/testgrid.ps  ${tmpdir}/testimg.ps
diff --git a/test/rgb3-roundtrip.ok b/test/rgb3-roundtrip.ok
new file mode 100644
index 00000000..745a7c5f
--- /dev/null
+++ b/test/rgb3-roundtrip.ok
@@ -0,0 +1,5 @@
+1926073387 101484
+2425386270 41
+0
+0
+0
diff --git a/test/rgb3-roundtrip.test b/test/rgb3-roundtrip.test
new file mode 100755
index 00000000..9cc45499
--- /dev/null
+++ b/test/rgb3-roundtrip.test
@@ -0,0 +1,31 @@
+#! /bin/bash
+# This script tests: ppmtorgb3 rgb3toppm
+# Also requires: pgmtopbm pgmtopgm ppmtopgm
+
+# Break an image into three monochrome planes, reassemble the
+# image from them and check whether the resulting output is
+# identical to the original input.
+
+cp testimg.ppm ${tmpdir} &&
+${PBM_TESTPREFIX}ppmtorgb3 ${tmpdir}/testimg.ppm &&
+${PBM_TESTPREFIX}rgb3toppm ${tmpdir}/testimg.red ${tmpdir}/testimg.grn \
+  ${tmpdir}/testimg.blu | cksum
+
+rm ${tmpdir}/testimg.{ppm,red,grn,blu}
+
+cp testgrid.pbm ${tmpdir} &&
+${PBM_TESTPREFIX}ppmtorgb3 ${tmpdir}/testgrid.pbm &&
+${PBM_TESTPREFIX}rgb3toppm ${tmpdir}/testgrid.red ${tmpdir}/testgrid.grn \
+  ${tmpdir}/testgrid.blu | \
+  ${PBM_BINPREFIX}ppmtopgm | ${PBM_BINPREFIX}pgmtopbm -th -val=0.5 | cksum
+
+
+# With PGM or PBM input, the three monochrome planes should be
+# identical.  Test for this.
+
+diff ${tmpdir}/testgrid.red ${tmpdir}/testgrid.grn ; echo $?
+diff ${tmpdir}/testgrid.grn ${tmpdir}/testgrid.blu ; echo $?
+${PBM_BINPREFIX}pgmtopgm < testgrid.pbm | diff - ${tmpdir}/testgrid.red;
+  echo $?
+
+rm ${tmpdir}/testgrid.{pbm,red,grn,blu}
diff --git a/testgrid.pbm b/test/testgrid.pbm
index cc6a50aa..cc6a50aa 100644
--- a/testgrid.pbm
+++ b/test/testgrid.pbm
diff --git a/testimg.ppm b/test/testimg.ppm
index 061d5368..061d5368 100644
--- a/testimg.ppm
+++ b/test/testimg.ppm
diff --git a/test/tiff-roundtrip.ok b/test/tiff-roundtrip.ok
new file mode 100644
index 00000000..0e712ce7
--- /dev/null
+++ b/test/tiff-roundtrip.ok
@@ -0,0 +1,4 @@
+1926073387 101484
+1926073387 101484
+2425386270 41
+2425386270 41
diff --git a/test/tiff-roundtrip.test b/test/tiff-roundtrip.test
new file mode 100755
index 00000000..e7f875cf
--- /dev/null
+++ b/test/tiff-roundtrip.test
@@ -0,0 +1,20 @@
+#! /bin/bash
+# This script tests: pamtotiff tifftopnm
+# Also requires: 
+
+${PBM_TESTPREFIX}pamtotiff testimg.ppm 1<>${tmpdir}/test1.tiff &&
+  ${PBM_TESTPREFIX}tifftopnm ${tmpdir}/test1.tiff | cksum
+
+# test flate compression 
+# Will fail if Netpbm was built without the flate library
+${PBM_TESTPREFIX}pamtotiff -flate testimg.ppm 1<>${tmpdir}/test2.tiff &&
+  ${PBM_TESTPREFIX}tifftopnm ${tmpdir}/test2.tiff | cksum
+
+${PBM_TESTPREFIX}pamtotiff testgrid.pbm 1<>${tmpdir}/test3.tiff &&
+  ${PBM_TESTPREFIX}tifftopnm ${tmpdir}/test3.tiff | cksum
+
+# test G4 compression 
+${PBM_TESTPREFIX}pamtotiff -g4 testgrid.pbm 1<>${tmpdir}/test4.tiff &&
+  ${PBM_TESTPREFIX}tifftopnm ${tmpdir}/test4.tiff | cksum
+
+rm ${tmpdir}/test[1234].tiff
diff --git a/test/xbm-roundtrip.ok b/test/xbm-roundtrip.ok
new file mode 100644
index 00000000..a676a1f2
--- /dev/null
+++ b/test/xbm-roundtrip.ok
@@ -0,0 +1,2 @@
+2425386270 41
+2425386270 41
diff --git a/test/xbm-roundtrip.test b/test/xbm-roundtrip.test
new file mode 100755
index 00000000..2dcb5a13
--- /dev/null
+++ b/test/xbm-roundtrip.test
@@ -0,0 +1,6 @@
+#! /bin/bash
+# This script tests: pbmtoxbm xbmtopbm
+# Also requires: 
+
+${PBM_TESTPREFIX}pbmtoxbm testgrid.pbm | ${PBM_TESTPREFIX}xbmtopbm | cksum
+${PBM_TESTPREFIX}pbmtoxbm -x10 testgrid.pbm | ${PBM_TESTPREFIX}xbmtopbm | cksum
diff --git a/test/xpm-roundtrip.ok b/test/xpm-roundtrip.ok
new file mode 100644
index 00000000..845be5fb
--- /dev/null
+++ b/test/xpm-roundtrip.ok
@@ -0,0 +1 @@
+2425386270 41
diff --git a/test/xpm-roundtrip.test b/test/xpm-roundtrip.test
new file mode 100755
index 00000000..310022cc
--- /dev/null
+++ b/test/xpm-roundtrip.test
@@ -0,0 +1,8 @@
+#! /bin/bash
+# This script tests: ppmtoxpm xpmtoppm
+# Also requires: pgmtopbm ppmtopgm
+
+#${PBM_TESTPREFIX}ppmtoxpm -hexonly testimg.ppm | \
+# ${PBM_TESTPREFIX}xpmtoppm  | cksum
+${PBM_TESTPREFIX}ppmtoxpm testgrid.pbm | ${PBM_TESTPREFIX}xpmtoppm | \
+  ${PBM_BINPREFIX}ppmtopgm | ${PBM_BINPREFIX}pgmtopbm -th -value=0.5 | cksum
diff --git a/test/xwd-roundtrip.ok b/test/xwd-roundtrip.ok
new file mode 100644
index 00000000..011ebd3a
--- /dev/null
+++ b/test/xwd-roundtrip.ok
@@ -0,0 +1,3 @@
+2871603838 33838
+1926073387 101484
+2425386270 41
diff --git a/test/xwd-roundtrip.test b/test/xwd-roundtrip.test
new file mode 100755
index 00000000..e24db7bc
--- /dev/null
+++ b/test/xwd-roundtrip.test
@@ -0,0 +1,14 @@
+#! /bin/bash
+# This script tests: pnmtoxwd xwdtopnm
+# Also requires: pamdepth ppmtopgm
+
+# Test 1.  Should produce 2871603838 33838
+# which is the output of ppmtopgm testimg.ppm | cksum
+${PBM_BINPREFIX}ppmtopgm testimg.ppm | ${PBM_TESTPREFIX}pnmtoxwd  | \
+  ${PBM_TESTPREFIX}xwdtopnm | ${PBM_BINPREFIX}pamdepth 255 | cksum
+
+${PBM_TESTPREFIX}pnmtoxwd --quiet  testimg.ppm | \
+  ${PBM_TESTPREFIX}xwdtopnm --quiet | ${PBM_BINPREFIX}pamdepth 255 | cksum
+
+${PBM_TESTPREFIX}pnmtoxwd --quiet  testgrid.pbm | \
+  ${PBM_TESTPREFIX}xwdtopnm | cksum