commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1150496 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java
Date Sun, 24 Jul 2011 21:43:08 GMT
Author: erans
Date: Sun Jul 24 21:43:08 2011
New Revision: 1150496

URL: http://svn.apache.org/viewvc?rev=1150496&view=rev
Log:
MATH-632
Added tests referred to in the corresponding JIRA ticket.

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java?rev=1150496&r1=1150495&r2=1150496&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java
Sun Jul 24 21:43:08 2011
@@ -20,6 +20,7 @@ package org.apache.commons.math.complex;
 import org.apache.commons.math.TestUtils;
 import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -478,6 +479,20 @@ public class ComplexTest {
         Assert.assertTrue(realNaN.equals(imaginaryNaN));
         Assert.assertTrue(imaginaryNaN.equals(complexNaN));
         Assert.assertTrue(realNaN.equals(complexNaN));
+
+        final double a = Double.NaN;
+        final double b = Double.NaN;
+        Assert.assertFalse("a == b", a == b);
+        Assert.assertEquals("a != b", a, b, Double.MIN_VALUE);
+        Assert.assertFalse("a == b", MathUtils.equals(a, b));
+        Assert.assertFalse("a == b", MathUtils.equals(a, b, Double.MIN_VALUE));
+        final Double dA = Double.valueOf(a);
+        final Double dB = Double.valueOf(b);
+        Assert.assertFalse("dA == dB", dA.doubleValue() == dB.doubleValue());
+        Assert.assertTrue("!dA.equals(dB)", dA.equals(dB));
+        final Complex cA = new Complex(a, 0);
+        final Complex cB = new Complex(b, 0);
+        Assert.assertTrue("!cA.equals(cB)", cA.equals(cB));
     }
 
     @Test



Mime
View raw message