-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay15KtTest.kt
43 lines (36 loc) · 1.28 KB
/
Day15KtTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package aoc2020.day15
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
internal class Day15KtTest {
private val input = readInputToList("6,13,1,15,2,0")
private val input0 = readInputToList("0,3,6")
private val input1 = readInputToList("1,3,2")
private val input2 = readInputToList("2,1,3")
@Test
fun readInputToList() {
println(input0)
println(input1)
println(input)
}
@Test
fun testSpeakNumbers() {
val limit = 2020
assertEquals(436, speakNumbers(input0, limit))
assertEquals(1, speakNumbers(input1, limit))
assertEquals(10, speakNumbers(input2, limit))
assertEquals(1194, speakNumbers(input, limit))
}
@Test
fun testSpeakNumbers2() {
var limit = 2020
assertEquals(436, speakNumbersV2(input0, limit))
assertEquals(1, speakNumbersV2(input1, limit))
assertEquals(10, speakNumbersV2(input2, limit))
assertEquals(1194, speakNumbersV2(input, limit))
limit = 30000000
assertEquals(175594, speakNumbersV2(input0, limit))
assertEquals(2578, speakNumbersV2(input1, limit))
assertEquals(3544142, speakNumbersV2(input2, limit))
assertEquals(48710, speakNumbersV2(input, limit))
}
}