about summary refs log tree commit diff
path: root/test/pbmnoise-parameters.test
blob: f3348ae88447c3ca360cd42889cfda1833173247 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#! /bin/bash
# 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

# Invalid -ratio arguments

pbmnoise -ratio       100 100 > ${test_out} || \
  echo -n "Expected failure 1"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio 0     1  100 > ${test_out} || \
  echo -n "Expected failure 2"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=1.1   100 100 > ${test_out} || \
  echo -n "Expected failure 3"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}
  
pbmnoise -ratio=-1    100 100 > ${test_out} || \
  echo -n "Expected failure 4"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=half  100 100 > ${test_out} || \
  echo -n "Expected failure 5"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=0/1/1 100 100 > ${test_out} || \
  echo -n "Expected failure 6"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=-1/2  100 100 > ${test_out} || \
  echo -n "Expected failure 7"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=1/0   100 100 > ${test_out} || \
  echo -n "Expected failure 8"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=/2    100 100 > ${test_out} || \
  echo -n "Expected failure 9"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=4/2   100 100 > ${test_out} || \
  echo -n "Expected failure 10"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=6/    100 100 > ${test_out} || \
  echo -n "Expected failure 11"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=1.0/2.0 100 100 > ${test_out} || \
  echo -n "Expected failure 12"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

# denominator must be power of 2  
pbmnoise -ratio=3/9   100 100 > ${test_out} || \
  echo -n "Expected failure 13"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=a/2   100 100 > ${test_out} || \
  echo -n "Expected failure 14"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}


pbmnoise -ratio=2/a  100 100 > ${test_out} || \
        echo -n "Expected failure 15"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=1/-2  100 100 > ${test_out} || \
        echo -n "Expected failure 16"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

# Denominator must be 65536 or less
pbmnoise -ratio=1/65537 100 100 > ${test_out} || \
  echo -n "Expected failure 17"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -ratio=1/131072 100 100 > ${test_out} || \
  echo -n "Expected failure 17"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -endian=large 100 100 > ${test_out} || \
  echo -n "Expected failure 18"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -randomseed 100 100 > ${test_out} || \
  echo -n "Expected failure 19"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -randomseed=-1 100 100 > ${test_out} || \
  echo -n "Expected failure 20"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise -randomseed=0.1 100 100 > ${test_out} || \
  echo -n "Expected failure 21"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise > ${test_out} || \
  echo -n "Expected failure 22"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise 100 > ${test_out} || \
  echo -n "Expected failure 23"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

pbmnoise 100 200 300 > ${test_out} || \
  echo -n "Expected failure 24"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}