-
-
Notifications
You must be signed in to change notification settings - Fork 283
NW | 25-ITP_Sep | Ahmad Hmedan | Sprint 3 | implement and rewrite tests #812
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
Changes from all commits
3760f67
9da6cfa
12ac0d3
b8f4270
4a5a46b
331e4ff
2163ec2
ebad589
3e9ab28
922e296
cf43501
1bb6c7e
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 |
|---|---|---|
|
|
@@ -7,7 +7,25 @@ test("should return true for a proper fraction", () => { | |
| }); | ||
|
|
||
| // Case 2: Identify Improper Fractions: | ||
|
|
||
| test("returns false for an improper fraction", () => { | ||
| expect(isProperFraction(5, 2)).toEqual(false); | ||
| }); | ||
| // Case 3: Identify Negative Fractions: | ||
|
|
||
| test("returns true for a negative proper fraction( absolute value of the numerator is less than the denominator)", () => { | ||
| expect(isProperFraction(-4, 7)).toEqual(true); | ||
| }); | ||
|
Comment on lines
+14
to
+16
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. When preparing tests, we should ensure the tests cover all possible cases (and maybe test multiple samples within each case to make the test more robust). Can you think of case(s) that should also be tested? |
||
| // Case 4: Identify Equal Numerator and Denominator: | ||
| test("returns false when numerator equals denominator", () => { | ||
| expect(isProperFraction(9, 9)).toEqual(false); | ||
| }); | ||
|
|
||
| test("return false when numerator equals denominator when both are negative", () => { | ||
| expect(isProperFraction(-4, -4)).toEqual(false); | ||
| }); | ||
|
|
||
| test("returns false for a negative proper fraction( absolute value of the denominator is less than the numerator)", () => { | ||
| expect(isProperFraction(-7, 4)).toEqual(false); | ||
| }); | ||
|
Comment on lines
+26
to
+28
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.
|
||
| test("returns false when denominator is zero", () => { | ||
| expect(isProperFraction(3, 0)).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.
denominator < 0is probably more expressive in the sense that it is closer to the definition of "negative number".