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
mthoma48
dotsandboxes
Commits
3cff0b8d
Commit
3cff0b8d
authored
3 years ago
by
mthoma48
Browse files
Options
Downloads
Patches
Plain Diff
Initial unit tests for Issue 1 bugs, completeBoxTest and gridLineException
parent
29c1ff34
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+26
-0
26 additions, 0 deletions
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
with
26 additions
and
0 deletions
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+
26
−
0
View file @
3cff0b8d
...
@@ -21,6 +21,7 @@ public class DotsAndBoxesGridTest {
...
@@ -21,6 +21,7 @@ public class DotsAndBoxesGridTest {
*
*
* This is a dummy test just to show that the test suite itself runs
* This is a dummy test just to show that the test suite itself runs
*/
*/
@Test
@Test
public
void
testTestSuiteRuns
()
{
public
void
testTestSuiteRuns
()
{
logger
.
info
(
"Dummy test to show the test suite runs"
);
logger
.
info
(
"Dummy test to show the test suite runs"
);
...
@@ -28,4 +29,29 @@ public class DotsAndBoxesGridTest {
...
@@ -28,4 +29,29 @@ 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 if algorithm for testing whether a box is complete is wrong
@Test
public
void
completeBoxTest
()
{
logger
.
info
(
"Test to see if completion algorithm is working"
);
DotsAndBoxesGrid
grid
=
new
DotsAndBoxesGrid
(
4
,
2
,
2
);
// draw a complete square
grid
.
drawHorizontal
(
1
,
1
,
1
);
grid
.
drawHorizontal
(
1
,
2
,
1
);
grid
.
drawVertical
(
1
,
2
,
1
);
assertTrue
(
grid
.
drawVertical
(
2
,
2
,
1
));
}
// Test that DotsAndBoxesGrid currently allows drawing a line on an existing line
@Test
public
void
gridLineException
()
{
logger
.
info
(
"Should not be able to draw a line over an already existing line"
);
DotsAndBoxesGrid
grid
=
new
DotsAndBoxesGrid
(
4
,
2
,
2
);
grid
.
drawHorizontal
(
1
,
1
,
1
);
// assert error here
assertThrows
(
RuntimeException
.
class
,
()
->
grid
.
drawHorizontal
(
1
,
1
,
2
),
"Line was drawn over another"
);
}
}
}
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