main_marking1/drumb_test7.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Sat, 11 Mar 2023 23:12:49 +0000
changeset 467 9b5165b8a762
parent 463 0315d9983cd0
permissions -rw-r--r--
updated

import scala.concurrent._
import scala.concurrent.duration._
import ExecutionContext.Implicits.global
import scala.language.postfixOps 

lazy val f = Future {

assert(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
assert(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
assert(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
assert(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
assert(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
assert((112 to 114).contains(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100)))  // 113
assert((252 to 256).contains(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100)))  // 254
assert((346 to 352).contains(M1.investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100)))  // 349
assert((11389 to 11619).contains(M1.investment(List("GOOG", "AAPL", "BIDU"), 1990 to 2017, 100))) //11504
}

Await.result(f, 32 second)