day04
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
package day03
|
||||
|
||||
import kotlin.test.Test
|
||||
|
49
app/src/test/kotlin/day04/Day04Test.kt
Normal file
49
app/src/test/kotlin/day04/Day04Test.kt
Normal file
@@ -0,0 +1,49 @@
|
||||
package day04
|
||||
|
||||
import kotlin.test.Test
|
||||
import util.InputDownloader
|
||||
|
||||
class Day04Test {
|
||||
val dayNum = 4
|
||||
val day = Day04()
|
||||
|
||||
val input = InputDownloader().getInput(dayNum)
|
||||
val example = """MMMSXXMASM
|
||||
MSAMXMSMSA
|
||||
AMXSXMAAMM
|
||||
MSAMASMSMX
|
||||
XMASAMXAMM
|
||||
XXAMMXXAMA
|
||||
SMSMSASXSS
|
||||
SAXAMASAAA
|
||||
MAMMMXMMMM
|
||||
MXMXAXMASX"""
|
||||
|
||||
@Test fun part1Example() {
|
||||
part1(example, 18)
|
||||
}
|
||||
|
||||
@Test fun part1Solution() {
|
||||
part1(input, 2545)
|
||||
}
|
||||
|
||||
@Test fun part2Example() {
|
||||
part2(example, 9)
|
||||
}
|
||||
|
||||
@Test fun part2Solution() {
|
||||
part2(input, 1886)
|
||||
}
|
||||
|
||||
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