This commit is contained in:
Andrew Glaze
2024-12-03 01:01:43 -05:00
parent ca7903c1c2
commit 0478b6d7b3
2 changed files with 94 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package day03
import kotlin.test.Test
import util.InputDownloader
class Day03Test {
val dayNum = 3
val day = Day03()
val input = InputDownloader().getInput(dayNum)
val example = "xmul(2,4)%&mul[3,7]!@^do_not_mul(5,5)+mul(32,64]then(mul(11,8)mul(8,5))"
val example2 = "xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5))"
@Test fun part1Example() {
part1(example, 161)
}
@Test fun part1Solution() {
part1(input, 153469856)
}
@Test fun part2Example() {
part2(example2, 48)
}
@Test fun part2Solution() {
part2(input, 77055967)
}
fun part1(input: String, expected: Int) {
val output = day.part1(input)
println("output: $output")
assert(output == expected)
}
fun part2(input: String, expected: Int) {
val output = day.part2(input)
println("output: $output")
assert(output == expected)
}
}