File tree Expand file tree Collapse file tree 4 files changed +60
-3
lines changed
main/java/de/havox_design/aoc2015/day06
test/java/de/havox_design/aoc2015/day06 Expand file tree Collapse file tree 4 files changed +60
-3
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ plugins {
44
55// project meta data
66group ' de.havox_design.aoc2015'
7- version ' 0.5.1 '
7+ version ' 0.5.2 '
88
99// Switch to gradle "all" distribution.
1010wrapper {
Original file line number Diff line number Diff line change 1+ package de .havox_design .aoc2015 .day06 ;
2+
3+ import de .havox_design .aoc2015 .utils .DataReader ;
4+
5+ import java .util .List ;
6+
7+ public class HouseDecoratingContest {
8+ private final List <String > input ;
9+
10+ public HouseDecoratingContest (String fileName ) {
11+ input = readData (fileName );
12+ }
13+
14+ public static int solvePart1 (String fileName ) {
15+ HouseDecoratingContest instance = new HouseDecoratingContest (fileName );
16+ return instance .solvePart1 ();
17+ }
18+
19+ public static int solvePart2 (String fileName ) {
20+ HouseDecoratingContest instance = new HouseDecoratingContest (fileName );
21+ return instance .solvePart2 ();
22+ }
23+
24+ public int solvePart1 () {
25+ return 0 ;
26+ }
27+
28+ public int solvePart2 () {
29+ return 0 ;
30+ }
31+
32+ private List <String > readData (String fileName ) {
33+ return DataReader .readData (fileName , MainClass .class );
34+ }
35+ }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ public class MainClass {
66 private static final Logger LOGGER = Logger .getLogger (MainClass .class .getName ());
77
88 public static void main (String [] args ) {
9- LOGGER .info ("Solution 1: 13" );
10- LOGGER .info ("Solution 2: 23" );
9+ LOGGER .info (() -> "Solution 1: " + HouseDecoratingContest . solvePart1 ( "day06.txt" ) );
10+ LOGGER .info (() -> "Solution 2: " + HouseDecoratingContest . solvePart1 ( "day06.txt" ) );
1111 }
1212}
Original file line number Diff line number Diff line change 11package de .havox_design .aoc2015 .day06 ;
22
3+ import org .junit .jupiter .api .Assertions ;
34import org .junit .jupiter .api .Test ;
5+ import org .junit .jupiter .params .ParameterizedTest ;
6+ import org .junit .jupiter .params .provider .Arguments ;
7+ import org .junit .jupiter .params .provider .MethodSource ;
8+
9+ import java .util .stream .Stream ;
410
511class Day06Test {
612
@@ -9,4 +15,20 @@ class Day06Test {
915 void testMainClass () {
1016 MainClass .main (new String [0 ]);
1117 }
18+
19+ @ ParameterizedTest
20+ @ MethodSource ("getDataForPart1" )
21+ void testPart1 (String fileName , int expectedNumberOfNiceStrings ) {
22+ Assertions .assertEquals (expectedNumberOfNiceStrings , HouseDecoratingContest .solvePart1 (fileName ));
23+ }
24+
25+ private static Stream <Arguments > getDataForPart1 () {
26+ return Stream .of (
27+ Arguments .of ("part1sample1.txt" , 1000000 ),
28+ Arguments .of ("part1sample2.txt" , 1000 ),
29+ Arguments .of ("part1sample3.txt" , 999000 ),
30+ Arguments .of ("part1sample4.txt" , 999996 ),
31+ Arguments .of ("part1sample5.txt" , 998996 )
32+ );
33+ }
1234}
You can’t perform that action at this time.
0 commit comments