marking1/drumb_test.sh
changeset 330 c3d3461a5e77
parent 284 9a04eb6a2291
child 331 e3878cdd38bc
--- a/marking1/drumb_test.sh	Mon Jan 27 10:18:13 2020 +0000
+++ b/marking1/drumb_test.sh	Tue Feb 04 11:20:31 2020 +0000
@@ -1,26 +1,25 @@
 #!/bin/bash
 set -euo pipefail
 
-
 out=${1:-output}
 
 echo "" > $out
 
-echo `date` >> $out
-echo >> $out
-echo "Below is the feedback and provisional marks for your submission" >> $out
-echo "for the Core Part of Assignment 6 .  Please note all marks are provisional until" >> $out
-echo "ratified by the assessment board -- this is not an official" >> $out
-echo "results transcript." >> $out
-echo "" >> $out
+echo -e `date` >> $out
+echo -e "" >> $out
+echo -e "Below is the feedback and provisional marks for your submission" >> $out
+echo -e "for the Core Part of Assignment 6.  Please note all marks are provisional until" >> $out
+echo -e "ratified by the assessment board -- this is not an official" >> $out
+echo -e "results transcript." >> $out
+echo -e "" >> $out
 
 # marks for CW6 main part 
 marks=$(( 0 ))
 
 
-echo "" >> $out
-echo "Below is the feedback for your submission drumb.scala" >> $out
-echo "" >> $out
+echo -e "" >> $out
+echo -e "Below is the feedback for your submission drumb.scala" >> $out
+echo -e "" >> $out
 
 
 # compilation tests
@@ -46,14 +45,14 @@
 
 # var, .par return, ListBuffer test
 #
-echo "drumb.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
+echo -e "drumb.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
 
 if (scala_vars drumb.scala)
 then
-  echo "  --> test failed" | tee -a $out
+  echo -e "  --> TEST FAILED\n" | tee -a $out
   tsts0=$(( 1 ))
 else
-  echo "  --> success" | tee -a $out
+  echo -e "  --> success" | tee -a $out
   tsts0=$(( 0 )) 
 fi
 
@@ -61,14 +60,14 @@
 # compilation test
 if  [ $tsts0 -eq 0 ]
 then 
-  echo "drumb.scala runs?" | tee -a $out
+  echo -e "drumb.scala runs?" | tee -a $out
 
   if (scala_compile drumb.scala)
   then
-    echo "  --> success" | tee -a $out
+    echo -e "  --> success" | tee -a $out
     tsts=$(( 0 ))
   else
-    echo "  --> scala drumb.scala did not run successfully" | tee -a $out
+    echo -e "  --> SCALA DID NOT RUN drumb.scala" | tee -a $out
     tsts=$(( 1 )) 
   fi
 else
@@ -81,15 +80,15 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  get_january_data(\"GOOG\", 1980) == List()" | tee -a $out
-  echo "  get_january_data(\"GOOG\", 2010).head == \"2010-01-04,312.204773\"" | tee -a $out
+  echo -e "  get_january_data(\"GOOG\", 1980) == List()" | tee -a $out
+  echo -e "  get_january_data(\"GOOG\", 2010).head == \"2010-01-04,312.204773\"" | tee -a $out
 
   if (scala_assert "drumb.scala" "drumb_test1.scala")
   then
-      echo "  --> success" | tee -a $out
+      echo -e "  --> success" | tee -a $out
       marks=$(( marks + 1 ))
   else
-      echo "  --> test failed" | tee -a $out
+      echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
 fi
 
@@ -97,15 +96,15 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  get_first_price(\"GOOG\", 1980) == None" | tee -a $out
-  echo "  get_first_price(\"GOOG\", 2010) == Some(312.204773)" | tee -a $out
+  echo -e "  get_first_price(\"GOOG\", 1980) == None" | tee -a $out
+  echo -e "  get_first_price(\"GOOG\", 2010) == Some(312.204773)" | tee -a $out
 
   if (scala_assert "drumb.scala" "drumb_test2.scala")
   then
-      echo "  --> success" | tee -a $out
+      echo -e "  --> success" | tee -a $out
       marks=$(( marks + 1 ))
   else
-      echo "  --> test failed" | tee -a $out
+      echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
 fi
 
@@ -113,21 +112,21 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  get_prices(List(\"BIDU\"), 2004 to 2008) ==" | tee -a $out
-  echo "       List(List(None), List(None), List(Some(6.35)), " | tee -a $out
-  echo "            List(Some(12.241)), List(Some(38.188)))" | tee -a $out
-  echo " " | tee -a $out  
-  echo "  get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012) ==" | tee -a $out
-  echo "       List(List(Some(312.204773), Some(26.782711))," | tee -a $out
-  echo "            List(Some(301.0466),   Some(41.244694))," | tee -a $out
-  echo "            List(Some(331.462585), Some(51.464207)))" | tee -a $out
+  echo -e "  get_prices(List(\"BIDU\"), 2004 to 2008) ==" | tee -a $out
+  echo -e "       List(List(None), List(None), List(Some(6.35)), " | tee -a $out
+  echo -e "            List(Some(12.241)), List(Some(38.188)))" | tee -a $out
+  echo -e " " | tee -a $out  
+  echo -e "  get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012) ==" | tee -a $out
+  echo -e "       List(List(Some(312.204773), Some(26.782711))," | tee -a $out
+  echo -e "            List(Some(301.0466),   Some(41.244694))," | tee -a $out
+  echo -e "            List(Some(331.462585), Some(51.464207)))" | tee -a $out
 
   if (scala_assert "drumb.scala" "drumb_test3.scala")
   then
-      echo "  --> success" | tee -a $out
+      echo -e "  --> success" | tee -a $out
       marks=$(( marks + 1 ))
   else
-      echo "  --> test failed" | tee -a $out
+      echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
 fi
 
@@ -135,17 +134,17 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  get_delta(None, None) == None" | 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
+  echo -e "  get_delta(None, None) == None" | tee -a $out
+  echo -e "  get_delta(Some(50.0), None) == None" | tee -a $out
+  echo -e "  get_delta(None, Some(100.0)) == None" | tee -a $out
+  echo -e "  get_delta(Some(50.0), Some(100.0)) == Some(1.0)" | tee -a $out
 
   if (scala_assert "drumb.scala" "drumb_test4.scala")
   then
-      echo "  --> success" | tee -a $out
+      echo -e "  --> success" | tee -a $out
       marks=$(( marks + 1 ))
   else
-      echo "  --> test failed" | tee -a $out
+      echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
 fi
 
@@ -164,10 +163,10 @@
   
   if (scala_assert "drumb.scala" "drumb_test5.scala") 
   then
-     echo "  --> success" | tee -a $out
+     echo -e "  --> success" | tee -a $out
      marks=$(( marks + 1 ))
   else
-     echo "  --> test failed" | tee -a $out
+     echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
 fi
 
@@ -177,15 +176,15 @@
 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(ds, 100, 0) == 125" | tee -a $out
+  echo -e "  yearly_yield(ds, 100, 1) == 117" | tee -a $out
   
   if (scala_assert "drumb.scala" "drumb_test6.scala") 
   then
-      echo "  --> success" | tee -a $out
+      echo -e "  --> success" | tee -a $out
       marks=$(( marks + 1 ))
   else
-      echo "  --> test failed" | tee -a $out
+      echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
 fi
 
@@ -208,14 +207,14 @@
   
   if (scala_assert "drumb.scala" "drumb_test7.scala") 
   then
-    echo "  --> success" | tee -a $out
+    echo -e "  --> success" | tee -a $out
     marks=$(( marks + 1 ))
   else
-    echo "  --> test failed" | tee -a $out
+    echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
 fi
 
 ## final marks
-echo >> $out
-echo "Overall mark for CW 6, Core Part" | tee -a $out
-echo "$marks" | tee -a $out
+echo -e "" >> $out
+echo -e "Overall mark for CW 6, Core Part" | tee -a $out
+echo -e "$marks" | tee -a $out