marking1/drumb_test7.scala
changeset 268 e43f7e92ba26
parent 261 8997430d9765
child 281 87b9e3e2c1a7
equal deleted inserted replaced
267:9e0216756771 268:e43f7e92ba26
       
     1 def myassert(cond : => Boolean) = {
       
     2   try {
       
     3     assert(cond)
       
     4   } catch { 
       
     5     case _ : Throwable => System.exit(1)
       
     6   }
       
     7 }
     1 
     8 
     2 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
     9 
     3 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
    10 myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
     4 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
    11 myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
     5 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
    12 myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
     6 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
    13 myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
     7 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100) == 113)
    14 myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
     8 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100) == 254)
    15 myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100) == 113)
     9 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100) == 349)
    16 myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100) == 254)
    10 assert(investment(List("GOOG", "AAPL", "BIDU"), 1990 to 2017, 100) == 83061)
    17 myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100) == 349)
       
    18 myassert(investment(List("GOOG", "AAPL", "BIDU"), 1990 to 2017, 100) == 11504)