-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day15KtTest.kt
35 lines (29 loc) · 990 Bytes
/
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
package aoc2023.day15
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import util.readInputLineByLine
internal class Day15KtTest {
private val testInputLines = readInputLineByLine("src/main/kotlin/aoc2023/day15/assets/input0")
private val inputLines = readInputLineByLine("src/main/kotlin/aoc2023/day15/assets/input")
@Test
fun testPart1() {
assertEquals(1320, part1(testInputLines))
assertEquals(511215, part1(inputLines))
}
@Test
fun testPart2() {
assertEquals(145, part2(testInputLines))
assertEquals(236057, part2(inputLines))
}
@Test
fun testHash() {
assertEquals(200, hash("H"))
assertEquals(153, hash("HA"))
assertEquals(172, hash("HAS"))
assertEquals(52, hash("HASH"))
assertEquals(30, hash("rn=1"))
assertEquals(253, hash("cm-"))
assertEquals(9, hash("ot=9"))
assertEquals(231, hash("ot=7"))
}
}