From d8579dda8c45e7b74e7ce484a913541094e77fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20R=C3=B8dland?= Date: Sun, 17 Dec 2023 09:59:31 +0100 Subject: [PATCH] 2023 - Day 17 - init --- .../kotlin/no/rodland/advent_2023/Day17.kt | 27 ++++++ .../no/rodland/advent_2023/Day17Test.kt | 82 +++++++++++++++++++ src/test/resources/2023/input_17_test.txt | 13 +++ 3 files changed, 122 insertions(+) create mode 100644 src/main/kotlin/no/rodland/advent_2023/Day17.kt create mode 100644 src/test/kotlin/no/rodland/advent_2023/Day17Test.kt diff --git a/src/main/kotlin/no/rodland/advent_2023/Day17.kt b/src/main/kotlin/no/rodland/advent_2023/Day17.kt new file mode 100644 index 00000000..63dc9d75 --- /dev/null +++ b/src/main/kotlin/no/rodland/advent_2023/Day17.kt @@ -0,0 +1,27 @@ +package no.rodland.advent_2023 + +import no.rodland.advent.Day + +// template generated: 17/12/2023 +// Fredrik Rødland 2023 + +class Day17(val input: List) : Day> { + + private val parsed = input.parse() + + override fun partOne(): Long { + return 2 + } + + override fun partTwo(): Long { + return 2 + } + + override fun List.parse(): List { + return map { line -> + line + } + } + + override val day = "17".toInt() +} diff --git a/src/test/kotlin/no/rodland/advent_2023/Day17Test.kt b/src/test/kotlin/no/rodland/advent_2023/Day17Test.kt new file mode 100644 index 00000000..02a445e9 --- /dev/null +++ b/src/test/kotlin/no/rodland/advent_2023/Day17Test.kt @@ -0,0 +1,82 @@ +package no.rodland.advent_2023 + +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 Day17Test { + private val data17 = "2023/input_17.txt".readFile() + private val test17 = "2023/input_17_test.txt".readFile() + + private val resultTestOne = 2L + private val resultTestTwo = 2L + private val resultOne = 2L + private val resultTwo = 2L + + val test = defaultTestSuiteParseOnInit( + Day17(data17), + Day17(test17), + resultTestOne, + resultOne, + resultTestTwo, + resultTwo, + { Day17(data17) }, + { Day17(test17) }, + ) + + @Nested + inner class Init { + @Test + fun `17,-,example,1`() { + report(AOCTest({ "123".toInt() }, Unit, 123, 5, "17".toInt(), Part.TWO, false, "example")) + } + + @Test + fun `17,-,example,2`() { + report(test.initTest.copy()) + } + + @Test + fun `17,-,test,init`() { + report(test.initTest) + } + + @Test + fun `17,-,live,init`() { + report(test.initLive) + } + } + + @Nested + inner class `Part 1` { + @Test + fun `17,1,test`() { + report(test.testPart1) + } + + @Test + fun `17,1,live,1`() { + report(test.livePart1) + } + } + + @Nested + inner class `Part 2` { + @Test + fun `17,2,test`() { + report(test.testPart2) + } + + @Test + fun `17,2,live,1`() { + report(test.livePart2) + } + } +} diff --git a/src/test/resources/2023/input_17_test.txt b/src/test/resources/2023/input_17_test.txt index e69de29b..3c850869 100644 --- a/src/test/resources/2023/input_17_test.txt +++ b/src/test/resources/2023/input_17_test.txt @@ -0,0 +1,13 @@ +2413432311323 +3215453535623 +3255245654254 +3446585845452 +4546657867536 +1438598798454 +4457876987766 +3637877979653 +4654967986887 +4564679986453 +1224686865563 +2546548887735 +4322674655533 \ No newline at end of file