-
-
Notifications
You must be signed in to change notification settings - Fork 240
London | 25-ITP-Sep | Shaghayegh Shirinfar | Sprint 3 | Implement-and-rewrite-tests #817
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?
London | 25-ITP-Sep | Shaghayegh Shirinfar | Sprint 3 | Implement-and-rewrite-tests #817
Conversation
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.
- Why not include a brief description of the changes made in this PR in the "Changelist" section of this PR description?
Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js
Outdated
Show resolved
Hide resolved
| const num = Number(rank); | ||
| if (num >= 2 && num <= 9) { | ||
| return num; | ||
| } |
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.
In JavaScript, strings that represent valid numeric literals in the language can be safely
converted to equivalent numbers or parsed into a valid integers.
Do you want to recognize these string values as valid ranks?
To find out what these strings are, you can ask AI
What kinds of string values would make
Number(rank)evaluate to2in JS?
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 did the changes in the code since we just need specific number and letters in our exercise.
thank you for your help
| // Case 5: Negative denominator | ||
| test("should return true when denominator is negative and proper", () => { | ||
| expect(isProperFraction(2, -5)).toEqual(true); | ||
| }); |
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.
Can your function pass this test?
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 change my code
from if (Math.abs(numerator) < (denominator))
to if (Math.abs(numerator) < Math.abs(denominator))
so that it also works with negative denominators.
| test("should return true for a negative proper fraction (numerator < denominator)", () => { | ||
| expect(isProperFraction(-4, 7)).toEqual(true); | ||
| }); |
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.
What about negative improper fraction?
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 made some changes to the is-proper-fraction function , it works correctly now.
Thank you for your guides
|
Dear Cj |
Learners, PR Template
Self checklist