Skip to content

Commit e6b8b53

Browse files
committed
Added tests for 0 with negative denominator or numerator
1 parent 248c2e8 commit e6b8b53

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,11 @@ test("Improper fraction with negative number: -Numerator > Denominator", () => {
4242
test("Proper fraction with negative numbers: -Numerator < -Denominator", () => {
4343
assert.equal(isProperFraction(-1, -2), true);
4444
});
45+
46+
test("Proper fraction with negative Numerator and Zero: -Numerator < 0", () => {
47+
assert.equal(isProperFraction(-1, 0), false);
48+
});
49+
50+
test("Proper fraction with Zero and negative Denominator: 0 < -Denominator", () => {
51+
assert.equal(isProperFraction(0, -2), false);
52+
});

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,17 @@ test(`should return false when: -Numerator > Denominator`, () => {
6060
expect(isProperFraction(-5, 4)).toEqual(false);
6161
expect(isProperFraction(-20, 10)).toEqual(false);
6262
});
63+
64+
// Special case: Improper fraction with negative Numerator and 0: -Numerator > 0
65+
test(`should return false when: -Numerator > Denominator`, () => {
66+
expect(isProperFraction(-2, 0)).toEqual(false);
67+
expect(isProperFraction(-5, 0)).toEqual(false);
68+
expect(isProperFraction(-20, 0)).toEqual(false);
69+
});
70+
71+
// Special case: Improper fraction with 0 and negative Denominator: 0 > -Denominator
72+
test(`should return false when: -Numerator > Denominator`, () => {
73+
expect(isProperFraction(0, -1)).toEqual(false);
74+
expect(isProperFraction(0, -4)).toEqual(false);
75+
expect(isProperFraction(0, -10)).toEqual(false);
76+
});

0 commit comments

Comments
 (0)