Glasgow | 26-ITP-May | Niangh Ciang | Sprint 3 | Implement and rewrite tests - #1401
Conversation
LonMcGregor
left a comment
There was a problem hiding this comment.
Very good work on these. It's just your fractions implementation that needs another update
|
|
||
| function isProperFraction(numerator, denominator) { | ||
| // TODO: Implement this function | ||
| if (numerator > 0 && denominator > 0 && numerator < denominator) { |
There was a problem hiding this comment.
Could this function be simplified? (Hint: your are returning true/false from an if condition)
| assertEquals(isProperFraction(1, 2), true); | ||
| assertEquals(isProperFraction(5, 10), true); | ||
| assertEquals(isProperFraction(2, 3), true); | ||
| assertEquals(isProperFraction(-2, 4), false); |
There was a problem hiding this comment.
-2/4 is actually a proper fraction. Can you check your test and implementation to see how to resolve this?
| expect(isProperFraction(1, 2)).toEqual(true); | ||
| expect(isProperFraction(3, 5)).toEqual(true); | ||
| }); | ||
| test("should return false when numerator is negative", () => { |
There was a problem hiding this comment.
See also my remark above. Fractions can have a negative numerator and still be valid proper fractions.
|
Hello, I have fixed the proper fraction logic. |
LonMcGregor
left a comment
There was a problem hiding this comment.
Great work, this task is complete now
|
Closing PR because the May ITP run has finished. Feel free to re-open if you're still working on it. |
Self checklist
Changelist
Implemented all three functions and rewrote their test suites using Jest.
Covered all required cases including valid, boundary, and invalid inputs.