main_testing1/drumb_test7.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 26 Apr 2024 17:37:56 +0100
changeset 488 5deaf53c2faa
parent 402 de59aa20a1dc
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: 248
diff changeset
     1
/*
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     2
def myassert(cond : => Boolean) = {
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     3
  try {
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     4
    assert(cond)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     5
  } catch { 
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     6
    case _ : Throwable => System.exit(1)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     7
  }
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     8
}
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     9
*/
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
402
de59aa20a1dc updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    11
assert(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
de59aa20a1dc updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    12
assert(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
de59aa20a1dc updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    13
assert(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
de59aa20a1dc updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    14
assert(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
de59aa20a1dc updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    15
assert(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
    16
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
    17
// 113
402
de59aa20a1dc updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    18
assert((112 to 114).contains(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100)))
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
    19
// 254
402
de59aa20a1dc updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    20
assert((252 to 256).contains(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100)))
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
    21
// 349
402
de59aa20a1dc updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    22
assert((346 to 352).contains(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100)))
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
    23
//11504
402
de59aa20a1dc updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    24
assert((11389 to 11619).contains(M1.investment(List("GOOG", "AAPL", "BIDU"), 1990 to 2017, 100)))