Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Buggy Triangle Classifier
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
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Brady James Garvin
Buggy Triangle Classifier
Commits
eced6b97
Commit
eced6b97
authored
3 years ago
by
Brady James Garvin
Browse files
Options
Downloads
Patches
Plain Diff
Used graybox testing to unit test the classify method.
parent
5af7abb7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
TESTING.md
+32
-0
32 additions, 0 deletions
TESTING.md
test_main.py
+54
-0
54 additions, 0 deletions
test_main.py
with
86 additions
and
0 deletions
TESTING.md
0 → 100644
+
32
−
0
View file @
eced6b97
# Test Design for `main.TriangleApp.classify`
## Categories
*
Type of triangle: invalid, equilateral, isosceles, right, scalene
*
Sign of lengths: all negative, mixed, all positive
*
Smallest side:
`a`
,
`b`
,
`c`
, tie
*
Largest side:
`a`
,
`b`
,
`c`
, tie
## Initial Test Frames (by CPT)
*
`a=5,`
`b=3,`
`c=6`
(scalene, all positive,
`b`
smallest,
`c`
largest)
*
`a=8,`
`b=2,`
`c=5`
(invalid, all positive,
`b`
smallest,
`a`
largest)
*
`a=-2,`
`b=-2,`
`c=-5`
(invalid, all negative,
`c`
smallest, tie for largest)
*
`a=3,`
`b=5,`
`c=4`
(right, all positive,
`a`
smallest,
`b`
largest)
*
`a=1,`
`b=1,`
`c=1`
(equilateral, all positive, tie for smallest, tie for largest)
*
`a=2,`
`b=2,`
`c=3`
(isosceles, all positive, tie for smallest,
`c`
largest)
*
`a=2,`
`b=2,`
`c=-3`
(invalid, mixed signs,
`c`
smallest, tie for largest)
## Supplemental Test Frames (for 100% branch coverage)
*
`a=0`
,
`b=1`
,
`c=2`
*
`a=2`
,
`b=3`
,
`c=18`
*
`a=3`
,
`b=4`
,
`c=5`
## Supplemental Test Frames (by mutation testing)
*
`a=…`
,
`b=…`
,
`c=…`
*
`a=…`
,
`b=…`
,
`c=…`
*
`a=…`
,
`b=…`
,
`c=…`
*
`a=…`
,
`b=…`
,
`c=…`
*
`a=…`
,
`b=…`
,
`c=…`
This diff is collapsed.
Click to expand it.
test_main.py
0 → 100644
+
54
−
0
View file @
eced6b97
from
unittest
import
TestCase
from
main
import
Classification
,
TriangleApp
class
TestTriangleApp
(
TestCase
):
def
test_classification_of_a_scalene_triangle
(
self
):
actual
=
TriangleApp
.
classify
(
5
,
3
,
6
)
expected
=
Classification
.
SCALENE
self
.
assertEqual
(
actual
,
expected
)
def
test_classification_of_a_triangle_with_sides_too_short_to_be_valid
(
self
):
actual
=
TriangleApp
.
classify
(
8
,
2
,
5
)
expected
=
Classification
.
INVALID
self
.
assertEqual
(
actual
,
expected
)
def
test_classification_of_a_triangle_with_all_negative_sides
(
self
):
actual
=
TriangleApp
.
classify
(
-
2
,
-
2
,
-
5
)
expected
=
Classification
.
INVALID
self
.
assertEqual
(
actual
,
expected
)
def
test_classification_of_a_right_triangle
(
self
):
actual
=
TriangleApp
.
classify
(
3
,
5
,
4
)
expected
=
Classification
.
RIGHT
self
.
assertEqual
(
actual
,
expected
)
def
test_classification_of_an_equilateral_triangle
(
self
):
actual
=
TriangleApp
.
classify
(
1
,
1
,
1
)
expected
=
Classification
.
EQUILATERAL
self
.
assertEqual
(
actual
,
expected
)
def
test_classification_of_an_isosceles_triangle
(
self
):
actual
=
TriangleApp
.
classify
(
2
,
2
,
3
)
expected
=
Classification
.
ISOSCELES
self
.
assertEqual
(
actual
,
expected
)
def
test_classification_of_a_triangle_with_one_negative_side
(
self
):
actual
=
TriangleApp
.
classify
(
2
,
2
,
-
3
)
expected
=
Classification
.
INVALID
self
.
assertEqual
(
actual
,
expected
)
def
test_classification_of_a_degenerate_triangle
(
self
):
actual
=
TriangleApp
.
classify
(
0
,
1
,
2
)
expected
=
Classification
.
INVALID
self
.
assertEqual
(
actual
,
expected
)
def
test_classification_of_a_triangle_with_short_sides
(
self
):
actual
=
TriangleApp
.
classify
(
2
,
3
,
18
)
expected
=
Classification
.
INVALID
self
.
assertEqual
(
actual
,
expected
)
def
test_classification_of_a_right_triangle_with_short_sides
(
self
):
actual
=
TriangleApp
.
classify
(
3
,
4
,
5
)
expected
=
Classification
.
RIGHT
self
.
assertEqual
(
actual
,
expected
)
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