From c369e3037344d5241e11782e5844fe1256cc4c9b Mon Sep 17 00:00:00 2001 From: Krishkumar Patel <kpatel9@myune.edu.au> Date: Fri, 18 Aug 2023 00:01:10 +1000 Subject: [PATCH] Added a test to check whether the game completes a box upon adding just one horizontal line. The test fails. --- src/test/java/dotsandboxes/DotsAndBoxesGridTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java index 1946bed..9a1ece8 100644 --- a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java +++ b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java @@ -28,4 +28,14 @@ public class DotsAndBoxesGridTest { } // FIXME: You need to write tests for the two known bugs in the code. + /** this tests whether drawing just a horitonal line at coordinate (0,0) + * completes a box at coordinate (0,0) or not. + * The game shouldn't complete a box and return false. */ + @DisplayName("Just horizontal line at [0][0], complete a box at [0][0]") + @Test + public void testBoxComplete() { + DotsAndBoxesGrid grid = new DotsAndBoxesGrid(4, 3, 2); + grid.drawHorizontal(0, 0, 1); + assertEquals(false, grid.boxComplete(0, 0)); + } } -- GitLab