Add evaluate/increment consistency test.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141363 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2004-07-07 12:50:50 +00:00
parent 29c4a34635
commit d5a2cabb81
1 changed files with 11 additions and 1 deletions

View File

@ -20,7 +20,7 @@ import org.apache.commons.math.stat.univariate.moment.SecondMoment;
/**
* Test cases for {@link StorelessUnivariateStatistic} classes.
* @version $Revision: 1.14 $ $Date: 2004/06/29 06:11:22 $
* @version $Revision: 1.15 $ $Date: 2004/07/07 12:50:50 $
*/
public abstract class StorelessUnivariateStatisticAbstractTest
extends UnivariateStatisticAbstractTest {
@ -136,5 +136,15 @@ public abstract class StorelessUnivariateStatisticAbstractTest
assertEquals(0d, moment.getResult(), 0);
}
}
/**
* Make sure that evaluate(double[]) and inrementAll(double[]),
* getResult() give same results.
*/
public void testConsistency() {
StorelessUnivariateStatistic stat = (StorelessUnivariateStatistic) getUnivariateStatistic();
stat.incrementAll(testArray);
assertEquals(stat.getResult(), stat.evaluate(testArray), getTolerance());
}
}