Skip to content

Commit 7d6f00f

Browse files
committed
Implemented isProperFraction function
1 parent 73c3708 commit 7d6f00f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

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

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

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

0 commit comments

Comments
 (0)