diff options
Diffstat (limited to 'test.sh')
-rwxr-xr-x | test.sh | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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" |