|
1 /* |
|
2 def myassert(cond : => Boolean) = { |
|
3 try { |
|
4 assert(cond) |
|
5 } catch { |
|
6 case _ : Throwable => System.exit(1) |
|
7 } |
|
8 } |
|
9 */ |
|
10 |
|
11 assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100) |
|
12 assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27) |
|
13 assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42) |
|
14 assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27) |
|
15 assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38) |
|
16 |
|
17 // 113 |
|
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))) |