-
-
Notifications
You must be signed in to change notification settings - Fork 337
Manchester | ITP-JAN-26 | Ofonime Edak | Sprint 3 | Coursework/sprint 3 implement and rewrite #1139
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
5209d8d
49570d3
0ee00b9
d1394c1
815a1c8
865cf09
b1a1d5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,32 @@ const isProperFraction = require("../implement/2-is-proper-fraction"); | |
| // TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories. | ||
|
|
||
| // Special case: numerator is zero | ||
| test(`should return false when denominator is zero`, () => { | ||
| test(`should return true when numerator is zero`, () => { | ||
| expect(isProperFraction(0, -4)).toEqual(true); | ||
| expect(isProperFraction(0, 1)).toEqual(true); | ||
| }); | ||
| test("should return false when denominator is zero", () => { | ||
| expect(isProperFraction(1, 0)).toEqual(false); | ||
| expect(isProperFraction(10, 0)).toEqual(false); | ||
| expect(isProperFraction(-2, 0)).toEqual(false); | ||
| expect(isProperFraction(-1, 0)).toEqual(false); | ||
| expect(isProperFraction(1, 0)).toEqual(false); | ||
| }); | ||
|
Contributor
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. These data categories and samples are not comprehensive enough. You should test also those proper and improper fraction samples you had in
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. Alright, I will improve the test case. Thank you very much |
||
|
|
||
| test("should return false when denominator and numerator have both the same negative and positive integer", () => { | ||
| expect(isProperFraction(-1, 1)).toEqual(false); | ||
| expect(isProperFraction(1, -1)).toEqual(false); | ||
| }); | ||
|
|
||
| test(`should return true when denominator is > numerator `, () => { | ||
| expect(isProperFraction(1, 2)).toEqual(true); | ||
| expect(isProperFraction(1, 10000)).toEqual(true); | ||
|
|
||
| expect(isProperFraction(1e2, 1e3)).toEqual(true); | ||
| expect(isProperFraction(-1, 2)).toEqual(true); | ||
| }); | ||
|
|
||
| test("should return false when denominator < numerator", () => { | ||
|
Comment on lines
+25
to
+33
Contributor
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. We can use pseudo-code such as Otherwise, |
||
| expect(isProperFraction(1e4, 1)).toEqual(false); | ||
| expect(isProperFraction(100, 2)).toEqual(false); | ||
| }); | ||
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.
How about
(angle <= 0 or angle >=360)?