--- a/marking1/drumb_test.sh Sat Jun 22 08:39:52 2019 +0100
+++ b/marking1/drumb_test.sh Wed Jul 24 14:22:06 2019 +0100
@@ -4,10 +4,19 @@
out=${1:-output}
-# read marks for CW6 part 1
-marks=$(( `tail -1 $out` ))
+echo "" > $out
-echo $marks
+echo `date` >> $out
+echo >> $out
+echo "Below is the feedback and provisional marks for your submission" >> $out
+echo "for the Main 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
+
+# marks for CW6 main part
+marks=$(( 0 ))
+
echo "" >> $out
echo "Below is the feedback for your submission drumb.scala" >> $out
@@ -17,13 +26,13 @@
# compilation tests
function scala_compile {
- (ulimit -t 60; JAVA_OPTS="-Xmx1g" scala -nc "$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 60; JAVA_OPTS="-Xmx4g" scala -nc -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
+ (ulimit -t 60; JAVA_OPTS="-Xmx4g" scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
}
@@ -66,6 +75,8 @@
tsts=$(( 1 ))
fi
+echo >> $out
+
### get january tests
if [ $tsts -eq 0 ]
@@ -120,64 +131,91 @@
fi
fi
+### get_delta test
+
+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
+
+ if (scala_assert "drumb.scala" "drumb_test4.scala")
+ then
+ echo " --> success" | tee -a $out
+ marks=$(( marks + 1 ))
+ else
+ echo " --> test failed" | tee -a $out
+ fi
+fi
+
+
### get_deltas_test
-#if [ $tsts -eq 0 ]
-#then
-# echo " val prices1 = get_prices(List(\"BIDU\"), 2004 to 2008)" | tee -a $out
-# echo " val prices2 = get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012)" | tee -a $out
-# echo " " | tee -a $out
-# echo " get_deltas(prices1) == List(List(None), List(None), " | tee -a $out
-# echo " List(Some(0.9277165354330709)), " | tee -a $out
-# echo " List(Some(2.119679764725104)))" | tee -a $out
-# echo " " | tee -a $out
-# echo " get_deltas(prices2) == List(List(Some(-0.03573992567129673), Some(0.5399749442411563)), " | tee -a $out
-# echo " List(Some(0.10103412653643493), Some(0.2477771728154912)))" | tee -a $out
-#
-# if (scala_assert "drumb.scala" "drumb_test2.scala")
-# then
-# echo " --> success" | tee -a $out
-# marks=$(( marks + 1 ))
-# else
-# echo " --> test failed" | tee -a $out
-# fi
-#fi
+if [ $tsts -eq 0 ]
+then
+ echo -e " get_deltas(get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012)) == " | tee -a $out
+ echo -e " List(List(Some(-0.03573992567129673), Some(0.539975124774038)), " | tee -a $out
+ echo -e " List(Some(0.10103412653643493), Some(0.24777709700099845)))" | tee -a $out
+ echo -e "" | tee -a $out
+ echo -e " get_deltas(get_prices(List(\"BIDU\"), 2004 to 2008)) == " | tee -a $out
+ echo -e " List(List(None), List(None), " | tee -a $out
+ echo -e " List(Some(0.9277165354330709)), List(Some(2.119679764725104)))) " | tee -a $out
+
+ if (scala_assert "drumb.scala" "drumb_test5.scala")
+ then
+ echo " --> success" | tee -a $out
+ marks=$(( marks + 1 ))
+ else
+ echo " --> test failed" | tee -a $out
+ fi
+fi
-### yield_tests, investment_test
+### yield_tests
-#if [ $tsts -eq 0 ]
-#then
-# echo " val prices1 = get_prices(List(\"BIDU\"), 2004 to 2008)" | tee -a $out
-# echo " val prices2 = get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012)" | tee -a $out
-# echo " val prices3 = get_prices(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2010 to 2012)" | tee -a $out
-# echo " val deltas1 = get_deltas(prices1)" | tee -a $out
-# echo " val deltas2 = get_deltas(prices2)" | tee -a $out
-# echo " val deltas3 = get_deltas(prices3)" | tee -a $out
-# echo "" | tee -a $out
-# echo " yearly_yield(deltas1, 100, 0) == 100" | tee -a $out
-# echo " yearly_yield(deltas1, 100, 2) == 192" | tee -a $out
-# echo " yearly_yield(deltas2, 100, 0) == 125" | tee -a $out
-# echo " yearly_yield(deltas3, 100, 0) == 164" | tee -a $out
-# echo " yearly_yield(deltas3, 100, 1) == 119" | tee -a $out
-# echo "" | tee -a $out
-# echo " val inv1 = investment(List(\"IBM\", \"BIDU\"), 2004 to 2008, 100)" | tee -a $out
-# echo " val inv2 = investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2010 to 2012, 100)" | tee -a $out
-# echo "" | tee -a $out
-# echo " inv1 >= 295 && inv1 <= 301" | tee -a $out
-# echo " inv2 >= 194 && inv2 <= 198" | tee -a $out
-#
-# if (scala_assert "drumb.scala" "drumb_test3.scala")
-# then
-# echo " --> success" | tee -a $out
-# marks=$(( marks + 1 ))
-# else
-# echo " --> test failed" | tee -a $out
-# fi
-#fi
+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
+
+ if (scala_assert "drumb.scala" "drumb_test6.scala")
+ then
+ echo " --> success" | tee -a $out
+ marks=$(( marks + 1 ))
+ else
+ echo " --> test failed" | tee -a $out
+ fi
+fi
+### investment_test
+
+if [ $tsts -eq 0 ]
+then
+ 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
+ echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2002, 100) == 42 " | tee -a $out
+ echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2003, 100) == 27 " | tee -a $out
+ echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2004, 100) == 38 " | tee -a $out
+ 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 " --> success" | tee -a $out
+ marks=$(( marks + 1 ))
+ else
+ echo " --> test failed" | tee -a $out
+ fi
+fi
## final marks
-echo "Overall mark for CW 6, Part 1 + 2" | tee -a $out
+echo >> $out
+echo "Overall mark for CW 6, Main Part" | tee -a $out
echo "$marks" | tee -a $out