@@ -31,7 +31,7 @@ static Stream<Arguments> provideSudokuBoards() {
31
31
/**
32
32
* Parameterized test to check the solution of a Sudoku board.
33
33
*
34
- * @param board The initial Sudoku board to solve.
34
+ * @param board The initial Sudoku board to solve.
35
35
* @param expectedResult Expected result - true if solvable, false otherwise.
36
36
*/
37
37
@ ParameterizedTest
@@ -43,29 +43,30 @@ void testSolveSudoku(int[][] board, boolean expectedResult) {
43
43
}
44
44
45
45
/**
46
- * Parameterized test to check if the number can be safely placed at a given cell.
46
+ * Parameterized test to check if the number can be safely placed at a given
47
+ * cell.
47
48
*
48
- * @param board The Sudoku board to check.
49
- * @param row The row index of the cell.
50
- * @param col The column index of the cell.
51
- * @param num The number to place.
49
+ * @param board The Sudoku board to check.
50
+ * @param row The row index of the cell.
51
+ * @param col The column index of the cell.
52
+ * @param num The number to place.
52
53
* @param expectedResult True if the placement is valid, false otherwise.
53
54
*/
54
55
@ ParameterizedTest
55
- @ CsvSource ({"'5,3,0,0,7,0,0,0,0;6,0,0,1,9,5,0,0,0;0,9,8,0,0,0,0,6,0;8,0,0,0,6,0,0,0,3;4,0,0,8,0,3,0,0,1;7,0,0,0,2,0,0,0,6;0,6,0,0,0,0,2,8,0;0,0,0,4,1,9,0,0,5;0,0,0,0,8,0,0,7,9', 0, 2, 4, false" ,
56
+ @ CsvSource ({
57
+ "'5,3,0,0,7,0,0,0,0;6,0,0,1,9,5,0,0,0;0,9,8,0,0,0,0,6,0;8,0,0,0,6,0,0,0,3;4,0,0,8,0,3,0,0,1;7,0,0,0,2,0,0,0,6;0,6,0,0,0,0,2,8,0;0,0,0,4,1,9,0,0,5;0,0,0,0,8,0,0,7,9', 0, 2, 4, false" ,
56
58
57
-
58
- "'5,3,0,0,7,0,0,0,0;6,0,0,1,9,5,0,0,0;0,9,8,0,0,0,0,6,0;8,0,0,0,6,0,0,0,3;4,0,0,8,0,3,0,0,1;7,0,0,0,2,0,0,0,6;0,6,0,0,0,0,2,8,0;0,0,0,4,1,9,0,0,5;0,0,0,0,8,0,0,7,9', 0, 2, 9, true" })
59
+ "'5,3,0,0,7,0,0,0,0;6,0,0,1,9,5,0,0,0;0,9,8,0,0,0,0,6,0;8,0,0,0,6,0,0,0,3;4,0,0,8,0,3,0,0,1;7,0,0,0,2,0,0,0,6;0,6,0,0,0,0,2,8,0;0,0,0,4,1,9,0,0,5;0,0,0,0,8,0,0,7,9', 0, 2, 9, true" })
59
60
60
- void
61
- testIsSafe (String boardString , int row , int col , int num , boolean expectedResult ) {
61
+ void testIsSafe (String boardString , int row , int col , int num , boolean expectedResult ) {
62
62
int [][] board = parseBoard (boardString );
63
63
assertEquals (expectedResult , Sudoku .isSafe (board , row , col , num ));
64
64
}
65
65
66
66
/**
67
67
* Helper method to parse a board from a string.
68
- * The board string is expected to have semicolon-separated rows with comma-separated values.
68
+ * The board string is expected to have semicolon-separated rows with
69
+ * comma-separated values.
69
70
*
70
71
* @param boardString The board represented as a string.
71
72
* @return The parsed 2D int array representing the Sudoku board.
0 commit comments