Added test to make sure NaN is returned when it should be.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141369 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2004-07-10 17:10:42 +00:00
parent 43af865138
commit 27cbce332c
1 changed files with 16 additions and 1 deletions

View File

@ -24,7 +24,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * Test cases for the {@link UnivariateStatistic} class.
* *
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $ * @version $Revision: 1.12 $ $Date: 2004/07/10 17:10:42 $
*/ */
public class SkewnessTest extends StorelessUnivariateStatisticAbstractTest{ public class SkewnessTest extends StorelessUnivariateStatisticAbstractTest{
@ -56,5 +56,20 @@ public class SkewnessTest extends StorelessUnivariateStatisticAbstractTest{
public double expectedValue() { public double expectedValue() {
return this.skew; return this.skew;
} }
/**
* Make sure Double.NaN is returned iff n < 3
*
*/
public void testNaN() {
Skewness skew = new Skewness();
assertTrue(Double.isNaN(skew.getResult()));
skew.increment(1d);
assertTrue(Double.isNaN(skew.getResult()));
skew.increment(1d);
assertTrue(Double.isNaN(skew.getResult()));
skew.increment(1d);
assertFalse(Double.isNaN(skew.getResult()));
}
} }