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