marking1/collatz_test2.scala
author Christian Urban <urbanc@in.tum.de>
Wed, 24 Jul 2019 15:18:44 +0100
changeset 267 9e0216756771
parent 212 4bda49ec24da
child 281 87b9e3e2c1a7
permissions -rw-r--r--
updated myassert workaround

def myassert(cond : => Boolean) = {
  try {
    assert(cond)
  } catch { 
    case _ : Throwable => System.exit(1)
  }
}

myassert(collatz_max(10) == (19, 9))

myassert(collatz_max(100) == (118, 97))

myassert(collatz_max(1000) == (178, 871))

myassert(collatz_max(10000) == (261, 6171))

myassert(collatz_max(100000) == (350, 77031))

myassert(collatz_max(1000000) == (524, 837799))

myassert(collatz_max(2) == (1, 2))

myassert(collatz_max(77000) == (339, 52527))