commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdigg...@apache.org
Subject cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate StorelessUnivariateStatisticAbstractTest.java
Date Wed, 19 Nov 2003 13:35:10 GMT
mdiggory    2003/11/19 05:35:10

  Modified:    math/src/test/org/apache/commons/math/stat/univariate
                        StorelessUnivariateStatisticAbstractTest.java
  Log:
  JUnit testing of serialization of all StorelessUnivariates
  
  Revision  Changes    Path
  1.9       +24 -2     jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/StorelessUnivariateStatisticAbstractTest.java
  
  Index: StorelessUnivariateStatisticAbstractTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/StorelessUnivariateStatisticAbstractTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StorelessUnivariateStatisticAbstractTest.java	14 Nov 2003 22:22:23 -0000	1.8
  +++ StorelessUnivariateStatisticAbstractTest.java	19 Nov 2003 13:35:10 -0000	1.9
  @@ -53,6 +53,7 @@
    */
   package org.apache.commons.math.stat.univariate;
   
  +import org.apache.commons.math.TestUtils;
   
   /**
    * Test cases for the {@link UnivariateStatistic} class.
  @@ -81,11 +82,32 @@
           }
   
           assertEquals(expectedValue(), statistic.getResult(), getTolerance());
  -        
  +
           statistic.clear();
   
           assertTrue(Double.isNaN(statistic.getResult()));
  +
  +    }
  +
  +    public void testSerialization() throws Exception {
  +
  +        StorelessUnivariateStatistic statistic =
  +            (StorelessUnivariateStatistic) getUnivariateStatistic();
  +
  +        statistic.clear();
  +
  +        for (int i = 0; i < testArray.length; i++) {
  +            statistic.increment(testArray[i]);
  +            if(i % 5 == 0)
  +                statistic = (StorelessUnivariateStatistic)TestUtils.serializeAndRecover(statistic);

  +        }
           
  +        assertEquals(expectedValue(), statistic.getResult(), getTolerance());
  +
  +        statistic.clear();
  +
  +        assertTrue(Double.isNaN(statistic.getResult()));
  +
       }
   
   }
  
  
  

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


Mime
View raw message