main_marking1/drumb_test.sh
changeset 463 0315d9983cd0
parent 424 daf561a83ba6
--- a/main_marking1/drumb_test.sh	Sun Jan 15 10:58:13 2023 +0000
+++ b/main_marking1/drumb_test.sh	Sat Mar 11 22:01:53 2023 +0000
@@ -27,13 +27,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 -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
+  (JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
 }
 
 
@@ -49,7 +49,7 @@
 
 if (scala_compile drumb.scala)
 then
-    echo -e "  --> success" | tee -a $out
+    echo -e "  --> success\n" | tee -a $out
     tsts=$(( 0 ))
 else
     echo -e "  --> SCALA DID NOT RUN drumb.scala\n" | tee -a $out
@@ -68,7 +68,7 @@
 	echo -e "  --> TEST FAILED\n" | tee -a $out
 	tsts=$(( 1 ))
     else
-	echo -e "  --> success" | tee -a $out
+	echo -e "  --> success\n" | tee -a $out
 	tsts=$(( 0 )) 
     fi
 else
@@ -86,7 +86,7 @@
 
   if (scala_assert "drumb.scala" "drumb_test1.scala")
   then
-      echo -e "  --> success" | tee -a $out
+      echo -e "  --> success (+ 0.5 Marks)\n" | tee -a $out
       marks=$(( marks + 0.5 ))
   else
       echo -e "  --> TEST FAILED\n" | tee -a $out
@@ -102,7 +102,7 @@
 
   if (scala_assert "drumb.scala" "drumb_test2.scala")
   then
-      echo -e "  --> success" | tee -a $out
+      echo -e "  --> success (+ 1 Mark)\n" | tee -a $out
       marks=$(( marks + 1.0 ))
   else
       echo -e "  --> TEST FAILED\n" | tee -a $out
@@ -124,7 +124,7 @@
 
   if (scala_assert "drumb.scala" "drumb_test3.scala")
   then
-      echo -e "  --> success" | tee -a $out
+      echo -e "  --> success (+ 1 Mark)\n" | tee -a $out
       marks=$(( marks + 1.0 ))
   else
       echo -e "  --> TEST FAILED\n" | tee -a $out
@@ -142,7 +142,7 @@
 
   if (scala_assert "drumb.scala" "drumb_test4.scala")
   then
-      echo -e "  --> success" | tee -a $out
+      echo -e "  --> success (+ 1 Mark)\n" | tee -a $out
       marks=$(( marks + 1.0 ))
   else
       echo -e "  --> TEST FAILED\n" | tee -a $out
@@ -164,7 +164,7 @@
   
   if (scala_assert "drumb.scala" "drumb_test5.scala") 
   then
-     echo -e "  --> success" | tee -a $out
+     echo -e "  --> success (+ 1 Mark)\n" | tee -a $out
      marks=$(( marks + 1.0 ))
   else
      echo -e "  --> TEST FAILED\n" | tee -a $out
@@ -182,7 +182,7 @@
   
   if (scala_assert "drumb.scala" "drumb_test6.scala") 
   then
-      echo -e "  --> success" | tee -a $out
+      echo -e "  --> success (+ 1 Mark)\n" | tee -a $out
       marks=$(( marks + 1.0 ))
   else
       echo -e "  --> TEST FAILED\n" | tee -a $out
@@ -194,6 +194,7 @@
 
 if [ $tsts -eq 0 ]
 then
+  #echo -e "NEEDS ADJUSTING"  
   echo -e "  All results need to be in the range of -/+ 1% of the given values."   | tee -a $out
   echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2000, 100) == 100"   | tee -a $out
   echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2001, 100) == 27 "   | tee -a $out
@@ -204,13 +205,18 @@
   echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2006, 100) == 254"   | tee -a $out
   echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2007, 100) == 349"   | tee -a $out
   echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 1990 to 2017, 100) == 11504"   | tee -a $out
-  
+  START=$(date +%s)
   
   if (scala_assert "drumb.scala" "drumb_test7.scala") 
   then
-    echo -e "  --> success" | tee -a $out
+    END=$(date +%s)
+    DIFF=$(( $END - $START ))  
+    echo -e "  --> success (+ 0.5 Marks)\n" | tee -a $out
     marks=$(( marks + 0.5 ))
   else
+    END=$(date +%s)
+    DIFF=$(( $END - $START ))
+    echo -e "  This test ran for $DIFF seconds" | tee -a $out    
     echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
 fi