-
Notifications
You must be signed in to change notification settings - Fork 0
/
testMyProject.sh
executable file
·125 lines (110 loc) · 2.73 KB
/
testMyProject.sh
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
#!/usr/bin/env bash
# Authors: Pavel Hrebicek (xhrebi04) - first 10 tests
# David Bolvansky (xbolva00) - other tests
# Tests for FLP BKG-SIMPLIFY
RED='\033[0;31m'
GREEN='\033[0;32m'
YEL='\033[0;33m'
NC='\033[0m' # No Color
total=0
ok=0
echo "Starting testing..."
if [ ! -f "./simplify-bkg" ]
then
echo -e "./simplify-bkg ${RED}not found.${NC}"
exit 1
fi
echo "***********************************************"
for (( i=1; i<=49; i++ ))
do
((total++))
# -i
./simplify-bkg -i tests/test0${i}.in > tests/test0${i}_i.temp
diff tests/test0${i}_i.temp tests/test0${i}_i.out
if [ "$?" == "0" ]
then
echo -e "[TEST 0$i] ./simplify-bkg -i tests/test0$i.in [${GREEN}OK${NC}]"
((ok++))
rm tests/test0${i}_i.temp
else
echo -e "[TEST 0$i] ./simplify-bkg -i tests/test0$i.in [${RED}BAD${NC}]"
fi
((total++))
# -1
./simplify-bkg -1 tests/test0${i}.in > tests/test0${i}_1.temp
diff tests/test0${i}_1.temp tests/test0${i}_1.out
if [ "$?" == "0" ]
then
echo -e "[TEST 0$i] ./simplify-bkg -1 tests/test0${i}.in [${GREEN}OK${NC}]"
((ok++))
rm tests/test0${i}_1.temp
else
echo -e "[TEST 0$i] ./simplify-bkg -1 tests/test0${i}.in [${RED}BAD${NC}]"
fi
((total++))
# -2
./simplify-bkg -2 tests/test0${i}.in > tests/test0${i}_2.temp
diff tests/test0${i}_2.temp tests/test0${i}_2.out
if [ "$?" == "0" ]
then
echo -e "[TEST 0$i] ./simplify-bkg -2 tests/test0${i}.in [${GREEN}OK${NC}]"
((ok++))
rm tests/test0${i}_2.temp
else
echo -e "[TEST 0$i] ./simplify-bkg -2 tests/test0${i}.in [${RED}BAD${NC}]"
fi
done
((total++))
./simplify-bkg -t
if [ "$?" == "1" ]
then
((ok++))
echo -e "./simplify-bkg -t [${GREEN}OK${NC}]"
else
echo -e "./simplify-bkg -t [${RED}BAD${NC}]"
fi
((total++))
./simplify-bkg -i -1 -2
if [ "$?" == "1" ]
then
((ok++))
echo -e "./simplify-bkg -i -1 -2 [${GREEN}OK${NC}]"
else
echo -e "./simplify-bkg -i -1 -2 [${RED}BAD${NC}]"
fi
((total++))
./simplify-bkg -i filenotexists
if [ "$?" == "1" ]
then
((ok++))
echo -e "./simplify-bkg -i filenotexists [${GREEN}OK${NC}]"
else
echo -e "./simplify-bkg -i filenotexists [${RED}BAD${NC}]"
fi
((total++))
./simplify-bkg tests/test01.in
if [ "$?" == "1" ]
then
((ok++))
echo -e "./simplify-bkg -i < tests/test01.in [${GREEN}OK${NC}]"
else
echo -e "./simplify-bkg -i < tests/test01.in [${RED}BAD${NC}]"
fi
((total++))
./simplify-bkg
if [ "$?" == "1" ]
then
((ok++))
echo -e "./simplify-bkg [${GREEN}OK${NC}]"
else
echo -e "./simplify-bkg [${RED}BAD${NC}]"
fi
echo "***********************************************"
echo -e "FINISHED TESTING:"
echo -e "OK/TOTAL: ${ok}/${total}"
if [ "$ok" == "$total" ]
then
echo -e "[${GREEN}SUCCESSFULL${NC}]"
else
echo -e "[${RED}FAILED${NC}]"
fi