commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r1053471 - in /commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution: CauchyDistributionTest.java FDistributionTest.java TDistributionTest.java
Date Tue, 28 Dec 2010 22:19:26 GMT
Author: mikl
Date: Tue Dec 28 22:19:26 2010
New Revision: 1053471

URL: http://svn.apache.org/viewvc?rev=1053471&view=rev
Log:
Purified tests introduced in MATH-385 such that NaNs and infinites are handled properly

Modified:
    commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/CauchyDistributionTest.java
    commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/FDistributionTest.java
    commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/TDistributionTest.java

Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/CauchyDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/CauchyDistributionTest.java?rev=1053471&r1=1053470&r2=1053471&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/CauchyDistributionTest.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/CauchyDistributionTest.java
Tue Dec 28 22:19:26 2010
@@ -115,16 +115,15 @@ public class CauchyDistributionTest exte
     }
 
     public void testMomonts() {
-        final double tol = 1e-9;
         CauchyDistribution dist;
         
         dist = new CauchyDistributionImpl(10.2, 0.15);
-        assertEquals(dist.getNumericalMean(), Double.NaN, tol);
-        assertEquals(dist.getNumericalVariance(), Double.NaN, tol); 
+        assertTrue(Double.isNaN(dist.getNumericalMean()));
+        assertTrue(Double.isNaN(dist.getNumericalVariance())); 
         
         dist.setMedian(23.12);
         dist.setScale(2.12);
-        assertEquals(dist.getNumericalMean(), Double.NaN, tol);
-        assertEquals(dist.getNumericalVariance(), Double.NaN, tol);
+        assertTrue(Double.isNaN(dist.getNumericalMean()));
+        assertTrue(Double.isNaN(dist.getNumericalVariance()));
     }
 }

Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/FDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/FDistributionTest.java?rev=1053471&r1=1053470&r2=1053471&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/FDistributionTest.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/FDistributionTest.java
Tue Dec 28 22:19:26 2010
@@ -134,13 +134,13 @@ public class FDistributionTest extends C
         FDistribution dist;
         
         dist = new FDistributionImpl(1, 2);
-        assertEquals(dist.getNumericalMean(), Double.NaN, tol);
-        assertEquals(dist.getNumericalVariance(), Double.NaN, tol); 
+        assertTrue(Double.isNaN(dist.getNumericalMean()));
+        assertTrue(Double.isNaN(dist.getNumericalVariance())); 
         
         dist.setNumeratorDegreesOfFreedom(1);
         dist.setDenominatorDegreesOfFreedom(3);
         assertEquals(dist.getNumericalMean(), 3d / (3d - 2d), tol);
-        assertEquals(dist.getNumericalVariance(), Double.NaN, tol);
+        assertTrue(Double.isNaN(dist.getNumericalVariance()));
         
         dist.setNumeratorDegreesOfFreedom(1);
         dist.setDenominatorDegreesOfFreedom(5);

Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/TDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/TDistributionTest.java?rev=1053471&r1=1053470&r2=1053471&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/TDistributionTest.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/distribution/TDistributionTest.java
Tue Dec 28 22:19:26 2010
@@ -121,12 +121,12 @@ public class TDistributionTest extends C
         TDistribution dist;
         
         dist = new TDistributionImpl(1);
-        assertEquals(dist.getNumericalMean(), Double.NaN, tol);
-        assertEquals(dist.getNumericalVariance(), Double.NaN, tol); 
+        assertTrue(Double.isNaN(dist.getNumericalMean()));
+        assertTrue(Double.isNaN(dist.getNumericalVariance())); 
         
         dist.setDegreesOfFreedom(1.5);
         assertEquals(dist.getNumericalMean(), 0, tol);
-        assertEquals(dist.getNumericalVariance(), Double.POSITIVE_INFINITY, tol);
+        assertTrue(Double.isInfinite(dist.getNumericalVariance()));
         
         dist.setDegreesOfFreedom(5);
         assertEquals(dist.getNumericalMean(), 0, tol);



Mime
View raw message