Skip to content

Commit 919b7f7

Browse files
authored
Allow greater tolerance in RationalTest (exercism#2898)
It has been reported that original tolerance was perhaps too strict, possibly preventing valid solutions from passing the test. Adjusting the tolerance to allow other valid solutions. The new tolerance value was copied from the Python implementation. Fixes exercism#2823. [no important files changed]
1 parent bce1d70 commit 919b7f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

exercises/practice/rational-numbers/src/test/java/RationalTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ public class RationalTest {
88

99
// Helper methods
1010

11-
private static final double DOUBLE_EQUALITY_TOLERANCE = 1e-15;
11+
private static final double DOUBLE_EQUALITY_TOLERANCE = 1e-8;
1212

1313
private void assertDoublesEqual(double x, double y) {
14-
assertThat(x).isEqualTo(y, within(DOUBLE_EQUALITY_TOLERANCE));
14+
assertThat(x).isCloseTo(y, within(DOUBLE_EQUALITY_TOLERANCE));
1515
}
1616

1717
// Tests

0 commit comments

Comments
 (0)