-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFloodFillTest.java
More file actions
23 lines (20 loc) · 884 Bytes
/
FloodFillTest.java
File metadata and controls
23 lines (20 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import org.example.problems.flood_fill.Solution;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.stream.Stream;
public class FloodFillTest {
private static Stream<Arguments> provideCases() {
return Stream.of(
Arguments.of(new int[][]{{1,1,1},{1,1,0},{1,0,1}}, 1, 1, 2, new int[][]{{2,2,2},{2,2,0},{2,0,1}}),
Arguments.of(new int[][]{{0,0,0},{0,0,0}}, 0, 0, 0, new int[][]{{0,0,0},{0,0,0}})
);
}
@ParameterizedTest
@MethodSource("provideCases")
public void test(int[][] matrix, int sr, int sc, int color, int[][] expected) {
Solution s = new Solution();
Assertions.assertArrayEquals(expected, s.floodFill(matrix, sr, sc, color));
}
}