-
Notifications
You must be signed in to change notification settings - Fork 0
/
tester.sh
44 lines (38 loc) · 1018 Bytes
/
tester.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
#! /bin/sh
numTests=25 # UPDATE THIS TO THE NUMBER OF TESTS
sucesses=0
getInput() {
echo "Enter which test case you would like to run, or \"ALL\" to run all tests: "
read -r num
}
runTest() {
echo "Running test case $1"
./tester/kamincpp < tester/tests/test"$1".lisp > tester/tests/test"$1".out
python3 src/project1.py < tester/tests/test"$1".lisp > tester/tests/test"$1".ans
matchedLines=$(diff -w -y --suppress-common-lines "tester/tests/test$1.ans" "tester/tests/test$1.out" | wc -l | tr -d '[:space:]')
if [ "$matchedLines" -eq "0" ]; then
echo "Test case $1 passed"
sucesses=$((sucesses+1))
else
echo "Test case $1 failed"
fi
}
test() {
if [ "$1" = "ALL" ]; then
for i in $(seq 1 $numTests); do
runTest "$i"
done
else
runTest "$1"
numTests=1
fi
echo "Number of tests passed: $sucesses/$numTests"
}
makeKamin() {
cd tester || return
make
cd ..
}
getInput
makeKamin
test "$num"