Skip to content

Commit

Permalink
2024 - Day 10 - input/init
Browse files Browse the repository at this point in the history
  • Loading branch information
fmmr committed Dec 10, 2024
1 parent f6d5b17 commit 93c7ea9
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/main/kotlin/no/rodland/advent_2024/Day10.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package no.rodland.advent_2024

import no.rodland.advent.Day

// template generated: 10/12/2024
// Fredrik Rødland 2024

class Day10(val input: List<String>) : Day<Long, Long, List<String>> {

private val parsed = input.parse()

override fun partOne(): Long {
return 2
}

override fun partTwo(): Long {
return 2
}

override fun List<String>.parse(): List<String> {
return map { line ->
line
}
}

override val day = "10".toInt()
}
82 changes: 82 additions & 0 deletions src/test/kotlin/no/rodland/advent_2024/Day10Test.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package no.rodland.advent_2024

import no.rodland.advent.*
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
import readFile

//
// run: download_aoc_input.sh to download input
//

@Suppress("ClassName")
@DisableSlow
internal class Day10Test {
private val data10 = "2024/input_10.txt".readFile()
private val test10 = "2024/input_10_test.txt".readFile()

private val resultTestOne = 2L
private val resultTestTwo = 2L
private val resultOne = 2L
private val resultTwo = 2L

val test = defaultTestSuiteParseOnInit(
Day10(data10),
Day10(test10),
resultTestOne,
resultOne,
resultTestTwo,
resultTwo,
{ Day10(data10) },
{ Day10(test10) },
)

@Nested
inner class Init {
@Test
fun `10,-,example,1`() {
report(AOCTest({ "123".toInt() }, Unit, 123, 5, "10".toInt(), Part.TWO, false, "example"))
}

@Test
fun `10,-,example,2`() {
report(test.initTest.copy())
}

@Test
fun `10,-,test,init`() {
report(test.initTest)
}

@Test
fun `10,-,live,init`() {
report(test.initLive)
}
}

@Nested
inner class `Part 1` {
@Test
fun `10,1,test`() {
report(test.testPart1)
}

@Test
fun `10,1,live,1`() {
report(test.livePart1)
}
}

@Nested
inner class `Part 2` {
@Test
fun `10,2,test`() {
report(test.testPart2)
}

@Test
fun `10,2,live,1`() {
report(test.livePart2)
}
}
}
8 changes: 8 additions & 0 deletions src/test/resources/2024/input_10_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
89010123
78121874
87430965
96549874
45678903
32019012
01329801
10456732

0 comments on commit 93c7ea9

Please sign in to comment.