blob: 14b4ca3d9f556a4c8ba0b7f9c0aea14a9a66e796 (
plain)
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
|
#!/bin/sh
re="${TEST:-$@}"
TESTBIN="test/run"
TESTOUT="test/last.out"
TESTERR="test/last.err"
CUBEOBJ="debugcube.o"
for t in test/*; do
if [ -n "$re" ] && !(echo "$t" | grep -q "$re"); then
continue
fi
# Verify if $t is a directory and if its name starts with three digits
if [ -d "$t" ] && basename "$t" | grep -Eq '^[0-9]{3}'; then
$CC -o $TESTBIN "$t"/*.c $CUBEOBJ || exit 1
for cin in "$t"/*.in; do
c=$(echo "$cin" | sed 's/\.in//')
cout="$c.out"
printf "%s: " "$c"
$TESTBIN < "$cin" > $TESTOUT 2> $TESTERR
if diff "$cout" "$TESTOUT"; then
printf "OK\n"
else
printf "Test failed! stderr:\n"
cat $TESTERR
exit 1
fi
done
fi
done
echo "All tests passed!"
rm -rf $TESTBIN $TESTOUT $TESTERR $CUBEOBJ
|