Skip to content

Commit

Permalink
Merge branch 'stt-test-suite' of https://github.com/charlestian23/LEGUP
Browse files Browse the repository at this point in the history
… into stt-test-suite
  • Loading branch information
charlestian23 committed Nov 14, 2023
2 parents 667b195 + 02ba918 commit 985b425
Show file tree
Hide file tree
Showing 14 changed files with 498 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sourceCompatibility = 11
dependencies {
implementation 'org.jetbrains:annotations:20.1.0'
implementation 'org.jetbrains:annotations:20.1.0'
implementation 'com.formdev:flatlaf:3.0'
implementation 'com.formdev:flatlaf:3.+'
implementation 'com.google.firebase:firebase-admin:6.3.0'
implementation 'org.apache.httpcomponents:httpclient:4.5.1'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'Legup'
rootProject.name = 'LEGUP'

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public void BulbsInPathContradictionRule_LightInHorizontalPath() throws InvalidF
Assert.assertNull(RULE.checkContradictionAt(board, board.getCell(0, 0)));
Assert.assertNull(RULE.checkContradictionAt(board, board.getCell(2, 0)));


Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(0, 1)));
}

Expand Down Expand Up @@ -67,4 +68,19 @@ public void BulbsInPathContradictionRule_BlockInVerticalPath() throws InvalidFil

Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 1)));
}

@Test
public void BulbsInPathContradictionRule_BlockInHorizontalPath() throws InvalidFileFormatException{
TestUtilities.importTestBoard("puzzles/lightup/rules/BulbsInPathContradictionRule/BlockInHorizontalPath", lightUp);
TreeNode rootNode = lightUp.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);

LightUpBoard board = (LightUpBoard) transition.getBoard();
Assert.assertNotNull(RULE.checkContradiction(board));
Assert.assertNotNull(RULE.checkContradictionAt(board,board.getCell(0,0)));
Assert.assertNotNull(RULE.checkContradictionAt(board,board.getCell(2,0)));
Assert.assertNotNull(RULE.checkContradictionAt(board,board.getCell(1,1)));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ public static void setUp() {
lightUp = new LightUp();
}

@Test
@Test
//extensive full testing of null and non-null in a 5x5 board
public void FullLightTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/lightup/rules/CannotLightACellContradictionRule/FullLightTest", lightUp);
TreeNode rootNode = lightUp.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);
transition.setRule(RULE);

LightUpBoard board = (LightUpBoard) transition.getBoard();
//confirm there is a contradiction somewhere on the board
Expand All @@ -36,21 +36,21 @@ public void FullLightTest() throws InvalidFileFormatException {
//confirm it is impossible to light up these squares
Assert.assertNull(RULE.checkContradictionAt(board, board.getCell(1, 3)));
Assert.assertNull(RULE.checkContradictionAt(board, board.getCell(3, 3)));

//confirm these are not required to be lit because they are already lit or unable to be
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(0, 0)));
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 1)));
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 0)));
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(3, 2)));
}

@Test
@Test
//simple contradiction testing for null and non-null in a 3x3 board
public void CannotLightMiddleTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/lightup/rules/CannotLightACellContradictionRule/CannotLight", lightUp);
TreeNode rootNode = lightUp.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);
transition.setRule(RULE);

LightUpBoard board = (LightUpBoard) transition.getBoard();
//confirm there is a contradiction somewhere on the board
Expand All @@ -68,4 +68,24 @@ public void CannotLightMiddleTest() throws InvalidFileFormatException {
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 2)));
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(2, 1)));
}

@Test
public void CanLightTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/lightup/rules/CannotLightACellContradictionRule/CanLightTest", lightUp);
TreeNode rootNode = lightUp.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);

LightUpBoard board = (LightUpBoard) transition.getBoard();
//confirm there is not a contradiction somewhere on the board
Assert.assertNotNull(RULE.checkContradiction(board));

//confirm that these cells can be lit, are already lit, or that they are just black blocks
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 3)));
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(3, 3)));
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(0, 0)));
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 1)));
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 0)));
Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(3, 2)));
}
}
Loading

0 comments on commit 985b425

Please sign in to comment.