marking1/collatz_test1.scala
changeset 267 9e0216756771
parent 266 ca48ac1d3c3e
child 281 87b9e3e2c1a7
--- a/marking1/collatz_test1.scala	Wed Jul 24 14:22:06 2019 +0100
+++ b/marking1/collatz_test1.scala	Wed Jul 24 15:18:44 2019 +0100
@@ -1,10 +1,14 @@
-
 
-assert(collatz(1) == 0)
-assert(collatz(6) == 9)
-assert(collatz(9) == 19)
-assert(collatz(9000) == 47)
+def myassert(cond : => Boolean) = {
+  try {
+    assert(cond)
+  } catch { 
+    case _ : Throwable => System.exit(1)
+  }
+}
 
+myassert(collatz(1) == 0)
+myassert(collatz(6) == 8)
+myassert(collatz(9) == 19)
+myassert(collatz(9000) == 47)
 
-System.exit(4)
-