-
Notifications
You must be signed in to change notification settings - Fork 1
/
testrun
62 lines (59 loc) · 1.49 KB
/
testrun
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
#!/bin/bash
echo "Parsing valid programs..."
find wacc_examples/valid -name "*.wacc" | {
fails=0
all=0
while read line; do
((all++))
./compile "$line" > .tmp.txt 2>&1
if [[ -s ".tmp.txt" ]] ; then
echo "Failed: $line"
if [ "$1" == "-v" ] ; then
cat .tmp.txt
fi
((fails++))
fi ;
done
if [ $fails == 0 ] ; then
echo "*********All valid programs are parsed!*********"
else
echo "_______$fails/$all valid programs are not parsed!_______"
fi ;
}
echo "Parsing invalid programs that should throw syntax errors..."
find wacc_examples/invalid/syntaxErr -name "*.wacc" | {
fails=0
all=0
while read line; do
((all++))
./compile "$line" > .tmp.txt 2>&1
if [[ ! -s ".tmp.txt" ]] ; then
echo "Parsed: $line"
((fails++))
fi ;
done
if [ $fails == 0 ] ; then
echo "****All programs with syntactic errors fail!****"
else
echo "_______$fails/$all syntactic errors are parsed!_______"
fi ;
}
echo "Parsing invalid programs that should throw semantic errors..."
find wacc_examples/invalid/semanticErr -name "*.wacc" | {
fails=0
all=0
while read line; do
((all++))
./compile "$line" > .tmp.txt 2>&1
if [[ ! -s ".tmp.txt" ]] ; then
echo "Parsed: $line"
((fails++))
fi ;
done
if [ $fails == 0 ] ; then
echo "*****All programs with semantic error fail!*****"
else
echo "_________$fails/$all semantic errors are parsed!_________"
fi ;
}
rm .tmp.txt