From 78c8b3bd7dd49700c8607093304c599e2313f346 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Fri, 23 Oct 2015 12:35:46 +0200 Subject: Practical1: comments; Java8 fancy stuff; enhancements tester --- Practical1/tester/test.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'Practical1/tester') diff --git a/Practical1/tester/test.sh b/Practical1/tester/test.sh index 068d6ea..83fdccb 100755 --- a/Practical1/tester/test.sh +++ b/Practical1/tester/test.sh @@ -4,8 +4,7 @@ java="/usr/lib/jvm/java-8-openjdk-amd64/bin/java" failed=0 cd "$(dirname $0)/../out/production/Practical1" -for tc in ../../../tester/samples/*.in -do +for tc in ../../../tester/samples/*.in; do answer=$(cat ${tc/in/out}) header=$(head -n1 "$tc" | tr -d '\n') echo -n "Running $(basename $tc) $(printf '%-12s' "($answer ")$(printf '%-12s' "/ $header)") ... " @@ -13,20 +12,20 @@ do result=$(eval "cat '$tc' | /usr/lib/jvm/java-8-openjdk-amd64/bin/java nl.camilstaps.cs.GarbageCollectionHelper") time_end=$(($(date +%s%N)/1000000)) time=`expr $time_end - $time_start` - if [ $result != $answer ] - then + if [ $result != $answer ]; then echo "failure ($time ms)." failed=$(($failed+1)) else echo "success ($time ms)." fi done -cd - +cd - >/dev/null -if [ $failed -eq 0 ] -then - echo "All tests passed" +if [ $failed -eq 0 ]; then + echo "All tests passed." +elif [ $failed -eq 1 ]; then + echo "1 test failed." else - echo "$failed tests failed" + echo "$failed tests failed." fi -- cgit v1.2.3