about summary refs log tree commit diff
path: root/test/pamaddnoise-parameters.test
blob: 098d494689816ce60d5d52eb37dda92abd8402f5 (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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
#! /bin/sh
# This script tests: pamaddnoise
# Also requires:

tmpdir=${tmpdir:-/tmp}
test_out=/${tmpdir}/test.out

# Test Invalid
echo "Test Invalid"

echo 1>&2
echo "Invalid command-line argument combinations." 1>&2
echo "Error messages should appear below the line." 1>&2
echo "-----------------------------------------------------------" 1>&2

# type gaussian implied

pamaddnoise -sigma1=-4.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 1 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -sigma2=-20.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 2 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -mgsigma=0.5 testgrid.pbm > ${test_out} || \
  printf "Expected failure 3 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -lsigma=10.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 4 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -tolerance=0.10 testgrid.pbm > ${test_out} || \
  printf "Expected failure 5 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -salt=0.50 testgrid.pbm > ${test_out} || \
  printf "Expected failure 6 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -lambda=12.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 7 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

# type gaussian explicitly stated

pamaddnoise -type gaussian -sigma1=-0.01 testgrid.pbm > ${test_out} || \
  printf "Expected failure 8 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type gaussian -sigma2=-0.01 testgrid.pbm > ${test_out} || \
  printf "Expected failure 9 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type gaussian -mgsigma=0.5 testgrid.pbm > ${test_out} || \
  printf "Expected failure 10 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type gaussian -lsigma=10.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 11 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type gaussian -tolerance=0.10 testgrid.pbm > ${test_out} || \
  printf "Expected failure 12 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type gaussian -salt=0.50 testgrid.pbm > ${test_out} || \
  printf "Expected failure 13 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type gaussian -lambda=12.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 14 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

# type multiplicative gaussian

pamaddnoise -type multiplicative_gaussian -sigma1=4.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 15 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}
  
pamaddnoise -type multiplicative_gaussian -sigma2=20.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 16 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type multiplicative_gaussian -mgsigma=-0.5 testgrid.pbm > ${test_out} || \
  printf "Expected failure 17 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type multiplicative_gaussian -lsigma=10.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 18 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type multiplicative_gaussian -tolerance=0.10 testgrid.pbm > ${test_out} || \
  printf "Expected failure 19 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type multiplicative_gaussian -salt=0.50 testgrid.pbm > ${test_out} || \
  printf "Expected failure 20 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type multiplicative_gaussian -lambda=12.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 21 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

# type laplacian

pamaddnoise -type laplacian -sigma1=4.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 22 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type laplacian -sigma2=20.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 23 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type laplacian -mgsigma=0.5 testgrid.pbm > ${test_out} || \
  printf "Expected failure 24 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type laplacian -lsigma=-10.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 25 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type laplacian -tolerance=0.10 testgrid.pbm > ${test_out} || \
  printf "Expected failure 26 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type laplacian -salt=0.50 testgrid.pbm > ${test_out} || \
  printf "Expected failure 27 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type laplacian -lambda=12.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 28 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}
 

# type impulse

pamaddnoise -type impulse -sigma1=4.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 29 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impulse -sigma2=20.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 30 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impulse -mgsigma=0.5 testgrid.pbm > ${test_out} || \
  printf "Expected failure 31 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impulse -lsigma=10.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 32 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impulse -tolerance=-0.10 testgrid.pbm > ${test_out} || \
  printf "Expected failure 33 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impulse -tolerance=1.10 testgrid.pbm > ${test_out} || \
  printf "Expected failure 34 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impulse -salt=-0.10 testgrid.pbm > ${test_out} || \
  printf "Expected failure 35 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impulse -salt=+1.10 testgrid.pbm > ${test_out} || \
  printf "Expected failure 36 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impulse -lambda=12.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 37 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

# type poisson

pamaddnoise -type poisson -sigma1=4.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 38 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type poisson -sigma2=20.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 39 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type poisson -mgsigma=0.5 testgrid.pbm > ${test_out} || \
  printf "Expected failure 40 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type poisson -lsigma=10.0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 41 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type poisson -tolerance=0.10 testgrid.pbm > ${test_out} || \
  printf "Expected failure 42 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type poisson -salt=0.50 testgrid.pbm > ${test_out} || \
  printf "Expected failure 43 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type poisson -lambda=0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 44 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

# Missing or invalid numerical parameters

pamaddnoise -sigma1 testgrid.pbm > ${test_out} || \
  printf "Expected failure 45 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -sigma1 Z testgrid.pbm > ${test_out} || \
  printf "Expected failure 46 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type gaussian -sigma2 testgrid.pbm > ${test_out} || \
  printf "Expected failure 47 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type gaussian -sigma2 sigma testgrid.pbm > ${test_out} || \
  printf "Expected failure 48 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type mult -mgsigma testgrid.pbm > ${test_out} || \
  printf "Expected failure 49 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type mult -mgsigma 10,0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 50 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type lapl -lsigma 1..0 testgrid.pbm > ${test_out} || \
  printf "Expected failure 51 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type lapl -lsigma lsigma testgrid.pbm > ${test_out} || \
  printf "Expected failure 52 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impul -tolerance testgrid.pbm > ${test_out} || \
  printf "Expected failure 53 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impul -tolerance t testgrid.pbm > ${test_out} || \
  printf "Expected failure 54 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impul -salt testgrid.pbm > ${test_out} || \
  printf "Expected failure 55 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type impul -salt pepper testgrid.pbm > ${test_out} || \
  printf "Expected failure 56 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type pois -lambda testgrid.pbm > ${test_out} || \
  printf "Expected failure 57 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -type pois -lambda L testgrid.pbm > ${test_out} || \
  printf "Expected failure 58 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -seed -1 testgrid.pbm > ${test_out} || \
  printf "Expected failure 59 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

pamaddnoise -seed random testgrid.pbm > ${test_out} || \
  printf "Expected failure 60 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}

  
# no type specified

pamaddnoise -type testgrid.pbm > ${test_out} || \
  printf "Expected failure 61 "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}