-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·58 lines (46 loc) · 842 Bytes
/
test.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
#!/bin/bash
function faillex() {
local testExit=$?
local test=$1
local output=$2
local expected=0
if case $test in tests/faillex*) ;; *) false;; esac; then
expected=1
fi
if [ $testExit -ne $expected ]
then
cat test_out.txt
echo "Failed: $test"
exit 1
fi
}
function failparse() {
local testExit=$?
local test=$1
local output=$2
local expected=0
if case $test in tests/fail*) ;; *) false;; esac; then
expected=1
fi
if [ $testExit -ne $expected ]
then
echo $output
echo "Failed: $test"
exit 1
else
echo "Success: $test"
fi
}
make lexmain
make parsemain
tests=($(ls tests/*))
for test in ${tests[@]}
do
echo "Test: $test"
./lexmain $test &> test_out.txt
faillex "$test"
./parsemain $test &> test_out.txt
failparse "$test"
echo
done
rm test_out.txt