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