Debian Codegraph @

test.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 hashcash="../hashcash -u -t 040404"
4 sha1="../sha1"
5 mkdirscip-shell system . . mkdir. -p test
6 cd test
7
8 #v=1
9 test=1
10
11 ######################################################################
12
13 echoscip-shell system . . echo. -n "test $test (-mb8) "
14 $hashcash -mqb8 [email protected] > stamp.$test
15 echoscip-shell system . . echo. -n `catscip-shell system . . cat. stamp.$test` | $sha1 | sedscip-shell system . . sed. 's/^\(..\).*/\1/' > res.$test
16 echoscip-shell system . . echo. 00 > out.$test
17 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
18 test=`exprscip-shell system . . expr. $test + 1`
19
20 ######################################################################
21
22 echoscip-shell system . . echo. -n "test $test (-mb12) "
23 $hashcash -mqb12 [email protected] > stamp.$test
24 echoscip-shell system . . echo. -n `catscip-shell system . . cat. stamp.$test` | $sha1 | sedscip-shell system . . sed. 's/^\(...\).*/\1/' > res.$test
25 echoscip-shell system . . echo. 000 > out.$test
26 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
27 test=`exprscip-shell system . . expr. $test + 1`
28
29 ######################################################################
30
31 echoscip-shell system . . echo. -n "test $test (-mb8 -mb12) "
32 $hashcash -mqb8 [email protected] -b12 [email protected] > stamp.$test
33 echoscip-shell system . . echo. -n `headscip-shell system . . head. -1 stamp.$test` | $sha1 | sedscip-shell system . . sed. 's/^\(..\).*/\1/' > res1.$test
34 echoscip-shell system . . echo. 00 > out1.$test
35 echoscip-shell system . . echo. -n `tailscip-shell system . . tail. -1 stamp.$test` | $sha1 | sedscip-shell system . . sed. 's/^\(...\).*/\1/' > res2.$test
36 echoscip-shell system . . echo. 000 > out2.$test
37 diffscip-shell system . . diff. -q res1.$test out1.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && \
38 diff -q res2.$test out2.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
39 test=`exprscip-shell system . . expr. $test + 1`
40
41 ######################################################################
42
43 echoscip-shell system . . echo. -n "test $test (-b10 partial) "
44 $hashcash -q -b10 < stamps
45 [scip-shell system . . `[`. $? -eq 2 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
46 test=`exprscip-shell system . . expr. $test + 1`
47
48 ######################################################################
49
50 echoscip-shell system . . echo. -n "test $test (-b15 insufficient) "
51 $hashcash -q -b15 < stamps
52 [scip-shell system . . `[`. $? -eq 1 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
53 test=`exprscip-shell system . . expr. $test + 1`
54
55 ######################################################################
56
57 echoscip-shell system . . echo. -n "test $test (-r partial) "
58 $hashcash -q -r '*@foo.com' < stamps
59 [scip-shell system . . `[`. $? -eq 2 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
60 test=`exprscip-shell system . . expr. $test + 1`
61
62 ######################################################################
63
64 echoscip-shell system . . echo. -n "test $test (-r no match) "
65 $hashcash -q -r '*@taz.com' < stamps
66 [scip-shell system . . `[`. $? -eq 1 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
67 test=`exprscip-shell system . . expr. $test + 1`
68
69 ######################################################################
70
71 echoscip-shell system . . echo. -n "test $test (-d not spent) "
72 catscip-shell system . . cat. > db.$test <<EOF
73 last_purged 700101000000
74 0:040402:[email protected]:0ace5ad5254b4e401036b5f0 2419200
75 EOF
76 catscip-shell system . . cat. > stamp.$test <<EOF
77 0:040402:[email protected]:be45eb4e586a3e08cf7c95c4
78 EOF
79 $hashcash -qd -f db.$test < stamp.$test
80 [scip-shell system . . `[`. $? -eq 2 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
81 test=`exprscip-shell system . . expr. $test + 1`
82
83 ######################################################################
84
85 echoscip-shell system . . echo. -n "test $test (-d spent) "
86 catscip-shell system . . cat. > db.$test <<EOF
87 last_purged 700101000000
88 0:040402:[email protected]:0ace5ad5254b4e401036b5f0 2419200
89 EOF
90 catscip-shell system . . cat. > stamp.$test <<EOF
91 0:040402:[email protected]:0ace5ad5254b4e401036b5f0
92 EOF
93 $hashcash -qd -f db.$test < stamp.$test
94 [scip-shell system . . `[`. $? -eq 1 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
95 test=`exprscip-shell system . . expr. $test + 1`
96
97 ######################################################################
98
99 echoscip-shell system . . echo. -n "test $test (-w) "
100 catscip-shell system . . cat. > stamps <<EOF
101 0:050403:[email protected]:1f0986777f16f66a53241ec3
102 0:030404:[email protected]:23d5ea11c43287d58ea6a63f
103 0:040402:[email protected]:0ace5ad5254b4e401036b5f0
104 0:040402:[email protected]:be45eb4e586a3e08cf7c95c4
105 0:040404:[email protected]:20056ff4e877027ef8ba55eb
106 EOF
107
108 catscip-shell system . . cat. > out.$test <<EOF
109 5
110 5
111 5
112 12
113 6
114 EOF
115 #if [ $v -ne "" ]; then echo; endif
116 [scip-shell system . . `[`. $v ] && echoscip-shell system . . echo. && echoscip-shell system . . echo. "$hashcash -wq < stamps > res.$test"
117 $hashcash -wq < stamps > res.$test
118 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
119 test=`exprscip-shell system . . expr. $test + 1`
120
121 ######################################################################
122
123 echoscip-shell system . . echo. -n "test $test (-wb10 one sufficient) "
124 catscip-shell system . . cat. > stamp.$test <<EOF
125 0:040402:[email protected]:be45eb4e586a3e08cf7c95c4
126 EOF
127
128 catscip-shell system . . cat. > out.$test <<EOF
129 12
130 EOF
131 #if [ $v -ne "" ]; then echo; endif
132 [scip-shell system . . `[`. $v ] && echoscip-shell system . . echo. && echoscip-shell system . . echo. "$hashcash -wq < stamp.$test > res.$test"
133 $hashcash -wqb10 < stamp.$test > res.$test
134 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
135 test=`exprscip-shell system . . expr. $test + 1`
136
137 ######################################################################
138
139 echoscip-shell system . . echo. -n "test $test (-wn) "
140 catscip-shell system . . cat. > out.$test <<EOF
141 [email protected] 5
142 [email protected] 5
143 [email protected] 5
144 [email protected] 12
145 [email protected] 6
146 EOF
147
148 $hashcash -wnq < stamps > res.$test
149 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
150 test=`exprscip-shell system . . expr. $test + 1`
151
152 ######################################################################
153
154 echoscip-shell system . . echo. -n "test $test (-n) "
155 catscip-shell system . . cat. > out.$test <<EOF
156 [email protected]
157 [email protected]
158 [email protected]
159 [email protected]
160 [email protected]
161 EOF
162
163 $hashcash -nq < stamps > res.$test
164 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
165 test=`exprscip-shell system . . expr. $test + 1`
166
167 ######################################################################
168
169 echoscip-shell system . . echo. -n "test $test (-nb10) "
170 catscip-shell system . . cat. > out.$test <<EOF
171 [email protected]
172 EOF
173
174 $hashcash -nqb10 < stamps > res.$test
175 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
176 test=`exprscip-shell system . . expr. $test + 1`
177
178 ######################################################################
179
180 echoscip-shell system . . echo. -n "test $test (-nr three match) "
181 catscip-shell system . . cat. > out.$test <<EOF
182 [email protected]
183 [email protected]
184 EOF
185
186 $hashcash -nq -r '*[email protected]' < stamps > res.$test
187 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
188 test=`exprscip-shell system . . expr. $test + 1`
189
190 ######################################################################
191
192 echoscip-shell system . . echo. -n "test $test (-l) "
193 catscip-shell system . . cat. > out.$test <<EOF
194 +31276800
195 -29030400
196 2419200
197 2419200
198 2592000
199 EOF
200
201 $hashcash -lq < stamps > res.$test
202 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
203 test=`exprscip-shell system . . expr. $test + 1`
204
205 ######################################################################
206
207 echoscip-shell system . . echo. -n "test $test (-nl) "
208 catscip-shell system . . cat. > out.$test <<EOF
209 [email protected] +31276800
210 [email protected] -29030400
211 [email protected] 2419200
212 [email protected] 2419200
213 [email protected] 2592000
214 EOF
215
216 $hashcash -nlq < stamps > res.$test
217 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
218 test=`exprscip-shell system . . expr. $test + 1`
219
220 ######################################################################
221
222 echoscip-shell system . . echo. -n "test $test (-wl) "
223 catscip-shell system . . cat. > out.$test <<EOF
224 5 +31276800
225 5 -29030400
226 5 2419200
227 12 2419200
228 6 2592000
229 EOF
230
231 $hashcash -wlq < stamps > res.$test
232 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
233 test=`exprscip-shell system . . expr. $test + 1`
234
235 ######################################################################
236
237 echoscip-shell system . . echo. -n "test $test (-nwl) "
238 catscip-shell system . . cat. > out.$test <<EOF
239 [email protected] 5 +31276800
240 [email protected] 5 -29030400
241 [email protected] 5 2419200
242 [email protected] 12 2419200
243 [email protected] 6 2592000
244 EOF
245
246 $hashcash -nwlq < stamps > res.$test
247 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
248 test=`exprscip-shell system . . expr. $test + 1`
249
250 ######################################################################
251 # -c with -y
252 ######################################################################
253
254 echoscip-shell system . . echo. -n "test $test (-cy -b10 match) "
255 $hashcash -cqy -b10 -r '*@foo.com' < stamps && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
256 test=`exprscip-shell system . . expr. $test + 1`
257
258 ######################################################################
259
260 echoscip-shell system . . echo. -n "test $test (-cy -b15 insufficient) "
261 $hashcash -cqy -b15 -r '*@foo.com' < stamps && echoscip-shell system . . echo. fail || echoscip-shell system . . echo. ok
262 test=`exprscip-shell system . . expr. $test + 1`
263
264 ######################################################################
265
266 echoscip-shell system . . echo. -n "test $test (-cy insufficient) "
267 $hashcash -cqy -b+0 -r '*@foo.com' < stamps && echoscip-shell system . . echo. fail || echoscip-shell system . . echo. ok
268 test=`exprscip-shell system . . expr. $test + 1`
269
270 ######################################################################
271
272 echoscip-shell system . . echo. -n "test $test (-cy -b10 no match) "
273 $hashcash -cqy -b10 -r '*@taz.com' < stamps && echoscip-shell system . . echo. fail || echoscip-shell system . . echo. ok
274 test=`exprscip-shell system . . expr. $test + 1`
275
276 ######################################################################
277
278 echoscip-shell system . . echo. -n "test $test (-cy -b5 expired) "
279 $hashcash -cqy -b5 -r '[email protected]' < stamps && echoscip-shell system . . echo. fail || echoscip-shell system . . echo. ok
280 test=`exprscip-shell system . . expr. $test + 1`
281
282 ######################################################################
283
284 echoscip-shell system . . echo. -n "test $test (-cy -b5 future) "
285 $hashcash -cqy -b5 -r '[email protected]' < stamps && echoscip-shell system . . echo. fail || echoscip-shell system . . echo. ok
286 test=`exprscip-shell system . . expr. $test + 1`
287
288
289 ######################################################################
290 # -c with exit codes
291 ######################################################################
292
293 echoscip-shell system . . echo. -n "test $test (-c -b10 partial) "
294 $hashcash -cq -b10 -r '*@foo.com' < stamps
295 [scip-shell system . . `[`. $? -eq 2 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
296 test=`exprscip-shell system . . expr. $test + 1`
297
298 ######################################################################
299
300 echoscip-shell system . . echo. -n "test $test (-cy -b10 success) "
301 $hashcash -cyq -b10 -r '*@foo.com' < stamps
302 [scip-shell system . . `[`. $? -eq 0 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
303 test=`exprscip-shell system . . expr. $test + 1`
304
305 ######################################################################
306
307 echoscip-shell system . . echo. -n "test $test (-c -b15 insufficient) "
308 $hashcash -cq -b15 -r '*@foo.com' < stamps
309 [scip-shell system . . `[`. $? -eq 1 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
310 test=`exprscip-shell system . . expr. $test + 1`
311
312 ######################################################################
313
314 echoscip-shell system . . echo. -n "test $test (-c -b10 no match) "
315 $hashcash -cq -b10 -r '*@taz.com' < stamps
316 [scip-shell system . . `[`. $? -eq 1 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
317 test=`exprscip-shell system . . expr. $test + 1`
318
319 ######################################################################
320
321 echoscip-shell system . . echo. -n "test $test (-c -b5 expired) "
322 $hashcash -cq -b5 -r '[email protected]' < stamps
323 [scip-shell system . . `[`. $? -eq 1 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
324 test=`exprscip-shell system . . expr. $test + 1`
325
326 ######################################################################
327
328 echoscip-shell system . . echo. -n "test $test (-c -b5 future) "
329 $hashcash -cq -b5 -r '[email protected]' < stamps
330 [scip-shell system . . `[`. $? -eq 1 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
331 test=`exprscip-shell system . . expr. $test + 1`
332
333
334 ######################################################################
335 # -cn
336 ######################################################################
337
338 catscip-shell system . . cat. > out.$test <<EOF
339 [email protected]
340 EOF
341
342 echoscip-shell system . . echo. -n "test $test (-cn -b10 one sufficient) "
343 $hashcash -cnq -b10 -r '*@foo.com' < stamps > res.$test
344 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
345 test=`exprscip-shell system . . expr. $test + 1`
346
347 ######################################################################
348
349 catscip-shell system . . cat. > out.$test <<EOF
350 [email protected]
351 [email protected]
352 [email protected]
353 EOF
354
355 echoscip-shell system . . echo. -n "test $test (-cn -b5 three valid) "
356 $hashcash -cnq -b5 -r '*@foo.com' < stamps > res.$test
357 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
358 test=`exprscip-shell system . . expr. $test + 1`
359
360 ######################################################################
361
362 catscip-shell system . . cat. > out.$test <<EOF
363 [email protected]
364 [email protected]
365 EOF
366
367 echoscip-shell system . . echo. -n "test $test (-cn -b5 two match) "
368 $hashcash -cnq -b5 -r '*[email protected]' < stamps > res.$test
369 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
370 test=`exprscip-shell system . . expr. $test + 1`
371
372 ######################################################################
373
374 echoscip-shell system . . echo. -n "" > out.$test
375
376 echoscip-shell system . . echo. -n "test $test (-cn none sufficient) "
377 $hashcash -cnqb+0 -r '*[email protected]' < stamps > res.$test
378 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
379 test=`exprscip-shell system . . expr. $test + 1`
380
381 ######################################################################
382
383 catscip-shell system . . cat. > out.$test <<EOF
384 [email protected]
385 EOF
386
387 echoscip-shell system . . echo. -n "test $test (-cn -r -o -r one sufficient) "
388 $hashcash -cnqb10 -r '*[email protected]' < stamps > res.$test
389 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
390 test=`exprscip-shell system . . expr. $test + 1`
391
392
393 ######################################################################
394 # -cw
395 ######################################################################
396
397 catscip-shell system . . cat. > out.$test <<EOF
398 5
399 12
400 6
401 EOF
402
403 echoscip-shell system . . echo. -n "test $test (-cwb5 three valid) "
404 $hashcash -cwqb5 < stamps > res.$test
405 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
406 test=`exprscip-shell system . . expr. $test + 1`
407
408 ######################################################################
409
410 catscip-shell system . . cat. > out.$test <<EOF
411 5
412 12
413 EOF
414
415 echoscip-shell system . . echo. -n "test $test (-cwb5 -r two valid match) "
416 $hashcash -cwqb5 -r '*[email protected]' < stamps > res.$test
417 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
418 test=`exprscip-shell system . . expr. $test + 1`
419
420 ######################################################################
421 # -cl
422 ######################################################################
423
424 catscip-shell system . . cat. > out.$test <<EOF
425 2419200
426 2419200
427 2592000
428 EOF
429
430 echoscip-shell system . . echo. -n "test $test (-cl -b5 three sufficient) "
431 $hashcash -clq -b5 < stamps > res.$test
432 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
433 test=`exprscip-shell system . . expr. $test + 1`
434
435 ######################################################################
436
437 echoscip-shell system . . echo. -n "test $test (-c -b10 -r [email protected] -o -b5 -r *@foo.com partial) "
438 $hashcash -cqb10 -r '[email protected]' -o -b5 -r '*[email protected]' < stamps
439 [scip-shell system . . `[`. $? -eq 2 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
440 test=`exprscip-shell system . . expr. $test + 1`
441
442 ######################################################################
443
444 echoscip-shell system . . echo. -n "test $test (-c -b10 -r blah -o -b6 -r blah -r *[email protected] partial) "
445 $hashcash -cqb10 -r '[email protected]' -o -b6 -r '*[email protected]' \
446 -r '*[email protected]' < stamps
447 [scip-shell system . . `[`. $? -eq 2 ] && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
448 test=`exprscip-shell system . . expr. $test + 1`
449
450 ######################################################################
451
452 catscip-shell system . . cat. > out.$test <<EOF
453 2419200
454 2419200
455 2592000
456 EOF
457
458 echoscip-shell system . . echo. -n "test $test (-cl -b5 three sufficient) "
459 $hashcash -clq -b5 < stamps > res.$test
460 diffscip-shell system . . diff. -q res.$test out.$test 1> /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && echoscip-shell system . . echo. ok || echoscip-shell system . . echo. fail
461 test=`exprscip-shell system . . expr. $test + 1`
462