Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
cjyuan
left a comment
There was a problem hiding this comment.
Code looks good.
It seems you might have misunderstood the definition of proper fraction.
| test(`should return "Invalid angle" when (angle === Invalid)`, () => { | ||
| // Test various invalid angles, including boundary cases | ||
| expect(getAngleType(361)).toEqual("Invalid angle"); | ||
| expect(getAngleType(0)).toEqual("Invalid angle"); | ||
| expect(getAngleType(-181)).toEqual("Invalid angle"); | ||
| }); |
There was a problem hiding this comment.
-
"(angle === Invalid)" does not quite tell which angles are considered invalid.
-
0is a good boundary case to check. Could you think of the other boundary case?
| // Special case: numerator is negative number | ||
| test(`should return true when denominator is 1`, () => { | ||
| expect(isProperFraction(-1, 1)).toEqual(false); | ||
| }); |
There was a problem hiding this comment.
-1 / 1, which is equal to -1, is not a proper fraction.
Could you look up the definition of "proper fraction" and then update the tests and your function implementation?
…eworked negative case in the proper fraction file
|
May I ask which authoritative source you used for the definition of a proper fraction? Are |
|
Hi CJ
May I ask which authoritative source you used for the definition of a
proper fraction?
I watched several youtube videos to better my understanding. Please let me
know if there's a specific authoritative source for reference
Are $\frac{-2}{3}$, $\frac{2}{-3}$ (which equals to $-\frac{2}{3}$) and
$\frac{-2}{-3}$ (which equals to $\frac{2}{3}$) proper fractions?
My understanding is yes, all examples are proper fractions because the
numerator is smaller than the denominator. I believe the negative sign is
ignored and only numbers are compared in which case, in your examples, the
numerator is smaller. Again that's my understanding, please advise if my
understanding is incorrect
Thank you
…On Fri, 23 Oct 2026 at 02:10, CJ Yuan ***@***.***> wrote:
*cjyuan* left a comment
(CodeYourFuture/Module-Structuring-and-Testing-Data#1692)
<#1692 (comment)>
May I ask which authoritative source you used for the definition of a
proper fraction?
Are $\frac{-2}{3}$, $\frac{2}{-3}$ (which equals to $-\frac{2}{3}$) and
$\frac{-2}{-3}$ (which equals to $\frac{2}{3}$) proper fractions?
—
Reply to this email directly, view it on GitHub
<#1692?email_source=notifications&email_token=A5MQRTTEFB2WRNXNZAUTRPT5VKVYRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMMZVGQ4TIOJQHE3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-6354949096>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5MQRTSBJ5I4QYDTNMV3J4L5VKVYRAVCNFSNUABFKJSXA33TNF2G64TZHM3TSOJSGQ2TGNRYHNEXG43VMU5TKOBSGY4TOOBQGIZKC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/A5MQRTXYENXTSAVJNREYLAL5VKVYRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMMZVGQ4TIOJQHE3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/A5MQRTRSXGHTWDPNAM3QAAT5VKVYRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMMZVGQ4TIOJQHE3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
<CodeYourFuture/Module-Structuring-and-Testing-Data/pull/1692/c6354949096@
github.com>
|
Yes. That's the way to determine if a fraction involving negative numbers is proper or not. I raised the question because your implementation does not agree with your tests. Also, the test description "should return true when denominator is two" could be misleading because |
|
Great, thanks for your confirmation.
Can I please confirm the scenario you are referring to here?
Also, the test description "should return true when denominator is two"
could be misleading because
1/2 is a proper fraction but 3/2 is not a proper fraction. Instead, you
could describe the condition in terms of *numerator* and *denominator*.
If it's the one below, could you please explain why it's misleading if the //
Special case: numerator is One?
// Special case: numerator is One
test(`should return true when denominator is two`, () => {
expect(isProperFraction(1, 2)).toEqual(true);
});
…On Thu, 29 Oct 2026 at 22:31, CJ Yuan ***@***.***> wrote:
*cjyuan* left a comment
(CodeYourFuture/Module-Structuring-and-Testing-Data#1692)
<#1692 (comment)>
the negative sign is ignored and only numbers are compared in which case
Yes. That's the way to determine if a fraction involving negative numbers
is proper or not.
I raised the question because your implementation does not agree with your
tests.
------------------------------
Also, the test description "should return true when denominator is two"
could be misleading because
1/2 is a proper fraction but 3/2 is not a proper fraction. Instead, you
could describe the condition in terms of *numerator* and *denominator*.
—
Reply to this email directly, view it on GitHub
<#1692?email_source=notifications&email_token=A5MQRTT7JCQCDLE3M67RPB35WPANVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNJQHE4TENBUHE3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-6509924496>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5MQRTQFELOOINLKCKBHDQ35WPANVAVCNFSNUABFKJSXA33TNF2G64TZHM3TSOJSGQ2TGNRYHNEXG43VMU5TKOBSGY4TOOBQGIZKC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/A5MQRTWLFLT7WMUXIBWB2NT5WPANVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNJQHE4TENBUHE3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/A5MQRTRSSCVWTB72BDVE46L5WPANVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNJQHE4TENBUHE3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
<CodeYourFuture/Module-Structuring-and-Testing-Data/pull/1692/c6509924496@
github.com>
|
|
The description A more specific description could be Alternatively, you could consider classifying test cases into categories and test samples in each category. For example, // Note: abs(x) means absolute value of x.
test(`should return true when abs(numerator) < abs(denominator)`, () => {
expect(isProperFraction(1, 2)).toEqual(true);
expect(isProperFraction(-1, 2)).toEqual(true);
expect(isProperFraction(1, -2)).toEqual(true);
expect(isProperFraction(-1, -2)).toEqual(true);
}); |
Task code
CYF-1059
Changelist
21/10 - updated invalid range and description in the get and angle file and reworked negative case in the proper fraction file
Uploaded implement and rewrite tests coursework