From 6054db7fc80c61a77033901438a6d6738d2a7a0b Mon Sep 17 00:00:00 2001 From: Charles Tian <46334090+charlestian23@users.noreply.github.com> Date: Fri, 29 Mar 2024 16:47:03 -0400 Subject: [PATCH 1/4] Improved auto-formatter behavior (#781) * Attempting improvements * Added git config info * Added check for modified files * Modifying GitHub Token use * Temporarily changing user for my fork * Change fork checking and repo name retrieval * Changing back Testing these changes on my fork now doesn't work * Removed distribution * Didn't properly change back * More testing * Testing to see if this works...? * Update java-autoformat.yml * Set upstream * Changing back to Bram * Changing method to create pull request * Modifying job execution conditions * Automated Java code formatting changes * Update java-autoformat.yml Changed branch name to be unique and fail task on master PRs * More debugging * More debugging * More changes * Adding bad formatting for testing * Automated Java code formatting changes * Even more debugging * Bug fixing * EVEN MORE DEBUGGING * Debugging... * Update java-autoformat.yml * Update java-autoformat.yml * Update java-autoformat.yml * Update java-autoformat.yml * Update java-autoformat.yml * Update java-autoformat.yml * Update java-autoformat.yml * Update java-autoformat.yml * Bad formatting for testing * Update java-autoformat.yml * Update java-autoformat.yml * Automated Java code formatting changes * Update java-autoformat.yml * DEBUG * Trying different way to check for modified files * Bad formatting for testing * Automated Java code formatting changes * More changes + more testing * Automated Java code formatting changes --------- Co-authored-by: Bram van Heuveln --- .github/workflows/java-autoformat.yml | 63 +++++++++- .../rpi/legup/model/gameboard/GridRegion.java | 108 +++++++++--------- 2 files changed, 113 insertions(+), 58 deletions(-) diff --git a/.github/workflows/java-autoformat.yml b/.github/workflows/java-autoformat.yml index 7aa2487cb..116332804 100644 --- a/.github/workflows/java-autoformat.yml +++ b/.github/workflows/java-autoformat.yml @@ -2,8 +2,10 @@ name: Java Code Auto Format on: pull_request jobs: - format: - if: github.event.pull_request.head.repo.full_name == github.repository + format_dev: + if: | + github.event.pull_request.head.ref == 'dev' && + github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - name: Checkout code @@ -15,7 +17,6 @@ jobs: uses: actions/setup-java@v1 with: java-version: 21 - distribution: temurin - name: Grant execute permission for gradlew run: chmod +x gradlew @@ -28,7 +29,58 @@ jobs: - name: Check for modified files id: git-check - run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT + run: echo "modified=$(if [[ -n $(git status -s) ]]; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT + + - name: Create temporary branch and pull request + if: steps.git-check.outputs.modified == 'true' + run: | + git config --global user.name 'Bram van Heuveln' + git config --global user.email 'bram28@users.noreply.github.com' + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} + branch_name="auto-format-code-$(date +%s)" + git checkout -b $branch_name + ./gradlew :spotlessApply + git add . + git commit -am "Automated Java code formatting changes" + git push --set-upstream origin $branch_name + gh pr create -B dev -H $branch_name --title 'Automated Java code formatting changes' --body 'This pull request contains automated code formatting changes.' --reviewer ${{ github.actor }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Must approve auto-format pull request + if: steps.git-check.outputs.modified == 'true' + run: | + echo "Please review and approve the appropriate auto-format-code pull request." + exit 1 + + format_pull_request_to_dev: + if: | + github.event.pull_request.base.ref == 'dev' && + github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v1 + with: + ref: ${{ github.head_ref }} + + - name: Set up JDK 21 + uses: actions/setup-java@v1 + with: + java-version: 21 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build -x test + + - name: Run spotless + run: ./gradlew :spotlessApply + + - name: Check for modified files + id: git-check + run: echo "modified=$(if [[ -n $(git status -s) ]]; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT - name: Push changes if: steps.git-check.outputs.modified == 'true' @@ -37,4 +89,5 @@ jobs: git config --global user.email 'bram28@users.noreply.github.com' git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} git add . - git diff --cached --exit-code || git commit -am "Automated Java code formatting changes" && git push \ No newline at end of file + git commit -am "Automated Java code formatting changes" + git push diff --git a/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java b/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java index e32cb55c8..c41d5e1b2 100644 --- a/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java +++ b/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java @@ -1,53 +1,55 @@ -package edu.rpi.legup.model.gameboard; - -import java.util.ArrayList; -import java.util.List; - -public abstract class GridRegion { - - protected List regionCells; - - /** - * Region Constructor - */ - public GridRegion() { - this.regionCells = new ArrayList<>(); - } - - /** - * Adds the cell to the region - * @param cell cell to be added to the region - */ - public void addCell(T cell) { - regionCells.add(cell); - } - - /** - * Removes the cell from the region - * @param cell cell to be remove from the region - */ - public void removeCell(T cell) { - regionCells.remove(cell); - } - - /** - * Returns the list of cells in the region - * @return list of cells in region - */ - public List getCells() { - return regionCells; - } - - /** - * Returns the number of cells in the region - * @return number of cells in the region - */ - public int getSize(){ - return regionCells.size(); - } - - /* - public void colorRegion(){} - */ - -} +package edu.rpi.legup.model.gameboard; + +import java.util.ArrayList; +import java.util.List; + +public abstract class GridRegion { + + protected List regionCells; + + /** Region Constructor */ + public GridRegion() { + this.regionCells = new ArrayList<>(); + } + + /** + * Adds the cell to the region + * + * @param cell cell to be added to the region + */ + public void addCell(T cell) { + regionCells.add(cell); + } + + /** + * Removes the cell from the region + * + * @param cell cell to be remove from the region + */ + public void removeCell(T cell) { + regionCells.remove(cell); + } + + /** + * Returns the list of cells in the region + * + * @return list of cells in region + */ + public List getCells() { + return regionCells; + } + + /** + * Returns the number of cells in the region + * + * @return number of cells in the region + */ + public int getSize() { + return regionCells.size(); + } + + /* + public void colorRegion(){} + */ + +} From 5452703000f5f9bb76df0ac262a51a199b062120 Mon Sep 17 00:00:00 2001 From: Charles Tian <46334090+charlestian23@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:09:52 -0400 Subject: [PATCH 2/4] Finishing Short Truth Table Contradiction Rule tests (#713) * Created Or Contradiction test files * Added false or test * Fixed false or test and added unknown or test * Methods should start with lowercase * Added true or test and removed useless lines * Added Not Contradiction test * Remove useless print statement * Added And Contradiction tests * Removed useless imports * Fixed bug with test * Added conditional test cases * Create ConditionalContradictionRuleTest.java Added Conditional Contradiction Rule tests * Added biconditional test files * Fixed typo * Create BiconditionalContradictionRuleTest.java Added biconditional contradiction rule tests * Added single test file * Added remaining test files * Added JUnit test * Removed unused tests Removed deprecated importer and statement tests --------- Co-authored-by: Chase Grajeda <76405306+Chase-Grajeda@users.noreply.github.com> Co-authored-by: Chase-Grajeda --- .../ShortTruthTableImporterTest.java | 10 -- .../ShortTruthTableStatementTest.java | 15 -- .../rules/AndContradictionRuleTest.java | 132 +++++++++++++++++ .../rules/AtomicContradictionRuleTest.java | 65 +++++++++ .../BiconditionalContradictionRuleTest.java | 132 +++++++++++++++++ .../ConditionalContradictionRuleTest.java | 132 +++++++++++++++++ .../rules/NotContradictionRuleTest.java | 65 +++++++++ .../rules/OrContradictionRuleTest.java | 133 ++++++++++++++++++ .../rules/AndContradictionRule/FFF | 15 ++ .../rules/AndContradictionRule/FFT | 15 ++ .../rules/AndContradictionRule/FFU | 14 ++ .../rules/AndContradictionRule/FTF | 15 ++ .../rules/AndContradictionRule/FTT | 15 ++ .../rules/AndContradictionRule/FTU | 14 ++ .../rules/AndContradictionRule/TFF | 15 ++ .../rules/AndContradictionRule/TFT | 15 ++ .../rules/AndContradictionRule/TFU | 14 ++ .../rules/AndContradictionRule/TTF | 15 ++ .../rules/AndContradictionRule/TTT | 15 ++ .../rules/AndContradictionRule/TTU | 14 ++ .../rules/AndContradictionRule/UFF | 14 ++ .../rules/AndContradictionRule/UFT | 14 ++ .../rules/AndContradictionRule/UFU | 15 ++ .../rules/AndContradictionRule/UTF | 14 ++ .../rules/AndContradictionRule/UTT | 14 ++ .../rules/AndContradictionRule/UTU | 15 ++ .../rules/AtomicContradictionRule/FF | 15 ++ .../rules/AtomicContradictionRule/FT | 15 ++ .../rules/AtomicContradictionRule/FU | 14 ++ .../rules/AtomicContradictionRule/TF | 15 ++ .../rules/AtomicContradictionRule/TT | 15 ++ .../rules/AtomicContradictionRule/TU | 14 ++ .../rules/AtomicContradictionRule/UF | 14 ++ .../rules/AtomicContradictionRule/UT | 14 ++ .../rules/AtomicContradictionRule/UU | 13 ++ .../rules/BiconditionalContradictionRule/FFF | 15 ++ .../rules/BiconditionalContradictionRule/FFT | 15 ++ .../rules/BiconditionalContradictionRule/FFU | 14 ++ .../rules/BiconditionalContradictionRule/FTF | 15 ++ .../rules/BiconditionalContradictionRule/FTT | 15 ++ .../rules/BiconditionalContradictionRule/FTU | 14 ++ .../rules/BiconditionalContradictionRule/TFF | 15 ++ .../rules/BiconditionalContradictionRule/TFT | 15 ++ .../rules/BiconditionalContradictionRule/TFU | 14 ++ .../rules/BiconditionalContradictionRule/TTF | 15 ++ .../rules/BiconditionalContradictionRule/TTT | 15 ++ .../rules/BiconditionalContradictionRule/TTU | 14 ++ .../rules/BiconditionalContradictionRule/UFF | 14 ++ .../rules/BiconditionalContradictionRule/UFT | 14 ++ .../rules/BiconditionalContradictionRule/UFU | 15 ++ .../rules/BiconditionalContradictionRule/UTF | 14 ++ .../rules/BiconditionalContradictionRule/UTT | 14 ++ .../rules/BiconditionalContradictionRule/UTU | 15 ++ .../rules/ConditionalContradictionRule/FFF | 15 ++ .../rules/ConditionalContradictionRule/FFT | 15 ++ .../rules/ConditionalContradictionRule/FFU | 14 ++ .../rules/ConditionalContradictionRule/FTF | 15 ++ .../rules/ConditionalContradictionRule/FTT | 15 ++ .../rules/ConditionalContradictionRule/FTU | 14 ++ .../rules/ConditionalContradictionRule/TFF | 15 ++ .../rules/ConditionalContradictionRule/TFT | 15 ++ .../rules/ConditionalContradictionRule/TFU | 14 ++ .../rules/ConditionalContradictionRule/TTF | 15 ++ .../rules/ConditionalContradictionRule/TTT | 15 ++ .../rules/ConditionalContradictionRule/TTU | 14 ++ .../rules/ConditionalContradictionRule/UFF | 14 ++ .../rules/ConditionalContradictionRule/UFT | 14 ++ .../rules/ConditionalContradictionRule/UFU | 15 ++ .../rules/ConditionalContradictionRule/UTF | 14 ++ .../rules/ConditionalContradictionRule/UTT | 14 ++ .../rules/ConditionalContradictionRule/UTU | 15 ++ .../rules/NotContradictionRule/FF | 14 ++ .../rules/NotContradictionRule/FT | 14 ++ .../rules/NotContradictionRule/FU | 13 ++ .../rules/NotContradictionRule/TF | 14 ++ .../rules/NotContradictionRule/TT | 14 ++ .../rules/NotContradictionRule/TU | 13 ++ .../rules/NotContradictionRule/UF | 13 ++ .../rules/NotContradictionRule/UT | 13 ++ .../rules/NotContradictionRule/UU | 12 ++ .../rules/OrContradictionRule/FFF | 15 ++ .../rules/OrContradictionRule/FFT | 15 ++ .../rules/OrContradictionRule/FFU | 14 ++ .../rules/OrContradictionRule/FTF | 15 ++ .../rules/OrContradictionRule/FTT | 15 ++ .../rules/OrContradictionRule/FTU | 14 ++ .../rules/OrContradictionRule/TFF | 15 ++ .../rules/OrContradictionRule/TFT | 15 ++ .../rules/OrContradictionRule/TFU | 14 ++ .../rules/OrContradictionRule/TTF | 15 ++ .../rules/OrContradictionRule/TTT | 15 ++ .../rules/OrContradictionRule/TTU | 14 ++ .../rules/OrContradictionRule/UFF | 14 ++ .../rules/OrContradictionRule/UFT | 14 ++ .../rules/OrContradictionRule/UFU | 15 ++ .../rules/OrContradictionRule/UTF | 14 ++ .../rules/OrContradictionRule/UTT | 14 ++ .../rules/OrContradictionRule/UTU | 15 ++ 98 files changed, 1956 insertions(+), 25 deletions(-) delete mode 100644 src/test/java/puzzles/shorttruthtable/ShortTruthTableImporterTest.java delete mode 100644 src/test/java/puzzles/shorttruthtable/ShortTruthTableStatementTest.java create mode 100644 src/test/java/puzzles/shorttruthtable/rules/AndContradictionRuleTest.java create mode 100644 src/test/java/puzzles/shorttruthtable/rules/AtomicContradictionRuleTest.java create mode 100644 src/test/java/puzzles/shorttruthtable/rules/BiconditionalContradictionRuleTest.java create mode 100644 src/test/java/puzzles/shorttruthtable/rules/ConditionalContradictionRuleTest.java create mode 100644 src/test/java/puzzles/shorttruthtable/rules/NotContradictionRuleTest.java create mode 100644 src/test/java/puzzles/shorttruthtable/rules/OrContradictionRuleTest.java create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFU create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTF create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTT create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTU diff --git a/src/test/java/puzzles/shorttruthtable/ShortTruthTableImporterTest.java b/src/test/java/puzzles/shorttruthtable/ShortTruthTableImporterTest.java deleted file mode 100644 index 3054a99d9..000000000 --- a/src/test/java/puzzles/shorttruthtable/ShortTruthTableImporterTest.java +++ /dev/null @@ -1,10 +0,0 @@ -// package puzzles.shorttruthtable; - -// class ShortTruthTableImporterTest{ - -// @Test -// public void testImport(){ - -// } - -// } diff --git a/src/test/java/puzzles/shorttruthtable/ShortTruthTableStatementTest.java b/src/test/java/puzzles/shorttruthtable/ShortTruthTableStatementTest.java deleted file mode 100644 index 91a45933a..000000000 --- a/src/test/java/puzzles/shorttruthtable/ShortTruthTableStatementTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package puzzles.shorttruthtable; - -// import org.junit.Test; -// import static org.junit.Assert.assertEquals; - -// class ShortTruthTableStatementTest{ - -// @Test -// public void testCreateStatement(){ -// ShortTruthTableStatement statement = new ShortTruthTableStatement("a^b"); - -// assertEquals(statement.getLength(), 3); -// } - -// } diff --git a/src/test/java/puzzles/shorttruthtable/rules/AndContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/AndContradictionRuleTest.java new file mode 100644 index 000000000..7cb0ed012 --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/AndContradictionRuleTest.java @@ -0,0 +1,132 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleAnd; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AndContradictionRuleTest { + + private static final ContradictionRuleAnd RULE = new ContradictionRuleAnd(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given a statement: A ^ B where ^ is true + * + * Asserts that this is a valid application of the rule if + * and only if A or B are set to false. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void trueAndTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/AndContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + trueAndTestHelper(path + first + "T" + second); + } + } + } + + private void trueAndTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.FALSE || b.getType() == ShortTruthTableCellType.FALSE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } + else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A ^ B where ^ is false + * + * Asserts that this is a valid application of the rule if + * and only if A or B (or both) are set to true. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void falseAndTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/AndContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + falseAndTestHelper(path + first + "F" + second); + } + } + } + + private void falseAndTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.TRUE && b.getType() == ShortTruthTableCellType.TRUE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } + else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A ^ B where ^ is unknown + * + * Asserts that this is not a valid application of this rule. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void unknownAndTest() throws InvalidFileFormatException { + // Getting the files that have or set to unknown from And Introduction + String path = "puzzles/shorttruthtable/rules/AndIntroductionDirectRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + unknownAndTestHelper(path + first + "U" + second); + } + } + } + + private void unknownAndTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/AtomicContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/AtomicContradictionRuleTest.java new file mode 100644 index 000000000..c6325df5d --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/AtomicContradictionRuleTest.java @@ -0,0 +1,65 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleAtomic; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AtomicContradictionRuleTest { + + private static final ContradictionRuleAtomic RULE = new ContradictionRuleAtomic(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given two statements: A, A + * + * Asserts that this is a valid application of the rule if + * and only if both A and B are not unknown and different. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void mismatchTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/AtomicContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + mismatchHelper(path + first + second); + } + } + } + + private void mismatchHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(0, 2); + + if (a.getType() != ShortTruthTableCellType.UNKNOWN && b.getType() != ShortTruthTableCellType.UNKNOWN && a.getType() != b.getType()) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } + else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/BiconditionalContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalContradictionRuleTest.java new file mode 100644 index 000000000..750eb544d --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalContradictionRuleTest.java @@ -0,0 +1,132 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleBiconditional; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class BiconditionalContradictionRuleTest { + + private static final ContradictionRuleBiconditional RULE = new ContradictionRuleBiconditional(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given a statement: A <-> B where <-> is true + * + * Asserts that this is a valid application of the rule if + * and only if A and B are not unknown and A does not equal B + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void trueBiconditionalTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/BiconditionalContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + trueBiconditionalTestHelper(path + first + "T" + second); + } + } + } + + private void trueBiconditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() != ShortTruthTableCellType.UNKNOWN && b.getType() != ShortTruthTableCellType.UNKNOWN && a.getType() != b.getType()) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } + else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A <-> B where <-> is false + * + * Asserts that this is a valid application of the rule if + * and only if A and B are not unknown and A equals B + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void falseConditionalTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/BiconditionalContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + falseBiconditionalTestHelper(path + first + "F" + second); + } + } + } + + private void falseBiconditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() != ShortTruthTableCellType.UNKNOWN && b.getType() != ShortTruthTableCellType.UNKNOWN && a.getType() == b.getType()) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } + else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A <-> B where <-> is unknown + * + * Asserts that this is not a valid application of this rule. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void unknownBiconditionalTest() throws InvalidFileFormatException { + // Getting the files that have or set to unknown from Biconditional Introduction + String path = "puzzles/shorttruthtable/rules/BiconditionalIntroductionDirectRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + unknownBiconditionalTestHelper(path + first + "U" + second); + } + } + } + + private void unknownBiconditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/ConditionalContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/ConditionalContradictionRuleTest.java new file mode 100644 index 000000000..a13217cb2 --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/ConditionalContradictionRuleTest.java @@ -0,0 +1,132 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleConditional; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ConditionalContradictionRuleTest { + + private static final ContradictionRuleConditional RULE = new ContradictionRuleConditional(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given a statement: A -> B where -> is true + * + * Asserts that this is a valid application of the rule if + * and only if both A is true and B is false + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void trueConditionalTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/ConditionalContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + trueConditionalTestHelper(path + first + "T" + second); + } + } + } + + private void trueConditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.TRUE && b.getType() == ShortTruthTableCellType.FALSE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } + else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A -> B where -> is false + * + * Asserts that this is a valid application of the rule if + * and only if A is false or B is true + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void falseConditionalTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/ConditionalContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + falseConditionalTestHelper(path + first + "F" + second); + } + } + } + + private void falseConditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.FALSE || b.getType() == ShortTruthTableCellType.TRUE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } + else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A -> B where -> is unknown + * + * Asserts that this is not a valid application of this rule. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void unknownConditionalTest() throws InvalidFileFormatException { + // Getting the files that have or set to unknown from Conditional Introduction + String path = "puzzles/shorttruthtable/rules/ConditionalIntroductionDirectRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + unknownConditionalTestHelper(path + first + "U" + second); + } + } + } + + private void unknownConditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/NotContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/NotContradictionRuleTest.java new file mode 100644 index 000000000..7c2b144e9 --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/NotContradictionRuleTest.java @@ -0,0 +1,65 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleNot; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class NotContradictionRuleTest { + + private static final ContradictionRuleNot RULE = new ContradictionRuleNot(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given a statement: ¬A + * + * Asserts that this is a valid application of the rule if + * and only if A and B are both true or are both false. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void notContradictionTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/NotContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + notContradictionTestHelper(path + first + second); + } + } + } + + private void notContradictionTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell not = board.getCell(0, 0); + ShortTruthTableCell a = board.getCell(1, 0); + + if ((not.getType() == ShortTruthTableCellType.TRUE && a.getType() == ShortTruthTableCellType.TRUE) || (not.getType() == ShortTruthTableCellType.FALSE && a.getType() == ShortTruthTableCellType.FALSE)) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } + else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/OrContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/OrContradictionRuleTest.java new file mode 100644 index 000000000..b2aaf583d --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/OrContradictionRuleTest.java @@ -0,0 +1,133 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleOr; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class OrContradictionRuleTest { + + private static final ContradictionRuleOr RULE = new ContradictionRuleOr(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given a statement: A V B where V is true + * + * Asserts that this is a valid application of the rule if + * and only if both A and B are set to false. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void trueOrTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/OrContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + trueOrTestHelper(path + first + "T" + second); + } + } + } + + private void trueOrTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.FALSE && b.getType() == ShortTruthTableCellType.FALSE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } + else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A V B where V is false + * + * Asserts that this is a valid application of the rule if + * and only if A or B is set to true or both A and B are set + * to true. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void falseOrTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/OrContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + falseOrTestHelper(path + first + "F" + second); + } + } + } + + private void falseOrTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.TRUE || b.getType() == ShortTruthTableCellType.TRUE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } + else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A V B where V is unknown + * + * Asserts that this is not a valid application of this rule. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void unknownOrTest() throws InvalidFileFormatException { + // Getting the files that have or set to unknown from Or Introduction + String path = "puzzles/shorttruthtable/rules/OrIntroductionDirectRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + unknownOrTestHelper(path + first + "U" + second); + } + } + } + + private void unknownOrTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } +} diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFF new file mode 100644 index 000000000..5285dbb86 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFT new file mode 100644 index 000000000..18d6030d9 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFU new file mode 100644 index 000000000..39b9e9811 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTF new file mode 100644 index 000000000..9df198c5f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTT new file mode 100644 index 000000000..0c2feabe7 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTU new file mode 100644 index 000000000..d024cb841 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFF new file mode 100644 index 000000000..8234ebd2a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFT new file mode 100644 index 000000000..4a6b0f1d7 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFU new file mode 100644 index 000000000..b2bb6e1a5 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTF new file mode 100644 index 000000000..9e53ac8e3 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTT new file mode 100644 index 000000000..837730943 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTU new file mode 100644 index 000000000..893f7d3ec --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFF new file mode 100644 index 000000000..6d4f44071 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFT new file mode 100644 index 000000000..7fcda3fba --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFU new file mode 100644 index 000000000..5285dbb86 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTF new file mode 100644 index 000000000..d11a314b8 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTT new file mode 100644 index 000000000..1772e1986 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTU new file mode 100644 index 000000000..9df198c5f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FF b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FF new file mode 100644 index 000000000..47ede6499 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FT b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FT new file mode 100644 index 000000000..56192a97b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FU b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FU new file mode 100644 index 000000000..9e25868fc --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TF b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TF new file mode 100644 index 000000000..326988fbb --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TT b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TT new file mode 100644 index 000000000..0b8b9b690 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TU b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TU new file mode 100644 index 000000000..4ee98e3d4 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UF b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UF new file mode 100644 index 000000000..03432df5f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UT b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UT new file mode 100644 index 000000000..a69e019a2 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UU b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UU new file mode 100644 index 000000000..7d1f0bae6 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UU @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFF new file mode 100644 index 000000000..b1c975982 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFT new file mode 100644 index 000000000..9aaa26431 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFU new file mode 100644 index 000000000..150134e46 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTF new file mode 100644 index 000000000..e1cecaeb7 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTT new file mode 100644 index 000000000..370cefc0a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTU new file mode 100644 index 000000000..4ac904290 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFF new file mode 100644 index 000000000..48e1fa36b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFT new file mode 100644 index 000000000..a260489cc --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFU new file mode 100644 index 000000000..08a999c1a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTF new file mode 100644 index 000000000..c6764d0fb --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTT new file mode 100644 index 000000000..7ce20257b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTU new file mode 100644 index 000000000..b440c157a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFF new file mode 100644 index 000000000..865d9b59b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFT new file mode 100644 index 000000000..31f372a95 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFU new file mode 100644 index 000000000..b1c975982 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTF new file mode 100644 index 000000000..e1e7eeafc --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTT new file mode 100644 index 000000000..15ed9b08f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTU new file mode 100644 index 000000000..e1cecaeb7 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFF new file mode 100644 index 000000000..479b8172d --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFT new file mode 100644 index 000000000..4c328f840 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFU new file mode 100644 index 000000000..2a5220f46 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTF new file mode 100644 index 000000000..d28a4b9f9 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTT new file mode 100644 index 000000000..aa0c242b3 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTU new file mode 100644 index 000000000..b9867188f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFF new file mode 100644 index 000000000..ad3329472 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFT new file mode 100644 index 000000000..92eaf7cb3 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFU new file mode 100644 index 000000000..0ea50831a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTF new file mode 100644 index 000000000..d0e4ec7bb --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTT new file mode 100644 index 000000000..e2f1a7102 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTU new file mode 100644 index 000000000..0a38381b1 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFF new file mode 100644 index 000000000..78ff4e0f0 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFT new file mode 100644 index 000000000..9ac9c39fa --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFU new file mode 100644 index 000000000..479b8172d --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTF new file mode 100644 index 000000000..cc05da528 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTT new file mode 100644 index 000000000..0559dcf83 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTU new file mode 100644 index 000000000..d28a4b9f9 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FF b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FF new file mode 100644 index 000000000..56b5cd97e --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FT b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FT new file mode 100644 index 000000000..5091d620c --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FU b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FU new file mode 100644 index 000000000..ae65d166d --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FU @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TF b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TF new file mode 100644 index 000000000..cf510f0c3 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TT b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TT new file mode 100644 index 000000000..7bcb69b15 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TU b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TU new file mode 100644 index 000000000..a33ef3016 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TU @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UF b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UF new file mode 100644 index 000000000..96bc1fb52 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UF @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UT b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UT new file mode 100644 index 000000000..b87293cdc --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UT @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UU b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UU new file mode 100644 index 000000000..78bd1d67e --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UU @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFF new file mode 100644 index 000000000..32c62f59e --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFT new file mode 100644 index 000000000..96e3122bf --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFU new file mode 100644 index 000000000..b9bb63a6b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTF new file mode 100644 index 000000000..062c5d3e4 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTT new file mode 100644 index 000000000..4fbb5922a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTU new file mode 100644 index 000000000..1767546df --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFF new file mode 100644 index 000000000..3e50d3b54 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFT new file mode 100644 index 000000000..69cbef4db --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFU new file mode 100644 index 000000000..018064192 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTF new file mode 100644 index 000000000..8247a1cfa --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTT new file mode 100644 index 000000000..4446c1e34 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTU new file mode 100644 index 000000000..c662ec79b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFF new file mode 100644 index 000000000..dae9e4311 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFT new file mode 100644 index 000000000..1c68eb53b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFU new file mode 100644 index 000000000..32c62f59e --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTF new file mode 100644 index 000000000..67169da0c --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTT new file mode 100644 index 000000000..c761569c5 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTU new file mode 100644 index 000000000..062c5d3e4 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + From 3541a9b59b13209ce1b5740255fef697a8aa3145 Mon Sep 17 00:00:00 2001 From: Charles Tian <46334090+charlestian23@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:21:02 -0400 Subject: [PATCH 3/4] Short Truth Table remaining case rules (#737) * Created conditional case rule test files * More test files * Created Conditional Case Rule tests * Added test files * Started creating tests Added true biconditional tests, false biconditional tests are not written yet * Finished False tests and changed variable names * Update BiconditionalCaseRuleTest.java Modified comments * Update OrCaseRuleTest.java Fixed inaccurate comments --------- Co-authored-by: Chase Grajeda <76405306+Chase-Grajeda@users.noreply.github.com> --- .../rules/BiconditionalCaseRuleTest.java | 186 ++++++++++++++++++ .../rules/ConditionalCaseRuleTest.java | 163 +++++++++++++++ .../shorttruthtable/rules/OrCaseRuleTest.java | 4 +- .../ComplexStatement1_False | 13 ++ .../ComplexStatement1_True | 13 ++ .../BiconditionalCaseRule/FalseBiconditional | 13 ++ .../BiconditionalCaseRule/TrueBiconditional | 13 ++ .../BiconditionalCaseRule/UnknownConditional | 12 ++ .../ComplexStatement1_False | 13 ++ .../ComplexStatement1_True | 13 ++ .../ConditionalCaseRule/FalseConditional | 13 ++ .../rules/ConditionalCaseRule/TrueConditional | 13 ++ .../ConditionalCaseRule/UnknownConditional | 12 ++ 13 files changed, 479 insertions(+), 2 deletions(-) create mode 100644 src/test/java/puzzles/shorttruthtable/rules/BiconditionalCaseRuleTest.java create mode 100644 src/test/java/puzzles/shorttruthtable/rules/ConditionalCaseRuleTest.java create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_False create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_True create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/FalseBiconditional create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/TrueBiconditional create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/UnknownConditional create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_False create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_True create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/FalseConditional create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/TrueConditional create mode 100644 src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/UnknownConditional diff --git a/src/test/java/puzzles/shorttruthtable/rules/BiconditionalCaseRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalCaseRuleTest.java new file mode 100644 index 000000000..2a4f8403d --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalCaseRuleTest.java @@ -0,0 +1,186 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.gameboard.Board; +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.caserule.CaseRuleBiconditional; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.ArrayList; + +public class BiconditionalCaseRuleTest { + + private static final CaseRuleBiconditional RULE = new CaseRuleBiconditional(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + private void trueBiconditionalTest(String fileName, + int biconditionalX, int biconditionalY, + int aX, int aY, + int bX, int bY) throws InvalidFileFormatException { + TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/BiconditionalCaseRule/" + fileName, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell cell = board.getCell(biconditionalX, biconditionalY); + ArrayList cases = RULE.getCases(board, cell); + + // Make sure that the rule checks out + Assert.assertNull(RULE.checkRule(transition)); + + // Make sure there are two branches + Assert.assertEquals(2, cases.size()); + + ShortTruthTableBoard caseBoard1 = (ShortTruthTableBoard) cases.get(0); + ShortTruthTableCellType board1A = caseBoard1.getCell(aX, aY).getType(); + ShortTruthTableCellType board1B = caseBoard1.getCell(bX, bY).getType(); + + ShortTruthTableBoard caseBoard2 = (ShortTruthTableBoard) cases.get(1); + ShortTruthTableCellType board2A = caseBoard2.getCell(aX, aY).getType(); + ShortTruthTableCellType board2B = caseBoard2.getCell(bX, bY).getType(); + + // Assert that the corresponding cells for the different case rules do not + // match with each other + Assert.assertNotEquals(board1A, board2A); + Assert.assertNotEquals(board1B, board2B); + + // Assert that A and B are equal and either true or false in both branches + Assert.assertEquals(board1A, board1B); + Assert.assertTrue( + (board1A.equals(ShortTruthTableCellType.TRUE) && board1B.equals(ShortTruthTableCellType.TRUE)) || (board1A.equals(ShortTruthTableCellType.FALSE) && board1B.equals(ShortTruthTableCellType.FALSE)) + ); + + Assert.assertNotEquals(board1B, board2B); + Assert.assertTrue( + (board2A.equals(ShortTruthTableCellType.TRUE) && board2B.equals(ShortTruthTableCellType.TRUE)) || (board2A.equals(ShortTruthTableCellType.FALSE) && board2B.equals(ShortTruthTableCellType.FALSE)) + ); + + // Verify the board dimensions are unchanged + Assert.assertEquals(caseBoard1.getHeight(), caseBoard2.getHeight(), board.getHeight()); + Assert.assertEquals(caseBoard1.getWidth(), caseBoard2.getWidth(), board.getWidth()); + + // Verify that everywhere else on the board is unchanged + for (int i = 0; i< caseBoard1.getWidth(); i++) { + for (int j = 0; j < caseBoard1.getHeight(); j++) { + // Make sure not to check the two cells that should be different + if (!((i == aX && j == aY) || (i == bX && j == bY))) { + Assert.assertEquals(caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); + } + } + } + } + + /** + * Given a statement A -> B where ^ is true, tests this case rule by ensuring that + * two branches are created: one where A is false and one where B is true. + */ + @Test + public void SimpleStatement1TrueTest() throws InvalidFileFormatException { + trueBiconditionalTest("TrueBiconditional", 1, 0, 0, 0, 2, 0); + } + + /** + * Given a statement ~(A|B) -> (C^D) where the -> is true, tests this case rule + * by ensuring that two branches are created: one where ~ is false and one where + * ^ is true. + */ + @Test + public void ComplexStatement1TrueTest() throws InvalidFileFormatException { + trueBiconditionalTest("ComplexStatement1_True", 6, 0, 0, 0, + 9, 0); + } + + private void falseBiconditionalTest(String fileName, + int biconditionalX, int biconditionalY, + int aX, int aY, + int bX, int bY) throws InvalidFileFormatException { + TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/BiconditionalCaseRule/" + fileName, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell cell = board.getCell(biconditionalX, biconditionalY); + ArrayList cases = RULE.getCases(board, cell); + + // Make sure that the rule checks out + Assert.assertNull(RULE.checkRule(transition)); + + // Make sure there are two branches + Assert.assertEquals(2, cases.size()); + + ShortTruthTableBoard caseBoard1 = (ShortTruthTableBoard) cases.get(0); + ShortTruthTableCellType board1A = caseBoard1.getCell(aX, aY).getType(); + ShortTruthTableCellType board1B = caseBoard1.getCell(bX, bY).getType(); + + ShortTruthTableBoard caseBoard2 = (ShortTruthTableBoard) cases.get(1); + ShortTruthTableCellType board2A = caseBoard2.getCell(aX, aY).getType(); + ShortTruthTableCellType board2B = caseBoard2.getCell(bX, bY).getType(); + + // Assert that the corresponding cells for the different case rules do not + // match with each other + Assert.assertNotEquals(board1A, board2A); + Assert.assertNotEquals(board1B, board2B); + + // Assert that A and B are not equal and are both either true or false in both branches + Assert.assertNotEquals(board1A, board1B); + Assert.assertTrue( + (board1A.equals(ShortTruthTableCellType.TRUE) && board1B.equals(ShortTruthTableCellType.FALSE)) || (board1A.equals(ShortTruthTableCellType.FALSE) && board1B.equals(ShortTruthTableCellType.TRUE)) + ); + + Assert.assertNotEquals(board2A, board2B); + Assert.assertTrue( + (board2A.equals(ShortTruthTableCellType.TRUE) && board2B.equals(ShortTruthTableCellType.FALSE)) || (board2A.equals(ShortTruthTableCellType.FALSE) && board2B.equals(ShortTruthTableCellType.TRUE)) + ); + + // Verify the board dimensions are unchanged + Assert.assertEquals(caseBoard1.getHeight(), caseBoard2.getHeight(), board.getHeight()); + Assert.assertEquals(caseBoard1.getWidth(), caseBoard2.getWidth(), board.getWidth()); + + // Verify that everywhere else on the board is unchanged + for (int i = 0; i< caseBoard1.getWidth(); i++) { + for (int j = 0; j < caseBoard1.getHeight(); j++) { + // Make sure not to check the two cells that should be different + if (!((i == aX && j == aY) || (i == bX && j == bY))) { + Assert.assertEquals(caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); + } + } + } + } + + /** + * Given a statement A -> B where -> is false, tests this case rule by ensuring that + * one branch is created where A is true and B is false. + */ + @Test + public void SimpleStatement1FalseTest() throws InvalidFileFormatException { + falseBiconditionalTest("FalseBiconditional", 1, 0, 0, 0, + 2, 0); + } + + /** + * Given a statement ~(A|B) -> (C^D) where -> is true, tests this case rule + * by ensuring that one branch is created where ~ is true and ^ is false. + */ + @Test + public void ComplexStatement1FalseTest() throws InvalidFileFormatException { + falseBiconditionalTest("ComplexStatement1_False", 6, 0, 0, 0, + 9, 0); + } +} \ No newline at end of file diff --git a/src/test/java/puzzles/shorttruthtable/rules/ConditionalCaseRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/ConditionalCaseRuleTest.java new file mode 100644 index 000000000..5ea600314 --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/ConditionalCaseRuleTest.java @@ -0,0 +1,163 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.gameboard.Board; +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.caserule.CaseRuleConditional; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.ArrayList; + +public class ConditionalCaseRuleTest { + + private static final CaseRuleConditional RULE = new CaseRuleConditional(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + private void trueConditionalTest(String fileName, + int conditionalX, int conditionalY, + int aX, int aY, + int bX, int bY) throws InvalidFileFormatException { + TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/ConditionalCaseRule/" + fileName, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell cell = board.getCell(conditionalX, conditionalY); + ArrayList cases = RULE.getCases(board, cell); + + // Make sure that the rule checks out + Assert.assertNull(RULE.checkRule(transition)); + + // Make sure there are two branches + Assert.assertEquals(2, cases.size()); + + ShortTruthTableBoard caseBoard1 = (ShortTruthTableBoard) cases.get(0); + ShortTruthTableCellType board1A = caseBoard1.getCell(aX, aY).getType(); + ShortTruthTableCellType board1B = caseBoard1.getCell(bX, bY).getType(); + + ShortTruthTableBoard caseBoard2 = (ShortTruthTableBoard) cases.get(1); + ShortTruthTableCellType board2A = caseBoard2.getCell(aX, aY).getType(); + ShortTruthTableCellType board2B = caseBoard2.getCell(bX, bY).getType(); + + // Assert that the corresponding cells for the different case rules do not + // match with each other + Assert.assertNotEquals(board1A, board2A); + Assert.assertNotEquals(board1B, board2B); + + // Assert that A is unknown in one board and false in the other + Assert.assertNotEquals(board1A, board2A); + Assert.assertTrue( + (board1A.equals(ShortTruthTableCellType.UNKNOWN) && board2A.equals(ShortTruthTableCellType.FALSE)) + || (board1A.equals(ShortTruthTableCellType.FALSE) && board2A.equals(ShortTruthTableCellType.UNKNOWN)) + ); + + // Assert that B is unknown in one board and true in the other + Assert.assertNotEquals(board1B, board2B); + Assert.assertTrue( + (board1B.equals(ShortTruthTableCellType.UNKNOWN) && board2B.equals(ShortTruthTableCellType.TRUE)) + || (board1B.equals(ShortTruthTableCellType.TRUE) && board2B.equals(ShortTruthTableCellType.UNKNOWN)) + ); + + // Verify the board dimensions are unchanged + Assert.assertEquals(caseBoard1.getHeight(), caseBoard2.getHeight(), board.getHeight()); + Assert.assertEquals(caseBoard1.getWidth(), caseBoard2.getWidth(), board.getWidth()); + + // Verify that everywhere else on the board is unchanged + for (int i = 0; i< caseBoard1.getWidth(); i++) { + for (int j = 0; j < caseBoard1.getHeight(); j++) { + // Make sure not to check the two cells that should be different + if (!((i == aX && j == aY) || (i == bX && j == bY))) { + Assert.assertEquals(caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); + } + } + } + } + + /** + * Given a statement A -> B where ^ is true, tests this case rule by ensuring that + * two branches are created: one where A is false and one where B is true. + */ + @Test + public void SimpleStatement1TrueTest() throws InvalidFileFormatException { + trueConditionalTest("TrueConditional", 1, 0, 0, 0, + 2, 0); + } + + /** + * Given a statement ~(A|B) -> (C^D) where the -> is true, tests this case rule + * by ensuring that two branches are created: one where ~ is false and one where + * ^ is true. + */ + @Test + public void ComplexStatement1TrueTest() throws InvalidFileFormatException { + trueConditionalTest("ComplexStatement1_True", 6, 0, 0, 0, + 9, 0); + } + + private void falseConditionalTest(String fileName, + int conditionalX, int conditionalY, + int aX, int aY, + int bX, int bY) throws InvalidFileFormatException { + TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/ConditionalCaseRule/" + fileName, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell cell = board.getCell(conditionalX, conditionalY); + ArrayList cases = RULE.getCases(board, cell); + + // Make sure that the rule checks out + Assert.assertNull(RULE.checkRule(transition)); + + // There should only be 1 branch + Assert.assertEquals(1, cases.size()); + + ShortTruthTableBoard caseBoard = (ShortTruthTableBoard) cases.get(0); + ShortTruthTableCellType caseBoardAType = caseBoard.getCell(aX, aY).getType(); + ShortTruthTableCellType caseBoardBType = caseBoard.getCell(bX, bY).getType(); + + // A should be true and B should be false + Assert.assertEquals(caseBoardAType, ShortTruthTableCellType.TRUE); + Assert.assertEquals(caseBoardBType, ShortTruthTableCellType.FALSE); + + // Verify the board dimensions are unchanged + Assert.assertEquals(caseBoard.getHeight(), caseBoard.getHeight(), board.getHeight()); + } + + /** + * Given a statement A -> B where -> is false, tests this case rule by ensuring that + * one branch is created where A is true and B is false. + */ + @Test + public void SimpleStatement1FalseTest() throws InvalidFileFormatException { + falseConditionalTest("FalseConditional", 1, 0, 0, 0, + 2, 0); + } + + /** + * Given a statement ~(A|B) -> (C^D) where -> is true, tests this case rule + * by ensuring that one branch is created where ~ is true and ^ is false. + */ + @Test + public void ComplexStatement1FalseTest() throws InvalidFileFormatException { + falseConditionalTest("ComplexStatement1_False", 6, 0, 0, 0, + 9, 0); + } +} \ No newline at end of file diff --git a/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java index 0bfa6fc6e..4c0fbe8c0 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java @@ -58,7 +58,7 @@ private void trueOrTest(String fileName, int andX, int andY, int aX, int aY, int Assert.assertNotEquals(board1B, board2B); // First assert the two cells are not equal, then verify that they are either - // unknown or false. + // unknown or true. Assert.assertNotEquals(board1A, board1B); Assert.assertTrue( board1A.equals(ShortTruthTableCellType.UNKNOWN) @@ -130,7 +130,7 @@ private void falseOrTest(String fileName, int andX, int andY, int aX, int aY, in ShortTruthTableCellType caseBoardAType = caseBoard.getCell(aX, aY).getType(); ShortTruthTableCellType caseBoardBType = caseBoard.getCell(bX, bY).getType(); - // Both cells should be true + // Both cells should be false Assert.assertEquals(caseBoardAType, ShortTruthTableCellType.FALSE); Assert.assertEquals(caseBoardBType, ShortTruthTableCellType.FALSE); Assert.assertEquals(caseBoardAType, caseBoardBType); diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_False b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_False new file mode 100644 index 000000000..8f31d9771 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_False @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_True b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_True new file mode 100644 index 000000000..f0bb0d508 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_True @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/FalseBiconditional b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/FalseBiconditional new file mode 100644 index 000000000..5ea1c8a63 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/FalseBiconditional @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/TrueBiconditional b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/TrueBiconditional new file mode 100644 index 000000000..cbf64468f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/TrueBiconditional @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/UnknownConditional b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/UnknownConditional new file mode 100644 index 000000000..82cdeb3ea --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/UnknownConditional @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_False b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_False new file mode 100644 index 000000000..f8be5f275 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_False @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_True b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_True new file mode 100644 index 000000000..d919b7214 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_True @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/FalseConditional b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/FalseConditional new file mode 100644 index 000000000..2da458f51 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/FalseConditional @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/TrueConditional b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/TrueConditional new file mode 100644 index 000000000..829861f75 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/TrueConditional @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/UnknownConditional b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/UnknownConditional new file mode 100644 index 000000000..deb93776d --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/UnknownConditional @@ -0,0 +1,12 @@ + + + + + + + + + + + + From 80280db71075d1426d8b65bc2ec7c4c8e3c6e8d4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:27:51 -0400 Subject: [PATCH 4/4] Automated Java code formatting changes (#783) * Automated Java code formatting changes * Automated Java code formatting changes --------- Co-authored-by: Bram van Heuveln Co-authored-by: Charles Tian <46334090+charlestian23@users.noreply.github.com> --- .../rules/AndContradictionRuleTest.java | 22 ++--- .../rules/AtomicContradictionRuleTest.java | 11 +-- .../rules/BiconditionalCaseRuleTest.java | 85 ++++++++++--------- .../BiconditionalContradictionRuleTest.java | 24 +++--- .../rules/ConditionalCaseRuleTest.java | 73 ++++++++-------- .../ConditionalContradictionRuleTest.java | 22 ++--- .../rules/NotContradictionRuleTest.java | 14 +-- .../rules/OrContradictionRuleTest.java | 23 +++-- 8 files changed, 140 insertions(+), 134 deletions(-) diff --git a/src/test/java/puzzles/shorttruthtable/rules/AndContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/AndContradictionRuleTest.java index 7cb0ed012..618c03926 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/AndContradictionRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/AndContradictionRuleTest.java @@ -28,8 +28,8 @@ public static void setUp() { /** * Given a statement: A ^ B where ^ is true * - * Asserts that this is a valid application of the rule if - * and only if A or B are set to false. + *

Asserts that this is a valid application of the rule if and only if A or B are set to + * false. * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException @@ -55,10 +55,10 @@ private void trueAndTestHelper(String filePath) throws InvalidFileFormatExceptio ShortTruthTableCell a = board.getCell(0, 0); ShortTruthTableCell b = board.getCell(2, 0); - if (a.getType() == ShortTruthTableCellType.FALSE || b.getType() == ShortTruthTableCellType.FALSE) { + if (a.getType() == ShortTruthTableCellType.FALSE + || b.getType() == ShortTruthTableCellType.FALSE) { Assert.assertNull(RULE.checkContradiction(transition.getBoard())); - } - else { + } else { Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); } } @@ -66,8 +66,8 @@ private void trueAndTestHelper(String filePath) throws InvalidFileFormatExceptio /** * Given a statement: A ^ B where ^ is false * - * Asserts that this is a valid application of the rule if - * and only if A or B (or both) are set to true. + *

Asserts that this is a valid application of the rule if and only if A or B (or both) are + * set to true. * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException @@ -93,10 +93,10 @@ private void falseAndTestHelper(String filePath) throws InvalidFileFormatExcepti ShortTruthTableCell a = board.getCell(0, 0); ShortTruthTableCell b = board.getCell(2, 0); - if (a.getType() == ShortTruthTableCellType.TRUE && b.getType() == ShortTruthTableCellType.TRUE) { + if (a.getType() == ShortTruthTableCellType.TRUE + && b.getType() == ShortTruthTableCellType.TRUE) { Assert.assertNull(RULE.checkContradiction(transition.getBoard())); - } - else { + } else { Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); } } @@ -104,7 +104,7 @@ private void falseAndTestHelper(String filePath) throws InvalidFileFormatExcepti /** * Given a statement: A ^ B where ^ is unknown * - * Asserts that this is not a valid application of this rule. + *

Asserts that this is not a valid application of this rule. * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException diff --git a/src/test/java/puzzles/shorttruthtable/rules/AtomicContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/AtomicContradictionRuleTest.java index c6325df5d..a87035f42 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/AtomicContradictionRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/AtomicContradictionRuleTest.java @@ -28,8 +28,8 @@ public static void setUp() { /** * Given two statements: A, A * - * Asserts that this is a valid application of the rule if - * and only if both A and B are not unknown and different. + *

Asserts that this is a valid application of the rule if and only if both A and B are not + * unknown and different. * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException @@ -55,10 +55,11 @@ private void mismatchHelper(String filePath) throws InvalidFileFormatException { ShortTruthTableCell a = board.getCell(0, 0); ShortTruthTableCell b = board.getCell(0, 2); - if (a.getType() != ShortTruthTableCellType.UNKNOWN && b.getType() != ShortTruthTableCellType.UNKNOWN && a.getType() != b.getType()) { + if (a.getType() != ShortTruthTableCellType.UNKNOWN + && b.getType() != ShortTruthTableCellType.UNKNOWN + && a.getType() != b.getType()) { Assert.assertNull(RULE.checkContradiction(transition.getBoard())); - } - else { + } else { Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); } } diff --git a/src/test/java/puzzles/shorttruthtable/rules/BiconditionalCaseRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalCaseRuleTest.java index 2a4f8403d..527cba652 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/BiconditionalCaseRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalCaseRuleTest.java @@ -9,14 +9,13 @@ import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; import edu.rpi.legup.puzzle.shorttruthtable.rules.caserule.CaseRuleBiconditional; import edu.rpi.legup.save.InvalidFileFormatException; +import java.util.ArrayList; import legup.MockGameBoardFacade; import legup.TestUtilities; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import java.util.ArrayList; - public class BiconditionalCaseRuleTest { private static final CaseRuleBiconditional RULE = new CaseRuleBiconditional(); @@ -28,11 +27,11 @@ public static void setUp() { stt = new ShortTruthTable(); } - private void trueBiconditionalTest(String fileName, - int biconditionalX, int biconditionalY, - int aX, int aY, - int bX, int bY) throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/BiconditionalCaseRule/" + fileName, stt); + private void trueBiconditionalTest( + String fileName, int biconditionalX, int biconditionalY, int aX, int aY, int bX, int bY) + throws InvalidFileFormatException { + TestUtilities.importTestBoard( + "puzzles/shorttruthtable/rules/BiconditionalCaseRule/" + fileName, stt); TreeNode rootNode = stt.getTree().getRootNode(); TreeTransition transition = rootNode.getChildren().get(0); transition.setRule(RULE); @@ -63,32 +62,37 @@ private void trueBiconditionalTest(String fileName, // Assert that A and B are equal and either true or false in both branches Assert.assertEquals(board1A, board1B); Assert.assertTrue( - (board1A.equals(ShortTruthTableCellType.TRUE) && board1B.equals(ShortTruthTableCellType.TRUE)) || (board1A.equals(ShortTruthTableCellType.FALSE) && board1B.equals(ShortTruthTableCellType.FALSE)) - ); + (board1A.equals(ShortTruthTableCellType.TRUE) + && board1B.equals(ShortTruthTableCellType.TRUE)) + || (board1A.equals(ShortTruthTableCellType.FALSE) + && board1B.equals(ShortTruthTableCellType.FALSE))); Assert.assertNotEquals(board1B, board2B); Assert.assertTrue( - (board2A.equals(ShortTruthTableCellType.TRUE) && board2B.equals(ShortTruthTableCellType.TRUE)) || (board2A.equals(ShortTruthTableCellType.FALSE) && board2B.equals(ShortTruthTableCellType.FALSE)) - ); + (board2A.equals(ShortTruthTableCellType.TRUE) + && board2B.equals(ShortTruthTableCellType.TRUE)) + || (board2A.equals(ShortTruthTableCellType.FALSE) + && board2B.equals(ShortTruthTableCellType.FALSE))); // Verify the board dimensions are unchanged Assert.assertEquals(caseBoard1.getHeight(), caseBoard2.getHeight(), board.getHeight()); Assert.assertEquals(caseBoard1.getWidth(), caseBoard2.getWidth(), board.getWidth()); // Verify that everywhere else on the board is unchanged - for (int i = 0; i< caseBoard1.getWidth(); i++) { + for (int i = 0; i < caseBoard1.getWidth(); i++) { for (int j = 0; j < caseBoard1.getHeight(); j++) { // Make sure not to check the two cells that should be different if (!((i == aX && j == aY) || (i == bX && j == bY))) { - Assert.assertEquals(caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); + Assert.assertEquals( + caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); } } } } /** - * Given a statement A -> B where ^ is true, tests this case rule by ensuring that - * two branches are created: one where A is false and one where B is true. + * Given a statement A -> B where ^ is true, tests this case rule by ensuring that two branches + * are created: one where A is false and one where B is true. */ @Test public void SimpleStatement1TrueTest() throws InvalidFileFormatException { @@ -96,21 +100,19 @@ public void SimpleStatement1TrueTest() throws InvalidFileFormatException { } /** - * Given a statement ~(A|B) -> (C^D) where the -> is true, tests this case rule - * by ensuring that two branches are created: one where ~ is false and one where - * ^ is true. + * Given a statement ~(A|B) -> (C^D) where the -> is true, tests this case rule by ensuring that + * two branches are created: one where ~ is false and one where ^ is true. */ @Test public void ComplexStatement1TrueTest() throws InvalidFileFormatException { - trueBiconditionalTest("ComplexStatement1_True", 6, 0, 0, 0, - 9, 0); + trueBiconditionalTest("ComplexStatement1_True", 6, 0, 0, 0, 9, 0); } - private void falseBiconditionalTest(String fileName, - int biconditionalX, int biconditionalY, - int aX, int aY, - int bX, int bY) throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/BiconditionalCaseRule/" + fileName, stt); + private void falseBiconditionalTest( + String fileName, int biconditionalX, int biconditionalY, int aX, int aY, int bX, int bY) + throws InvalidFileFormatException { + TestUtilities.importTestBoard( + "puzzles/shorttruthtable/rules/BiconditionalCaseRule/" + fileName, stt); TreeNode rootNode = stt.getTree().getRootNode(); TreeTransition transition = rootNode.getChildren().get(0); transition.setRule(RULE); @@ -141,46 +143,49 @@ private void falseBiconditionalTest(String fileName, // Assert that A and B are not equal and are both either true or false in both branches Assert.assertNotEquals(board1A, board1B); Assert.assertTrue( - (board1A.equals(ShortTruthTableCellType.TRUE) && board1B.equals(ShortTruthTableCellType.FALSE)) || (board1A.equals(ShortTruthTableCellType.FALSE) && board1B.equals(ShortTruthTableCellType.TRUE)) - ); + (board1A.equals(ShortTruthTableCellType.TRUE) + && board1B.equals(ShortTruthTableCellType.FALSE)) + || (board1A.equals(ShortTruthTableCellType.FALSE) + && board1B.equals(ShortTruthTableCellType.TRUE))); Assert.assertNotEquals(board2A, board2B); Assert.assertTrue( - (board2A.equals(ShortTruthTableCellType.TRUE) && board2B.equals(ShortTruthTableCellType.FALSE)) || (board2A.equals(ShortTruthTableCellType.FALSE) && board2B.equals(ShortTruthTableCellType.TRUE)) - ); + (board2A.equals(ShortTruthTableCellType.TRUE) + && board2B.equals(ShortTruthTableCellType.FALSE)) + || (board2A.equals(ShortTruthTableCellType.FALSE) + && board2B.equals(ShortTruthTableCellType.TRUE))); // Verify the board dimensions are unchanged Assert.assertEquals(caseBoard1.getHeight(), caseBoard2.getHeight(), board.getHeight()); Assert.assertEquals(caseBoard1.getWidth(), caseBoard2.getWidth(), board.getWidth()); // Verify that everywhere else on the board is unchanged - for (int i = 0; i< caseBoard1.getWidth(); i++) { + for (int i = 0; i < caseBoard1.getWidth(); i++) { for (int j = 0; j < caseBoard1.getHeight(); j++) { // Make sure not to check the two cells that should be different if (!((i == aX && j == aY) || (i == bX && j == bY))) { - Assert.assertEquals(caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); + Assert.assertEquals( + caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); } } } } /** - * Given a statement A -> B where -> is false, tests this case rule by ensuring that - * one branch is created where A is true and B is false. + * Given a statement A -> B where -> is false, tests this case rule by ensuring that one branch + * is created where A is true and B is false. */ @Test public void SimpleStatement1FalseTest() throws InvalidFileFormatException { - falseBiconditionalTest("FalseBiconditional", 1, 0, 0, 0, - 2, 0); + falseBiconditionalTest("FalseBiconditional", 1, 0, 0, 0, 2, 0); } /** - * Given a statement ~(A|B) -> (C^D) where -> is true, tests this case rule - * by ensuring that one branch is created where ~ is true and ^ is false. + * Given a statement ~(A|B) -> (C^D) where -> is true, tests this case rule by ensuring that one + * branch is created where ~ is true and ^ is false. */ @Test public void ComplexStatement1FalseTest() throws InvalidFileFormatException { - falseBiconditionalTest("ComplexStatement1_False", 6, 0, 0, 0, - 9, 0); + falseBiconditionalTest("ComplexStatement1_False", 6, 0, 0, 0, 9, 0); } -} \ No newline at end of file +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/BiconditionalContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalContradictionRuleTest.java index 750eb544d..af41a5b8c 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/BiconditionalContradictionRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalContradictionRuleTest.java @@ -28,8 +28,8 @@ public static void setUp() { /** * Given a statement: A <-> B where <-> is true * - * Asserts that this is a valid application of the rule if - * and only if A and B are not unknown and A does not equal B + *

Asserts that this is a valid application of the rule if and only if A and B are not + * unknown and A does not equal B * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException @@ -55,10 +55,11 @@ private void trueBiconditionalTestHelper(String filePath) throws InvalidFileForm ShortTruthTableCell a = board.getCell(0, 0); ShortTruthTableCell b = board.getCell(2, 0); - if (a.getType() != ShortTruthTableCellType.UNKNOWN && b.getType() != ShortTruthTableCellType.UNKNOWN && a.getType() != b.getType()) { + if (a.getType() != ShortTruthTableCellType.UNKNOWN + && b.getType() != ShortTruthTableCellType.UNKNOWN + && a.getType() != b.getType()) { Assert.assertNull(RULE.checkContradiction(transition.getBoard())); - } - else { + } else { Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); } } @@ -66,8 +67,8 @@ private void trueBiconditionalTestHelper(String filePath) throws InvalidFileForm /** * Given a statement: A <-> B where <-> is false * - * Asserts that this is a valid application of the rule if - * and only if A and B are not unknown and A equals B + *

Asserts that this is a valid application of the rule if and only if A and B are not + * unknown and A equals B * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException @@ -93,10 +94,11 @@ private void falseBiconditionalTestHelper(String filePath) throws InvalidFileFor ShortTruthTableCell a = board.getCell(0, 0); ShortTruthTableCell b = board.getCell(2, 0); - if (a.getType() != ShortTruthTableCellType.UNKNOWN && b.getType() != ShortTruthTableCellType.UNKNOWN && a.getType() == b.getType()) { + if (a.getType() != ShortTruthTableCellType.UNKNOWN + && b.getType() != ShortTruthTableCellType.UNKNOWN + && a.getType() == b.getType()) { Assert.assertNull(RULE.checkContradiction(transition.getBoard())); - } - else { + } else { Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); } } @@ -104,7 +106,7 @@ private void falseBiconditionalTestHelper(String filePath) throws InvalidFileFor /** * Given a statement: A <-> B where <-> is unknown * - * Asserts that this is not a valid application of this rule. + *

Asserts that this is not a valid application of this rule. * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException diff --git a/src/test/java/puzzles/shorttruthtable/rules/ConditionalCaseRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/ConditionalCaseRuleTest.java index 5ea600314..891fd975d 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/ConditionalCaseRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/ConditionalCaseRuleTest.java @@ -9,14 +9,13 @@ import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; import edu.rpi.legup.puzzle.shorttruthtable.rules.caserule.CaseRuleConditional; import edu.rpi.legup.save.InvalidFileFormatException; +import java.util.ArrayList; import legup.MockGameBoardFacade; import legup.TestUtilities; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import java.util.ArrayList; - public class ConditionalCaseRuleTest { private static final CaseRuleConditional RULE = new CaseRuleConditional(); @@ -28,11 +27,11 @@ public static void setUp() { stt = new ShortTruthTable(); } - private void trueConditionalTest(String fileName, - int conditionalX, int conditionalY, - int aX, int aY, - int bX, int bY) throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/ConditionalCaseRule/" + fileName, stt); + private void trueConditionalTest( + String fileName, int conditionalX, int conditionalY, int aX, int aY, int bX, int bY) + throws InvalidFileFormatException { + TestUtilities.importTestBoard( + "puzzles/shorttruthtable/rules/ConditionalCaseRule/" + fileName, stt); TreeNode rootNode = stt.getTree().getRootNode(); TreeTransition transition = rootNode.getChildren().get(0); transition.setRule(RULE); @@ -63,58 +62,58 @@ private void trueConditionalTest(String fileName, // Assert that A is unknown in one board and false in the other Assert.assertNotEquals(board1A, board2A); Assert.assertTrue( - (board1A.equals(ShortTruthTableCellType.UNKNOWN) && board2A.equals(ShortTruthTableCellType.FALSE)) - || (board1A.equals(ShortTruthTableCellType.FALSE) && board2A.equals(ShortTruthTableCellType.UNKNOWN)) - ); + (board1A.equals(ShortTruthTableCellType.UNKNOWN) + && board2A.equals(ShortTruthTableCellType.FALSE)) + || (board1A.equals(ShortTruthTableCellType.FALSE) + && board2A.equals(ShortTruthTableCellType.UNKNOWN))); // Assert that B is unknown in one board and true in the other Assert.assertNotEquals(board1B, board2B); Assert.assertTrue( - (board1B.equals(ShortTruthTableCellType.UNKNOWN) && board2B.equals(ShortTruthTableCellType.TRUE)) - || (board1B.equals(ShortTruthTableCellType.TRUE) && board2B.equals(ShortTruthTableCellType.UNKNOWN)) - ); + (board1B.equals(ShortTruthTableCellType.UNKNOWN) + && board2B.equals(ShortTruthTableCellType.TRUE)) + || (board1B.equals(ShortTruthTableCellType.TRUE) + && board2B.equals(ShortTruthTableCellType.UNKNOWN))); // Verify the board dimensions are unchanged Assert.assertEquals(caseBoard1.getHeight(), caseBoard2.getHeight(), board.getHeight()); Assert.assertEquals(caseBoard1.getWidth(), caseBoard2.getWidth(), board.getWidth()); // Verify that everywhere else on the board is unchanged - for (int i = 0; i< caseBoard1.getWidth(); i++) { + for (int i = 0; i < caseBoard1.getWidth(); i++) { for (int j = 0; j < caseBoard1.getHeight(); j++) { // Make sure not to check the two cells that should be different if (!((i == aX && j == aY) || (i == bX && j == bY))) { - Assert.assertEquals(caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); + Assert.assertEquals( + caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); } } } } /** - * Given a statement A -> B where ^ is true, tests this case rule by ensuring that - * two branches are created: one where A is false and one where B is true. + * Given a statement A -> B where ^ is true, tests this case rule by ensuring that two branches + * are created: one where A is false and one where B is true. */ @Test public void SimpleStatement1TrueTest() throws InvalidFileFormatException { - trueConditionalTest("TrueConditional", 1, 0, 0, 0, - 2, 0); + trueConditionalTest("TrueConditional", 1, 0, 0, 0, 2, 0); } /** - * Given a statement ~(A|B) -> (C^D) where the -> is true, tests this case rule - * by ensuring that two branches are created: one where ~ is false and one where - * ^ is true. + * Given a statement ~(A|B) -> (C^D) where the -> is true, tests this case rule by ensuring that + * two branches are created: one where ~ is false and one where ^ is true. */ @Test public void ComplexStatement1TrueTest() throws InvalidFileFormatException { - trueConditionalTest("ComplexStatement1_True", 6, 0, 0, 0, - 9, 0); + trueConditionalTest("ComplexStatement1_True", 6, 0, 0, 0, 9, 0); } - private void falseConditionalTest(String fileName, - int conditionalX, int conditionalY, - int aX, int aY, - int bX, int bY) throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/ConditionalCaseRule/" + fileName, stt); + private void falseConditionalTest( + String fileName, int conditionalX, int conditionalY, int aX, int aY, int bX, int bY) + throws InvalidFileFormatException { + TestUtilities.importTestBoard( + "puzzles/shorttruthtable/rules/ConditionalCaseRule/" + fileName, stt); TreeNode rootNode = stt.getTree().getRootNode(); TreeTransition transition = rootNode.getChildren().get(0); transition.setRule(RULE); @@ -142,22 +141,20 @@ private void falseConditionalTest(String fileName, } /** - * Given a statement A -> B where -> is false, tests this case rule by ensuring that - * one branch is created where A is true and B is false. + * Given a statement A -> B where -> is false, tests this case rule by ensuring that one branch + * is created where A is true and B is false. */ @Test public void SimpleStatement1FalseTest() throws InvalidFileFormatException { - falseConditionalTest("FalseConditional", 1, 0, 0, 0, - 2, 0); + falseConditionalTest("FalseConditional", 1, 0, 0, 0, 2, 0); } /** - * Given a statement ~(A|B) -> (C^D) where -> is true, tests this case rule - * by ensuring that one branch is created where ~ is true and ^ is false. + * Given a statement ~(A|B) -> (C^D) where -> is true, tests this case rule by ensuring that one + * branch is created where ~ is true and ^ is false. */ @Test public void ComplexStatement1FalseTest() throws InvalidFileFormatException { - falseConditionalTest("ComplexStatement1_False", 6, 0, 0, 0, - 9, 0); + falseConditionalTest("ComplexStatement1_False", 6, 0, 0, 0, 9, 0); } -} \ No newline at end of file +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/ConditionalContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/ConditionalContradictionRuleTest.java index a13217cb2..cfbc98b67 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/ConditionalContradictionRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/ConditionalContradictionRuleTest.java @@ -28,8 +28,8 @@ public static void setUp() { /** * Given a statement: A -> B where -> is true * - * Asserts that this is a valid application of the rule if - * and only if both A is true and B is false + *

Asserts that this is a valid application of the rule if and only if both A is true and B + * is false * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException @@ -55,10 +55,10 @@ private void trueConditionalTestHelper(String filePath) throws InvalidFileFormat ShortTruthTableCell a = board.getCell(0, 0); ShortTruthTableCell b = board.getCell(2, 0); - if (a.getType() == ShortTruthTableCellType.TRUE && b.getType() == ShortTruthTableCellType.FALSE) { + if (a.getType() == ShortTruthTableCellType.TRUE + && b.getType() == ShortTruthTableCellType.FALSE) { Assert.assertNull(RULE.checkContradiction(transition.getBoard())); - } - else { + } else { Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); } } @@ -66,8 +66,8 @@ private void trueConditionalTestHelper(String filePath) throws InvalidFileFormat /** * Given a statement: A -> B where -> is false * - * Asserts that this is a valid application of the rule if - * and only if A is false or B is true + *

Asserts that this is a valid application of the rule if and only if A is false or B is + * true * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException @@ -93,10 +93,10 @@ private void falseConditionalTestHelper(String filePath) throws InvalidFileForma ShortTruthTableCell a = board.getCell(0, 0); ShortTruthTableCell b = board.getCell(2, 0); - if (a.getType() == ShortTruthTableCellType.FALSE || b.getType() == ShortTruthTableCellType.TRUE) { + if (a.getType() == ShortTruthTableCellType.FALSE + || b.getType() == ShortTruthTableCellType.TRUE) { Assert.assertNull(RULE.checkContradiction(transition.getBoard())); - } - else { + } else { Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); } } @@ -104,7 +104,7 @@ private void falseConditionalTestHelper(String filePath) throws InvalidFileForma /** * Given a statement: A -> B where -> is unknown * - * Asserts that this is not a valid application of this rule. + *

Asserts that this is not a valid application of this rule. * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException diff --git a/src/test/java/puzzles/shorttruthtable/rules/NotContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/NotContradictionRuleTest.java index 7c2b144e9..b95612235 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/NotContradictionRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/NotContradictionRuleTest.java @@ -28,8 +28,8 @@ public static void setUp() { /** * Given a statement: ¬A * - * Asserts that this is a valid application of the rule if - * and only if A and B are both true or are both false. + *

Asserts that this is a valid application of the rule if and only if A and B are both true + * or are both false. * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException @@ -54,11 +54,13 @@ private void notContradictionTestHelper(String filePath) throws InvalidFileForma ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); ShortTruthTableCell not = board.getCell(0, 0); ShortTruthTableCell a = board.getCell(1, 0); - - if ((not.getType() == ShortTruthTableCellType.TRUE && a.getType() == ShortTruthTableCellType.TRUE) || (not.getType() == ShortTruthTableCellType.FALSE && a.getType() == ShortTruthTableCellType.FALSE)) { + + if ((not.getType() == ShortTruthTableCellType.TRUE + && a.getType() == ShortTruthTableCellType.TRUE) + || (not.getType() == ShortTruthTableCellType.FALSE + && a.getType() == ShortTruthTableCellType.FALSE)) { Assert.assertNull(RULE.checkContradiction(transition.getBoard())); - } - else { + } else { Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); } } diff --git a/src/test/java/puzzles/shorttruthtable/rules/OrContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/OrContradictionRuleTest.java index b2aaf583d..d03328640 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/OrContradictionRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/OrContradictionRuleTest.java @@ -28,8 +28,8 @@ public static void setUp() { /** * Given a statement: A V B where V is true * - * Asserts that this is a valid application of the rule if - * and only if both A and B are set to false. + *

Asserts that this is a valid application of the rule if and only if both A and B are set + * to false. * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException @@ -55,10 +55,10 @@ private void trueOrTestHelper(String filePath) throws InvalidFileFormatException ShortTruthTableCell a = board.getCell(0, 0); ShortTruthTableCell b = board.getCell(2, 0); - if (a.getType() == ShortTruthTableCellType.FALSE && b.getType() == ShortTruthTableCellType.FALSE) { + if (a.getType() == ShortTruthTableCellType.FALSE + && b.getType() == ShortTruthTableCellType.FALSE) { Assert.assertNull(RULE.checkContradiction(transition.getBoard())); - } - else { + } else { Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); } } @@ -66,9 +66,8 @@ private void trueOrTestHelper(String filePath) throws InvalidFileFormatException /** * Given a statement: A V B where V is false * - * Asserts that this is a valid application of the rule if - * and only if A or B is set to true or both A and B are set - * to true. + *

Asserts that this is a valid application of the rule if and only if A or B is set to true + * or both A and B are set to true. * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException @@ -94,10 +93,10 @@ private void falseOrTestHelper(String filePath) throws InvalidFileFormatExceptio ShortTruthTableCell a = board.getCell(0, 0); ShortTruthTableCell b = board.getCell(2, 0); - if (a.getType() == ShortTruthTableCellType.TRUE || b.getType() == ShortTruthTableCellType.TRUE) { + if (a.getType() == ShortTruthTableCellType.TRUE + || b.getType() == ShortTruthTableCellType.TRUE) { Assert.assertNull(RULE.checkContradiction(transition.getBoard())); - } - else { + } else { Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); } } @@ -105,7 +104,7 @@ private void falseOrTestHelper(String filePath) throws InvalidFileFormatExceptio /** * Given a statement: A V B where V is unknown * - * Asserts that this is not a valid application of this rule. + *

Asserts that this is not a valid application of this rule. * * @param filePath The file path for test board setup. * @throws InvalidFileFormatException