|
| 1 | +#! /bin/bash |
| 2 | +# This script tests: pbmnoise |
| 3 | +# Also requires: |
| 4 | + |
| 5 | +echo "Invalid command-line argument combinations." 1>&2 |
| 6 | +echo "Error messages should appear below the line." 1>&2 |
| 7 | +echo "-----------------------------------------------------------" 1>&2 |
| 8 | + |
| 9 | +echo "Test Invalid" |
| 10 | + |
| 11 | +test_out=${tmpdir}/test_out |
| 12 | + |
| 13 | +# Invalid -ratio arguments |
| 14 | + |
| 15 | +pbmnoise -ratio 100 100 > ${test_out} || \ |
| 16 | + echo -n "Expected failure 1" |
| 17 | + test -s ${test_out}; echo " "$? |
| 18 | + rm -f ${test_out} |
| 19 | + |
| 20 | +pbmnoise -ratio 0 1 100 > ${test_out} || \ |
| 21 | + echo -n "Expected failure 2" |
| 22 | + test -s ${test_out}; echo " "$? |
| 23 | + rm -f ${test_out} |
| 24 | + |
| 25 | +pbmnoise -ratio=1.1 100 100 > ${test_out} || \ |
| 26 | + echo -n "Expected failure 3" |
| 27 | + test -s ${test_out}; echo " "$? |
| 28 | + rm -f ${test_out} |
| 29 | + |
| 30 | +pbmnoise -ratio=-1 100 100 > ${test_out} || \ |
| 31 | + echo -n "Expected failure 4" |
| 32 | + test -s ${test_out}; echo " "$? |
| 33 | + rm -f ${test_out} |
| 34 | + |
| 35 | +pbmnoise -ratio=half 100 100 > ${test_out} || \ |
| 36 | + echo -n "Expected failure 5" |
| 37 | + test -s ${test_out}; echo " "$? |
| 38 | + rm -f ${test_out} |
| 39 | + |
| 40 | +pbmnoise -ratio=0/1/1 100 100 > ${test_out} || \ |
| 41 | + echo -n "Expected failure 6" |
| 42 | + test -s ${test_out}; echo " "$? |
| 43 | + rm -f ${test_out} |
| 44 | + |
| 45 | +pbmnoise -ratio=-1/2 100 100 > ${test_out} || \ |
| 46 | + echo -n "Expected failure 7" |
| 47 | + test -s ${test_out}; echo " "$? |
| 48 | + rm -f ${test_out} |
| 49 | + |
| 50 | +pbmnoise -ratio=1/0 100 100 > ${test_out} || \ |
| 51 | + echo -n "Expected failure 8" |
| 52 | + test -s ${test_out}; echo " "$? |
| 53 | + rm -f ${test_out} |
| 54 | + |
| 55 | +pbmnoise -ratio=/2 100 100 > ${test_out} || \ |
| 56 | + echo -n "Expected failure 9" |
| 57 | + test -s ${test_out}; echo " "$? |
| 58 | + rm -f ${test_out} |
| 59 | + |
| 60 | +pbmnoise -ratio=4/2 100 100 > ${test_out} || \ |
| 61 | + echo -n "Expected failure 10" |
| 62 | + test -s ${test_out}; echo " "$? |
| 63 | + rm -f ${test_out} |
| 64 | + |
| 65 | +pbmnoise -ratio=6/ 100 100 > ${test_out} || \ |
| 66 | + echo -n "Expected failure 11" |
| 67 | + test -s ${test_out}; echo " "$? |
| 68 | + rm -f ${test_out} |
| 69 | + |
| 70 | +pbmnoise -ratio=1.0/2.0 100 100 > ${test_out} || \ |
| 71 | + echo -n "Expected failure 12" |
| 72 | + test -s ${test_out}; echo " "$? |
| 73 | + rm -f ${test_out} |
| 74 | + |
| 75 | +# denominator must be power of 2 |
| 76 | +pbmnoise -ratio=3/9 100 100 > ${test_out} || \ |
| 77 | + echo -n "Expected failure 13" |
| 78 | + test -s ${test_out}; echo " "$? |
| 79 | + rm -f ${test_out} |
| 80 | + |
| 81 | +pbmnoise -ratio=a/2 100 100 > ${test_out} || \ |
| 82 | + echo -n "Expected failure 14" |
| 83 | + test -s ${test_out}; echo " "$? |
| 84 | + rm -f ${test_out} |
| 85 | + |
| 86 | + |
| 87 | +pbmnoise -ratio=2/a 100 100 > ${test_out} || \ |
| 88 | + echo -n "Expected failure 15" |
| 89 | + test -s ${test_out}; echo " "$? |
| 90 | + rm -f ${test_out} |
| 91 | + |
| 92 | +pbmnoise -ratio=1/-2 100 100 > ${test_out} || \ |
| 93 | + echo -n "Expected failure 16" |
| 94 | + test -s ${test_out}; echo " "$? |
| 95 | + rm -f ${test_out} |
| 96 | + |
| 97 | +# Denominator must be 65536 or less |
| 98 | +pbmnoise -ratio=1/65537 100 100 > ${test_out} || \ |
| 99 | + echo -n "Expected failure 17" |
| 100 | + test -s ${test_out}; echo " "$? |
| 101 | + rm -f ${test_out} |
| 102 | + |
| 103 | +pbmnoise -ratio=1/131072 100 100 > ${test_out} || \ |
| 104 | + echo -n "Expected failure 17" |
| 105 | + test -s ${test_out}; echo " "$? |
| 106 | + rm -f ${test_out} |
| 107 | + |
| 108 | +pbmnoise -endian=large 100 100 > ${test_out} || \ |
| 109 | + echo -n "Expected failure 18" |
| 110 | + test -s ${test_out}; echo " "$? |
| 111 | + rm -f ${test_out} |
| 112 | + |
| 113 | +pbmnoise -randomseed 100 100 > ${test_out} || \ |
| 114 | + echo -n "Expected failure 19" |
| 115 | + test -s ${test_out}; echo " "$? |
| 116 | + rm -f ${test_out} |
| 117 | + |
| 118 | +pbmnoise -randomseed=-1 100 100 > ${test_out} || \ |
| 119 | + echo -n "Expected failure 20" |
| 120 | + test -s ${test_out}; echo " "$? |
| 121 | + rm -f ${test_out} |
| 122 | + |
| 123 | +pbmnoise -randomseed=0.1 100 100 > ${test_out} || \ |
| 124 | + echo -n "Expected failure 21" |
| 125 | + test -s ${test_out}; echo " "$? |
| 126 | + rm -f ${test_out} |
| 127 | + |
| 128 | +pbmnoise > ${test_out} || \ |
| 129 | + echo -n "Expected failure 22" |
| 130 | + test -s ${test_out}; echo " "$? |
| 131 | + rm -f ${test_out} |
| 132 | + |
| 133 | +pbmnoise 100 > ${test_out} || \ |
| 134 | + echo -n "Expected failure 23" |
| 135 | + test -s ${test_out}; echo " "$? |
| 136 | + rm -f ${test_out} |
| 137 | + |
| 138 | +pbmnoise 100 200 300 > ${test_out} || \ |
| 139 | + echo -n "Expected failure 24" |
| 140 | + test -s ${test_out}; echo " "$? |
| 141 | + rm -f ${test_out} |
| 142 | + |
| 143 | + |
0 commit comments