-
Notifications
You must be signed in to change notification settings - Fork 0
/
testall.sh
executable file
·52 lines (41 loc) · 1.06 KB
/
testall.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
#!/bin/bash
# source ./clean.sh
# cd macrotests/testcasegen
# source build.sh
# cd ../..
if [ $# -eq 1 ]; then
test_name=$1
debug=0
else
echo -e "\033c"
test_name=""
debug=0
fi
ls macrotests | grep .sleq | sed 's/.sleq//' | while read line; do
if [ ! -z "$test_name" ] && [[ "$line" != $test_name* ]]; then
continue
fi
echo -n "$line "
script=$(sed -n '/;# SCRIPT/,/;# END/p' macrotests/$line.sleq | sed 's/^;//')
expected=$(eval "$script")
if [ "$expected" = "" ]; then
echo -e "\033[0;33mNot tested\033[0m"
continue
fi
result=$( \
../SLEQASM/sleqasm.js macrotests/$line.sleq $debug && \
../SLEQASM/subleq macrotests/$line.v20raw | \
tr -d '\n' | \
tr -d '\r' \
)
if [ "$expected" = "$result" ]; then
echo -e "\033[0;32mOK\033[0m"
else
echo -e "\033[0;31mFAIL\033[0m"
# if [ ! -z "$test_name" ]; then
echo -e "\tExpected \'$expected\'"
echo -e "\tBut got \'$result\'"
# fi
fi
done
source ./clean.sh