1212
1313function isProperFraction ( numerator , denominator ) {
1414 // TODO: Implement this function
15+ if ( denominator === 0 ) {
16+ return false ;
17+ }
18+ return numerator < denominator ;
1519}
1620
1721// The line below allows us to load the isProperFraction function into tests in other files.
@@ -31,3 +35,24 @@ function assertEquals(actualOutput, targetOutput) {
3135
3236// Example: 1/2 is a proper fraction
3337assertEquals ( isProperFraction ( 1 , 2 ) , true ) ;
38+ // Proper fractions
39+ assertEquals ( isProperFraction ( 2 , 3 ) , true ) ;
40+ assertEquals ( isProperFraction ( 3 , 4 ) , true ) ;
41+ assertEquals ( isProperFraction ( 0 , 5 ) , true ) ;
42+
43+ // Improper fractions
44+ assertEquals ( isProperFraction ( 5 , 5 ) , false ) ;
45+ assertEquals ( isProperFraction ( 7 , 3 ) , false ) ;
46+
47+ // Denominator zero
48+ assertEquals ( isProperFraction ( 5 , 0 ) , false ) ;
49+
50+ // Negative numerators
51+ assertEquals ( isProperFraction ( - 1 , 2 ) , true ) ;
52+
53+ // Negative denominators
54+ assertEquals ( isProperFraction ( 1 , - 2 ) , false ) ;
55+
56+ // Both negative
57+ assertEquals ( isProperFraction ( - 3 , - 2 ) , false ) ;
58+
0 commit comments