marking1/collatz_test2.scala
author Christian Urban <urbanc@in.tum.de>
Tue, 19 Nov 2019 06:38:10 +0000
changeset 321 7b0055205ec9
parent 281 87b9e3e2c1a7
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
     1
//def myassert(cond : => Boolean) = {
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
     2
//  try {
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
     3
//    assert(cond)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
     4
//  } catch { 
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
     5
//    case _ : Throwable => System.exit(1)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
     6
//  }
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
     7
//}
158
94b11ac19b41 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
     9
assert(CW6a.collatz_max(10) == (19, 9))
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
    10
assert(CW6a.collatz_max(100) == (118, 97))
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
    11
assert(CW6a.collatz_max(1000) == (178, 871))
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
    12
assert(CW6a.collatz_max(10000) == (261, 6171))
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
    13
assert(CW6a.collatz_max(100000) == (350, 77031))
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
    14
assert(CW6a.collatz_max(1000000) == (524, 837799))
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
    15
assert(CW6a.collatz_max(2) == (1, 2))
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 267
diff changeset
    16
assert(CW6a.collatz_max(77000) == (339, 52527))