diff options
author | David Phillips <david@sighup.nz> | 2019-03-16 21:06:15 +1300 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2019-03-16 21:06:15 +1300 |
commit | 53e40ead2dc29deaff619803d1aa57812b2920fc (patch) | |
tree | ca1d3c816e87143d69507f3a2364a1ce42056c56 /run_tests.sh | |
parent | 16a2da0f217aa4f2da4b084014e4da731740e0df (diff) | |
download | sudoku-53e40ead2dc29deaff619803d1aa57812b2920fc.tar.xz |
Tally test results, add new tests
Diffstat (limited to 'run_tests.sh')
-rwxr-xr-x | run_tests.sh | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/run_tests.sh b/run_tests.sh index 2cff423..fe5f068 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,6 +1,8 @@ -#!/bin/bash -e +#!/bin/bash -exit_code=0 +t_pass=0 +t_fail=0 +t_xfail=0 [ -z "$SOLVER" ] && SOLVER="$PWD/test-solver" XFAILS="$PWD/test/xfails" @@ -8,26 +10,36 @@ XFAILS="$PWD/test/xfails" test_fail() { t="$(basename $1)" if grep -q "$t" "$XFAILS" ; then - echo -e "$t: "'[\e[34;1mXFAIL\e[0m]' + echo -e '[\e[34;1mXFAIL\e[0m]'" $t" + ((t_xfail++)) else - echo -e "$t: "'[\e[31;1mFAIL\e[0m]' + echo -e '[\e[31;1mFAIL\e[0m]'" $t" + ((t_fail++)) fi } test_pass() { t="$(basename $1)" - echo -e "$t: "'[\e[32;1mPASS\e[0m]' + echo -e '[\e[32;1mPASS\e[0m]'" $t" + ((t_pass++)) } for t in test/*-* ; do pushd "$t" >/dev/null if ! "$SOLVER" >/dev/null ; then test_fail "$t" - exit_code=1 else test_pass "$t" fi popd >/dev/null done -exit "$exit_code" +total_fail="$((t_fail + t_xfail))" +echo "========================================" +echo "Passes : $t_pass" +echo "Failures: $t_fail ($t_xfail of which are expected)" +echo "========================================" + +if [ "$t_fail" -gt "0" ]; then + exit 1 +fi |