Skip to content

Commit

Permalink
added test where rule should not work
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-771 committed Oct 13, 2023
1 parent 3b8513c commit 8ab6eb5
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,35 @@ public void MiddleTentTest() throws InvalidFileFormatException {
}
}
}

@Test
public void FailTentTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/treetent/rules/FinishWithGrassDirectRule/FailTent", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);

TreeTentBoard board = (TreeTentBoard) transition.getBoard();

List<TreeTentCell> cells = new ArrayList<TreeTentCell>();
for (int i = 0; i < board.getWidth(); i++) {
for (int k = 0; k < board.getHeight(); k++) {
TreeTentCell c = board.getCell(i, k);
c.setData(TreeTentType.GRASS);
cells.add(c);
}
}

for (TreeTentCell c : cells) {
board.addModifiedData(c);
}

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

for (TreeTentCell c : cells) {
Assert.assertNotNull(RULE.checkRuleAt(transition, c));
}
}
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Legup>
<puzzle name="TreeTent">
<board height="3" width="3">
<cells>
</cells>
<axis side="east">
<clue index="A" value="1"/>
<clue index="B" value="1"/>
<clue index="C" value="1"/>
</axis>
<axis side="south">
<clue index="1" value="1"/>
<clue index="2" value="1"/>
<clue index="3" value="1"/>
</axis>
</board>
</puzzle>
<solved isSolved="false" lastSaved="--"/>
</Legup>

0 comments on commit 8ab6eb5

Please sign in to comment.