2023-12-05 00:28:46 +05:00
|
|
|
import kotlin.test.Test
|
|
|
|
import kotlin.test.assertEquals
|
|
|
|
|
|
|
|
class Solution02Test {
|
|
|
|
@Test
|
|
|
|
fun testGetSumOfCorrectGameIDs() {
|
2024-01-09 11:08:24 +05:00
|
|
|
val text = ResourceReader().readFile("day-02/test.txt")
|
|
|
|
val res = Solution02().getSumOfCorrectGameIDs(text, CubeCount(12, 13, 14))
|
2023-12-05 00:28:46 +05:00
|
|
|
assertEquals(8, res)
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun testGetPowerSum() {
|
2024-01-09 11:08:24 +05:00
|
|
|
val text = ResourceReader().readFile("day-02/test.txt")
|
|
|
|
val res = Solution02().getSumOfPowers(text)
|
2023-12-05 00:28:46 +05:00
|
|
|
assertEquals(2286, res)
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun solvePart1() {
|
2024-01-09 11:08:24 +05:00
|
|
|
val text = ResourceReader().readFile("day-02/input.txt")
|
|
|
|
val res = Solution02().getSumOfCorrectGameIDs(text, CubeCount(12, 13, 14))
|
2023-12-05 00:28:46 +05:00
|
|
|
println(res)
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun solvePart2() {
|
2024-01-09 11:08:24 +05:00
|
|
|
val text = ResourceReader().readFile("day-02/input.txt")
|
|
|
|
val res = Solution02().getSumOfPowers(text)
|
2023-12-05 00:28:46 +05:00
|
|
|
println(res)
|
|
|
|
}
|
2024-01-09 11:08:24 +05:00
|
|
|
}
|