268
|
1 |
def myassert(cond : => Boolean) = {
|
|
2 |
try {
|
|
3 |
assert(cond)
|
|
4 |
} catch {
|
|
5 |
case _ : Throwable => System.exit(1)
|
|
6 |
}
|
|
7 |
}
|
260
|
8 |
|
268
|
9 |
|
|
10 |
myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
|
|
11 |
myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
|
|
12 |
myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
|
|
13 |
myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
|
|
14 |
myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
|
|
15 |
myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100) == 113)
|
|
16 |
myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100) == 254)
|
|
17 |
myassert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100) == 349)
|
|
18 |
myassert(investment(List("GOOG", "AAPL", "BIDU"), 1990 to 2017, 100) == 11504)
|