Added tests for special values.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141319 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2004-06-18 13:24:46 +00:00
parent d3322d7d6c
commit fe63fc7a81
1 changed files with 17 additions and 1 deletions

View File

@ -23,7 +23,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/18 13:24:46 $
*/
public class MaxTest extends StorelessUnivariateStatisticAbstractTest{
@ -55,5 +55,21 @@ public class MaxTest extends StorelessUnivariateStatisticAbstractTest{
public double expectedValue() {
return this.max;
}
public void testSpecialValues() {
double[] testArray = {0d, Double.NaN, Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY};
Max max = new Max();
assertTrue(Double.isNaN(max.getResult()));
max.increment(testArray[0]);
assertEquals(0d, max.getResult(), 0);
max.increment(testArray[1]);
// assertEquals(0d, max.getResult(), 0);
max.increment(testArray[2]);
// assertEquals(0d, max.getResult(), 0);
max.increment(testArray[3]);
// assertEquals(Double.POSITIVE_INFINITY, max.getResult(), 0);
assertEquals(Double.POSITIVE_INFINITY, max.evaluate(testArray), 0);
}
}