public void SolveGame_Legal_16X16_ReturnTrue() { // Arrange // create valid 16 on 16 sudoku Board string testBoard = "0080040000000003" + "0000000000000000" + "@00000=000000000" + "<0000>000?000000" + "07@000000;030000" + "000000>005000;00" + "00000000=0400000" + "0000000000009000" + "0000060800>00007" + ":0;00000@<000000" + "0000000000?00200" + "000000@>00000000" + "00700=0;00000060" + "0000000000000@00" + "0>002@000=000000" + "000100000000=500"; Board board = new Board(testBoard, 16); GameSolver solver = new GameSolver(board); // Act bool solved = solver.SolveGame(); // Assert Assert.AreEqual(solved, true); }
public void SolveGame_Unsolvable_9X9_ReturnFalse() { // Arrange // Create valid 9 on 9 sudoku Board // this board in unslovable because we have to set '9' in // indexes [0,8] and this wiil casue '9' dupliacte in the last col string testBoard = "123456780" + "000000000" + "000000000" + "009000000" + "000000000" + "000005000" + "000000000" + "030002009" + "000000000"; Board board = new Board(testBoard, 9); GameSolver solver = new GameSolver(board); // Act bool solved = solver.SolveGame(); // Assert - The solver needs to try to solve the board // without success and return false Assert.AreEqual(solved, false); }
public void SolveGame_Legal_9X9_ReturnTrue() { // Arrange // create valid 9 on 9 sudoku Board string string testBoard = "500080049" + "000500030" + "067300001" + "150000000" + "000208000" + "000000018" + "700004150" + "030002000" + "490050000"; // build a Board and gameSolver Board board = new Board(testBoard, 9); GameSolver solver = new GameSolver(board); // Act // try to solve the sudoku board bool solved = solver.SolveGame(); // Assert - we expect the solver to Solve the sudoku and return true Assert.AreEqual(solved, true); }
public void SolveGame_EmptyBoard16X16_ReturnTrue() { // Arrange // create empty 16 on 16 sudoku Board string testBoard = new string('0', 16 * 16); Board board = new Board(testBoard, 16); GameSolver solver = new GameSolver(board); // Act bool solved = solver.SolveGame(); // Assert // empty board is solvable board with a lot of solvign options // the function should return true Assert.AreEqual(solved, true); }
public void SolveGame_Legal_4X4_ReturnTrue() { // Arrange // create valid 4 on 4 sudoku Board string testBoard = "1234" + "3400" + "2040" + "4002"; Board Sudokuboard = new Board(testBoard, 4); GameSolver solver = new GameSolver(Sudokuboard); // Act bool solved = solver.SolveGame(); // Assert Assert.AreEqual(solved, true); }
public void SolveGame_SolvedBoard_ReturnTrue() { // Arrange // Create 4 on 4 solved board string slovedBoard = "1234" + "3412" + "2143" + "4321"; Board board = new Board(slovedBoard, 4); GameSolver solver = new GameSolver(board); // Act bool solved = solver.SolveGame(); // Assert Assert.AreEqual(solved, true); }
public void SolveGame_Unsolvable_4X4_ReturnFalse() { // Arrange // Create Legal 4 on 4 sudoku Board // this board in unslovable because we have to set '4' in // indexes [2,1] and this wiil casue '4' dupliacte in the third row string testBoard = "4000" + "0000" + "1042" + "2300"; Board Sudokuboard = new Board(testBoard, 4); GameSolver solver = new GameSolver(Sudokuboard); // Act bool solved = solver.SolveGame(); // Assert - The solver needs to try to solve the board // without success and return false Assert.AreEqual(solved, false); }