Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
saryl3
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
saryal3
saryl3
Commits
351ab749
Commit
351ab749
authored
10 months ago
by
saryal3
Browse files
Options
Downloads
Patches
Plain Diff
Added failing unit tests for known bugs in square completion and duplicate line draw
parent
aea174d6
Branches
Branches containing commit
Tags
testsfail
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+26
-8
26 additions, 8 deletions
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
with
26 additions
and
8 deletions
src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+
26
−
8
View file @
351ab749
...
@@ -20,12 +20,30 @@ public class DotsAndBoxesGridTest {
...
@@ -20,12 +20,30 @@ public class DotsAndBoxesGridTest {
* or more assertions to check that a condition holds.
* or more assertions to check that a condition holds.
*
*
* 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
* Following are the Unit testing done
*/
*/
@Test
@Test
public
void
testTestSuiteRuns
()
{
public
void
testIncompleteSquare
()
{
logger
.
info
(
"Dummy test to show the test suite runs"
);
DotsAndBoxesGrid
grid
=
new
DotsAndBoxesGrid
(
3
,
3
,
2
);
// Create a 3x3 grid
assertTrue
(
true
);
// Mark only two lines of a square (incomplete)
grid
.
drawHorizontal
(
0
,
0
,
1
);
grid
.
drawVertical
(
0
,
1
,
1
);
// Assert that the square is not complete
assertFalse
(
grid
.
boxComplete
(
0
,
0
),
"Square should not be complete with only two lines"
);
}
}
// FIXME: You need to write tests for the two known bugs in the code.
@Test
public
void
testDuplicateLineDrawing
()
{
DotsAndBoxesGrid
grid
=
new
DotsAndBoxesGrid
(
3
,
3
,
2
);
// Create a 3x3 grid
// Mark a horizontal line
grid
.
drawHorizontal
(
0
,
0
,
1
);
// Attempt to draw the same line again
assertThrows
(
IllegalStateException
.
class
,
()
->
grid
.
drawHorizontal
(
0
,
0
,
1
),
"Duplicate line drawing should throw an 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