-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day25Test.kt
49 lines (43 loc) · 1.35 KB
/
Day25Test.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
package io.dmitrijs.aoc2017
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Nested
import kotlin.test.Test
import kotlin.test.assertEquals
@DisplayName("Day 25")
internal class Day25Test {
private val problemInput = Resources.resourceAsText("day25")
private val exampleInput = """
Begin in state A.
Perform a diagnostic checksum after 6 steps.
In state A:
If the current value is 0:
- Write the value 1.
- Move one slot to the right.
- Continue with state B.
If the current value is 1:
- Write the value 0.
- Move one slot to the left.
- Continue with state B.
In state B:
If the current value is 0:
- Write the value 1.
- Move one slot to the left.
- Continue with state A.
If the current value is 1:
- Write the value 1.
- Move one slot to the right.
- Continue with state A.
""".trimIndent()
@Nested
@DisplayName("Puzzle 1")
inner class Puzzle1 {
@Test
fun `solves examples`() {
assertEquals(3, Day25(exampleInput).puzzle1())
}
@Test
fun `solves problem`() {
assertEquals(4_217, Day25(problemInput).puzzle1())
}
}
}