Added tests to make sure n=0 results in NaN, n=1 returns 0.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141339 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2004-06-26 23:34:22 +00:00
parent 6a3874abd5
commit 1916ebe30a
1 changed files with 12 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.
*
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $
* @version $Revision: 1.12 $ $Date: 2004/06/26 23:34:22 $
*/
public class VarianceTest extends StorelessUnivariateStatisticAbstractTest{
@ -57,4 +57,15 @@ public class VarianceTest extends StorelessUnivariateStatisticAbstractTest{
return this.var;
}
/**
* Make sure Double.NaN is returned iff n = 0
*
*/
public void testNaN() {
StandardDeviation std = new StandardDeviation();
assertTrue(Double.isNaN(std.getResult()));
std.increment(1d);
assertEquals(0d, std.getResult(), 0);
}
}