File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
src/main/kotlin/de/ronny_h/aoc Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -9,20 +9,19 @@ abstract class AdventOfCode<T>(val year: Int, val day: Int) {
99 abstract fun part1 (input : List <String >): T
1010 abstract fun part2 (input : List <String >): T
1111
12- private val input = readInput()
13-
1412 fun run (expectedPart1 : T , expectedPart2 : T ) {
13+ val input = readInput()
1514 println (" Day $day $year - ${this ::class .simpleName} - part 1" )
16- printAndCheck(::part1, expectedPart1)
15+ printAndCheck(input, ::part1, expectedPart1)
1716 println (" Day $day $year - ${this ::class .simpleName} - part 2" )
18- printAndCheck(::part2, expectedPart2)
17+ printAndCheck(input, ::part2, expectedPart2)
1918 }
2019
2120 private fun readInput () = Path (" src/input/$year /Day${paddedDay()} .txt" ).readText().trim().lines()
2221
2322 private fun paddedDay (): String = day.toString().padStart(2 , ' 0' )
2423
25- private fun printAndCheck (block : (List <String >) -> T , expected : T ) {
24+ private fun printAndCheck (input : List < String >, block : (List <String >) -> T , expected : T ) {
2625 printAndCheck(measureTimedValue { block(input) }, expected)
2726 }
2827
You can’t perform that action at this time.
0 commit comments