Skip to content

Commit 9207345

Browse files
committed
test: add cases for proper and improper fractions
1 parent f9a510e commit 9207345

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ function assertEquals(actualOutput, targetOutput) {
5151

5252
// TODO: Write tests to cover all cases, including boundary and invalid cases.
5353
// Example: Identify Right Angles
54-
const right = getAngleType(45);
54+
const right = getAngleType(90);
5555
assertEquals(right, "Right angle");
5656
const acute = getAngleType(45);
5757
assertEquals(acute, "Acute angle");
58-
const obtuse = getAngleType(180);
58+
const obtuse = getAngleType(110);
5959
assertEquals(obtuse, "Obtuse angle");
6060
const straight = getAngleType(180);
6161
assertEquals(straight, "Straight angle");

Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
// execute the code to ensure all tests pass.
1212

1313
function isProperFraction(numerator, denominator) {
14-
// TODO: Implement this function
14+
if (numerator < denominator ){
15+
return true;
16+
}
17+
return false;
1518
}
1619

1720
// The line below allows us to load the isProperFraction function into tests in other files.
@@ -30,4 +33,9 @@ function assertEquals(actualOutput, targetOutput) {
3033
// What combinations of numerators and denominators should you test?
3134

3235
// Example: 1/2 is a proper fraction
33-
assertEquals(isProperFraction(1, 2), true);
36+
assertEquals(isProperFraction(3, 2), false);
37+
assertEquals(isProperFraction(2, 2), false);
38+
assertEquals(isProperFraction(3, 4), true);
39+
assertEquals(isProperFraction(5, 3), false);
40+
assertEquals(isProperFraction(0, 5), true);
41+
console.log("✓ All test executed!");

0 commit comments

Comments
 (0)