Skip to content

Commit

Permalink
added staircase test
Browse files Browse the repository at this point in the history
  • Loading branch information
tdou25 committed Aug 2, 2024
1 parent 1852dca commit bcc89ef
Showing 1 changed file with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public static void setUp() {
/*test ideas:
-basic test (based off icon)
-"staircase" test
-false
-no possible test
-almost but not actually test
*/
@Test
public void basicSpotTest() throws InvalidFileFormatException{
Expand All @@ -52,5 +53,29 @@ public void basicSpotTest() throws InvalidFileFormatException{
}

}
@Test
public void staircaseTest() throws InvalidFileFormatException{
TestUtilities.importTestBoard(
"puzzles/sudoku/rules/LastCellForNumberDirectRule/StaircaseCase", sudoku
);
TreeNode rootNode = sudoku.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);

for(int i = 1; i <= 9; ++i) {
SudokuBoard board = (SudokuBoard) transition.getBoard();
SudokuCell cell = board.getCell(4,4);

cell.setData(i);
board.addModifiedData(cell);
if(i == 7) {
Assert.assertNull(RULE.checkRuleAt(transition, cell));
}
else {
Assert.assertNotNull(RULE.checkRuleAt(transition, cell));
}

}
}

}

0 comments on commit bcc89ef

Please sign in to comment.