Skip to content

Commit

Permalink
Finish ColumnsWithinRegions direct rule tests
Browse files Browse the repository at this point in the history
  • Loading branch information
summerhenson committed Jul 16, 2024
1 parent 2e62d41 commit 060897a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,29 @@ public void ColumnsWithinRegionsDirectRule_FalseColumnsWithinRegions3()
}
}

@Test
public void ColumnsWithinRegionsDirectRule_FalseColumnsWithinRegions4()
throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/FalseStarOverlap", starbattle);
TreeNode rootNode = starbattle.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);

StarBattleBoard board = (StarBattleBoard) transition.getBoard();
StarBattleCell cell1 = board.getCell(2,2);
cell1.setData(StarBattleCellType.BLACK.value);
board.addModifiedData(cell1);
StarBattleCell cell2 = board.getCell(2,3);
cell2.setData(StarBattleCellType.BLACK.value);
board.addModifiedData(cell2);

Assert.assertNotNull(RULE.checkRule(transition));

for (int i = 0; i < board.getHeight(); i++) {
for (int k = 0; k < board.getWidth(); k++) {
Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i)));
}
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Legup version="2.0.0">
<puzzle name="StarBattle">
<board size="4" puzzle_num="2">
<region>
<cells>
<cell value="0" x="0" y="0"/>
<cell value="0" x="0" y="1"/>
<cell value="0" x="1" y="1"/>
</cells>
</region>
<region>
<cells>
<cell value="0" x="0" y="2"/>
<cell value="0" x="1" y="2"/>
<cell value="0" x="2" y="2"/>
<cell value="0" x="0" y="3"/>
<cell value="0" x="1" y="3"/>
<cell value="0" x="2" y="3"/>
</cells>
</region>
<region>
<cells>
<cell value="-2" x="1" y="0"/>
<cell value="0" x="2" y="0"/>
<cell value="0" x="2" y="1"/>
</cells>
</region>
<region>
<cells>
<cell value="0" x="3" y="0"/>
<cell value="0" x="3" y="1"/>
<cell value="0" x="3" y="2"/>
<cell value="0" x="3" y="3"/>
</cells>
</region>
</board>
</puzzle>
<solved isSolved="false" lastSaved="--"/>
</Legup>

0 comments on commit 060897a

Please sign in to comment.