Skip to content

Commit

Permalink
added a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-771 committed Apr 2, 2024
1 parent b419df8 commit b8c62bc
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,28 @@ public void TooManyTentsContradictionRule_BottomAccount() throws InvalidFileForm
}
}
}

/**
* Tests TooManyTents where there is no contradiction
* Row Tent Counts: 1,0,1 Column Tent Counts: 0,1,1
* @throws InvalidFileFormatException
*/
public void TooManyTentsContradictionRule_NoContradiction() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/TooManyTentsContradictionRule/TooManyTentsNoContradiction",
treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);

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

Assert.assertNotNull(RULE.checkContradiction(board));

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,22 @@
<Legup>
<puzzle name="TreeTent">
<board height="3" width="3">
<cells>
<cell value="1" x="1" y="1"/>
<cell value="3" x="1" y="0"/>
<cell value="3" x="2" y="2"/>
</cells>
<axis side="east">
<clue index="A" value="1"/>
<clue index="B" value="0"/>
<clue index="C" value="1"/>
</axis>
<axis side="south">
<clue index="1" value="0"/>
<clue index="2" value="1"/>
<clue index="3" value="1"/>
</axis>
</board>
</puzzle>
<solved isSolved="false" lastSaved="--"/>
</Legup>

0 comments on commit b8c62bc

Please sign in to comment.