|
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) |