day03
This commit is contained in:
42
app/src/test/kotlin/day03/Day03Test.kt
Normal file
42
app/src/test/kotlin/day03/Day03Test.kt
Normal 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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user