about summary refs log tree commit diff
path: root/test/ppmforge.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/ppmforge.test')
-rwxr-xr-xtest/ppmforge.test53
1 files changed, 47 insertions, 6 deletions
diff --git a/test/ppmforge.test b/test/ppmforge.test
index 3ebea88c..2a120357 100755
--- a/test/ppmforge.test
+++ b/test/ppmforge.test
@@ -1,9 +1,50 @@
-#! /bin/bash
+#! /bin/sh
 # This script tests: ppmforge
-# Also requires:
+# Also requires: pnmpsnr
 
-# Use small x y values to avoid floating point issues.
-
-# Should print: 3634219838 196623 (Glibc)
-#               3262664440 196623 (MAC OS)
+echo "Test 1. Should print: 547829788 196623  (Mersenne Twister)" 
 ppmforge -night -seed 1 | cksum
+
+tmpdir=${tmpdir:-/tmp}
+test_ppm=${tmpdir}/test.ppm
+
+# Target values for following tests were determined by running the
+# ppmforge command pairs 1000 times with different seeds, finding
+# the minimum (or "poorest match") for each component and 
+# subtracting 0.01 dB.   As such these are weak tests.
+
+echo "Test 2."
+ppmforge -cloud -seed 110 -power 0.75 > ${test_ppm}
+ppmforge -cloud -seed 110 -power 0.74 | \
+  pnmpsnr -rgb -target1=40.53 -target2=40.53 -target3=999 - ${test_ppm}
+
+
+rm ${test_ppm}
+
+echo "Test 3."
+ppmforge -cloud -seed 111 -dimension 2.15 > ${test_ppm}
+ppmforge -cloud -seed 111 -dimension 2.16 | \
+  pnmpsnr -rgb -target1=40.34 -target2=40.34 -target3=999 - ${test_ppm}        
+
+  # Note that there should be no difference for the target3: blue.
+
+
+rm ${test_ppm}
+
+echo "Test 4."
+ppmforge -seed 200 -stars 0 -ice 0.01 -power 1.180 -hour 10 >  ${test_ppm}
+ppmforge -seed 200 -stars 0 -ice 0.01 -power 1.181 -hour 10 | \
+  pnmpsnr -rgb -target1=45.9 -target2=45.81 -target3=32.11 - ${test_ppm}
+
+rm ${test_ppm}
+
+
+echo "Test 5."
+ppmforge -seed 300 -stars 0 -ice 0.01 \
+    -inclination 9  -hour 12 -power 300 > ${test_ppm} 
+ppmforge -seed 300 -stars 0 -ice 0.01 \
+    -inclination 9.1 -hour 12 -power 300 | \
+  pnmpsnr -rgb -target1=44.86 -target2=44.86 -target3=42.43 - ${test_ppm}
+
+
+rm ${test_ppm}