Skip to content
Snippets Groups Projects
Commit 3c28e6ca authored by Neha Bagga's avatar Neha Bagga
Browse files

first file

parent f4cc147e
No related branches found
No related tags found
No related merge requests found
File added
File added
File added
......@@ -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);
......
File added
File added
......@@ -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);
});
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment