diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9d9efa412ed23d2e7c24841c4656a814e201b21d Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/main/.DS_Store b/src/main/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..36cb684eb741bc0e6531645095591ecf668f697d Binary files /dev/null and b/src/main/.DS_Store differ diff --git a/src/main/java/.DS_Store b/src/main/java/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3c0560e5c57cc9ed1d372a2ea5d5d48c98962a21 Binary files /dev/null and b/src/main/java/.DS_Store differ diff --git a/src/main/java/dotsandboxes/Main.java b/src/main/java/dotsandboxes/Main.java index 98cd350a3380aaa35d947384f8c45e71a937fd72..ee187a45232bef5e7a1d62310c1dfe694b1fc8c5 100644 --- a/src/main/java/dotsandboxes/Main.java +++ b/src/main/java/dotsandboxes/Main.java @@ -12,7 +12,7 @@ public class Main { DotsAndBoxesGrid grid = new DotsAndBoxesGrid(15, 8, 2); // FIXME: Update this label to show your name and student number - JLabel label = new JLabel("Name: (Your name and student number goes here)"); + JLabel label = new JLabel("Name: Neha Bagga (220263170)"); JPanel borderPane = new JPanel(new BorderLayout()); borderPane.add(label, BorderLayout.SOUTH); diff --git a/src/test/.DS_Store b/src/test/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..45c13fe9b227e8ce6f96de24dabe0f27a423925b Binary files /dev/null and b/src/test/.DS_Store differ diff --git a/src/test/java/.DS_Store b/src/test/java/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..99f980d0d5585b8c012a3399ae41bc248b3909a1 Binary files /dev/null and b/src/test/java/.DS_Store differ diff --git a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java index 1946beda974d180686c65c0259a7b881e9a4eb5a..083f264808685b2e11f25d8304446bca7fd8e8f8 100644 --- a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java +++ b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java @@ -14,18 +14,65 @@ public class DotsAndBoxesGridTest { */ private static final Logger logger = LogManager.getLogger(DotsAndBoxesGridTest.class); - /* - * Tests are functions that have an @Test annotation before them. - * The typical format of a test is that it contains some code that does something, and then one - * or more assertions to check that a condition holds. - * - * This is a dummy test just to show that the test suite itself runs - */ - @Test + /* @Test public void testTestSuiteRuns() { logger.info("Dummy test to show the test suite runs"); assertTrue(true); + }*/ + DotsAndBoxesGrid dabg; + + @BeforeEach + void setUp() { + dabg = new DotsAndBoxesGrid(3, 3, 1); + } + @Test + public void testIsBoxComplete() { + + logger.info("Test for complete boxes"); + + // draw first complete box + dabg.drawHorizontal(0,0,1); + dabg.drawHorizontal(0,1,1); + dabg.drawVertical(0,0,1); + dabg.drawVertical(1,0,1); + + // draw second incomplete box + //dabg.drawHorizontal(0,1,1); + + // checking that the first complete box gets true from boxComplete method + assertEquals( + + true, dabg.boxComplete(0,0) + + ); + + // checking that the second incomplete box gets false from boxComplete method + assertEquals( + + false, dabg.boxComplete(1,0) + + ); } + @Test + public void testduplinehorizonatal() { + logger.info("Test for duplicate horizontal line"); + dabg.drawHorizontal(0, 0, 1); + dabg.drawVertical(0, 0, 1); + - // FIXME: You need to write tests for the two known bugs in the code. + assertThrows(IllegalStateException.class, () -> { + dabg.drawHorizontal(0,0,1); + }); + } + @Test + public void testduplinevertical() { + logger.info("Test for duplicate vertical line"); + dabg.drawHorizontal(0, 0, 1); + dabg.drawVertical(0, 0, 1); + + + assertThrows(IllegalStateException.class, () -> { + dabg.drawVertical(0,0,1); + }); + } }