diff --git a/settings.gradle b/settings.gradle index dcbd58cf9..0fe46c84f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1 @@ rootProject.name = 'LEGUP' - diff --git a/src/test/java/puzzles/lightup/rules/EmptyCornersDirectRuleTest.java b/src/test/java/puzzles/lightup/rules/EmptyCornersDirectRuleTest.java index 073b1c9df..bea69b95f 100644 --- a/src/test/java/puzzles/lightup/rules/EmptyCornersDirectRuleTest.java +++ b/src/test/java/puzzles/lightup/rules/EmptyCornersDirectRuleTest.java @@ -28,8 +28,8 @@ public void EmptyCornersTest() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/lightup/rules/EmptyCornersDirectRule/EmptyCorners", lightUp); TreeNode rootNode = lightUp.getTree().getRootNode(); TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - + transition.setRule(RULE); + //get board state LightUpBoard board = (LightUpBoard) transition.getBoard(); @@ -42,16 +42,32 @@ public void EmptyCornersTest() throws InvalidFileFormatException { cell2.setData(LightUpCellType.EMPTY.value); board.addModifiedData(cell2); + LightUpCell cell3 = board.getCell(4,3); + cell3.setData(LightUpCellType.EMPTY.value); + board.addModifiedData(cell3); + //confirm there is a logical following of the EmptyCorners rule Assert.assertNull(RULE.checkRule(transition)); + //this should not be accepted, the cell should remain unknown + LightUpCell cell4 = board.getCell(4,5); + cell4.setData(LightUpCellType.EMPTY.value); + board.addModifiedData(cell4); + + //this should not be accepted, the cell should be empty but not because of this rule + LightUpCell cell5 = board.getCell(4,1); + cell5.setData(LightUpCellType.EMPTY.value); + board.addModifiedData(cell5); + + Assert.assertNotNull(RULE.checkRule(transition)); + //confirm the two expected cells are emptied USING THE RULE // and none of the rest are (others can be empty just not by the same rule) LightUpCell c; for (int i = 0; i < board.getHeight(); i++) { for (int j = 0; j < board.getWidth(); j++) { c = board.getCell(j, i); - if ((i == 2 && j == 0) || (i == 2 && j == 2)){ + if ((i == 2 && j == 0) || (i == 2 && j == 2) || (i==3 && j==4)){ Assert.assertNull(RULE.checkRuleAt(transition, c)); } else { @@ -60,4 +76,4 @@ public void EmptyCornersTest() throws InvalidFileFormatException { } } } -} +} \ No newline at end of file diff --git a/src/test/resources/puzzles/lightup/rules/EmptyCornersDirectRule/EmptyCorners b/src/test/resources/puzzles/lightup/rules/EmptyCornersDirectRule/EmptyCorners index 5dc1013fd..3d082d4b2 100644 --- a/src/test/resources/puzzles/lightup/rules/EmptyCornersDirectRule/EmptyCorners +++ b/src/test/resources/puzzles/lightup/rules/EmptyCornersDirectRule/EmptyCorners @@ -1,9 +1,13 @@ - + + + + +