main_marking1/drumb_test7.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 05 Nov 2021 17:20:01 +0000
changeset 397 085fefce672e
parent 388 ed63dca8068a
child 424 daf561a83ba6
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
388
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
/*
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
def myassert(cond : => Boolean) = {
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
  try {
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     4
    assert(cond)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     5
  } catch { 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     6
    case _ : Throwable => System.exit(1)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
  }
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
*/
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
assert(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    17
// 113
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    18
assert((112 to 114).contains(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100)))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    19
// 254
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    20
assert((252 to 256).contains(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100)))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    21
// 349
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    22
assert((346 to 352).contains(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100)))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    23
//11504
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    24
assert((11389 to 11619).contains(CW6b.investment(List("GOOG", "AAPL", "BIDU"), 1990 to 2017, 100)))