267
|
1 |
def myassert(cond : => Boolean) = {
|
|
2 |
try {
|
|
3 |
assert(cond)
|
|
4 |
} catch {
|
|
5 |
case _ : Throwable => System.exit(1)
|
|
6 |
}
|
|
7 |
}
|
158
|
8 |
|
267
|
9 |
myassert(collatz_max(10) == (19, 9))
|
158
|
10 |
|
267
|
11 |
myassert(collatz_max(100) == (118, 97))
|
158
|
12 |
|
267
|
13 |
myassert(collatz_max(1000) == (178, 871))
|
158
|
14 |
|
267
|
15 |
myassert(collatz_max(10000) == (261, 6171))
|
|
16 |
|
|
17 |
myassert(collatz_max(100000) == (350, 77031))
|
158
|
18 |
|
267
|
19 |
myassert(collatz_max(1000000) == (524, 837799))
|
158
|
20 |
|
267
|
21 |
myassert(collatz_max(2) == (1, 2))
|
|
22 |
|
|
23 |
myassert(collatz_max(77000) == (339, 52527))
|