pre_marking1/collatz_test2.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Mon, 25 Jan 2021 00:21:00 +0000
changeset 389 4113d4d8cf62
parent 373 d29cd5883c7b
permissions -rw-r--r--
updated marking 2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
373
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
//def myassert(cond : => Boolean) = {
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
//  try {
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
//    assert(cond)
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     4
//  } catch { 
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     5
//    case _ : Throwable => System.exit(1)
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     6
//  }
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
//}
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
assert(CW6a.collatz_max(10) == (19, 9))
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
assert(CW6a.collatz_max(100) == (118, 97))
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
assert(CW6a.collatz_max(1000) == (178, 871))
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
assert(CW6a.collatz_max(10000) == (261, 6171))
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13
assert(CW6a.collatz_max(100000) == (350, 77031))
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
assert(CW6a.collatz_max(1000000) == (524, 837799))
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
assert(CW6a.collatz_max(2) == (1, 2))
d29cd5883c7b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
assert(CW6a.collatz_max(77000) == (339, 52527))