aboutsummaryrefslogtreecommitdiff
path: root/Practical1/tester
diff options
context:
space:
mode:
authorCamil Staps2015-10-23 12:35:46 +0200
committerCamil Staps2015-10-23 12:35:46 +0200
commit78c8b3bd7dd49700c8607093304c599e2313f346 (patch)
treecefbaec6a4ad0a96edd303f023c69b3aa3b9a077 /Practical1/tester
parentRobson's algorithm; added test outputs; more test cases; tester bugfix (diff)
Practical1: comments; Java8 fancy stuff; enhancements tester
Diffstat (limited to 'Practical1/tester')
-rwxr-xr-xPractical1/tester/test.sh17
1 files changed, 8 insertions, 9 deletions
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