Skip to content

Commit 352348a

Browse files
complete the test
1 parent 64f576d commit 352348a

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

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

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

1313
function isProperFraction(numerator, denominator) {
14-
// TODO: Implement this function
14+
if (denominator === 0){
15+
return false;
16+
}
17+
else if (numerator < denominator)
18+
{
19+
return true;
20+
21+
}
22+
else
23+
{
24+
return false;
25+
}
1526
}
1627

1728
// The line below allows us to load the isProperFraction function into tests in other files.
1829
// This will be useful in the "rewrite tests with jest" step.
19-
module.exports = isProperFraction;
30+
//module.exports = isProperFraction;
2031

2132
// Here's our helper again
2233
function assertEquals(actualOutput, targetOutput) {
@@ -31,3 +42,10 @@ function assertEquals(actualOutput, targetOutput) {
3142

3243
// Example: 1/2 is a proper fraction
3344
assertEquals(isProperFraction(1, 2), true);
45+
assertEquals(isProperFraction(5, 4), false);
46+
assertEquals(isProperFraction(3, 3), false);
47+
assertEquals(isProperFraction(0, 5), true);
48+
assertEquals(isProperFraction(3, 0), false);
49+
assertEquals(isProperFraction(-3, 2), true);
50+
assertEquals(isProperFraction(2, -5), false);
51+
assertEquals(isProperFraction(-2, -3), false);

0 commit comments

Comments
 (0)