Skip to content
Snippets Groups Projects
Commit fb19c627 authored by abryce2's avatar abryce2
Browse files

Added unit testing

parent 755d4746
No related branches found
No related tags found
No related merge requests found
Pipeline #1337 failed
......@@ -27,5 +27,36 @@ public class DotsAndBoxesGridTest {
assertTrue(true);
}
// FIXME: You need to write tests for the two known bugs in the code.
@Test
public void testBoxComplete() {
logger.info("Test to show that box complete runs correctly");
DotsAndBoxesGrid DaB = new DotsAndBoxesGrid(10, 10, 1);
Assertions.assertEquals(false, DaB.boxComplete(4, 3));
}
@Test
public void testdrawHorizontal() {
logger.info("Test to show horizontal lines can only be draw once in the same place");
DotsAndBoxesGrid DaB = new DotsAndBoxesGrid(10, 10, 1);
DaB.drawHorizontal(4, 2, 1);
Assertions.assertThrows(IllegalStateException.class, () -> {
DaB.drawHorizontal(4,2, 1);
}, "There is already a horizontal line here. ");
}
@Test
public void testdrawVertical() {
logger.info("Test to show vertical lines can only be draw once in the same place");
DotsAndBoxesGrid DaB = new DotsAndBoxesGrid(10, 10, 1);
DaB.drawVertical(4, 2, 1);
Assertions.assertThrows(IllegalStateException.class, () -> {
DaB.drawVertical(4,2, 1);
}, "There is already a vertical line here. ");
}
}
// FIXME: You need to write tests for the two known bugs in the code.
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