Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
assignment_2
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
Steve McKinnon
assignment_2
Commits
4450a8e9
Commit
4450a8e9
authored
3 years ago
by
Steve McKinnon
Browse files
Options
Downloads
Patches
Plain Diff
created tests to check complete box and redraw line
parent
24b230ca
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
+31
-10
31 additions, 10 deletions
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
with
31 additions
and
10 deletions
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+
31
−
10
View file @
4450a8e9
...
...
@@ -14,18 +14,39 @@ public class DotsAndBoxesGridTest {
*/
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
DotsAndBoxesGridTest
.
class
);
/*
* Tests are functions that have an @Test annotation before them.
* The typical format of a test is that it contains some code that does something, and then one
* or more assertions to check that a condition holds.
*
* This is a dummy test just to show that the test suite itself runs
*/
* A test to check if a box is correctly marked as complete.
* Asserting False after drawing a complete box
*/
@Test
public
void
testTestSuiteRuns
()
{
logger
.
info
(
"Dummy test to show the test suite runs"
);
assertTrue
(
true
);
public
void
testForCompleteBox
()
{
logger
.
info
(
"Testing the complete box"
);
DotsAndBoxesGrid
grid
=
new
DotsAndBoxesGrid
(
10
,
10
,
2
);
grid
.
drawHorizontal
(
1
,
1
,
1
);
grid
.
drawHorizontal
(
1
,
2
,
1
);
grid
.
drawVertical
(
1
,
1
,
1
);
grid
.
drawVertical
(
2
,
1
,
1
);
assertFalse
(
grid
.
boxComplete
(
1
,
1
));
}
// FIXME: You need to write tests for the two known bugs in the code.
/*
* A test to see if a line can be redrawn after it has already been drawn,
* test should throw an exception
*/
@Test
public
void
testRedrawLineFails
()
{
logger
.
info
(
"Testing redrawing a line"
);
DotsAndBoxesGrid
grid
=
new
DotsAndBoxesGrid
(
10
,
10
,
2
);
grid
.
drawVertical
(
5
,
5
,
1
);
assertThrows
(
IllegalStateException
.
class
,
()
->
grid
.
drawVertical
(
5
,
5
,
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