about summary refs log tree commit diff
path: root/test/pamcrater.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/pamcrater.test')
-rwxr-xr-xtest/pamcrater.test38
1 files changed, 23 insertions, 15 deletions
diff --git a/test/pamcrater.test b/test/pamcrater.test
index 1d182208..cc937731 100755
--- a/test/pamcrater.test
+++ b/test/pamcrater.test
@@ -1,13 +1,21 @@
 #! /bin/bash
 # This script tests: pamcrater pamshadedrelief
-# Also requires: pamslice pamvalidate
+# Also requires: pamstack pamvalidate pamcut pamflip
 
   alias pamcrater="${PBM_TESTPREFIX}pamcrater"
-  alias pamslice="${PBM_TESTPREFIX}pamshadedrelief"
-  alias pamslice="${PBM_BINPREFIX}pamslice"
-  alias pamvalidate="${PBM_TESTPREFIX}pamvalidate"
+  alias pamshadedrelief="${PBM_TESTPREFIX}pamshadedrelief"
+  alias pamstack="${PBM_BINPREFIX}pamstack"
+  alias pamvalidate="${PBM_BINPREFIX}pamvalidate"
+  alias pamcut="${PBM_BINPREFIX}pamcut"
+  alias pamflip="${PBM_BINPREFIX}pamflip"
+
   shopt -s expand_aliases
 
+# We use the undocumented --test and --radius options of pamcrater.
+# pamcrater --test --radius=N
+# The above draws a single crater of radius N.
+# The resulting image should be symmetric.
+
 tmpdir=${tmpdir:-/tmp}
 
 test_pam=${tmpdir}/test.pam
@@ -29,11 +37,11 @@ pamstack ${test10_pam} ${test50_pam} ${test100_pam} ${test150_pam} |
 
 for i in 1 10 70
   do
-    ( pamslice -row=$((128 + $i))  ${test_pam} | cksum &&
-      pamslice -row=$((128 - $i))  ${test_pam} | cksum &&
-      pamslice -col=$((128 + $i))  ${test_pam} | cksum &&
-      pamslice -col=$((128 - $i))  ${test_pam} | cksum
-    ) | uniq -c | awk '{print $1}'
+  ( pamcut -top=$((128 + $i)) -height=1 ${test_pam} | cksum &&
+    pamcut -top=$((128 - $i)) -height=1 ${test_pam} | cksum &&
+    pamcut -left=$((128 + $i)) -width=1 ${test_pam} | pamflip -xy | cksum &&
+    pamcut -left=$((128 - $i)) -width=1 ${test_pam} | pamflip -xy | cksum
+  ) | uniq -c | awk '{print $1}'
   done
 
 rm ${test_pam} ${test10_pam} ${test50_pam}
@@ -42,12 +50,12 @@ rm ${test_pam} ${test10_pam} ${test50_pam}
 
 pamshadedrelief ${test100_pam} > ${testshaded_pam}
 
-( pamslice -row=$((128 + 12))  ${testshaded_pam} | cksum &&
-  pamslice -row=$((128 - 12))  ${testshaded_pam} | cksum &&
-  pamslice -row=$((128 + 31))  ${testshaded_pam} | cksum &&
-  pamslice -row=$((128 - 31))  ${testshaded_pam} | cksum &&
-  pamslice -row=$((128 + 99))  ${testshaded_pam} | cksum &&
-  pamslice -row=$((128 - 99))  ${testshaded_pam} | cksum
+( pamcut -top=$((128 + 12)) -height=1  ${testshaded_pam} | cksum &&
+  pamcut -top=$((128 - 12)) -height=1  ${testshaded_pam} | cksum &&
+  pamcut -top=$((128 + 31)) -height=1  ${testshaded_pam} | cksum &&
+  pamcut -top=$((128 - 31)) -height=1  ${testshaded_pam} | cksum &&
+  pamcut -top=$((128 + 99)) -height=1  ${testshaded_pam} | cksum &&
+  pamcut -top=$((128 - 99)) -height=1  ${testshaded_pam} | cksum
 ) | uniq -c | awk '{print $1}'
 
 rm ${testshaded_pam} ${test100_pam}