- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInsertIntervalTest.java
More file actions
Latest commit
28 lines (25 loc) · 1020 Bytes
/
Copy pathInsertIntervalTest.java
File metadata and controls
28 lines (25 loc) · 1020 Bytes
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
importorg.example.problems.insert_interval.Solution;
importorg.junit.jupiter.api.Assertions;
importorg.junit.jupiter.params.ParameterizedTest;
importorg.junit.jupiter.params.provider.Arguments;
importorg.junit.jupiter.params.provider.MethodSource;
importjava.util.Arrays;
importjava.util.stream.Stream;
publicclassInsertIntervalTest {
privatestaticStream<Arguments> provideCases() {
returnStream.of(
Arguments.of(newint[][]{{1, 3}, {6, 9}}, newint[]{2, 5}, newint[][]{{1, 5}, {6, 9}}),
Arguments.of(
newint[][]{{1, 2}, {3, 5}, {6, 7}, {8, 10}, {12, 16}},
newint[]{4, 8},
newint[][]{{1, 2}, {3, 10}, {12, 16}}
)
);
}
@ParameterizedTest
@MethodSource("provideCases")
publicvoidtest(int[][] intervals, int[] newInterval, int[][] expected) {
Solutions = newSolution();
Assertions.assertTrue(Arrays.deepEquals(expected, s.insert(intervals, newInterval)));
}
}