Skip to content
Snippets Groups Projects
Commit fb833143 authored by Muyuan Li's avatar Muyuan Li
Browse files

boxCompleteTest is the unit test to check whether a box at a particular...

boxCompleteTest is the unit test to check whether a box at a particular coordinate is drawn from all sides. drawHorizontalTest checks whether there is an excetion thrown on redrawing the horizontal line. drawVerticalTest works similarly
parent 1a5c1ef6
Branches
No related merge requests found
...@@ -27,5 +27,39 @@ public class DotsAndBoxesGridTest { ...@@ -27,5 +27,39 @@ public class DotsAndBoxesGridTest {
assertTrue(true); assertTrue(true);
} }
// FIXME: You need to write tests for the two known bugs in the code. @Test
public void boxCompleteTest() {
DotsAndBoxesGrid A = new DotsAndBoxesGrid(4,3,1);
A.drawHorizontal(0,0,1);
A.drawHorizontal(1,0,1);
A.drawVertical(0,0,1);
A.drawVertical(0,1,1);
asserTrue(A.boxComplete(0,0));
}
@Test
public void drawHorizontalTest(){
DotsAndBoxesGrid B = new DotsAndBoxesGrid(4,3,1);
B.drawHorizontal(0,0,1);
try{
B.drawHorizontal(0,0,1);
}
catch (Exception e){
assertEquals("Horizontal line already drawn", e.getMessage());
}
}
@Test
public void drawVerticalTest(){
DotsAndBoxesGrid C = new DotsAndBoxesGrid(4,3,1);
C.drawVertical(0,0,1);
try{
C.drawVertical(0,0,1);
}
catch (Exception e){
assertEquals("Vertical line already drawn", e.getMessage());
}
} // 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.
Please register or to comment