From 919b7f7b2425951d1ad6d873a3070cadf0e9dcd2 Mon Sep 17 00:00:00 2001 From: veloukonst <147618898+veloukonst@users.noreply.github.com> Date: Sat, 4 Jan 2025 00:56:04 +0200 Subject: [PATCH] Allow greater tolerance in RationalTest (#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 #2823. [no important files changed] --- .../practice/rational-numbers/src/test/java/RationalTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/practice/rational-numbers/src/test/java/RationalTest.java b/exercises/practice/rational-numbers/src/test/java/RationalTest.java index 7eb882688..8a26c474a 100644 --- a/exercises/practice/rational-numbers/src/test/java/RationalTest.java +++ b/exercises/practice/rational-numbers/src/test/java/RationalTest.java @@ -8,10 +8,10 @@ public class RationalTest { // Helper methods - private static final double DOUBLE_EQUALITY_TOLERANCE = 1e-15; + private static final double DOUBLE_EQUALITY_TOLERANCE = 1e-8; private void assertDoublesEqual(double x, double y) { - assertThat(x).isEqualTo(y, within(DOUBLE_EQUALITY_TOLERANCE)); + assertThat(x).isCloseTo(y, within(DOUBLE_EQUALITY_TOLERANCE)); } // Tests