Added small sample tests for 2nd+ order moments.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141349 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c9ac892c42
commit
c1062adc04
|
@ -16,10 +16,11 @@
|
|||
package org.apache.commons.math.stat.univariate;
|
||||
|
||||
import org.apache.commons.math.TestUtils;
|
||||
import org.apache.commons.math.stat.univariate.moment.SecondMoment;
|
||||
|
||||
/**
|
||||
* Test cases for the {@link UnivariateStatistic} class.
|
||||
* @version $Revision: 1.13 $ $Date: 2004/06/17 22:33:23 $
|
||||
* Test cases for {@link StorelessUnivariateStatistic} classes.
|
||||
* @version $Revision: 1.14 $ $Date: 2004/06/29 06:11:22 $
|
||||
*/
|
||||
public abstract class StorelessUnivariateStatisticAbstractTest
|
||||
extends UnivariateStatisticAbstractTest {
|
||||
|
@ -125,5 +126,15 @@ public abstract class StorelessUnivariateStatisticAbstractTest
|
|||
emptyHash, statistic.hashCode());
|
||||
|
||||
}
|
||||
|
||||
public void testMomentSmallSamples() {
|
||||
UnivariateStatistic stat = getUnivariateStatistic();
|
||||
if (stat instanceof SecondMoment) {
|
||||
SecondMoment moment = (SecondMoment) getUnivariateStatistic();
|
||||
assertTrue(Double.isNaN(moment.getResult()));
|
||||
moment.increment(1d);
|
||||
assertEquals(0d, moment.getResult(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue