diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-01-14 19:05:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-01-14 19:05:28 +0000 |
commit | 49b0eb1a2a99dc82b81a9355bb7851db6423486a (patch) | |
tree | 23d3f3ff66a83e1968e648554a85c2f334302281 /test/pbmnoise-parameters.test | |
parent | 771e1f9460d70eb92f07716f88d9caa95f86527a (diff) | |
download | netpbm-mirror-49b0eb1a2a99dc82b81a9355bb7851db6423486a.tar.gz netpbm-mirror-49b0eb1a2a99dc82b81a9355bb7851db6423486a.tar.xz netpbm-mirror-49b0eb1a2a99dc82b81a9355bb7851db6423486a.zip |
Factor out 'test invalid' checks
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4837 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pbmnoise-parameters.test')
-rwxr-xr-x | test/pbmnoise-parameters.test | 164 |
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" |