marking1/drumb_test4.scala
author Christian Urban <urbanc@in.tum.de>
Tue, 13 Aug 2019 10:23:20 +0100
changeset 275 eb1b4ad23941
parent 268 e43f7e92ba26
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
myassert(get_delta(None, None) == None)
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
    10
myassert(get_delta(Some(50.0), None) == None)
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
    11
myassert(get_delta(None, Some(100.0)) == None)
e43f7e92ba26 updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
    12
myassert(get_delta(Some(50.0), Some(100.0)) == Some(1.0))