-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
54 lines (52 loc) · 1.07 KB
/
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
#!bin/bash
echo "+-------------+"
echo "| Make |"
echo "+-------------+"
make
echo "+-------------+"
echo "| Tests |"
echo "+-------------+"
# for file in ./tests/*/*.src
# do
# echo "+--------------------"
# echo "| TEST: "$file
# echo "+--------------------"
# ./compiler -p 1 $file
# echo " "
# done
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
echo "+-------------+"
echo "| Examples |"
echo "+-------------+"
let "passed = 0"
let "files = 0"
for file in examples/*.src
do
let "files = files + 1"
echo "+--------------------"
echo "| EXAMPLE: "$file
echo "+--------------------"
./compiler -o out/ -a -f $file
y=${file%.*}
if [ -f $y.out ]; then
diff <(timeout 10s ./out/${y##*/}.out) $y.out
let "eq = $(echo $?)"
#echo "eq: $(echo $?)"
if [ $eq = "0" ]; then
echo -e "${RED}+-----"
echo -e "| " $file " has passed!"
echo -e "+-----"
let "passed = passed + 1"
else
echo "+-----"
echo "| " $file " has NOT passed!"
echo "+-----"
fi
else
let "passed = passed + 1"
fi
done
echo $passed "/" $files " has passed."
echo "done"