-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.sh
executable file
·34 lines (29 loc) · 896 Bytes
/
tests.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
#!/bin/bash
mkdir -p output
start="$(date +%s%N)"
for filename in *Topo.py; do
name=$(basename $filename .py)
python run_spanning_tree.py $name output/$name.txt
done
end="$(date +%s%N)"
passedCounter=0
testCounter=0
for filename in output/*.txt; do
testCounter=$((testCounter+1))
name=$(basename $filename .txt)
if ! diff -q -s output/$name.txt solution/$name.txt > /dev/null; then
echo "❌ $name failed!"
else
echo "✔️ $name passed!"
passedCounter=$((passedCounter+1))
fi
done
echo "-----------------------------------------"
if [ "$passedCounter" = "$testCounter" ] ; then
echo "️✔️ All tests ($passedCounter/$testCounter) passed!"
elapsed="$((($end-$start)/1000000))"
echo "Total time taken: $elapsed milliseconds."
else
echo "❗ Some test(s) failed! ($passedCounter/$testCounter) passed."
fi
echo "-----------------------------------------"