-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay4KtTest.kt
58 lines (50 loc) · 2.05 KB
/
Day4KtTest.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
package aoc2018.day04
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
class Day4KtTest {
//Sort entries by date and time
//Get guard with most minutes asleep overall
//Result is guard's ID * minute of most common asleep time
@Test
fun test_read_input_and_sort() {
}
@Test
fun test_get_guard_with_most_time_asleep() {
val list: List<GuardStatus> = sortInputByDate(readInputAndParse("src/main/kotlin/aoc2018/day04/out2"))
assertEquals(10, getGuardWithMostTimeAsleep(list))
}
@Test
fun test_get_guard_with_most_time_asleep_2() {
val list: List<GuardStatus> = sortInputByDate(readInputAndParse("src/main/kotlin/aoc2018/day04/out"))
assertEquals(1487, getGuardWithMostTimeAsleep(list))
}
@Test
fun test_draw_sleep_pattern() {
val list: List<GuardStatus> = sortInputByDate(readInputAndParse("src/main/kotlin/aoc2018/day04/out2"))
drawSleepPattern(10, list)
}
@Test
fun test_draw_sleep_pattern_2() {
val list: List<GuardStatus> = sortInputByDate(readInputAndParse("src/main/kotlin/aoc2018/day04/out"))
drawSleepPattern(1487, list)
}
//Result is 1487*34
// Part 2 - Example
// Matrix where x are the minutes and y are the guard IDs
// 000000000011111111112222222222333333333344444444445555555555
// 012345678901234567890123456789012345678901234567890123456789
//10 .....11111111111111111112111101111111111111111111111111.....
//99 ....................................1111222223222211111.....
//
// The result is the ID of the guard times the minute you chose (e.g. 99 * 45 = 4455)
@Test
fun test_sleep_count_matrix() {
val list: List<GuardStatus> = sortInputByDate(readInputAndParse("src/main/kotlin/aoc2018/day04/out2"))
buildSleepCountMatrix(list)
}
@Test
fun test_sleep_count_matrix_2() {
val list: List<GuardStatus> = sortInputByDate(readInputAndParse("src/main/kotlin/aoc2018/day04/out"))
buildSleepCountMatrix(list)
}
}