Glasgow | 26-ITP-Jan| Martin McLean |Sprint 3| implement and rewrite tests coursework#1019
Glasgow | 26-ITP-Jan| Martin McLean |Sprint 3| implement and rewrite tests coursework#1019mjm-git185 wants to merge 6 commits intoCodeYourFuture:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
LonMcGregor
left a comment
There was a problem hiding this comment.
Good work on these tasks, just a couple of things to take another look at
| ); | ||
| } | ||
|
|
||
| assertEquals(getAngleType(320), "Acute angle"); |
There was a problem hiding this comment.
Are you sure this test case has the correct expected value?
|
|
||
| function isProperFraction(numerator, denominator) { | ||
| // TODO: Implement this function | ||
| if (numerator >= denominator) { |
There was a problem hiding this comment.
Think about the clean code examples we discussed a while ago - is there a way you could simplify this function further?
LonMcGregor
left a comment
There was a problem hiding this comment.
Good changes. In the isProperFraction function - you have made the branching a bit simpler, but you could probably take it a bit further. (hint: Think about how you are returning values.)
LonMcGregor
left a comment
There was a problem hiding this comment.
I think in our call we got this even more refined - did you submit your most recent commit?
LonMcGregor
left a comment
There was a problem hiding this comment.
The angle and the card tasks are complete now, and good work adding extra test cases.
I think you still need to make some changes to the fractions task, I've left some comments there.
| }); | ||
| test(`Should return the correct answer for negative numerators (numerator < denominator)`,()=>{ | ||
| expect(isProperFraction(-1,2)).toEqual(true) | ||
| expect(isProperFraction(-100,2)).toEqual(true) |
There was a problem hiding this comment.
Are you sure -100/2 is a valid proper fraction?
|
|
||
| function isProperFraction(numerator, denominator) { | ||
| // TODO: Implement this function | ||
| numerator = Math.sign(numerator) * Math.abs(numerator); |
There was a problem hiding this comment.
Good idea to use Math.abs, though I am not sure you need Math.sign here. There might also be an issue in a test case that means this implementation isn't being fully tested.
Changelist
my coursework