Skip to content

Commit 5c0d472

Browse files
committed
implemented function and tested
1 parent 5ad372d commit 5c0d472

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

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

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

1313
function isProperFraction(numerator, denominator) {
14-
// TODO: Implement this function
14+
if (numerator <= denominator && numerator > 0) {
15+
return true;
16+
} else {
17+
return false;
18+
}
1519
}
1620

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

3236
// Example: 1/2 is a proper fraction
3337
assertEquals(isProperFraction(1, 2), true);
38+
assertEquals(isProperFraction(0, 4), false);
39+
assertEquals(isProperFraction(5, 5), true);
40+
assertEquals(isProperFraction(-8, 2), false);
41+
assertEquals(isProperFraction(4, 0), false);
42+
assertEquals(isProperFraction(0, 0), false);
43+
assertEquals(isProperFraction(-2, -2), false)
44+

0 commit comments

Comments
 (0)