You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2018/02/28 02:56:48 UTC

[math] Temporary duplicate code removed.

Repository: commons-math
Updated Branches:
  refs/heads/master 583d9ec86 -> 939e9f1d6


Temporary duplicate code removed.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/939e9f1d
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/939e9f1d
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/939e9f1d

Branch: refs/heads/master
Commit: 939e9f1d63f13347d64848d937cee8638132a5ea
Parents: 583d9ec
Author: Gilles <er...@apache.org>
Authored: Wed Feb 28 03:55:54 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Wed Feb 28 03:55:54 2018 +0100

----------------------------------------------------------------------
 .../analysis/solvers/LaguerreSolverTest.java    | 34 ++------------------
 1 file changed, 2 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/939e9f1d/src/test/java/org/apache/commons/math4/analysis/solvers/LaguerreSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/LaguerreSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/LaguerreSolverTest.java
index caee1cc..32f92f6 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/LaguerreSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/LaguerreSolverTest.java
@@ -23,6 +23,7 @@ import org.apache.commons.math4.analysis.solvers.LaguerreSolver;
 import org.apache.commons.math4.exception.NoBracketingException;
 import org.apache.commons.math4.exception.NumberIsTooLargeException;
 import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.TestUtils;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -129,7 +130,7 @@ public final class LaguerreSolverTest {
                                                 new Complex(0.5, -0.5 * FastMath.sqrt(3.0)) }) {
             final double tolerance = FastMath.max(solver.getAbsoluteAccuracy(),
                                                   FastMath.abs(expected.abs() * solver.getRelativeAccuracy()));
-            assertContains(result, expected, tolerance);
+            TestUtils.assertContains(result, expected, tolerance);
         }
     }
 
@@ -157,35 +158,4 @@ public final class LaguerreSolverTest {
             // expected
         }
     }
-
-    /**
-     * Fails iff values does not contain a number within epsilon of z.
-     *
-     * @param msg  message to return with failure
-     * @param values complex array to search
-     * @param z  value sought
-     * @param epsilon  tolerance
-     */
-    private static void assertContains(String msg, Complex[] values,
-                                       Complex z, double epsilon) {
-        for (Complex value : values) {
-            if (Precision.equals(value.getReal(), z.getReal(), epsilon) &&
-                Precision.equals(value.getImaginary(), z.getImaginary(), epsilon)) {
-                return;
-            }
-        }
-        Assert.fail(msg + " Unable to find " + z);
-    }
-
-    /**
-     * Fails iff values does not contain a number within epsilon of z.
-     *
-     * @param values complex array to search
-     * @param z  value sought
-     * @param epsilon  tolerance
-     */
-    private static void assertContains(Complex[] values,
-                                       Complex z, double epsilon) {
-        assertContains(null, values, z, epsilon);
-    }
 }