Purified tests introduced in MATH-385 such that NaNs and infinites are handled properly
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1053472 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
38155d7ef3
commit
392f47dfed
|
@ -109,15 +109,14 @@ public class CauchyDistributionTest extends ContinuousDistributionAbstractTest
|
|||
}
|
||||
|
||||
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);
|
||||
dist = new CauchyDistributionImpl(10.2, 0.15);
|
||||
assertTrue(Double.isNaN(dist.getNumericalMean()));
|
||||
assertTrue(Double.isNaN(dist.getNumericalVariance()));
|
||||
|
||||
dist = new CauchyDistributionImpl(23.12, 2.12);
|
||||
assertEquals(dist.getNumericalMean(), Double.NaN, tol);
|
||||
assertEquals(dist.getNumericalVariance(), Double.NaN, tol);
|
||||
assertTrue(Double.isNaN(dist.getNumericalMean()));
|
||||
assertTrue(Double.isNaN(dist.getNumericalVariance()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,12 +130,12 @@ public class FDistributionTest extends ContinuousDistributionAbstractTest {
|
|||
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 = new FDistributionImpl(1, 3);
|
||||
assertEquals(dist.getNumericalMean(), 3d / (3d - 2d), tol);
|
||||
assertEquals(dist.getNumericalVariance(), Double.NaN, tol);
|
||||
assertTrue(Double.isNaN(dist.getNumericalVariance()));
|
||||
|
||||
dist = new FDistributionImpl(1, 5);
|
||||
assertEquals(dist.getNumericalMean(), 5d / (5d - 2d), tol);
|
||||
|
|
|
@ -124,12 +124,12 @@ public class TDistributionTest extends ContinuousDistributionAbstractTest {
|
|||
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 = new TDistributionImpl(1.5);
|
||||
assertEquals(dist.getNumericalMean(), 0, tol);
|
||||
assertEquals(dist.getNumericalVariance(), Double.POSITIVE_INFINITY, tol);
|
||||
assertTrue(Double.isInfinite(dist.getNumericalVariance()));
|
||||
|
||||
dist = new TDistributionImpl(5);
|
||||
assertEquals(dist.getNumericalMean(), 0, tol);
|
||||
|
|
Loading…
Reference in New Issue