marking1/drumb_test2.scala
author Christian Urban <urbanc@in.tum.de>
Thu, 01 Aug 2019 09:48:34 +0100
changeset 268 e43f7e92ba26
parent 210 63a1376cbebd
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: 210
diff changeset
     1
def myassert(cond : => Boolean) = {
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
     2
  try {
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
     3
    assert(cond)
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
     4
  } catch { 
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
     5
    case _ : Throwable => System.exit(1)
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
     6
  }
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
     7
}
158
94b11ac19b41 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
268
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
     9
myassert(get_first_price("GOOG", 1980) == None)
158
94b11ac19b41 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
268
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    11
myassert(get_first_price("GOOG", 2010) == Some(312.204773))
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 210
diff changeset
    12