-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day08Test.kt
63 lines (55 loc) · 1.53 KB
/
Day08Test.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package io.dmitrijs.aoc2023
import io.dmitrijs.aoc2023.Resources.resourceAsLines
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Tag
import kotlin.test.Test
import kotlin.test.assertEquals
@DisplayName("Day 8")
internal class Day08Test {
@Nested
inner class Example {
@Test
fun puzzle1() {
val exampleInput = """
RL
AAA = (BBB, CCC)
BBB = (DDD, EEE)
CCC = (ZZZ, GGG)
DDD = (DDD, DDD)
EEE = (EEE, EEE)
GGG = (GGG, GGG)
ZZZ = (ZZZ, ZZZ)
""".trimIndent().lines()
assertEquals(2, Day08(exampleInput).puzzle1())
}
@Test
fun puzzle2() {
val exampleInput = """
LR
11A = (11B, XXX)
11B = (XXX, 11Z)
11Z = (11B, XXX)
22A = (22B, XXX)
22B = (22C, 22C)
22C = (22Z, 22Z)
22Z = (22B, 22B)
XXX = (XXX, XXX)
""".trimIndent().lines()
assertEquals(6, Day08(exampleInput).puzzle2())
}
}
@Nested
@Tag("personal")
inner class Problem {
private val day = Day08(resourceAsLines("day08"))
@Test
fun puzzle1() {
assertEquals(19_099, day.puzzle1())
}
@Test
fun puzzle2() {
assertEquals(17_099_847_107_071, day.puzzle2())
}
}
}