-
Notifications
You must be signed in to change notification settings - Fork 1
/
testit
executable file
·58 lines (49 loc) · 1.51 KB
/
testit
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
#!/bin/bash
# -----------------------------------------------------------------------------
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar
# 14 rue de Plaisance, 75014 Paris, France
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
# 0. You just DO WHAT THE FUCK YOU WANT TO.
#
# -----------------------------------------------------------------------------
errors=0
run_tests() {
testname=$1
cmdgen=$2
cmddef=$3
cmdinf=$4
for sz in 1 5 10 50 100 500 1000 5000 10000 50000 100000 500000 1000000 ; do
printf "= %8s ~%10d:" "$testname" $sz
for i in `seq 1 10` ; do
$cmdgen "./test.tmp" $(($sz + ($RANDOM%1000)))
$cmddef < "./test.tmp" | $cmdinf | diff -q "./test.tmp" -
if [ $? -eq 0 ] ; then
echo -en " [$i: OK ]"
rm -f "./test.tmp"
else
echo -en " [$i:BLAD]"
mv "./test.tmp" "./bad-$testname-$sz-$i.txt"
let errors+=1
fi
done
echo
done
}
run_tests "bin+file" "./Zfilegen" "./Zdef" "./Zinf"
run_tests "txt+file" "./Ztextgen" "./Zdef" "./Zinf"
run_tests "txt+line" "./Ztextgen" "./Zdef" "./Zgetline"
if [ $errors -eq 0 ] ; then
echo "= -------- ~ ---------: OK"
else
echo "Bledow: $errors"
fi