Repository navigation
London | 26-Sept | Hugh Mills | Sprint 2 | Implement and rewrite tests #1670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e8606f9
53621cd
5721c8b
5e692d8
b61b4b4
7ccf911
426aabb
1c3277f
c4786d8
707ac48
16f4f20
e3a8f17
ae7ef77
d4db679
9970ef6
2830bf3
c7af1dd
2fc4cd2
8662c14
6ae03b0
3727932
5d6c6ef
b155253
6f64f2e
b37a765
9770764
67f4dd7
77cf05b
3f42554
328f3c1
0cca1dc
2633baa
9cf8fc2
876923e
899e435
248c2e8
e6b8b53
23c6ee7
1236e2f
0845379
0569019
1a20c17
ba66435
cdd5f00
8b09c49
f78ab0d
7046cb7
57ae03a
9154abe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both valid and invalid cards, there should be more test cases covering various combinations. Please add them. Thank you. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,36 @@ test(`should return "Acute angle" when (0 < angle < 90)`, () => { | |
| }); | ||
|
|
||
| // Case 2: Right angle | ||
| test(`should return "Right angle" when (angle = 90)`, () => { | ||
| expect(getAngleType(90)).toEqual("Right angle"); | ||
| }); | ||
| // Case 3: Obtuse angles | ||
| // Case 4: Straight angle | ||
| test(`should return "Obtuse angle" when (90 < angle < 180)`, () => { | ||
| expect(getAngleType(91)).toEqual("Obtuse angle"); | ||
| expect(getAngleType(167)).toEqual("Obtuse angle"); | ||
| expect(getAngleType(179)).toEqual("Obtuse angle"); | ||
| }); | ||
| // Case 4: Straight angle | ||
| test(`should return "Straight angle" when (angle = 180)`, () => { | ||
| expect(getAngleType(180)).toEqual("Straight angle"); | ||
| }); | ||
| // Case 5: Reflex angles | ||
| test(`should return "Right angle" when (180 < angle < 360)`, () => { | ||
| expect(getAngleType(186)).toEqual("Reflex angle"); | ||
| expect(getAngleType(270)).toEqual("Reflex angle"); | ||
| expect(getAngleType(359)).toEqual("Reflex angle"); | ||
| }); | ||
| // Case 6: Invalid angles | ||
| test(`should return "Invalid angle" when (0 > angle > 360)`, () => { | ||
| expect(getAngleType(361)).toEqual("Invalid angle"); | ||
| expect(getAngleType(396)).toEqual("Invalid angle"); | ||
| expect(getAngleType(-57)).toEqual("Invalid angle"); | ||
| }); | ||
|
Comment on lines
+35
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be two boundary cases in this test suite. Can you think of them? Please add them. Thank you.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see, I did not have Zero angle and Full angle. Was just looking at what was mentioned for the tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just they should be counted as invalid (per question's definition). |
||
| // Case 7: Zero angles | ||
| test(`should return "Invalid angle" when (angle = 0)`, () => { | ||
| expect(getAngleType(0)).toEqual("Invalid angle"); | ||
| }); | ||
| // Case 8: Full angles | ||
| test(`should return "Invalid angle" when (angle = 360)`, () => { | ||
| expect(getAngleType(360)).toEqual("Invalid angle"); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be one more boundary case for invalid angle. Can you think of it? Please add it back. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added invalid angle for negative numbers.