Skip to content

Commit fcd184f

Browse files
committed
practicing asserting tests
1 parent f34d033 commit fcd184f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99

1010
function isProperFraction(numerator, denominator) {
1111
if (numerator < denominator) {
12-
return true;
12+
return true ;
13+
}
14+
else {
15+
return false;
1316
}
1417
}
1518

@@ -38,22 +41,29 @@ assertEquals(properFraction, true);
3841
// Input: numerator = 5, denominator = 2
3942
// target output: false
4043
// Explanation: The fraction 5/2 is an improper fraction, where the numerator is greater than or equal to the denominator. The function should return false.
41-
const improperFraction = isProperFraction(5, 2);
42-
assertEquals(improperFraction, false);
44+
const properFraction2 = isProperFraction(5, 2);
45+
assertEquals(properFraction2, false);
4346

4447
// Negative Fraction check:
4548
// Input: numerator = -4, denominator = 7
4649
// target output: true
4750
// Explanation: The fraction -4/7 is a proper fraction because the absolute value of the numerator (4) is less than the denominator (7). The function should return true.
4851
const negativeFraction = isProperFraction(-4, 7);
52+
assertEquals(negativeFraction, true);
4953
// ====> complete with your assertion
5054

5155
// Equal Numerator and Denominator check:
5256
// Input: numerator = 3, denominator = 3
5357
// target output: false
5458
// Explanation: The fraction 3/3 is not a proper fraction because the numerator is equal to the denominator. The function should return false.
5559
const equalFraction = isProperFraction(3, 3);
56-
// ====> complete with your assertion
60+
assertEquals(equalFraction, false);
5761

5862
// Stretch:
5963
// What other scenarios could you test for?
64+
65+
const properFraction3 = isProperFraction(0, 6);
66+
assertEquals(properFraction3,true)
67+
68+
const properFraction4 = isProperFraction(0, 1);
69+
assertEquals(properFraction4, true);

0 commit comments

Comments
 (0)