2024-01-07 01:59:16 +05:00
|
|
|
import java.io.File
|
|
|
|
import kotlin.test.Test
|
|
|
|
import kotlin.test.assertEquals
|
|
|
|
|
|
|
|
class Solution03Test {
|
|
|
|
@Test
|
|
|
|
fun testGetSumOfParts() {
|
2024-01-09 11:08:24 +05:00
|
|
|
val text = ResourceReader().readFile("day-03/test.txt")
|
|
|
|
val instance = Solution03(text)
|
2024-01-07 01:59:16 +05:00
|
|
|
val res = instance.getSumOfParts()
|
|
|
|
assertEquals(4361, res)
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun solvePart1() {
|
2024-01-09 11:08:24 +05:00
|
|
|
val text = ResourceReader().readFile("day-03/input.txt")
|
|
|
|
val instance = Solution03(text)
|
2024-01-07 01:59:16 +05:00
|
|
|
val res = instance.getSumOfParts()
|
|
|
|
println(res)
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun testGetGearRatio() {
|
2024-01-09 11:08:24 +05:00
|
|
|
val text = ResourceReader().readFile("day-03/test.txt")
|
|
|
|
val instance = Solution03(text)
|
2024-01-07 01:59:16 +05:00
|
|
|
val res = instance.getGearRatioSum()
|
|
|
|
assertEquals(467835, res)
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun solvePart2() {
|
2024-01-09 11:08:24 +05:00
|
|
|
val text = ResourceReader().readFile("day-03/input.txt")
|
|
|
|
val instance = Solution03(text)
|
2024-01-07 01:59:16 +05:00
|
|
|
val res = instance.getGearRatioSum()
|
|
|
|
println(res)
|
|
|
|
}
|
|
|
|
}
|