Skip to content

Commit 9542809

Browse files
committed
commit
1 parent 2940579 commit 9542809

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// execute the code to ensure all tests pass.
1212

1313
function isProperFraction(numerator, denominator) {
14-
// TODO: Implement this function
14+
return Math.abs(numerator) < Math.abs(denominator)
1515
}
1616

1717
// The line below allows us to load the isProperFraction function into tests in other files.
@@ -31,3 +31,27 @@ function assertEquals(actualOutput, targetOutput) {
3131

3232
// Example: 1/2 is a proper fraction
3333
assertEquals(isProperFraction(1, 2), true);
34+
35+
//Case 2: 5/5 is not a proper fraction
36+
assertEquals(isProperFraction(5,5), false);
37+
38+
//Case 3: (-3)/(-5) is a proper fraction
39+
assertEquals(isFinite(-3,-5), true);
40+
41+
//Case 4: (-4)/6 is a proper fraction
42+
assertEquals(isProperFraction(-4,6),true);
43+
44+
//case 5: 5/(-8) is a proper fraction
45+
assertEquals(isProperFraction(5,-8), true);
46+
47+
//case 6: 9/7 is not a proper fraction
48+
assertEquals(isProperFraction(9,7), false);
49+
50+
//case 7: 7/0 is not a proper fraction
51+
assertEquals(isProperFraction(7,0), false);
52+
53+
//case 8: 0/6 is a proper fraction
54+
assertEquals(isProperFraction(0,6), true);
55+
56+
//case 9: 0/-8 is a proper fraction
57+
assertEquals(isProperFraction(0,-8), true);

0 commit comments

Comments
 (0)