|
13 | 13 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
14 | 14 |
|
15 | 15 | class AppTest {
|
| 16 | + private final List<String> testInput = Arrays.asList( |
| 17 | + "467..114..", |
| 18 | + "...*......", |
| 19 | + "..35..633.", |
| 20 | + "......#...", |
| 21 | + "617*......", |
| 22 | + ".....+.58.", |
| 23 | + "..592.....", |
| 24 | + "......755.", |
| 25 | + "...$.*....", |
| 26 | + ".664.598.."); |
| 27 | + |
| 28 | + private final List<String> testInput2 = Arrays.asList( |
| 29 | + "467..114..", |
| 30 | + "...*......", |
| 31 | + "..35...633", |
| 32 | + "4.....#...", |
| 33 | + "617*......", |
| 34 | + ".....+.58.", |
| 35 | + "..592.....", |
| 36 | + "......755.", |
| 37 | + "...$..*...", |
| 38 | + ".664...598"); |
| 39 | + |
16 | 40 | @Test
|
17 | 41 | void testGetPart1() throws IOException {
|
18 |
| - List<String> lines = Arrays.asList( |
19 |
| - "467..114..", |
20 |
| - "...*......", |
21 |
| - "..35..633.", |
22 |
| - "......#...", |
23 |
| - "617*......", |
24 |
| - ".....+.58.", |
25 |
| - "..592.....", |
26 |
| - "......755.", |
27 |
| - "...$.*....", |
28 |
| - ".664.598.."); |
29 |
| - assertEquals("4361", App.getPart1(lines)); |
30 |
| - |
31 |
| - lines = readLinesFromResources(this, "input.txt"); |
32 |
| - assertEquals("512794", App.getPart1(lines)); |
| 42 | + assertEquals("4361", App.getPart1(testInput)); |
| 43 | + assertEquals("4361", App.getPart1(testInput2)); |
| 44 | + |
| 45 | + List<String> realInput = readLinesFromResources(this, "input.txt"); |
| 46 | + assertEquals("512794", App.getPart1(realInput)); |
33 | 47 | }
|
34 | 48 |
|
35 | 49 | @Test
|
36 | 50 | void testGetPart2() throws IOException {
|
37 |
| - List<String> lines = Arrays.asList( |
38 |
| - "467..114..", |
39 |
| - "...*......", |
40 |
| - "..35..633.", |
41 |
| - "......#...", |
42 |
| - "617*......", |
43 |
| - ".....+.58.", |
44 |
| - "..592.....", |
45 |
| - "......755.", |
46 |
| - "...$.*....", |
47 |
| - ".664.598.."); |
48 |
| - assertEquals("467835", App.getPart2(lines)); |
49 |
| - |
50 |
| - lines = readLinesFromResources(this, "input.txt"); |
51 |
| - assertEquals("67779080", App.getPart2(lines)); |
| 51 | + assertEquals("467835", App.getPart2(testInput)); |
| 52 | + assertEquals("467835", App.getPart2(testInput2)); |
| 53 | + |
| 54 | + List<String> realInput = readLinesFromResources(this, "input.txt"); |
| 55 | + assertEquals("67779080", App.getPart2(realInput)); |
52 | 56 | }
|
53 | 57 | }
|
0 commit comments