From 9ac7253f2b35a65af08597e09f0ad91e9dda1b9e Mon Sep 17 00:00:00 2001 From: Relurk1 Date: Tue, 14 Nov 2023 16:55:34 -0500 Subject: [PATCH] Changes and additions to test suite This commit includes: - A change for readability made in the case rule, replacing Integer objects with NurikabeType - Adding false test cases where necessary - Updating test cases where necessary --- .../BlackBetweenRegionsDirectRuleTest.java | 24 +++++++++++++++ .../rules/BlackOrWhiteCaseRuleTest.java | 10 +++---- .../BlackSquareContradictionRuleTest.java | 22 +++++++++++++- .../rules/CornerBlackDirectRuleTest.java | 30 +++++++++++++++++-- .../rules/FillinBlackDirectRuleTest.java | 23 ++++++++++++++ .../rules/FillinWhiteDirectRuleTest.java | 26 ++++++++++++++++ .../IsolateBlackContradictionRuleTest.java | 22 +++++++++++++- .../rules/NoNumbersContradictionRuleTest.java | 26 +++++++++++++--- .../PreventBlackSquareDirectRuleTest.java | 20 +++++++++++++ .../rules/SurroundRegionDirectRuleTest.java | 22 ++++++++++++++ .../TooFewSpacesContradictionRuleTest.java | 23 ++++++++++++++ .../TooManySpacesContradictionRuleTest.java | 25 ++++++++++++++++ .../rules/WhiteBottleNeckDirectRuleTest.java | 26 ++++++++++++++++ .../FalseBlackBetweenRegions | 13 ++++++++ .../FalseBlackSquare | 11 +++++++ .../CornerBlackDirectRule/FalseCornerBlack | 12 ++++++++ .../FillinBlackDirectRule/FalseFillinBlack | 12 ++++++++ .../FillinWhiteDirectRule/FalseFillinWhite | 12 ++++++++ .../FalseIsolateBlack | 10 +++++++ .../{NoNumberReachable => FalseNoNumber} | 0 .../NoNumberContradictionRule/FalseNoNumber2 | 18 +++++++++++ .../{NoNumberSurroundBlack => SimpleNoNumber} | 0 .../FalseBlackSquare | 10 +++++++ .../FalseSurroundRegion | 10 +++++++ .../FalseTooFewSpaces | 17 +++++++++++ .../MultipleNumberRegion | 11 +++++++ .../WhiteBottleNeckDirectRule/FalseBottleNeck | 11 +++++++ 27 files changed, 432 insertions(+), 14 deletions(-) create mode 100644 src/test/resources/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRule/FalseBlackBetweenRegions create mode 100644 src/test/resources/puzzles/nurikabe/rules/BlackSquareContradictionRule/FalseBlackSquare create mode 100644 src/test/resources/puzzles/nurikabe/rules/CornerBlackDirectRule/FalseCornerBlack create mode 100644 src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/FalseFillinBlack create mode 100644 src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/FalseFillinWhite create mode 100644 src/test/resources/puzzles/nurikabe/rules/IsolateBlackContradictionRule/FalseIsolateBlack rename src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/{NoNumberReachable => FalseNoNumber} (100%) create mode 100644 src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/FalseNoNumber2 rename src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/{NoNumberSurroundBlack => SimpleNoNumber} (100%) create mode 100644 src/test/resources/puzzles/nurikabe/rules/PreventBlackSquareDirectRule/FalseBlackSquare create mode 100644 src/test/resources/puzzles/nurikabe/rules/SurroundRegionDirectRule/FalseSurroundRegion create mode 100644 src/test/resources/puzzles/nurikabe/rules/TooFewSpacesContradictionRule/FalseTooFewSpaces create mode 100644 src/test/resources/puzzles/nurikabe/rules/TooManySpacesContradictionRule/MultipleNumberRegion create mode 100644 src/test/resources/puzzles/nurikabe/rules/WhiteBottleNeckDirectRule/FalseBottleNeck diff --git a/src/test/java/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRuleTest.java b/src/test/java/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRuleTest.java index a6652ea60..7e8b5eb83 100644 --- a/src/test/java/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRuleTest.java +++ b/src/test/java/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRuleTest.java @@ -163,4 +163,28 @@ public void BlackBetweenRegionsDirectRule_VerticalBlackBetweenRegionsTest() thro } } } + + /** + * Tests the Black Between Regions direct rule for a false application of the rule, where a black tile is enclosed by one region + */ + @Test + public void BlackBetweenRegionsDirectRule_FalseBlackBetweenRegionsTest() throws InvalidFileFormatException{ + TestUtilities.importTestBoard("puzzles/nurikabe/rules/BlackBetweenRegionsDirectRule/FalseBlackBetweenRegions",nurikabe); + TreeNode rootNode = nurikabe.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + NurikabeBoard board = (NurikabeBoard) transition.getBoard(); + NurikabeCell cell = board.getCell(1,1); + cell.setData(NurikabeType.BLACK.toValue()); + board.addModifiedData(cell); + + Assert.assertNotNull(RULE.checkRule(transition)); + + for(int i=0; i + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/nurikabe/rules/BlackSquareContradictionRule/FalseBlackSquare b/src/test/resources/puzzles/nurikabe/rules/BlackSquareContradictionRule/FalseBlackSquare new file mode 100644 index 000000000..813114443 --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/BlackSquareContradictionRule/FalseBlackSquare @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/nurikabe/rules/CornerBlackDirectRule/FalseCornerBlack b/src/test/resources/puzzles/nurikabe/rules/CornerBlackDirectRule/FalseCornerBlack new file mode 100644 index 000000000..0599fdfa4 --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/CornerBlackDirectRule/FalseCornerBlack @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/FalseFillinBlack b/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/FalseFillinBlack new file mode 100644 index 000000000..731e2dc74 --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/FalseFillinBlack @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/FalseFillinWhite b/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/FalseFillinWhite new file mode 100644 index 000000000..f2599c71f --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/FalseFillinWhite @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/nurikabe/rules/IsolateBlackContradictionRule/FalseIsolateBlack b/src/test/resources/puzzles/nurikabe/rules/IsolateBlackContradictionRule/FalseIsolateBlack new file mode 100644 index 000000000..b4eb09302 --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/IsolateBlackContradictionRule/FalseIsolateBlack @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/NoNumberReachable b/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/FalseNoNumber similarity index 100% rename from src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/NoNumberReachable rename to src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/FalseNoNumber diff --git a/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/FalseNoNumber2 b/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/FalseNoNumber2 new file mode 100644 index 000000000..be1fc64f7 --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/FalseNoNumber2 @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/NoNumberSurroundBlack b/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/SimpleNoNumber similarity index 100% rename from src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/NoNumberSurroundBlack rename to src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/SimpleNoNumber diff --git a/src/test/resources/puzzles/nurikabe/rules/PreventBlackSquareDirectRule/FalseBlackSquare b/src/test/resources/puzzles/nurikabe/rules/PreventBlackSquareDirectRule/FalseBlackSquare new file mode 100644 index 000000000..2fd8e7d35 --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/PreventBlackSquareDirectRule/FalseBlackSquare @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/nurikabe/rules/SurroundRegionDirectRule/FalseSurroundRegion b/src/test/resources/puzzles/nurikabe/rules/SurroundRegionDirectRule/FalseSurroundRegion new file mode 100644 index 000000000..5e0b04f68 --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/SurroundRegionDirectRule/FalseSurroundRegion @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/nurikabe/rules/TooFewSpacesContradictionRule/FalseTooFewSpaces b/src/test/resources/puzzles/nurikabe/rules/TooFewSpacesContradictionRule/FalseTooFewSpaces new file mode 100644 index 000000000..ca3e9be84 --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/TooFewSpacesContradictionRule/FalseTooFewSpaces @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/nurikabe/rules/TooManySpacesContradictionRule/MultipleNumberRegion b/src/test/resources/puzzles/nurikabe/rules/TooManySpacesContradictionRule/MultipleNumberRegion new file mode 100644 index 000000000..3ec126199 --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/TooManySpacesContradictionRule/MultipleNumberRegion @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/nurikabe/rules/WhiteBottleNeckDirectRule/FalseBottleNeck b/src/test/resources/puzzles/nurikabe/rules/WhiteBottleNeckDirectRule/FalseBottleNeck new file mode 100644 index 000000000..521576aeb --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/WhiteBottleNeckDirectRule/FalseBottleNeck @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file