Skip to content

Commit d21bb5c

Browse files
committed
Print out solutions in AfterAll phase
1 parent 0e0ee4f commit d21bb5c

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/main/kotlin/com/github/hsz/aoc/Day.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package com.github.hsz.aoc
22

33
import com.github.hsz.aoc.utils.Resources
44

5-
abstract class Day(number: Number) {
5+
abstract class Day(val number: Number) {
66

77
private val input = Resources.asString("day${number.toString().padStart(2, '0')}.txt")
88

src/test/kotlin/com/github/hsz/aoc/Day01Test.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ class Day01Test : DayTest() {
88
override val day = Day01()
99

1010
@Test
11-
fun part1() {
11+
fun `Part 1`() {
1212
assertEquals(0, day.part1("foo")) // check against test input
1313
assertEquals(0, day.part1()) // check against input data
1414
}
1515

1616
@Test
17-
fun part2() {
17+
fun `Part 2`() {
1818
assertEquals(0, day.part2("bar"))
1919
assertEquals(0, day.part2())
2020
}

src/test/kotlin/com/github/hsz/aoc/DayTest.kt

+10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@ package com.github.hsz.aoc
33
import org.junit.jupiter.api.AfterAll
44
import org.junit.jupiter.api.TestInstance
55

6+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
67
abstract class DayTest {
78

89
abstract val day: Day
10+
11+
@AfterAll
12+
fun solve() {
13+
with(day) {
14+
println("Solutions for Day $number:")
15+
println("Part 1: ${part1()}")
16+
println("Part 2: ${part2()}")
17+
}
18+
}
919
}

0 commit comments

Comments
 (0)