Skip to content

Commit 1f0b098

Browse files
authored
1-get-angle-type.js
1 parent 408f2e1 commit 1f0b098

File tree

1 file changed

+4
-34
lines changed

1 file changed

+4
-34
lines changed

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

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,8 @@ function getAngleType(angle) {
1111
if (angle === 90) {
1212
return "Right angle";
1313
}
14-
if (angle < 90 && angle > 0) {
15-
return "Acute angle";
16-
}
17-
if (angle > 90 && angle < 180) {
18-
return "Obtuse angle";
19-
}
20-
if (angle === 180) {
21-
return "Straight angle";
22-
}
23-
if (angle > 180 && angle < 360) {
24-
return "Reflex angle";
25-
}
26-
return "Invalid angle";
14+
// Run the tests, work out what Case 2 is testing, and implement the required code here.
15+
// Then keep going for the other cases, one at a time.
2716
}
2817

2918
// The line below allows us to load the getAngleType function into tests in other files.
@@ -61,33 +50,14 @@ assertEquals(acute, "Acute angle");
6150
// When the angle is greater than 90 degrees and less than 180 degrees,
6251
// Then the function should return "Obtuse angle"
6352
const obtuse = getAngleType(120);
64-
assertEquals(obtuse, "Obtuse angle");
53+
// ====> write your test here, and then add a line to pass the test in the function above
6554

6655
// Case 4: Identify Straight Angles:
6756
// When the angle is exactly 180 degrees,
6857
// Then the function should return "Straight angle"
6958
// ====> write your test here, and then add a line to pass the test in the function above
70-
const straight = getAngleType(180);
71-
assertEquals(straight, "Straight angle");
59+
7260
// Case 5: Identify Reflex Angles:
7361
// When the angle is greater than 180 degrees and less than 360 degrees,
7462
// Then the function should return "Reflex angle"
7563
// ====> write your test here, and then add a line to pass the test in the function above
76-
const reflex = getAngleType(270);
77-
assertEquals(reflex, "Reflex angle");
78-
79-
let angle = 120;
80-
console.log(angle + " degrees is a " + getAngleType(angle));
81-
angle = 45;
82-
console.log(angle + " degrees is a " + getAngleType(angle));
83-
angle = 90;
84-
console.log(angle + " degrees is a " + getAngleType(angle));
85-
angle = 180;
86-
console.log(angle + " degrees is a " + getAngleType(angle));
87-
angle = 270;
88-
console.log(angle + " degrees is a " + getAngleType(angle));
89-
angle = -10;
90-
console.log(angle + " degrees is a " + getAngleType(angle));
91-
angle = 400;
92-
console.log(angle + " degrees is a " + getAngleType(angle));
93-
// Case 6: Handle Invalid Angles:

0 commit comments

Comments
 (0)