testing1/drumb_test7.scala
changeset 281 87b9e3e2c1a7
parent 248 1616d06a0893
equal deleted inserted replaced
280:a057dc4457fc 281:87b9e3e2c1a7
       
     1 /*
       
     2 def myassert(cond : => Boolean) = {
       
     3   try {
       
     4     assert(cond)
       
     5   } catch { 
       
     6     case _ : Throwable => System.exit(1)
       
     7   }
       
     8 }
       
     9 */
     1 
    10 
     2 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
    11 assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
     3 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
    12 assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
     4 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
    13 assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
     5 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
    14 assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
     6 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
    15 assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
     7 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100) == 113)
    16 
     8 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100) == 254)
    17 // 113
     9 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100) == 349)
    18 assert((112 to 114).contains(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100)))
       
    19 // 254
       
    20 assert((252 to 256).contains(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100)))
       
    21 // 349
       
    22 assert((346 to 352).contains(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100)))
       
    23 //11504
       
    24 assert((11389 to 11619).contains(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 1990 to 2017, 100)))