--- a/core_marking1/collatz_test.sh Sun Jan 15 10:58:13 2023 +0000
+++ b/core_marking1/collatz_test.sh Sat Mar 11 22:01:53 2023 +0000
@@ -25,13 +25,13 @@
# compilation tests
function scala_compile {
- (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
+ (JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
}
# functional tests
function scala_assert {
- (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
+ (JAVA_OPTS="-Xmx1g" scala -nc -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
}
# purity test
@@ -88,10 +88,10 @@
if (scala_assert "collatz.scala" "collatz_test1.scala")
then
- echo " --> success" | tee -a $out
+ echo -e " --> success (+ 1 Mark)\n" | tee -a $out
marks=$(( marks + 1 ))
else
- echo " --> one of the tests failed" | tee -a $out
+ echo -e " --> one of the tests failed\n" | tee -a $out
fi
fi
@@ -111,10 +111,10 @@
if (scala_assert "collatz.scala" "collatz_test2.scala")
then
- echo " --> success" | tee -a $out
+ echo -e " --> success (+ 1 Mark)\n" | tee -a $out
marks=$(( marks + 1 ))
else
- echo " --> one of the tests failed" | tee -a $out
+ echo -e " --> one of the tests failed\n" | tee -a $out
fi
fi
@@ -125,13 +125,19 @@
echo " last_odd(113) == 85" | tee -a $out
echo " last_odd(84) == 21" | tee -a $out
echo " last_odd(605) == 341" | tee -a $out
-
+ START=$(date +%s)
+
if (scala_assert "collatz.scala" "collatz_test3.scala")
then
- echo " --> success" | tee -a $out
+ END=$(date +%s)
+ DIFF=$(( $END - $START ))
+ echo -e " --> success (+ 1 Mark)\n" | tee -a $out
marks=$(( marks + 1 ))
else
- echo " --> one of the tests failed" | tee -a $out
+ END=$(date +%s)
+ DIFF=$(( $END - $START ))
+ echo -e " This test ran for $DIFF seconds" | tee -a $out
+ echo -e " --> one of the tests failed\n" | tee -a $out
fi
fi