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
Brett McAndrew
Assessment2
Commits
b9ff1f22
Commit
b9ff1f22
authored
1 year ago
by
Brett McAndrew
Browse files
Options
Downloads
Patches
Plain Diff
Unit tests added
parent
f4cc147e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1
Unit tests added
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+26
-1
26 additions, 1 deletion
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
with
26 additions
and
1 deletion
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+
26
−
1
View file @
b9ff1f22
...
...
@@ -27,5 +27,30 @@ public class DotsAndBoxesGridTest {
assertTrue
(
true
);
}
// FIXME: You need to write tests for the two known bugs in the code.
@Test
public
void
boxCompleteDetectsCompletedBoxes
()
{
// A grid where we're going to draw a box, and then test whether it's complete
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
));
assertTrue
(
case1
.
boxComplete
(
1
,
1
));
assertTrue
(
case1
.
getHorizontal
(
0
,
0
)&&
case1
.
getVertical
(
0
,
0
));
assertTrue
(
case1
.
getHorizontal
(
1
,
0
)&&
case1
.
getVertical
(
1
,
0
));
}
@Test
public
void
drawHorizontalTest
()
{
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
);
assertThrows
(
RuntimeException
.
class
,
()
->
{
case1
.
drawHorizontal
(
0
,
0
,
0
);});
}
}
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