testing1/collatz_test.sh
changeset 199 54befaf23648
parent 144 716042628398
child 206 bbe00108a6f3
--- a/testing1/collatz_test.sh	Wed Nov 07 12:08:01 2018 +0000
+++ b/testing1/collatz_test.sh	Thu Nov 08 23:42:03 2018 +0000
@@ -15,13 +15,13 @@
 # compilation tests
 
 function scala_compile {
-  (ulimit -t 30 -m 1024000 ; scala "$1" 2>> $out 1>> $out) 
+  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out) 
 }
 
 # functional tests
 
 function scala_assert {
-  (ulimit -t 30 -m 1024000 ; scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
+  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
 }
 
 # purity test
@@ -37,8 +37,8 @@
 
 if (scala_vars collatz.scala)
 then
-  echo "  --> fail" >> $out
-  tsts0=$(( 1 ))
+  echo "  --> fail (make tripply-sure your program conforms to the required format)" >> $out
+  tsts0=$(( 0 ))
 else
   echo "  --> success" >> $out
   tsts0=$(( 0 )) 
@@ -68,9 +68,9 @@
 if [ $tsts -eq 0 ]
 then
   echo "collatz.scala tests:" >> $out
-  echo "  collatz(1) == 0,1 or 4" >> $out
-  echo "  collatz(6) == 9" >> $out
-  echo "  collatz(9) == 20" >> $out
+  echo "  collatz(1) == 0" >> $out
+  echo "  collatz(6) == 8" >> $out
+  echo "  collatz(9) == 19" >> $out
 
   if (scala_assert "collatz.scala" "collatz_test1.scala")
   then
@@ -84,12 +84,12 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  collatz_max(10) == (20, 9)" >> $out
-  echo "  collatz_max(100) == (119, 97)" >> $out
-  echo "  collatz_max(1000) == (179, 871)" >> $out
-  echo "  collatz_max(10000) == (262, 6171)" >> $out
-  echo "  collatz_max(100000) == (351, 77031)" >> $out
-  echo "  collatz_max(1000000) == (525, 837799)" >> $out
+  echo "  collatz_max(10) == (19, 9)" >> $out
+  echo "  collatz_max(100) == (118, 97)" >> $out
+  echo "  collatz_max(1000) == (178, 871)" >> $out
+  echo "  collatz_max(10000) == (261, 6171)" >> $out
+  echo "  collatz_max(100000) == (350, 77031)" >> $out
+  echo "  collatz_max(1000000) == (524, 837799)" >> $out
 
   if (scala_assert "collatz.scala" "collatz_test2.scala") 
   then