You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 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.
42
44
constnegativeFraction=isProperFraction(-4,7);
43
-
// ====> complete with your assertion
45
+
assertEquals(negativeFraction,true);
44
46
45
47
// Equal Numerator and Denominator check:
46
48
// Input: numerator = 3, denominator = 3
47
49
// target output: false
48
50
// Explanation: The fraction 3/3 is not a proper fraction because the numerator is equal to the denominator. The function should return false.
49
51
constequalFraction=isProperFraction(3,3);
50
-
// ====> complete with your assertion
52
+
assertEquals(equalFraction,false);
51
53
52
54
// Stretch:
53
55
// What other scenarios could you test for?
56
+
57
+
// Other scenarios to test could include:
58
+
59
+
// Cases where the numerator or denominator is zero (e.g., 0/5, 5/0) —
60
+
// especially to check for division by zero or invalid fractions.
61
+
62
+
// Fractions with negative denominators (e.g., 3/-4)
63
+
// to see if the function handles sign correctly.
64
+
65
+
// Very large numbers
66
+
// to check if the function works with large integers.
0 commit comments