-
-
Notifications
You must be signed in to change notification settings - Fork 245
London | 25-ITP-SEP | Imran Mohamed| Sprint 3 | Coursework/sprint 3 implement and rewrite #791
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
1ee1bc0
17de75c
0db0719
58b4b7e
0e18f06
2755b3f
014892f
ccb6ce8
d40b0a5
4e519a1
38c863e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
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 need to work on the other two acceptance criterias not accounted for. The instruction says: "complete the rest of the tests and cases", you have completed two cases in the acceptance criteria and two cases in the strech, you need to complete the remaining two cases in the acceptance criteria.
Author
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. amended to address the remaining 2 cases in acceptance criteria |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,11 +8,25 @@ | |
| // write one test at a time, and make it pass, build your solution up methodically | ||
|
|
||
| function isProperFraction(numerator, denominator) { | ||
| if (numerator < denominator) { | ||
| if (Math.abs(numerator) < Math.abs(denominator)) { | ||
| return true; | ||
|
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 matches acceptance criteria 1 which is "proper fraction check" |
||
| } | ||
| if (numerator >= denominator) { | ||
| return false; | ||
| } | ||
|
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 matches acceptance criteria 2 which is "improper fraction check" |
||
| if (numerator == 0 && denominator !== 0) { | ||
| return true; | ||
| } | ||
|
Author
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 is a stretch scenario I created, I have updated the code to ensure the condition also checks that the denominator is non-zero. 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 matches stretch scenario 1 which "Zero numerator check" |
||
| if (denominator === 0) { | ||
| return false; | ||
| } | ||
|
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 matches stretch scenario 2 which is "zero denominator check" |
||
| if (numerator == denominator) { | ||
| return false; | ||
| } | ||
| if (numerator < 0 && denominator > 0 && Math.abs(numerator) < denominator) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| // The line below allows us to load the isProperFraction function into tests in other files. | ||
| // This will be useful in the "rewrite tests with jest" step. | ||
| module.exports = isProperFraction; | ||
|
|
@@ -47,13 +61,48 @@ assertEquals(improperFraction, false); | |
| // Explanation: The fraction -4/7 is a proper fraction because the absolute value of the numerator (4) is less than the denominator (7). The function should return true. | ||
| const negativeFraction = isProperFraction(-4, 7); | ||
| // ====> complete with your assertion | ||
|
|
||
| assertEquals(negativeFraction, true); | ||
| // Equal Numerator and Denominator check: | ||
| // Input: numerator = 3, denominator = 3 | ||
| // target output: false | ||
| // Explanation: The fraction 3/3 is not a proper fraction because the numerator is equal to the denominator. The function should return false. | ||
| const equalFraction = isProperFraction(3, 3); | ||
| // ====> complete with your assertion | ||
|
|
||
| assertEquals(equalFraction, false); | ||
| // Stretch: | ||
| // What other scenarios could you test for? | ||
| // Zero Numerator check: | ||
| // Input: numerator = 0, denominator = 5 | ||
| // target output: true | ||
| // Explanation: The fraction 0/5 is a proper fraction because the numerator (0) is less than the denominator (5). The function should return true. | ||
| const zeroNumerator = isProperFraction(0, 5); | ||
| // ====> complete with your assertion | ||
| assertEquals(zeroNumerator, true); | ||
| // Zero Denominator check: | ||
| // Input: numerator = 4, denominator = 0 | ||
| // target output: false | ||
| // Explanation: The fraction 4/0 is undefined because division by zero is not allowed. The function should return false. | ||
| const zeroDenominator = isProperFraction(4, 0); | ||
| // ====> complete with your assertion | ||
| assertEquals(zeroDenominator, false); | ||
| // Negative Denominator check: | ||
| // Input: numerator = 3, denominator = -5 | ||
| // target output: true | ||
| // Explanation: The fraction 3/-5 is a proper fraction because the absolute value of the numerator (3) is less than the absolute value of the denominator (5). The function should return true. | ||
| const negativeDenominator = isProperFraction(3, -5); | ||
| // ====> complete with your assertion | ||
| assertEquals(negativeDenominator, true); | ||
| // Both Negative check: | ||
| // Input: numerator = -2, denominator = -6 | ||
| // target output: true | ||
| // Explanation: The fraction -2/-6 is a proper fraction because the absolute value of the numerator (2) is less than the absolute value of the denominator (6). The function should return true. | ||
| const bothNegative = isProperFraction(-2, -6); | ||
| // ====> complete with your assertion | ||
| assertEquals(bothNegative, true); | ||
| // Zero Numerator and Denominator check: | ||
| // Input: numerator = 0, denominator = 0 | ||
| // target output: false | ||
| // Explanation: The fraction 0/0 is undefined. The function should return false. | ||
| const zeroNumeratorDenominator = isProperFraction(0, 0); | ||
| // ====> complete with your assertion | ||
| assertEquals(zeroNumeratorDenominator, false); | ||
|
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. I think you should review the acceptance criteria again for this and follow it.
Author
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. amended to throw error as opposed to returning for invalid cards |
|
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. The test are okay |
|
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. The test structure is okay |
|
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. The test structure here looks okay, just confirm that the get-card-value.js follows the acceptance criteria
Author
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. amended to throw error as opposed to returning error for invalid cards |
Uh oh!
There was an error while loading. Please reload this page.
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.
I think your implementation of the getAngleType function is logically correct, and follow TDD principles good work