marking1/drumb_test7.scala
author Christian Urban <urbanc@in.tum.de>
Sat, 02 Nov 2019 12:06:07 +0000
changeset 303 b4c597be7514
parent 281 87b9e3e2c1a7
child 331 e3878cdd38bc
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
     1
/*
268
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
     2
def myassert(cond : => Boolean) = {
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
     3
  try {
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
     4
    assert(cond)
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
     5
  } catch { 
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
     6
    case _ : Throwable => System.exit(1)
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
     7
  }
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
     8
}
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
     9
*/
268
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
    10
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    11
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    12
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    13
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    14
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    15
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    16
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100) == 113)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    17
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100) == 254)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    18
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100) == 349)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    19
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 1990 to 2017, 100) == 11504)