From bcc89efd070f460e761d885eed9e0e2a66a83397 Mon Sep 17 00:00:00 2001 From: tdou25 Date: Fri, 2 Aug 2024 15:10:53 -0400 Subject: [PATCH] added staircase test --- ...LastCellForNumberDirectRuleRegionTest.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/test/java/puzzles/sudoku/rules/LastCellForNumberDirectRuleRegionTest.java b/src/test/java/puzzles/sudoku/rules/LastCellForNumberDirectRuleRegionTest.java index 32ecc84c7..485254ceb 100644 --- a/src/test/java/puzzles/sudoku/rules/LastCellForNumberDirectRuleRegionTest.java +++ b/src/test/java/puzzles/sudoku/rules/LastCellForNumberDirectRuleRegionTest.java @@ -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{ @@ -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)); + } + + } + } } \ No newline at end of file