#! /bin/sh
# This script tests: ppmforge
# Also requires: pnmpsnr

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}
