about summary refs log tree commit diff
path: root/test/pbmnoise-parameters.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/pbmnoise-parameters.test')
-rwxr-xr-xtest/pbmnoise-parameters.test164
1 files changed, 32 insertions, 132 deletions
diff --git a/test/pbmnoise-parameters.test b/test/pbmnoise-parameters.test
index 0d9319cc..d0e04ebf 100755
--- a/test/pbmnoise-parameters.test
+++ b/test/pbmnoise-parameters.test
@@ -2,142 +2,42 @@
 # This script tests: pbmnoise
 # Also requires:
 
-echo "Invalid command-line argument combinations." 1>&2
-echo "Error messages should appear below the line." 1>&2
-echo "-----------------------------------------------------------" 1>&2
-
 echo "Test Invalid"
 
-test_out=${tmpdir}/test_out
+. ${srcdir}/test-invalid.inc
 
 # Invalid -ratio arguments
 
-pbmnoise -ratio       100 100 > ${test_out} || \
-  printf "Expected failure 1 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio 0     1  100 > ${test_out} || \
-  printf "Expected failure 2 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=1.1   100 100 > ${test_out} || \
-  printf "Expected failure 3 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-  
-pbmnoise -ratio=-1    100 100 > ${test_out} || \
-  printf "Expected failure 4 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=half  100 100 > ${test_out} || \
-  printf "Expected failure 5 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=0/1/1 100 100 > ${test_out} || \
-  printf "Expected failure 6 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=-1/2  100 100 > ${test_out} || \
-  printf "Expected failure 7 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=1/0   100 100 > ${test_out} || \
-  printf "Expected failure 8 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=/2    100 100 > ${test_out} || \
-  printf "Expected failure 9 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=4/2   100 100 > ${test_out} || \
-  printf "Expected failure 10 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=6/    100 100 > ${test_out} || \
-  printf "Expected failure 11 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=1.0/2.0 100 100 > ${test_out} || \
-  printf "Expected failure 12 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-# denominator must be power of 2  
-pbmnoise -ratio=3/9   100 100 > ${test_out} || \
-  printf "Expected failure 13 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=a/2   100 100 > ${test_out} || \
-  printf "Expected failure 14 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-
-pbmnoise -ratio=2/a  100 100 > ${test_out} || \
-        printf "Expected failure 15 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=1/-2  100 100 > ${test_out} || \
-        printf "Expected failure 16 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
+invCmd "pbmnoise -ratio       100 100"
+invCmd "pbmnoise -ratio 0     1  100"
+invCmd "pbmnoise -ratio=1.1   100 100"
+invCmd "pbmnoise -ratio=-1    100 100"
+invCmd "pbmnoise -ratio=half  100 100"
+invCmd "pbmnoise -ratio=0/1/1 100 100"
+invCmd "pbmnoise -ratio=-1/2  100 100"
+invCmd "pbmnoise -ratio=1/0   100 100"
+invCmd "pbmnoise -ratio=/2    100 100"
+invCmd "pbmnoise -ratio=4/2   100 100"
+invCmd "pbmnoise -ratio=6/    100 100"
+invCmd "pbmnoise -ratio=1.0/2.0 100 100"
+
+# denominator must be power of 2
+invCmd "pbmnoise -ratio=3/9  100 100"
+invCmd "pbmnoise -ratio=a/2  100 100"
+invCmd "pbmnoise -ratio=2/a  100 100"
+invCmd "pbmnoise -ratio=1/-2 100 100"
 
 # Denominator must be 65536 or less
-pbmnoise -ratio=1/65537 100 100 > ${test_out} || \
-  printf "Expected failure 17 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -ratio=1/131072 100 100 > ${test_out} || \
-  printf "Expected failure 17 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -endian=large 100 100 > ${test_out} || \
-  printf "Expected failure 18 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -randomseed 100 100 > ${test_out} || \
-  printf "Expected failure 19 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -randomseed=-1 100 100 > ${test_out} || \
-  printf "Expected failure 20 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise -randomseed=0.1 100 100 > ${test_out} || \
-  printf "Expected failure 21 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise > ${test_out} || \
-  printf "Expected failure 22 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise 100 > ${test_out} || \
-  printf "Expected failure 23 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-pbmnoise 100 200 300 > ${test_out} || \
-  printf "Expected failure 24 "
-  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
-  rm -f ${test_out}
-
-  
+invCmd "pbmnoise -ratio=1/65537 100 100"
+invCmd "pbmnoise -ratio=1/131072 100 100"
+
+# Other
+invCmd "pbmnoise"
+invCmd "pbmnoise 100"
+invCmd "pbmnoise 100 0"
+invCmd "pbmnoise 0 100"
+invCmd "pbmnoise 100 200 300"
+invCmd "pbmnoise -endian=large 100 100"
+invCmd "pbmnoise -randomseed 100 100"
+invCmd "pbmnoise -randomseed=-1 100 100"
+invCmd "pbmnoise -randomseed=0.1 100 100"