Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cosc220-a2-220188955
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
nreeves5
cosc220-a2-220188955
Commits
3068f5da
Commit
3068f5da
authored
3 years ago
by
nreeves5
Browse files
Options
Downloads
Patches
Plain Diff
Committing with unit tests for box completion and line already drawn, both fail.
parent
196de253
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+29
-1
29 additions, 1 deletion
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
with
29 additions
and
1 deletion
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+
29
−
1
View file @
3068f5da
...
@@ -3,6 +3,7 @@ package dotsandboxes;
...
@@ -3,6 +3,7 @@ package dotsandboxes;
import
org.junit.jupiter.api.*
;
import
org.junit.jupiter.api.*
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.*;
import
static
org
.
junit
.
jupiter
.
api
.
Assumptions
.*;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertThrows
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
...
@@ -28,4 +29,31 @@ public class DotsAndBoxesGridTest {
...
@@ -28,4 +29,31 @@ public class DotsAndBoxesGridTest {
}
}
// FIXME: You need to write tests for the two known bugs in the code.
// FIXME: You need to write tests for the two known bugs in the code.
@Test
public
void
testTestingBoxComplete
()
{
logger
.
info
(
"Test of box completion test"
);
logger
.
info
(
"Drawing complete box, then asserting incomplete state"
);
DotsAndBoxesGrid
g
=
new
DotsAndBoxesGrid
(
4
,
4
,
1
);
g
.
drawHorizontal
(
1
,
1
,
1
);
g
.
drawHorizontal
(
1
,
2
,
1
);
g
.
drawVertical
(
1
,
1
,
1
);
g
.
drawVertical
(
2
,
1
,
1
);
assertEquals
(
false
,
g
.
boxComplete
(
1
,
1
));
}
@Test
public
void
testTestingLineDrawn
()
{
logger
.
info
(
"Test of line already drawn detection"
);
logger
.
info
(
"Instantiating new grid"
);
DotsAndBoxesGrid
h
=
new
DotsAndBoxesGrid
(
4
,
4
,
1
);
logger
.
info
(
"Drawing a line to later be duplicated"
);
h
.
drawHorizontal
(
1
,
1
,
1
);
logger
.
info
(
"Drawing line a second time within an assert throws block, expecting and illegal state exception"
);
IllegalStateException
thrown
=
assertThrows
(
IllegalStateException
.
class
,
()
->
h
.
drawHorizontal
(
1
,
1
,
1
),
"Drawing second horizontal line should have thrown illegal state exception, did not"
);
assertTrue
(
thrown
.
getMessage
().
contains
(
"IllegalStateException"
));
}
}
}
\ No newline at end of file
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