marking1/drumb_test7.scala
changeset 268 e43f7e92ba26
parent 261 8997430d9765
child 281 87b9e3e2c1a7
--- a/marking1/drumb_test7.scala	Wed Jul 24 15:18:44 2019 +0100
+++ b/marking1/drumb_test7.scala	Thu Aug 01 09:48:34 2019 +0100
@@ -1,10 +1,18 @@
+def myassert(cond : => Boolean) = {
+  try {
+    assert(cond)
+  } catch { 
+    case _ : Throwable => System.exit(1)
+  }
+}
 
-assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
-assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
-assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
-assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
-assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
-assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100) == 113)
-assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100) == 254)
-assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100) == 349)
-assert(investment(List("GOOG", "AAPL", "BIDU"), 1990 to 2017, 100) == 83061)
+
+myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
+myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
+myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
+myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
+myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
+myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100) == 113)
+myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100) == 254)
+myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100) == 349)
+myassert(investment(List("GOOG", "AAPL", "BIDU"), 1990 to 2017, 100) == 11504)