Sheffield | 26-Jan-ITP | Seti Mussa | sprint 3 | coursework implement and rewrite #1278
Sheffield | 26-Jan-ITP | Seti Mussa | sprint 3 | coursework implement and rewrite #1278Seti-Jemal wants to merge 12 commits intoCodeYourFuture:mainfrom
Conversation
cjyuan
left a comment
There was a problem hiding this comment.
-
The
isProperFraction()function is not quite correct. The other two functions are good. -
This exercise also expects you to implement the Jest tests in the
rewrite-tests-with-jestfolder.
| assertEquals(isProperFraction(3, 5), true); | ||
| assertEquals(isProperFraction(4, 8), true); | ||
| assertEquals(isProperFraction(-1, 2), true); | ||
| assertEquals(isProperFraction(-1, -2), true); | ||
| assertEquals(isProperFraction(1, -2), true); | ||
|
|
||
| //Not | ||
| assertEquals(isProperFraction(9, 7), false); | ||
| assertEquals(isProperFraction(13, 11), false); | ||
| assertEquals(isProperFraction(19, 10), false); | ||
| assertEquals(isProperFraction(17, 3), false); |
There was a problem hiding this comment.
-
Your current function cannot yet pass all these tests.
-
You can also test some improper fractions with negative numerator or/and denominator.
There was a problem hiding this comment.
I have applied the feedbacks.
There was a problem hiding this comment.
-
If you have made any new commit, don't forget to push the commit also to GitHub.
-
If your PR is ready to be re-reviewed, don't forget to add the "Needs Review" label.
…github.com/Seti-Jemal/Module-Structuring-and-Testing-Data into coursework-sprint-3--implement-and-rewrite
| test(`should return true when numerator is less than denominator`, () => { | ||
| expect(isProperFraction(5, 9)).toEqual(true); | ||
| }); | ||
|
|
||
| // Special case; negative numerator and positive denominatore | ||
| test(` should return true when numertaor is negative and less than demoniator`, () => { | ||
| expect(isProperFraction(-5, 9)).toEqual(true); | ||
| }); | ||
|
|
||
| // special case: postive numerator and negative deminator | ||
| test(`should return true when numerator is positive and less than denominator`, () => { | ||
| expect(isProperFraction(5, -9)).toEqual(true); | ||
| }); | ||
|
|
||
| // Special case: negative numerator and negative denominator | ||
| test(`should return true when both are negative`, () => { | ||
| expect(isProperFraction(-5, -9)).toEqual(true); | ||
| }); |
There was a problem hiding this comment.
These descriptions are not quite correct without mentioning the comparison is to be made on their absolute value. For example, 5 is actually more than -9, but abs(5) < abs(9).
Note: We can use pseudo-code and notations like abs(...) or | ... | in the descriptions to more
concisely describe the conditions (the "when" part).
Self checklist
Changelist
I have completed the Sprint 3 implement and rewrite test
Questions
N/A