aboutsummaryrefslogtreecommitdiff
path: root/test/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.sh')
-rwxr-xr-xtest/test.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/test.sh b/test/test.sh
new file mode 100755
index 0000000..d59270b
--- /dev/null
+++ b/test/test.sh
@@ -0,0 +1,32 @@
1#!/bin/sh
2
3CC="cc -DDEBUG -std=c99 -pthread -pedantic -Wall -Wextra \
4 -Wno-unused-parameter -Wno-unused-function -g3"
5if [ $(uname) != "OpenBSD" ]; then
6 CC="$CC -fsanitize=address -fsanitize=undefined"
7fi
8SRC="src/cube.c"
9TESTBIN="test/run"
10TESTOUT="test/last.out"
11TESTERR="test/last.err"
12
13for t in test/*; do
14 if [ ! -d $t ]; then continue; fi
15 $CC -o $TESTBIN $t/*.c $SRC || exit 1;
16 for cin in $t/*.in; do
17 c=$(echo "$cin" | sed 's/\.in//')
18 cout=$c.out
19 printf "$c: "
20 $TESTBIN < "$cin" > $TESTOUT 2> $TESTERR
21 if diff $cout $TESTOUT; then
22 printf "OK\n"
23 else
24 printf "Test failed! stderr:\n"
25 cat $TESTERR
26 exit 1
27 fi
28 done
29done
30
31echo "All tests passed!"
32rm -rf $TESTBIN $TESTOUT $TESTERR

Generated with cgit - Back to sebastiano.tronto.net