-
-
Notifications
You must be signed in to change notification settings - Fork 337
West Midlands | 26-Jan-ITP | Fida H Ali Zada | Sprint 3 | Implement and Rewrite Tests #1129
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
acc84eb
4f6ab7b
780c9f9
60f9cc7
e229134
d21f276
599d6db
6a29885
d24a40f
675f16e
609355f
59a4508
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 |
|---|---|---|
|
|
@@ -8,3 +8,18 @@ const isProperFraction = require("../implement/2-is-proper-fraction"); | |
| test(`should return false when denominator is zero`, () => { | ||
| expect(isProperFraction(1, 0)).toEqual(false); | ||
| }); | ||
|
|
||
| test(`should return true when abs(numerator) < abs(denominator)`, () => { | ||
| expect(isProperFraction(0, 1)).toEqual(true); | ||
| expect(isProperFraction(-3, -6)).toEqual(true); | ||
| expect(isProperFraction(1, 2)).toEqual(true); | ||
| }) | ||
|
|
||
| test(`should return false when abs(numerator) > abs(denominator)`, () => { | ||
| expect(isProperFraction(2, 1)).toEqual(false); | ||
| expect(isProperFraction(-2, -1)).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. You have more comprehensive test data in |
||
| test(`should return false when (numerator == denominator)`, () => { | ||
| expect(isProperFraction(0, 0)).toEqual(false); | ||
| }) | ||
|
Comment on lines
+23
to
+25
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. This test would have missed detecting a bug in this implementation: function isProperFraction(numarator, denominator) {
if (denominator == 0) return false;
return Math.abs(numarator) <= Math.abs(denominator);
} |
||
Uh oh!
There was an error while loading. Please reload this page.