-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day06Test.java
50 lines (40 loc) · 1.6 KB
/
Day06Test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package net.bqc.aoc.year2023;
import net.bqc.aoc.AbstractTest;
import net.bqc.aoc.Solution;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.math.BigInteger;
import java.util.List;
import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Day06Test extends AbstractTest {
private Day06 solution;
@BeforeAll
static void setUp() {
INPUT_PATH = "year2023/Day06_Input.txt";
SAMPLE_INPUT_PATH = "year2023/Day06_SampleInput.txt";
}
@BeforeEach
void init() {
solution = new Day06();
}
@ParameterizedTest
@MethodSource("inputDataSource")
void testSolver(Solution.PART_NUMBER part, List<String> inputLines, BigInteger expectedSum) {
BigInteger computedSum = solution.solve2(part, inputLines);
assertEquals(expectedSum, computedSum);
}
static Stream<Arguments> inputDataSource() {
List<String> sampleInputLines = getSampleInput();
List<String> inputLines = getInput();
return Stream.of(
Arguments.of(Solution.PART_NUMBER.ONE, sampleInputLines, new BigInteger("288")),
Arguments.of(Solution.PART_NUMBER.TWO, sampleInputLines, new BigInteger("71503")),
Arguments.of(Solution.PART_NUMBER.ONE, inputLines, new BigInteger("1413720")),
Arguments.of(Solution.PART_NUMBER.TWO, inputLines, new BigInteger("30565288"))
);
}
}