diff --git a/src/test/org/apache/commons/math/stat/univariate/StorelessUnivariateStatisticAbstractTest.java b/src/test/org/apache/commons/math/stat/univariate/StorelessUnivariateStatisticAbstractTest.java index ef45a1bb6..8b27dc276 100644 --- a/src/test/org/apache/commons/math/stat/univariate/StorelessUnivariateStatisticAbstractTest.java +++ b/src/test/org/apache/commons/math/stat/univariate/StorelessUnivariateStatisticAbstractTest.java @@ -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); + } + } }