marking1/collatz_test2.scala
changeset 267 9e0216756771
parent 212 4bda49ec24da
child 281 87b9e3e2c1a7
equal deleted inserted replaced
266:ca48ac1d3c3e 267:9e0216756771
       
     1 def myassert(cond : => Boolean) = {
       
     2   try {
       
     3     assert(cond)
       
     4   } catch { 
       
     5     case _ : Throwable => System.exit(1)
       
     6   }
       
     7 }
     1 
     8 
       
     9 myassert(collatz_max(10) == (19, 9))
     2 
    10 
     3 assert(collatz_max(10) == (19, 9))
    11 myassert(collatz_max(100) == (118, 97))
     4 
    12 
     5 assert(collatz_max(100) == (118, 97))
    13 myassert(collatz_max(1000) == (178, 871))
     6 
    14 
     7 assert(collatz_max(1000) == (178, 871))
    15 myassert(collatz_max(10000) == (261, 6171))
     8 
    16 
     9 assert(collatz_max(10000) == (261, 6171))
    17 myassert(collatz_max(100000) == (350, 77031))
    10 
    18 
    11 assert(collatz_max(100000) == (350, 77031))
    19 myassert(collatz_max(1000000) == (524, 837799))
    12 
    20 
    13 assert(collatz_max(1000000) == (524, 837799))
    21 myassert(collatz_max(2) == (1, 2))
    14 
    22 
    15 //assert(collatz_max(2) == (1, 2) || collatz_max(2) == (0, 1))
    23 myassert(collatz_max(77000) == (339, 52527))
    16 assert(collatz_max(2) == (1, 2))
       
    17 assert(collatz_max(77000) == (339, 52527))