You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ps...@apache.org on 2004/06/29 08:07:10 UTC

cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/summary ProductTest.java

psteitz     2004/06/28 23:07:10

  Modified:    math/src/test/org/apache/commons/math/stat/univariate/summary
                        ProductTest.java
  Log:
  Added tests for NaNs, infinite values.
  
  Revision  Changes    Path
  1.13      +16 -1     jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/summary/ProductTest.java
  
  Index: ProductTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/summary/ProductTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ProductTest.java	17 Jun 2004 21:37:05 -0000	1.12
  +++ ProductTest.java	29 Jun 2004 06:07:10 -0000	1.13
  @@ -59,5 +59,20 @@
       public double expectedValue() {
           return this.product;
       }
  +    
  +    public void testSpecialValues() {
  +        Product product = new Product();
  +        assertTrue(Double.isNaN(product.getResult()));
  +        product.increment(1);
  +        assertEquals(1, product.getResult(), 0);
  +        product.increment(Double.POSITIVE_INFINITY);
  +        assertEquals(Double.POSITIVE_INFINITY, product.getResult(), 0);
  +        product.increment(Double.NEGATIVE_INFINITY);
  +        assertEquals(Double.NEGATIVE_INFINITY, product.getResult(), 0);
  +        product.increment(Double.NaN);
  +        assertTrue(Double.isNaN(product.getResult())); 
  +        product.increment(1);
  +        assertTrue(Double.isNaN(product.getResult())); 
  +    }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org