psteitz     2004/01/28 21:27:55

  Modified:    math/src/test/org/apache/commons/math/random
                        EmpiricalDistributionTest.java
  Log:
  Speed up, clean up.
  
  Revision  Changes    Path
  1.12      +3 -6      
jakarta-commons/math/src/test/org/apache/commons/math/random/EmpiricalDistributionTest.java
  
  Index: EmpiricalDistributionTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/random/EmpiricalDistributionTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- EmpiricalDistributionTest.java    25 Jan 2004 21:30:41 -0000      1.11
  +++ EmpiricalDistributionTest.java    29 Jan 2004 05:27:54 -0000      1.12
  @@ -81,8 +81,6 @@
       public void setUp() {
           empiricalDistribution = new EmpiricalDistributionImpl(100);
           url = getClass().getResource("testData.txt");
  -        String fileName = URLDecoder.decode(url.getFile());
  -        file = new File(fileName);
       }
   
       public static Test suite() {
  @@ -134,7 +132,7 @@
        * Make sure we can handle a grid size that is too fine
        */
       public void testGridTooFine() throws Exception {
  -        empiricalDistribution = new EmpiricalDistributionImpl(10000);
  +        empiricalDistribution = new EmpiricalDistributionImpl(1001);
           tstGen(0.1);    
       }
       
  @@ -148,12 +146,11 @@
       }
       
       private void tstGen(double tolerance)throws Exception {
  -        empiricalDistribution.load(file);   
  +        empiricalDistribution.load(url);   
           SummaryStatistics stats = SummaryStatistics.newInstance();
           for (int i = 1; i < 1000; i++) {
               stats.addValue(empiricalDistribution.getNextValue());
           }
  -        //TODO: replace these with statistical tests -- refactor as necessary
           assertEquals("mean", stats.getMean(),5.069831575018909,tolerance);
           assertEquals
            ("std dev", stats.getStandardDeviation(),1.0173699343977738,tolerance);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to