Skip to content

Commit 49570d3

Browse files
committed
proper fraction with test cases
1 parent 5209d8d commit 49570d3

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,5 @@ assertEquals(straightAngle, "Straight angle");
6363
assertEquals(invalid1, "Invalid angle");
6464
assertEquals(invalidAngle, "Invalid angle");
6565
assertEquals(reflexAngle2, "Reflex angle");
66+
assertEquals(acute3, "Acute angle");
67+

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313
function isProperFraction(numerator, denominator) {
1414
// TODO: Implement this function
15+
if(numerator>denominator) {
16+
return false
17+
}else{
18+
return true
19+
}
1520
}
1621

1722
// The line below allows us to load the isProperFraction function into tests in other files.
@@ -31,3 +36,12 @@ function assertEquals(actualOutput, targetOutput) {
3136

3237
// Example: 1/2 is a proper fraction
3338
assertEquals(isProperFraction(1, 2), true);
39+
assertEquals(isProperFraction(1, 10000), true);
40+
assertEquals(isProperFraction(100, 2), false);
41+
assertEquals(isProperFraction(1, 0.005), false);
42+
assertEquals(isProperFraction(1e2, 1e3), true);
43+
assertEquals(isProperFraction(1e4, 1e0), false);
44+
assertEquals(isProperFraction(-1, 1), true);
45+
assertEquals(isProperFraction(1, -1), false);
46+
assertEquals(isProperFraction(0, -1), false);
47+
assertEquals(isProperFraction(-1, 0), true);

0 commit comments

Comments
 (0)