Repository: commons-numbers Updated Branches: refs/heads/master 621aa3350 -> ea2c1d79d
NUMBERS-65: Redundant functionality. Unit test confirms duplicate implementations. Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/ea2c1d79 Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/ea2c1d79 Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/ea2c1d79 Branch: refs/heads/master Commit: ea2c1d79d8b482bed262541e813d037294e6b572 Parents: 621aa33 Author: Gilles Sadowski <gil...@harfang.homelinux.org> Authored: Fri Feb 2 15:56:54 2018 +0100 Committer: Gilles Sadowski <gil...@harfang.homelinux.org> Committed: Fri Feb 2 15:56:54 2018 +0100 ---------------------------------------------------------------------- .../apache/commons/numbers/complex/RootsOfUnityTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/ea2c1d79/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/RootsOfUnityTest.java ---------------------------------------------------------------------- diff --git a/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/RootsOfUnityTest.java b/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/RootsOfUnityTest.java index df40f99..5599f08 100644 --- a/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/RootsOfUnityTest.java +++ b/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/RootsOfUnityTest.java @@ -16,6 +16,7 @@ */ package org.apache.commons.numbers.complex; +import java.util.List; import org.junit.Assert; import org.junit.Test; @@ -78,6 +79,15 @@ public class RootsOfUnityTest { z.getImaginary(), tol); } + + if (n > 0) { + final List<Complex> list = Complex.ONE.nthRoot(n); + for (int k = 0; k < n; k++) { + final Complex c1 = list.get(k); + final Complex c2 = roots.getRoot(k); + Assert.assertTrue("k=" + k + ": " + c1 + " != " + c2, Complex.equals(c1, c2, 1e-15)); + } + } } } }