-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day02Test.kt
52 lines (44 loc) · 1.2 KB
/
Day02Test.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
package io.dmitrijs.aoc2017
import io.dmitrijs.aoc2017.Resources.resourceAsLines
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Nested
import kotlin.test.Test
import kotlin.test.assertEquals
@DisplayName("Day 2")
internal class Day02Test {
private val problemInput = resourceAsLines("day02")
@Nested
@DisplayName("Puzzle 1")
inner class Puzzle1 {
@Test
fun `solves example`() {
val exampleInput = """
5 1 9 5
7 5 3
2 4 6 8
""".trimIndent().lines()
assertEquals(18, Day02(exampleInput).puzzle1())
}
@Test
fun `solves problem`() {
assertEquals(51_139, Day02(problemInput).puzzle1())
}
}
@Nested
@DisplayName("Puzzle 2")
inner class Puzzle2 {
@Test
fun `solves example`() {
val exampleInput = """
5 9 2 8
9 4 7 3
3 8 6 5
""".trimIndent().lines()
assertEquals(9, Day02(exampleInput).puzzle2())
}
@Test
fun `solves problem`() {
assertEquals(272, Day02(problemInput).puzzle2())
}
}
}