author | Christian Urban <urbanc@in.tum.de> |
Tue, 13 Aug 2019 10:23:20 +0100 | |
changeset 275 | eb1b4ad23941 |
parent 267 | 9e0216756771 |
child 281 | 87b9e3e2c1a7 |
permissions | -rw-r--r-- |
158 | 1 |
|
267
9e0216756771
updated myassert workaround
Christian Urban <urbanc@in.tum.de>
parents:
266
diff
changeset
|
2 |
def myassert(cond : => Boolean) = { |
9e0216756771
updated myassert workaround
Christian Urban <urbanc@in.tum.de>
parents:
266
diff
changeset
|
3 |
try { |
9e0216756771
updated myassert workaround
Christian Urban <urbanc@in.tum.de>
parents:
266
diff
changeset
|
4 |
assert(cond) |
9e0216756771
updated myassert workaround
Christian Urban <urbanc@in.tum.de>
parents:
266
diff
changeset
|
5 |
} catch { |
9e0216756771
updated myassert workaround
Christian Urban <urbanc@in.tum.de>
parents:
266
diff
changeset
|
6 |
case _ : Throwable => System.exit(1) |
9e0216756771
updated myassert workaround
Christian Urban <urbanc@in.tum.de>
parents:
266
diff
changeset
|
7 |
} |
9e0216756771
updated myassert workaround
Christian Urban <urbanc@in.tum.de>
parents:
266
diff
changeset
|
8 |
} |
158 | 9 |
|
267
9e0216756771
updated myassert workaround
Christian Urban <urbanc@in.tum.de>
parents:
266
diff
changeset
|
10 |
myassert(collatz(1) == 0) |
9e0216756771
updated myassert workaround
Christian Urban <urbanc@in.tum.de>
parents:
266
diff
changeset
|
11 |
myassert(collatz(6) == 8) |
9e0216756771
updated myassert workaround
Christian Urban <urbanc@in.tum.de>
parents:
266
diff
changeset
|
12 |
myassert(collatz(9) == 19) |
9e0216756771
updated myassert workaround
Christian Urban <urbanc@in.tum.de>
parents:
266
diff
changeset
|
13 |
myassert(collatz(9000) == 47) |
158 | 14 |