Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dotsandboxes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zach Swann
dotsandboxes
Commits
d3d38060
Commit
d3d38060
authored
3 years ago
by
Zach Swann
Browse files
Options
Downloads
Patches
Plain Diff
testsfail -Unit Tests for Complete Box and Line drawn twice Added
parent
f98f4e30
No related branches found
No related tags found
1 merge request
!1
bugfix Fixed Fail Test Line Drawn Twice and Test Box Complete Now Passes, A...
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+87
-0
87 additions, 0 deletions
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
with
87 additions
and
0 deletions
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+
87
−
0
View file @
d3d38060
...
...
@@ -28,4 +28,91 @@ public class DotsAndBoxesGridTest {
}
// FIXME: You need to write tests for the two known bugs in the code.
@Test
public
void
testTestCompleteBox
(){
logger
.
info
(
"Tests the algorithm for whether a box is complete"
);
DotsAndBoxesGrid
grid
=
new
DotsAndBoxesGrid
(
10
,
10
,
2
);
//Create TestBoxes
grid
.
drawHorizontal
(
0
,
0
,
1
);
grid
.
drawHorizontal
(
0
,
1
,
1
);
grid
.
drawVertical
(
1
,
0
,
1
);
grid
.
drawVertical
(
0
,
0
,
1
);
grid
.
drawHorizontal
(
0
,
1
,
1
);
grid
.
drawHorizontal
(
1
,
1
,
1
);
grid
.
drawVertical
(
2
,
0
,
2
);
grid
.
drawVertical
(
1
,
1
,
1
);
grid
.
drawVertical
(
0
,
1
,
1
);
grid
.
drawHorizontal
(
0
,
2
,
2
);
grid
.
drawVertical
(
1
,
2
,
2
);
grid
.
drawHorizontal
(
0
,
3
,
2
);
grid
.
drawHorizontal
(
1
,
3
,
2
);
grid
.
drawVertical
(
2
,
2
,
2
);
grid
.
drawVertical
(
2
,
1
,
1
);
grid
.
drawHorizontal
(
2
,
2
,
2
);
grid
.
drawHorizontal
(
2
,
3
,
2
);
grid
.
drawHorizontal
(
2
,
1
,
2
);
grid
.
drawVertical
(
3
,
1
,
2
);
grid
.
drawHorizontal
(
2
,
0
,
1
);
grid
.
drawVertical
(
3
,
0
,
2
);
grid
.
drawVertical
(
2
,
3
,
2
);
//Outbounds
assertFalse
(
grid
.
boxComplete
(
0
,-
1
));
assertFalse
(
grid
.
boxComplete
(
0
,
10
));
assertFalse
(
grid
.
boxComplete
(-
1
,
0
));
assertFalse
(
grid
.
boxComplete
(
10
,
0
));
//Complete Box
assertTrue
(
grid
.
boxComplete
(
0
,
0
));
assertTrue
(
grid
.
boxComplete
(
1
,
0
));
assertTrue
(
grid
.
boxComplete
(
2
,
0
));
assertTrue
(
grid
.
boxComplete
(
2
,
1
));
assertTrue
(
grid
.
boxComplete
(
0
,
1
));
assertFalse
(
grid
.
boxComplete
(
1
,
1
));
assertFalse
(
grid
.
boxComplete
(
1
,
2
));
assertFalse
(
grid
.
boxComplete
(
0
,
2
));
assertFalse
(
grid
.
boxComplete
(
1
,
2
));
assertFalse
(
grid
.
boxComplete
(
2
,
2
));
assertFalse
(
grid
.
boxComplete
(
0
,
3
));
assertFalse
(
grid
.
boxComplete
(
1
,
3
));
assertFalse
(
grid
.
boxComplete
(
2
,
3
));
assertFalse
(
grid
.
boxComplete
(
3
,
3
));
}
@Test
public
void
testTestExceptionOnLineDrawnTwice
(){
logger
.
info
(
"Tests Exception is thrown when a line is drawn twice."
);
DotsAndBoxesGrid
grid
=
new
DotsAndBoxesGrid
(
10
,
10
,
2
);
grid
.
drawHorizontal
(
0
,
0
,
1
);
grid
.
drawHorizontal
(
0
,
9
,
1
);
grid
.
drawHorizontal
(
9
,
1
,
1
);
grid
.
drawHorizontal
(
9
,
1
,
1
);
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawHorizontal
(
0
,
0
,
2
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawHorizontal
(
0
,
0
,
1
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawHorizontal
(
0
,
9
,
2
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawHorizontal
(
0
,
9
,
1
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawHorizontal
(
9
,
1
,
2
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawHorizontal
(
9
,
1
,
1
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawHorizontal
(
9
,
1
,
2
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawHorizontal
(
9
,
1
,
1
));
grid
.
drawVertical
(
0
,
0
,
1
);
grid
.
drawVertical
(
0
,
9
,
1
);
grid
.
drawVertical
(
9
,
1
,
1
);
grid
.
drawVertical
(
9
,
1
,
1
);
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawVertical
(
0
,
0
,
2
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawVertical
(
0
,
0
,
1
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawVertical
(
0
,
9
,
2
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawVertical
(
0
,
9
,
1
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawVertical
(
9
,
1
,
2
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawVertical
(
9
,
1
,
1
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawVertical
(
9
,
1
,
2
));
assertThrows
(
IllegalArgumentException
.
class
,
()->
grid
.
drawVertical
(
9
,
1
,
1
));
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment