Skip to content

Commit 0e5b084

Browse files
author
Enice-Codes
committed
Remove unrelated get-angle-type changes from practice-tdd branch
1 parent 1a326b8 commit 0e5b084

1 file changed

Lines changed: 21 additions & 13 deletions

File tree

Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,31 @@
77
// - "Straight angle" for exactly 180°
88
// - "Reflex angle" for angles greater than 180° and less than 360°
99
// - "Invalid angle" for angles outside the valid range.
10+
1011
// Assumption: The parameter is a valid number. (You do not need to handle non-numeric inputs.)
1112

13+
// Acceptance criteria:
14+
// After you have implemented the function, write tests to cover all the cases, and
15+
// execute the code to ensure all tests pass.
16+
1217
function getAngleType(angle) {
13-
if (angle > 0 && angle < 90) {
14-
return "Acute angle";
15-
} else if (angle === 90) {
16-
return "Right angle";
17-
} else if (angle > 90 && angle < 180) {
18-
return "Obtuse angle";
19-
} else if (angle === 180) {
20-
return "Straight angle";
21-
} else if (angle > 180 && angle < 360) {
22-
return "Reflex angle";
23-
} else {
24-
return "Invalid angle";
25-
}
18+
// TODO: Implement this function
2619
}
2720

2821
// The line below allows us to load the getAngleType function into tests in other files.
22+
// This will be useful in the "rewrite tests with jest" step.
2923
module.exports = getAngleType;
24+
25+
// This helper function is written to make our assertions easier to read.
26+
// If the actual output matches the target output, the test will pass
27+
function assertEquals(actualOutput, targetOutput) {
28+
console.assert(
29+
actualOutput === targetOutput,
30+
`Expected ${actualOutput} to equal ${targetOutput}`
31+
);
32+
}
33+
34+
// TODO: Write tests to cover all cases, including boundary and invalid cases.
35+
// Example: Identify Right Angles
36+
const right = getAngleType(90);
37+
assertEquals(right, "Right angle");

0 commit comments

Comments
 (0)