marking1/drumb_test2.sh
changeset 261 8997430d9765
parent 260 b4812c877b05
child 264 ecd989eee8bd
--- a/marking1/drumb_test2.sh	Sat Feb 02 01:21:43 2019 +0000
+++ b/marking1/drumb_test2.sh	Sat Feb 02 13:28:05 2019 +0000
@@ -4,6 +4,8 @@
 
 out=${1:-output}
 
+echo "" > $out
+
 echo "Below is the feedback and provisional marks for your submission" >> $out
 echo "for assignment 6 Advanced Part 3.  Please note all marks are provisional until" >> $out
 echo "ratified by the assessment board -- this is not an official" >> $out
@@ -23,7 +25,7 @@
 # functional tests
 
 function scala_assert {
-    (ulimit -t 30; JAVA_OPTS="-Xmx4g" scala -i -nc "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
+    (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc -i  "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
 }
 
 
@@ -72,9 +74,9 @@
 if [ $tsts -eq 0 ]
 then
   echo "  get_delta(None, None) == None" | tee -a $out
-  echo "  get_delta(Some(100.0), None) == None" | tee -a $out
-  echo "  get_delta(None, Some(50.0)) == None" | tee -a $out
-  echo "  get_delta(Some(100.0), Some(50.0)) == Some(1.0)" | tee -a $out
+  echo "  get_delta(Some(50.0), None) == None" | tee -a $out
+  echo "  get_delta(None, Some(100.0)) == None" | tee -a $out
+  echo "  get_delta(Some(50.0), Some(100.0)) == Some(1.0)" | tee -a $out
 
   if (scala_assert "drumb.scala" "drumb_test4.scala")
   then
@@ -100,7 +102,7 @@
   
   if (scala_assert "drumb.scala" "drumb_test5.scala") 
   then
-     echo -e "  --> success" | tee -a $out
+     echo "  --> success" | tee -a $out
      marks=$(( marks + 1 ))
   else
      echo "  --> test failed" | tee -a $out
@@ -113,12 +115,12 @@
 if [ $tsts -eq 0 ]
 then
   echo -e "  val ds = get_deltas(get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012))" | tee -a $out
-  echo -e "  yearly_yield(get_deltas(ds, 100, 0) == 125" | tee -a $out
-  echo -e "  yearly_yield(get_deltas(ds, 100, 1) == 117" | tee -a $out
+  echo -e "  yearly_yield(get_deltas(ds, 100, 0)) == 125" | tee -a $out
+  echo -e "  yearly_yield(get_deltas(ds, 100, 1)) == 117" | tee -a $out
   
   if (scala_assert "drumb.scala" "drumb_test6.scala") 
   then
-      echo -e "  --> success" | tee -a $out
+      echo "  --> success" | tee -a $out
       marks=$(( marks + 1 ))
   else
       echo "  --> test failed" | tee -a $out
@@ -138,13 +140,14 @@
   echo -e "  investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2005, 100) == 113"   | tee -a $out
   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) == 83061"   | tee -a $out
   
   if (scala_assert "drumb.scala" "drumb_test7.scala") 
   then
-      echo -e "  --> success" | tee -a $out
-      marks=$(( marks + 1 ))
+    echo "  --> success" | tee -a $out
+    marks=$(( marks + 1 ))
   else
-      echo "  --> test failed" | tee -a $out
+    echo "  --> test failed" | tee -a $out
   fi
 fi