Skip to content

Commit bc93560

Browse files
I implemented the isProperFunction and wrote different test cases for it.
1 parent 646d6a5 commit bc93560

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

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

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

1313
function isProperFraction(numerator, denominator) {
14+
if( numerator < denominator) {
15+
return true;
16+
}
17+
else {return false; }
18+
1419
// TODO: Implement this function
1520
}
1621

@@ -31,3 +36,18 @@ function assertEquals(actualOutput, targetOutput) {
3136

3237
// Example: 1/2 is a proper fraction
3338
assertEquals(isProperFraction(1, 2), true);
39+
// inproper fraction:
40+
assertEquals (isProperFraction(5, 3), false );
41+
42+
// equal numbers
43+
assertEquals (isProperFraction(4, 4), false );
44+
45+
// negative numbers
46+
assertEquals (isProperFraction(-2, 4), true );
47+
assertEquals (isProperFraction(5, -4), false );
48+
assertEquals (isProperFraction (-3,-5), false);
49+
50+
// special case
51+
assertEquals(isProperFraction(1,0) , false);
52+
53+
assertEquals (isProperFraction (0,5), true);

0 commit comments

Comments
 (0)