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