marking1/collatz_test.sh
changeset 210 63a1376cbebd
parent 158 94b11ac19b41
child 212 4bda49ec24da
--- a/marking1/collatz_test.sh	Sat Nov 17 15:35:50 2018 +0000
+++ b/marking1/collatz_test.sh	Sat Nov 17 22:39:02 2018 +0000
@@ -23,13 +23,13 @@
 # compilation tests
 
 function scala_compile {
-  (ulimit -t 30 -m 1024000 ; scala "$1" 2> /dev/null 1> /dev/null)
+  (ulimit -t 60; JAVA_OPTS="-Xmx1g" scala "$1" 2> /dev/null 1> /dev/null)
 }
 
 # functional tests
 
 function scala_assert {
-  (ulimit -t 30 -m 1024000 ; scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
+  (ulimit -t 60; JAVA_OPTS="-Xmx1g" scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
 }
 
 # purity test
@@ -41,11 +41,11 @@
 
 # var, .par return, ListBuffer test
 #
-echo "collatz.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
+echo "collatz.scala does not contain vars, return etc?" | tee -a $out
 
 if (scala_vars collatz.scala)
 then
-  echo "  --> fail" | tee -a $out
+  echo "  --> test failed" | tee -a $out
   tsts0=$(( 1 ))
 else
   echo "  --> success" | tee -a $out
@@ -64,7 +64,7 @@
     echo "  --> success" | tee -a $out
     tsts=$(( 0 ))
   else
-    echo "  --> scala did not run collatz.scala" | tee -a $out
+    echo "  --> scala collatz.scala did not run successfully" | tee -a $out
     tsts=$(( 1 )) 
   fi
 else
@@ -76,10 +76,10 @@
 if [ $tsts -eq 0 ]
 then
   echo "collatz.scala tests:" | tee -a $out
-  echo "  collatz(1) == 0,1 or 4" | tee -a $out
-  echo "  collatz(6) == 9" | tee -a $out
-  echo "  collatz(9) == 20" | tee -a $out
-  echo "  collatz(9000) == 48" | tee -a $out
+  echo "  collatz(1) == 0" | tee -a $out
+  echo "  collatz(6) == 8" | tee -a $out
+  echo "  collatz(9) == 19" | tee -a $out
+  echo "  collatz(9000) == 47" | tee -a $out
 
   if (scala_assert "collatz.scala" "collatz_test1.scala")
   then
@@ -94,14 +94,14 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  collatz_max(10) == (20, 9)" | tee -a $out
-  echo "  collatz_max(100) == (119, 97)" | tee -a $out
-  echo "  collatz_max(1000) == (179, 871)" | tee -a $out
-  echo "  collatz_max(10000) == (262, 6171)" | tee -a $out
-  echo "  collatz_max(100000) == (351, 77031)" | tee -a $out
-  echo "  collatz_max(1000000) == (525, 837799)" | tee -a $out
-  echo "  collatz_max(2) == (2, 2)" | tee -a $out
-  echo "  collatz_max(77000) == (340, 52527)" | tee -a $out
+  echo "  collatz_max(10) == (19, 9)" | tee -a $out
+  echo "  collatz_max(100) == (118, 97)" | tee -a $out
+  echo "  collatz_max(1000) == (178, 871)" | tee -a $out
+  echo "  collatz_max(10000) == (261, 6171)" | tee -a $out
+  echo "  collatz_max(100000) == (350, 77031)" | tee -a $out
+  echo "  collatz_max(1000000) == (524, 837799)" | tee -a $out
+  echo "  collatz_max(2) == (1, 2) || collatz_max(2) == (0, 1)" | tee -a $out
+  echo "  collatz_max(77000) == (339, 52527)" | tee -a $out
 
   if (scala_assert "collatz.scala" "collatz_test2.scala") 
   then