Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
assessment2
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
hmccrist
assessment2
Commits
9231f72f
Commit
9231f72f
authored
1 year ago
by
hmccrist
Browse files
Options
Downloads
Patches
Plain Diff
Added unit tests
parent
65856686
No related branches found
Branches containing commit
Tags
testsfail
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+27
-0
27 additions, 0 deletions
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
with
27 additions
and
0 deletions
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+
27
−
0
View file @
9231f72f
...
...
@@ -28,4 +28,31 @@ public class DotsAndBoxesGridTest {
}
// FIXME: You need to write tests for the two known bugs in the code.
@Test
public
void
boxCompleteDetectsCompletedBoxes
()
{
DotsAndBoxesGrid
case1
=
new
DotsAndBoxesGrid
(
5
,
5
,
2
);
case1
.
drawHorizontal
(
0
,
0
,
0
);
case1
.
drawVertical
(
0
,
0
,
1
);
case1
.
drawHorizontal
(
0
,
1
,
0
);
case1
.
drawVertical
(
1
,
0
,
1
);
assertTrue
(
case1
.
boxComplete
(
0
,
0
));
}
@Test
public
void
boxCompleteDetectsIncompleteBoxes
()
{
DotsAndBoxesGrid
case2
=
new
DotsAndBoxesGrid
(
5
,
5
,
2
);
case2
.
drawHorizontal
(
0
,
0
,
0
);
case2
.
drawVertical
(
0
,
0
,
1
);
assertFalse
(
case2
.
boxComplete
(
0
,
0
));
}
@Test
public
void
checkDrawLineException
()
{
DotsAndBoxesGrid
case3
=
new
DotsAndBoxesGrid
(
5
,
5
,
2
);
case3
.
drawHorizontal
(
0
,
0
,
0
);
case3
.
drawVertical
(
0
,
0
,
1
);
assertThrows
(
IllegalArgumentException
.
class
,
()
->
case3
.
drawHorizontal
(
0
,
0
,
0
));
assertThrows
(
IllegalArgumentException
.
class
,
()
->
case3
.
drawVertical
(
0
,
0
,
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