-
-
Notifications
You must be signed in to change notification settings - Fork 336
London | ITP-JAN-2026 | Said Fayaz Sadat | Sprint 3 | coursework/sprint-3/implement-and-rewrite-tests #1221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 13 commits
62f2bc9
5218dc7
4541230
60dd1f1
d0b2a26
22cbee3
9ab2716
a517fe7
40bd7ce
8c587a2
560d5c6
401d8cb
48cfeba
595de00
e21d0fd
921a30a
8a9fab6
89c02e7
b3bbf8a
0f7221f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,43 @@ test(`should return "Acute angle" when (0 < angle < 90)`, () => { | |
| }); | ||
|
|
||
| // Case 2: Right angle | ||
| test(`should return "Right angle" when (angle === 90)`, () => { | ||
| expect(getAngleType(90)).toEqual("Right angle"); | ||
| }); | ||
|
|
||
| // Case 3: Obtuse angles | ||
| test(`should return "Obtuse angle" when (90 < angle < 180)`, () => { | ||
| expect(getAngleType(91)).toEqual("Obtuse angle"); | ||
| expect(getAngleType(135)).toEqual("Obtuse angle"); | ||
| expect(getAngleType(179)).toEqual("Obtuse angle"); | ||
| }); | ||
|
|
||
| // Case 4: Straight angle | ||
| test(`should return "Straight angle" when (angle === 180)`, () => { | ||
| expect(getAngleType(180)).toEqual("Straight angle"); | ||
| }); | ||
|
|
||
| // Case 5: Reflex angles | ||
| test(`should return "Reflex angle" when (180 < angle < 360)`, () => { | ||
| expect(getAngleType(181)).toEqual("Reflex angle"); | ||
| expect(getAngleType(270)).toEqual("Reflex angle"); | ||
| expect(getAngleType(359)).toEqual("Reflex angle"); | ||
| }); | ||
|
|
||
| // Case 6: Invalid angles | ||
| test(`should return "Invalid angle" when angle < 1 `, () => { | ||
| expect(getAngleType(-1)).toEqual("Invalid angle"); | ||
| }); | ||
|
|
||
| test(`should return "Invalid angle" when angle > 360 `, () => { | ||
| expect(getAngleType(361)).toEqual("Invalid angle"); | ||
| }); | ||
|
|
||
| // Largest valid angle(boundary case) | ||
| test(`should return "Straight angle" when angle is the maximum valid value (360)`, () => { | ||
| expect(getAngleType(360)).toEqual("Straight angle"); | ||
| }); | ||
| // Smallest valid angle(boundary case) | ||
| test(`should return "Acute angle" when angle is the minimum valid value (1)`, () => { | ||
| expect(getAngleType(1)).toEqual("Acute angle"); | ||
| }); | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,28 @@ const isProperFraction = require("../implement/2-is-proper-fraction"); | |
|
|
||
| // TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories. | ||
|
|
||
| // Special case: numerator is zero | ||
| test(`should return false when denominator is zero`, () => { | ||
| expect(isProperFraction(1, 0)).toEqual(false); | ||
|
|
||
| // Category 1: Numerator is zero | ||
| test("should return true when numerator is zero and denominator is positive", () => { | ||
| expect(isProperFraction(0, 1)).toBe(true); | ||
| }); | ||
| test("should return true when numerator is zero and denominator is negative", () => { | ||
| expect(isProperFraction(0, -1)).toBe(true); | ||
| }); | ||
|
|
||
| // Category 2: Proper fractions (numerator < denominator) | ||
| test("should return true when numerator is less than denominator", () => { | ||
| expect(isProperFraction(1, 2)).toBe(true); | ||
| expect(isProperFraction(3, 5)).toBe(true); | ||
| }); | ||
|
|
||
| // Category 3: Improper fractions (numerator >= denominator) | ||
| test("should return false when numerator is greater than or equal to denominator", () => { | ||
|
||
| expect(isProperFraction(2, 1)).toBe(false); | ||
| expect(isProperFraction(5, 5)).toBe(false); | ||
| }); | ||
cjyuan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Category 4: Denominator is zero | ||
| test("should return false when denominator is zero", () => { | ||
| expect(isProperFraction(1, 0)).toBe(false); | ||
| }); | ||
cjyuan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.