Skip to content

Commit

Permalink
2023 - Day12 - init
Browse files Browse the repository at this point in the history
  • Loading branch information
fmmr committed Dec 12, 2023
1 parent 51b491f commit ff2f2b1
Show file tree
Hide file tree
Showing 4 changed files with 1,120 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/main/kotlin/no/rodland/advent_2023/Day12.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package no.rodland.advent_2023

import no.rodland.advent.Day

// template generated: 12/12/2023
// Fredrik Rødland 2023

class Day12(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 = "12".toInt()
}
82 changes: 82 additions & 0 deletions src/test/kotlin/no/rodland/advent_2023/Day12Test.kt
Original file line number Diff line number Diff line change
@@ -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 Day12Test {
private val data12 = "2023/input_12.txt".readFile()
private val test12 = "2023/input_12_test.txt".readFile()

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

val test = defaultTestSuiteParseOnInit(
Day12(data12),
Day12(test12),
resultTestOne,
resultOne,
resultTestTwo,
resultTwo,
{ Day12(data12) },
{ Day12(test12) },
)

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

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

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

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

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

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

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

@Test
fun `12,2,live,1`() {
report(test.livePart2)
}
}
}
Loading

0 comments on commit ff2f2b1

Please sign in to comment.