File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Sprint-3/1-implement-and-rewrite-tests/implement Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 88// write one test at a time, and make it pass, build your solution up methodically
99
1010function isProperFraction ( numerator , denominator ) {
11- return numerator < denominator ;
11+ if ( denominator === 0 ) return false ;
12+ return Math . abs ( numerator ) < Math . abs ( denominator ) ;
1213}
1314
1415// The line below allows us to load the isProperFraction function into tests in other files.
@@ -59,3 +60,9 @@ assertEquals(equalFraction, false);
5960// Explanation: Should return true when numerator is zero
6061const zeroFraction = isProperFraction ( 0 , 5 ) ;
6162assertEquals ( zeroFraction , true ) ;
63+
64+ // New negative cases
65+ assertEquals ( isProperFraction ( - 4 , 3 ) , false ) ;
66+ assertEquals ( isProperFraction ( - 2 , 5 ) , true ) ;
67+ assertEquals ( isProperFraction ( - 1 , 1 ) , false ) ;
68+ assertEquals ( isProperFraction ( - 2 , - 3 ) , true ) ;
You can’t perform that action at this time.
0 commit comments