-
Notifications
You must be signed in to change notification settings - Fork 1
/
runtests
executable file
·33 lines (31 loc) · 926 Bytes
/
runtests
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
trap "exit" INT
if [ "$#" -gt 0 ]
then
name="$1"
asm=${name%.*}.s
python compile.py $name
gcc $asm hashtable.o hashtable_itr.o hashtable_utility.o runtime.o -lm -m32 -o ${name%.*}
compiledoutput=$(cat tests/input.txt | ./${name%.*})
correctoutput=$(cat tests/input.txt | python $name)
if [ "$compiledoutput" = "$correctoutput" ]
then
echo Succeeded: $name
else
echo Failed: $name. Expected $correctoutput but got $compiledoutput.
fi
else
for name in $(find tests -type f -name "*.py");
do
asm=${name%.*}.s
python compile.py $name
gcc $asm hashtable.o hashtable_itr.o hashtable_utility.o runtime.o -lm -m32 -o ${name%.*}
compiledoutput=$(cat tests/input.txt | ./${name%.*})
correctoutput=$(cat tests/input.txt | python $name)
if [ "$compiledoutput" = "$correctoutput" ]
then
echo Succeeded: $name
else
echo Failed: $name. Expected $correctoutput but got $compiledoutput.
fi
done
fi