From fe63fc7a8142cccf2b7c2df1e7671bff77fcbc9e Mon Sep 17 00:00:00 2001 From: Phil Steitz Date: Fri, 18 Jun 2004 13:24:46 +0000 Subject: [PATCH] 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 --- .../math/stat/univariate/rank/MaxTest.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/test/org/apache/commons/math/stat/univariate/rank/MaxTest.java b/src/test/org/apache/commons/math/stat/univariate/rank/MaxTest.java index f5b62a3ba..d2a743287 100644 --- a/src/test/org/apache/commons/math/stat/univariate/rank/MaxTest.java +++ b/src/test/org/apache/commons/math/stat/univariate/rank/MaxTest.java @@ -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); + } }