about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Test-Order13
-rw-r--r--test/all-in-place.ok4
-rwxr-xr-xtest/all-in-place.test4
-rw-r--r--test/pamenlarge-pamscale-point.ok9
-rwxr-xr-xtest/pamenlarge-pamscale-point.test36
-rw-r--r--test/pamenlarge-pbm.ok86
-rwxr-xr-xtest/pamenlarge-pbm.test61
-rw-r--r--test/pamfile.ok7
-rwxr-xr-xtest/pamfile.test7
-rw-r--r--test/pamfind.ok83
-rwxr-xr-xtest/pamfind.test32
-rw-r--r--test/pamscale-filters1.ok15
-rwxr-xr-xtest/pamscale-filters1.test64
-rw-r--r--test/pamscale-filters2.ok24
-rwxr-xr-xtest/pamscale-filters2.test97
-rw-r--r--test/pamscale-filters3.ok7
-rwxr-xr-xtest/pamscale-filters3.test32
-rw-r--r--test/pamscale-reportonly.ok18
-rwxr-xr-xtest/pamscale-reportonly.test35
-rw-r--r--test/pamstretch.ok20
-rwxr-xr-xtest/pamstretch.test48
-rw-r--r--test/ppmbrighten.ok6
-rwxr-xr-xtest/ppmbrighten.test4
23 files changed, 708 insertions, 4 deletions
diff --git a/test/Test-Order b/test/Test-Order
index 8bda73a4..49eaeff2 100644
--- a/test/Test-Order
+++ b/test/Test-Order
@@ -33,6 +33,7 @@ ppmrough.test
 # Analyzer tests
 
 pamfile.test
+pamfind.test
 pamtable.test
 pgmhist.test
 ppmhist.test
@@ -58,7 +59,6 @@ pamcut.test
 pnmcat.test
 pamflip1.test
 pamflip2.test
-pamenlarge.test
 pnminvert.test
 pamchannel.test
 ppmchange.test
@@ -78,6 +78,17 @@ ppmdim.test
 pnmshear.test
 pgmbentley.test
 
+pamenlarge.test
+pamenlarge-pbm.test
+
+pamscale-reportonly.test
+pamscale-filters1.test
+pamscale-filters2.test
+pamscale-filters3.test
+pamenlarge-pamscale-point.test
+
+pamstretch.test
+
 ppmmix.test
 pammixmulti-identity.test
 
diff --git a/test/all-in-place.ok b/test/all-in-place.ok
index 81eaa320..2df9f392 100644
--- a/test/all-in-place.ok
+++ b/test/all-in-place.ok
@@ -40,6 +40,7 @@ pamaltsat: ok
 pamarith: ok
 pambackground: ok
 pambayer: ok
+pambrighten: ok
 pamchannel: ok
 pamcomp: ok
 pamcrater: ok
@@ -53,16 +54,19 @@ pamendian: ok
 pamenlarge: ok
 pamexec: ok
 pamfile: ok
+pamfind: ok
 pamfix: ok
 pamflip: ok
 pamfunc: ok
 pamgauss: ok
 pamgetcolor: ok
 pamgradient: ok
+pamhue: ok
 pamlevels: ok
 pamlookup: ok
 pammasksharpen: ok
 pammixinterlace: ok
+pammixmulti: ok
 pammosaicknit: ok
 pamoil: ok
 pampaintspill: ok
diff --git a/test/all-in-place.test b/test/all-in-place.test
index cf402b6f..6cf677ef 100755
--- a/test/all-in-place.test
+++ b/test/all-in-place.test
@@ -82,6 +82,7 @@ ordinary_testprogs="\
   pamarith \
   pambackground \
   pambayer \
+  pambrighten \
   pamchannel \
   pamcomp \
   pamcrater \
@@ -95,16 +96,19 @@ ordinary_testprogs="\
   pamenlarge \
   pamexec \
   pamfile \
+  pamfind \
   pamfix \
   pamflip \
   pamfunc \
   pamgauss \
   pamgetcolor \
   pamgradient \
+  pamhue \
   pamlevels \
   pamlookup \
   pammasksharpen \
   pammixinterlace \
+  pammixmulti \
   pammosaicknit \
   pamoil \
   pampaintspill \
diff --git a/test/pamenlarge-pamscale-point.ok b/test/pamenlarge-pamscale-point.ok
new file mode 100644
index 00000000..dea0a3a9
--- /dev/null
+++ b/test/pamenlarge-pamscale-point.ok
@@ -0,0 +1,9 @@
+1 0 0 : 0
+2 -filter=point 0 0 : 0
+3 -linear 0 0 : 0
+4 -nomix 0 0 : 0
+5 0 0 : 0
+7 0 0 : 0
+6 -nomix 0 0 : 0
+15 -nomix -linear 0 0 : 0
+24 -nomix 0 0 : 0
diff --git a/test/pamenlarge-pamscale-point.test b/test/pamenlarge-pamscale-point.test
new file mode 100755
index 00000000..08b34bb7
--- /dev/null
+++ b/test/pamenlarge-pamscale-point.test
@@ -0,0 +1,36 @@
+#! /bin/bash
+# This script tests: pamenlarge pamscale
+# Also requires:
+
+tmpdir=${tmpdir:-/tmp}
+enlarge_ppm=${tmpdir}/enlarge.ppm
+
+# When scale factor is an integer and the pamscale filter is point (default)
+# pamenlarge and pamscale should produce identical output
+
+for option in 1 "2 -filter=point" "3 -linear" "4 -nomix" 5
+  do
+  scale=${option% *}
+  pamenlarge $scale testimg.ppm > ${enlarge_ppm}
+  pamscale   $option testimg.ppm | cmp -s - ${enlarge_ppm}  
+  echo $option ${PIPESTATUS[@]} ":" $?
+  rm  ${enlarge_ppm}  
+  done
+
+
+pamenlarge -xscale=7 -yscale=7 testimg.ppm > ${enlarge_ppm}
+pamscale   -xscale=7 -yscale=7 testimg.ppm | cmp -s - ${enlarge_ppm}  
+echo 7 ${PIPESTATUS[@]} ":" $?
+rm  ${enlarge_ppm}
+
+
+enlarge_pbm=${tmpdir}/enlarge.pbm
+
+for option in "6 -nomix" "15 -nomix -linear" "24 -nomix"
+  do
+  scale=${option%% *}
+  pamenlarge $scale testgrid.pbm > ${enlarge_pbm}
+  pamscale   $option testgrid.pbm | cmp -s - ${enlarge_pbm}  
+  echo $option ${PIPESTATUS[@]} ":" $?
+  rm  ${enlarge_pbm}
+  done
diff --git a/test/pamenlarge-pbm.ok b/test/pamenlarge-pbm.ok
new file mode 100644
index 00000000..dcc2da97
--- /dev/null
+++ b/test/pamenlarge-pbm.ok
@@ -0,0 +1,86 @@
+test 1
+1777627284 265
+2806322261 522
+1951888658 778
+3502911227 1034
+3041987260 1290
+2012524746 1546
+4279863183 1802
+3672763467 2058
+3994368242 2314
+4119105059 2570
+1760702195 2826
+2751077869 3082
+262508159 3339
+743430575 3595
+94950162 3851
+2113456870 4107
+1143977004 4363
+2167141643 4619
+1816864555 4875
+2848735506 5131
+600474914 5387
+3831078134 5643
+1848221383 5899
+test 2
+2525154083 7435
+2525154083 7435
+2525154083 7435
+1983944984 14347
+1983944984 14347
+1983944984 14347
+2319780757 20747
+2319780757 20747
+2319780757 20747
+141252239 26635
+141252239 26635
+141252239 26635
+2074950535 32012
+2074950535 32012
+2074950535 32012
+2906360922 36876
+2906360922 36876
+2906360922 36876
+1320535490 41228
+1320535490 41228
+1320535490 41228
+1972046289 45068
+1972046289 45068
+1972046289 45068
+2203980644 48396
+2203980644 48396
+2203980644 48396
+2060433297 51212
+2060433297 51212
+2060433297 51212
+912377848 53516
+912377848 53516
+912377848 53516
+3346570289 55308
+3346570289 55308
+3346570289 55308
+1851051473 56588
+1851051473 56588
+1851051473 56588
+1940412039 57356
+1940412039 57356
+1940412039 57356
+2001859943 57612
+2001859943 57612
+test 3
+1  2764166846 191
+2  971905193 244
+3  6339889 299
+4  3973389476 342
+5  530215023 403
+6  2124428491 451
+7  2999665126 507
+8  4073302787 539
+9  3877636246 612
+10  1762263341 663
+11  3034611851 717
+12  3339857159 760
+13  119666911 821
+14  4197425209 869
+15  1169924963 924
+16  1845126791 954
diff --git a/test/pamenlarge-pbm.test b/test/pamenlarge-pbm.test
new file mode 100755
index 00000000..10c00ba0
--- /dev/null
+++ b/test/pamenlarge-pbm.test
@@ -0,0 +1,61 @@
+#! /bin/bash
+# This script tests: pamenlarge
+# Also requires: pbmmake pnmpad
+
+tmpdir=${tmpdir:-/tmp}
+complete256_pbm=${tmpdir}/complete256.pbm
+
+# works with gawk and mawk
+# produce all possible 8-bit patterns
+
+LC_ALL=C awk 'BEGIN { print "P4";         # header
+                      print "8 256";
+                      for (i=0;i<256;++i) # raster
+                           printf("%c",i) }' > ${complete256_pbm}
+
+# xscale factor should be tested to at least 21 (=13+8)
+
+# Test 1.
+echo "test 1"
+ 
+for xs in `seq 23`
+  do
+  pamenlarge -xscale=$xs ${complete256_pbm} | cksum
+  done
+
+# Test 2.
+echo "test 2"
+
+for xs1 in `seq 15`
+  do
+  xs2=$((30-$xs1))
+  pamenlarge -xscale=$xs1 ${complete256_pbm} | pamenlarge -xscale=$xs2 | cksum
+  if [ $xs1 != $xs2 ]; then
+  pamenlarge -xscale=$xs2 ${complete256_pbm} | pamenlarge -xscale=$xs1 | cksum
+  fi
+  pamenlarge -xscale=$(($xs1 * $xs2)) ${complete256_pbm} | cksum
+  done
+
+rm ${complete256_pbm}
+
+# Test 3.
+echo "test 3"
+
+test3_pbm=${tmpdir}/test3.pbm
+
+for width in `seq 16`
+  do
+  pbmmake -g ${width} 1 | pnmpad -top=1 -white | \
+      pnmpad -bottom=1 -black > ${test3_pbm}.${width}
+  done
+ 
+  for xscale in `seq 16`
+    do echo -n ${xscale} " "
+    for width in `seq 16`
+      do pamenlarge -xscale=${xscale} ${test3_pbm}.${width} ; done | cksum
+      #
+      # unlike most other tests we take the cksum of a composite PBM file
+      #
+    done
+
+rm ${test3_pbm}.[1-9]  ${test3_pbm}.1[1-6]
\ No newline at end of file
diff --git a/test/pamfile.ok b/test/pamfile.ok
index 57cc8cfd..c0d80c28 100644
--- a/test/pamfile.ok
+++ b/test/pamfile.ok
@@ -3,3 +3,10 @@ testgrid.pbm:	PBM raw, 14 by 16
 stdin:	PGM raw, 227 by 149  maxval 255
 stdin:	PAM, 227 by 149 by 1 maxval 255
     Tuple type: GRAYSCALE
+stdin:	3 images
+stdin:	Image 0:	PBM raw, 14 by 16
+stdin:	Image 1:	PBM raw, 14 by 16
+stdin:	Image 2:	PBM raw, 14 by 16
+227 149
+testimg.ppm: PPM RAW 227 149 3 255 RGB
+stdin: PBM RAW 14 16 1 1 BLACKANDWHITE
diff --git a/test/pamfile.test b/test/pamfile.test
index ac927172..545a2289 100755
--- a/test/pamfile.test
+++ b/test/pamfile.test
@@ -7,3 +7,10 @@ pamfile testimg.ppm
 pamfile testgrid.pbm
 pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | pamfile
 pamchannel -tupletype="GRAYSCALE" -infile=testimg.ppm 0 | pamfile
+
+cat testgrid.pbm testgrid.pbm testgrid.pbm | pamfile -count
+cat testgrid.pbm testgrid.pbm testgrid.pbm | pamfile -allimages
+
+pamfile -size testimg.ppm
+pamfile -machine testimg.ppm
+cat testgrid.pbm testimg.ppm testgrid.pbm | pamfile -machine
diff --git a/test/pamfind.ok b/test/pamfind.ok
new file mode 100644
index 00000000..dc0f95ed
--- /dev/null
+++ b/test/pamfind.ok
@@ -0,0 +1,83 @@
+Test 1
+Locations containing tuple (43/43/43)/255:
+(6, 0)
+(6, 1)
+(7, 0)
+(7, 1)
+(19, 184)
+Locations containing tuple (210/57/41)/255:
+(44, 109)
+(96, 74)
+(96, 75)
+(100, 75)
+(100, 76)
+(100, 77)
+(100, 78)
+(101, 73)
+(101, 74)
+(101, 75)
+(101, 76)
+(101, 77)
+(101, 78)
+(102, 72)
+Test 2
+Locations containing tuple (1)/1:
+(0, 1)
+(0, 3)
+(0, 5)
+(0, 7)
+(0, 9)
+(0, 11)
+(0, 13)
+(2, 1)
+(2, 3)
+(2, 5)
+(2, 7)
+(2, 9)
+(2, 11)
+(2, 13)
+(4, 1)
+(4, 3)
+(4, 5)
+(4, 7)
+(4, 9)
+(4, 11)
+(4, 13)
+(6, 1)
+(6, 3)
+(6, 5)
+(6, 7)
+(6, 9)
+(6, 11)
+(6, 13)
+(8, 1)
+(8, 3)
+(8, 5)
+(8, 7)
+(8, 9)
+(8, 11)
+(8, 13)
+(10, 1)
+(10, 3)
+(10, 5)
+(10, 7)
+(10, 9)
+(10, 11)
+(10, 13)
+(12, 1)
+(12, 3)
+(12, 5)
+(12, 7)
+(12, 9)
+(12, 11)
+(12, 13)
+(14, 1)
+(14, 3)
+(14, 5)
+(14, 7)
+(14, 9)
+(14, 11)
+(14, 13)
+Test 3
+okay
+okay
diff --git a/test/pamfind.test b/test/pamfind.test
new file mode 100755
index 00000000..39cb1437
--- /dev/null
+++ b/test/pamfind.test
@@ -0,0 +1,32 @@
+#! /bin/bash
+# This script tests: pamfind
+# Also requires:
+
+tmpdir=${tmpdir:-/tmp}
+sorted0_res=${tmpdir}/pamfind_sorted0.res
+sorted1_res=${tmpdir}/pamfind_sorted1.res
+
+# Test 1
+echo Test 1
+pamfind -color=grey17     testimg.ppm 
+pamfind -target=210,57,41 testimg.ppm
+
+# Test 2
+echo Test 2
+pamfind -target=1 testgrid.pbm
+
+# Test 3
+# The two outputs should be disjoint
+echo Test 3
+pamfind -target=0 testgrid.pbm | sort > ${sorted0_res}
+pamfind -target=1 testgrid.pbm | sort > ${sorted1_res}
+comm -3 ${sorted0_res}  ${sorted1_res}  |
+  awk 'END {if (NR==226) print  "okay";
+            else printf("failure (line count=%d)\n", NR)}'
+comm -12 ${sorted0_res}  ${sorted1_res} | 
+  awk '{print}; END { if(NR == 0) print  "okay";
+            else printf("failure (line count=%d)\n", NR)}'
+
+rm ${sorted0_res} ${sorted1_res}
+
+
diff --git a/test/pamscale-filters1.ok b/test/pamscale-filters1.ok
new file mode 100644
index 00000000..083505ee
--- /dev/null
+++ b/test/pamscale-filters1.ok
@@ -0,0 +1,15 @@
+4 box:
+match
+match
+9 triangle:
+match
+match
+4 quadratic:
+match
+match
+10 cubic:
+match
+match
+4 catrom:
+match
+match
diff --git a/test/pamscale-filters1.test b/test/pamscale-filters1.test
new file mode 100755
index 00000000..63e0d012
--- /dev/null
+++ b/test/pamscale-filters1.test
@@ -0,0 +1,64 @@
+#! /bin/bash
+# This script tests: pamscale pamenlarge
+# Also requires: pamvalidate pnmpsnr
+
+tmpdir=${tmpdir:-/tmp}
+enlarge_ppm=${tmpdir}/enlarge.ppm
+
+width_height=`pamfile -size testimg.ppm | \
+                awk '{print "-width="$1, "-height="$2}'`
+
+# The target values here were determined by running the test on a
+# 32-bit GNU/Linux system and subtracting 2.5 (dB) from observed
+# values.
+
+pamenlarge  4 testimg.ppm | pamvalidate > ${enlarge_ppm}
+echo  4 box:  
+pamscale  4 -filter=box testimg.ppm | \
+  pnmpsnr -target1=35.67 -target2=49.25 -target3=43.28 - ${enlarge_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+ 
+pamscale ${width_height} -filter=point ${enlarge_ppm} | \
+  pnmpsnr -target1=1000 -target2=1000 -target3=1000 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${enlarge_ppm}
+
+pamenlarge  9 testimg.ppm | pamvalidate > ${enlarge_ppm}
+echo  9 triangle:  
+pamscale  9 -filter=triangle testimg.ppm | \
+  pnmpsnr -target1=35.27 -target2=49.06 -target3=43.11 - ${enlarge_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+pamscale ${width_height} -filter=triangle ${enlarge_ppm} | \
+  pnmpsnr -target1=41.52 -target2=56.96 -target3=52.68 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${enlarge_ppm}
+
+pamenlarge  4 testimg.ppm | pamvalidate > ${enlarge_ppm}
+echo  4 quadratic:  
+pamscale  4 -filter=quadratic testimg.ppm | \
+  pnmpsnr -target1=35.39 -target2=49.36 -target3=43.46 - ${enlarge_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+pamscale ${width_height} -filter=quadratic ${enlarge_ppm} | \
+  pnmpsnr -target1=39.34 -target2=55.24 -target3=50.65 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${enlarge_ppm}
+
+pamenlarge 10 testimg.ppm | pamvalidate > ${enlarge_ppm}
+echo 10 cubic:  
+pamscale 10 -filter=cubic testimg.ppm | \
+  pnmpsnr -target1=34.39 -target2=48.45 -target3=42.52 - ${enlarge_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+pamscale ${width_height} -filter=cubic ${enlarge_ppm} | \
+  pnmpsnr -target1=37.7 -target2=53.84 -target3=48.96 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${enlarge_ppm}
+
+pamenlarge  4 testimg.ppm | pamvalidate > ${enlarge_ppm}
+echo  4 catrom:  
+pamscale  4 -filter=catrom testimg.ppm | \
+  pnmpsnr -target1=36.05 -target2=49.51 -target3=43.49 - ${enlarge_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+pamscale ${width_height} -filter=catrom ${enlarge_ppm} | \
+  pnmpsnr -target1=46.5 -target2=60.68 -target3=57.8 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${enlarge_ppm}
diff --git a/test/pamscale-filters2.ok b/test/pamscale-filters2.ok
new file mode 100644
index 00000000..b8d51d37
--- /dev/null
+++ b/test/pamscale-filters2.ok
@@ -0,0 +1,24 @@
+-xscale=4 -yscale=3 mitchell:
+match
+match
+-xscale=3 -yscale=4 gauss:
+match
+match
+-xscale=2 -yscale=2 sinc:
+match
+match
+-xscale=2 -yscale=4 bessel:
+match
+match
+-xscale=3 -yscale=3 hanning:
+match
+match
+-xscale=5 -yscale=5 hamming:
+match
+match
+5.85 blackman:
+match
+match
+5.10 kaiser:
+match
+match
diff --git a/test/pamscale-filters2.test b/test/pamscale-filters2.test
new file mode 100755
index 00000000..f7370020
--- /dev/null
+++ b/test/pamscale-filters2.test
@@ -0,0 +1,97 @@
+#! /bin/bash
+# This script tests: pamscale pamstretch pamstretch-gen
+# Also requires: pamvalidate pnmpsnr
+
+tmpdir=${tmpdir:-/tmp}
+stretch_ppm=${tmpdir}/stretch.ppm
+
+width_height=`pamfile -size testimg.ppm | \
+                awk '{print "-width="$1, "-height="$2}'`
+
+pamstretch -xscale=4 -yscale=3 testimg.ppm | pamvalidate > ${stretch_ppm}
+echo -xscale=4 -yscale=3 mitchell:  
+pamscale -xscale=4 -yscale=3 -filter=mitchell testimg.ppm | \
+  pnmpsnr -target1=34.15 -target2=46.95 -target3=41.02 - ${stretch_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+
+pamscale ${width_height} -filter=mitchell ${stretch_ppm} | \
+  pnmpsnr -target1=33.36 -target2=46.74 -target3=40.79 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${stretch_ppm}
+
+pamstretch -xscale=3 -yscale=4 testimg.ppm | pamvalidate > ${stretch_ppm}
+echo -xscale=3 -yscale=4 gauss:  
+pamscale -xscale=3 -yscale=4 -filter=gauss testimg.ppm | \
+  pnmpsnr -target1=34.4 -target2=46.98 -target3=41.07 - ${stretch_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+
+pamscale ${width_height} -filter=gauss ${stretch_ppm} | \
+  pnmpsnr -target1=33.1 -target2=46.61 -target3=40.64 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${stretch_ppm}
+
+pamstretch -xscale=2 -yscale=2 testimg.ppm | pamvalidate > ${stretch_ppm}
+echo -xscale=2 -yscale=2 sinc:  
+pamscale -xscale=2 -yscale=2 -filter=sinc testimg.ppm | \
+  pnmpsnr -target1=36.27 -target2=49.39 -target3=43.62 - ${stretch_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+
+pamscale ${width_height} -filter=sinc ${stretch_ppm} | \
+  pnmpsnr -target1=36.23 -target2=49.47 -target3=43.69 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${stretch_ppm}
+
+pamstretch -xscale=2 -yscale=4 testimg.ppm | pamvalidate > ${stretch_ppm}
+echo -xscale=2 -yscale=4 bessel:  
+pamscale -xscale=2 -yscale=4 -filter=bessel testimg.ppm | \
+  pnmpsnr -target1=35.09 -target2=47.77 -target3=41.88 - ${stretch_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+
+pamscale ${width_height} -filter=bessel ${stretch_ppm} | \
+  pnmpsnr -target1=33.99 -target2=47.47 -target3=41.55 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${stretch_ppm}
+
+pamstretch -xscale=3 -yscale=3 testimg.ppm | pamvalidate > ${stretch_ppm}
+echo -xscale=3 -yscale=3 hanning:  
+pamscale -xscale=3 -yscale=3 -filter=hanning testimg.ppm | \
+  pnmpsnr -target1=34.73 -target2=47.42 -target3=41.54 - ${stretch_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+
+pamscale ${width_height} -filter=hanning ${stretch_ppm} | \
+  pnmpsnr -target1=33.86 -target2=47.24 -target3=41.29 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${stretch_ppm}
+
+pamstretch -xscale=5 -yscale=5 testimg.ppm | pamvalidate > ${stretch_ppm}
+echo -xscale=5 -yscale=5 hamming:  
+pamscale -xscale=5 -yscale=5 -filter=hamming testimg.ppm | \
+  pnmpsnr -target1=33.4 -target2=46.02 -target3=40.07 - ${stretch_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+
+pamscale ${width_height} -filter=hamming ${stretch_ppm} | \
+  pnmpsnr -target1=32.49 -target2=45.81 -target3=39.8 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${stretch_ppm}
+
+pamstretch-gen 5.85 testimg.ppm | pamvalidate > ${stretch_ppm}
+echo 5.85 blackman:  
+pamscale 5.85 -filter=blackman testimg.ppm | \
+  pnmpsnr -target1=34.29 -target2=48.78 -target3=42.75 - ${stretch_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+
+pamscale ${width_height} -filter=blackman ${stretch_ppm} | \
+  pnmpsnr -target1=33.69 -target2=48.83 -target3=42.72 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${stretch_ppm}
+
+pamstretch-gen 5.10 testimg.ppm | pamvalidate > ${stretch_ppm}
+echo 5.10 kaiser:  
+pamscale 5.10 -filter=kaiser testimg.ppm | \
+  pnmpsnr -target1=34.58 -target2=49.03 -target3=43.01 - ${stretch_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+
+pamscale ${width_height} -filter=blackman ${stretch_ppm} | \
+  pnmpsnr -target1=33.69 -target2=48.83 -target3=42.72 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${stretch_ppm}
diff --git a/test/pamscale-filters3.ok b/test/pamscale-filters3.ok
new file mode 100644
index 00000000..94d4ae96
--- /dev/null
+++ b/test/pamscale-filters3.ok
@@ -0,0 +1,7 @@
+failure : 0
+3.96 hermite:
+match
+match
+2.75 lanczos:
+match
+match
diff --git a/test/pamscale-filters3.test b/test/pamscale-filters3.test
new file mode 100755
index 00000000..83198e2b
--- /dev/null
+++ b/test/pamscale-filters3.test
@@ -0,0 +1,32 @@
+#! /bin/bash
+# This script tests: pamscale pamstretch pamstretch-gen 
+ # Also requires: pamvalidate pnmpsnr || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+
+tmpdir=${tmpdir:-/tmp}
+stretch_ppm=${tmpdir}/stretch.ppm
+
+width_height=`pamfile -size testimg.ppm | \
+                awk '{print "-width="$1, "-height="$2}'`
+
+pamstretch-gen 3.96 testimg.ppm | pamvalidate > ${stretch_ppm}
+echo 3.96 hermite:  
+pamscale 3.96 -filter=hermite testimg.ppm | \
+  pnmpsnr -target1=34.13 -target2=48.95 -target3=42.73 - ${stretch_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+
+pamscale ${width_height} -filter=hermite ${stretch_ppm} | \
+  pnmpsnr -target1=33.12 -target2=48.59 -target3=42.3 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${stretch_ppm}
+
+pamstretch-gen 2.75 testimg.ppm | pamvalidate > ${stretch_ppm}
+echo 2.75 lanczos:  
+pamscale 2.75 -filter=lanczos testimg.ppm | \
+  pnmpsnr -target1=32.93 -target2=48.28 -target3=41.89 - ${stretch_ppm} || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+
+pamscale ${width_height} -filter=lanczos ${stretch_ppm} | \
+  pnmpsnr -target1=32.81 -target2=48.43 -target3=41.94 testimg.ppm - || \
+  echo failure ${PIPESTATUS[@]} ":" $?
+rm ${stretch_ppm}
diff --git a/test/pamscale-reportonly.ok b/test/pamscale-reportonly.ok
new file mode 100644
index 00000000..00152411
--- /dev/null
+++ b/test/pamscale-reportonly.ok
@@ -0,0 +1,18 @@
+227 149 3.000000 3.000000 681 447
+227 149 5.000000 5.000000 1135 745
+227 149 2.682819 2.684564 609 400
+227 149 2.819383 2.818792 640 420
+227 149 0.440529 0.442953 100 66
+227 149 0.167401 0.167785 38 25
+227 149 0.101322 0.100671 23 15
+227 149 2.819383 2.684564 640 400
+227 149 2.819383 2.684564 640 400
+227 149 2.819383 2.000000 640 298
+227 149 1.400881 2.684564 318 400
+227 149 1.000000 1.000000 227 149
+expected error
+expected error
+expected error
+expected error
+expected error
+expected error
diff --git a/test/pamscale-reportonly.test b/test/pamscale-reportonly.test
new file mode 100755
index 00000000..7205be2f
--- /dev/null
+++ b/test/pamscale-reportonly.test
@@ -0,0 +1,35 @@
+#! /bin/bash
+# This script tests: pamscale
+# Also requires:
+
+pamscale -reportonly 3 testimg.ppm
+pamscale -reportonly 5 testimg.ppm
+pamscale -reportonly -xysize 640 400 testimg.ppm
+pamscale -reportonly -xyfill 640 400 testimg.ppm
+pamscale -reportonly -xyfit  100 100 testimg.ppm
+pamscale -reportonly -reduce 6 testimg.ppm
+pamscale -reportonly -reduce 10 testimg.ppm
+pamscale -reportonly -xsize=640 -ysize=400 testimg.ppm
+pamscale -reportonly -width=640 -height=400 testimg.ppm
+pamscale -reportonly -width=640 -yscale=2 testimg.ppm
+pamscale -reportonly -xscale=1.4 -height=400 testimg.ppm
+pamscale -reportonly -pixels=45000 testimg.ppm
+
+# expected error cases
+echo 1>&2
+echo "Invalid command-line argument combinations." 1>&2
+echo "Error messages should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
+pamscale -reportonly -xsize=640 -ysize=400 -xscale=2 testimg.ppm || \
+  echo expected error
+pamscale -reportonly -xsize=640 -xscale=2 -yscale=3 testimg.ppm || \
+  echo expected error
+pamscale -reportonly -xsize=640 -ysize=400 -pixels=200000 testimg.ppm || \
+  echo expected error
+pamscale -reportonly -xsize=640 -ysize=400 -xysize 640 400 testimg.ppm || \
+  echo expected error
+pamscale -reportonly -xsize=640 -ysize=400 -xyfit  640 400 testimg.ppm || \
+  echo expected error
+pamscale -reportonly -xsize=640 -ysize=400 -xyfill 640 400 testimg.ppm || \
+  echo expected error
+
diff --git a/test/pamstretch.ok b/test/pamstretch.ok
new file mode 100644
index 00000000..3253cfd6
--- /dev/null
+++ b/test/pamstretch.ok
@@ -0,0 +1,20 @@
+test 1
+211995824 12277766
+test 2
+1361899 202953
+test 3
+2735552884 302379
+test 4
+3681010585 802767
+test 5
+1926073387 101484
+1926073387 101484
+1926073387 101484
+1926073387 101484
+test 6
+3638965616 913236
+598302847 913236
+220708621 903111
+3948746482 903111
+3948746482 903111
+220708621 903111
diff --git a/test/pamstretch.test b/test/pamstretch.test
new file mode 100755
index 00000000..55dd4e9c
--- /dev/null
+++ b/test/pamstretch.test
@@ -0,0 +1,48 @@
+#! /bin/bash
+# This script tests: pamstretch
+# Also requires: pamcut pamfile
+
+# Test 1.  Should print 211995824 12277766
+echo test 1
+pamstretch 11 testimg.ppm | cksum
+
+# Test 2.  Should print 1361899 202953
+echo test 2
+
+pamstretch -xscale=2 -blackedge testimg.ppm | cksum
+
+# Test 3.  Should print 3427416462 301047
+echo test 3
+dropedge1_ppm=${tmpdir}/drop1.ppm
+pamstretch -yscale=3 -dropedge testimg.ppm | tee ${dropedge1_ppm} | cksum
+
+# Test 4. Should print 3681010585 802767
+echo test 4
+pamstretch -xscale=2 -yscale=4 -dropedge testimg.ppm | cksum
+
+# Test 5.  Should print 1926073387 101484 four times
+echo test 5
+pamstretch 1 testimg.ppm | cksum
+pamstretch -xscale=1 -yscale=1 testimg.ppm | cksum
+pamstretch 1 -dropedge testimg.ppm | cksum
+pamstretch 1 -blackedge testimg.ppm | cksum
+
+# Test 6.
+# Should print 3638965616 913236 , 598302847 913236 
+# followed by 3948746482 903111 four times and finally
+# -width=678 -height=444"
+
+echo test 6
+stretch_ppm=${tmpdir}/stretch.ppm
+dropedge_ppm=${tmpdir}/drop.ppm
+blackedge_ppm=${tmpdir}/black.ppm
+pamstretch 3 testimg.ppm | tee ${stretch_ppm} | cksum
+pamstretch 3 -blackedge testimg.ppm | tee ${blackedge_ppm} | cksum
+pamstretch -xscale=3 -dropedge ${dropedge1_ppm} | tee ${dropedge_ppm} | cksum
+width_height=`pamfile -size ${dropedge_ppm} | \
+              awk '{print "-width="$1, "-height="$2}'`
+pamcut -left=0 -top=0 ${width_height} ${stretch_ppm} | cksum
+pamcut -left=0 -top=0 ${width_height} ${blackedge_ppm} | cksum
+pamcut -left=0 -top=0 ${width_height} ${dropedge_ppm} | cksum
+
+rm ${stretch_ppm} ${dropedge_ppm} ${dropedge1_ppm} ${blackedge_ppm}
\ No newline at end of file
diff --git a/test/ppmbrighten.ok b/test/ppmbrighten.ok
index 0ce9f722..376e71d3 100644
--- a/test/ppmbrighten.ok
+++ b/test/ppmbrighten.ok
@@ -1,3 +1,3 @@
-2634278866 101484
-2791274519 101484
-2464564658 101484
+1969633344 101484
+3688219243 101484
+295150171 101484
diff --git a/test/ppmbrighten.test b/test/ppmbrighten.test
index fa7702d8..46c5cab5 100755
--- a/test/ppmbrighten.test
+++ b/test/ppmbrighten.test
@@ -2,6 +2,10 @@
 # This script tests: ppmbrighten
 # Also requires:
 
+# Failure message
+## Ppmbrighten is sensitive to subtle differences in floating point math.
+## If this test fails, please run the program and visually examine
+## the output.
 
 ppmbrighten -v 100 testimg.ppm | cksum
 ppmbrighten -v 100 -normalize testimg.ppm | cksum