Skip to content

Commit 41df520

Browse files
committed
get fraction test file update
1 parent a69d461 commit 41df520

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

‎Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,31 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
88
test(`should return false when denominator is zero`, () => {
99
expect(isProperFraction(1, 0)).toEqual(false);
1010
});
11+
12+
// Case 1: Standard Positive Numbers
13+
test("should handle standard positive fractions correctly", () => {
14+
expect(isProperFraction(1, 2)).toEqual(true);
15+
expect(isProperFraction(5, 3)).toEqual(false);
16+
});
17+
18+
// Case 2: Equal Numbers (Boundary)
19+
test("should return false when numerator and denominator are equal", () => {
20+
expect(isProperFraction(5, 5)).toEqual(false); // Equals 1 whole (Improper)
21+
});
22+
23+
// Case 3: Numerator is Zero
24+
test("should return true when numerator is zero and denominator is positive", () => {
25+
expect(isProperFraction(0, 5)).toEqual(true);
26+
});
27+
28+
// Case 4: Negative Numbers
29+
test("should handle negative integers according to mathematical comparison rules", () => {
30+
expect(isProperFraction(-5, -2)).toEqual(true);
31+
expect(isProperFraction(-1, -4)).toEqual(false);
32+
});
33+
34+
// Case 5: Mixed Positive and Negative Numbers
35+
test("should return true when only the numerator is negative", () => {
36+
expect(isProperFraction(-1, 2)).toEqual(true);
37+
expect(isProperFraction(1, -2)).toEqual(false);
38+
});

0 commit comments

Comments
 (0)