diff -r 34d2cfb7761a -r 86d59b074abe cw3_marking/cw3_test.sh --- a/cw3_marking/cw3_test.sh Fri Sep 18 10:57:24 2026 +0100 +++ b/cw3_marking/cw3_test.sh Fri Sep 18 10:58:01 2026 +0100 @@ -31,13 +31,17 @@ function scala_assert { rm -rf /Users/cu/.ammonite/cache/3.*/* 2> /dev/null ; - (ulimit -t 30; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out) + (ulimit -t 60; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out) } function scala_fail { - (ulimit -t 30; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out) + rm -rf /Users/cu/.ammonite/cache/3.*/* 2> /dev/null ; + (ulimit -t 60; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out) } +# remove @main +gsed -i -e "s|@main||g" cw03.sc + ### compilation test @@ -61,13 +65,20 @@ if [ $tsts -eq 0 ] then - echo -e "1) Parsing test with example files (does it raise an exception):\n" | tee -a $out - cat cw03.sc c3_add.sc > cw033_add.sc + echo -e "1) Parsing test with example files (no exception is raised):\n" | tee -a $out + cat cw03.sc c3_add.sc > cw033_add.sc + START=$(date +%s) if (scala_assert "c3.sc") then + END=$(date +%s) + DIFF=$(( $END - $START )) + echo -e " This test ran for $DIFF seconds" | tee -a $out echo -e " --> success (+ 6.0 Marks)\n" | tee -a $out marks=$(( marks + 6.0 )) else + END=$(date +%s) + DIFF=$(( $END - $START )) + echo -e " This test ran for $DIFF seconds" | tee -a $out echo -e " --> FAILED\n" | tee -a $out #cat $out | tee -a $out fi @@ -83,8 +94,8 @@ cat c4_pre.sc cw03.sc c4_add.sc > cw034_add.sc if (scala_assert "c4.sc") then - echo -e " --> success (+ 2.0 Marks)\n" | tee -a $out - marks=$(( marks + 2.0 )) + echo -e " --> success (+ 5.0 Marks)\n" | tee -a $out + marks=$(( marks + 5.0 )) else echo -e " --> FAILED\n" | tee -a $out #cat $out | tee -a $out @@ -103,8 +114,8 @@ echo -e "\"\"\"\n" >> $out if (scala_assert "c5.sc") then - echo -e " --> success (+ 2.0 Marks)\n" | tee -a $out - marks=$(( marks + 2.0 )) + echo -e " --> success (+ 4.0 Marks)\n" | tee -a $out + marks=$(( marks + 4.0 )) else echo -e " --> FAILED\n" | tee -a $out tail -25 $out | pr -to10