1111// execute the code to ensure all tests pass.
1212
1313function 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
2233function assertEquals ( actualOutput , targetOutput ) {
@@ -31,3 +42,10 @@ function assertEquals(actualOutput, targetOutput) {
3142
3243// Example: 1/2 is a proper fraction
3344assertEquals ( 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