summaryrefslogtreecommitdiff
path: root/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test.sh')
-rwxr-xr-xtest.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..0167381
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+total=0
+correct=0
+for inf in tests/*.in; do
+ base="${inf//.in}"
+ outf="$base.out"
+ tmpf="$base.tmp"
+ if ! ./solve <"$inf" >"$tmpf" 2>/dev/null; then
+ echo "\x1B[33mERROR\x1B[0m solve returned $?"
+ fi
+ total=$((total+1))
+ if ! diff "$tmpf" "$outf" >/dev/null; then
+ echo "failure on $inf"
+ else
+ rm "$tmpf"
+ correct=$((correct+1))
+ fi
+done
+if test $correct -eq $total; then printf "\x1B[33mOK"; else printf "\x1B[31mFAILURE"; fi
+printf "\x1B[0m: %d/%d\n" "$correct" "$total"