brentworden    2004/02/28 13:58:33

  Modified:    math/src/test/org/apache/commons/math/distribution
                        TDistributionTest.java
  Log:
  

  PR: 27243

  Obtained from: Scott Duchin

  Submitted by: Brent Worden

  

  Adding Scott's unit test.  See 
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27243 for details.
  
  Revision  Changes    Path
  1.13      +18 -6     
jakarta-commons/math/src/test/org/apache/commons/math/distribution/TDistributionTest.java
  
  Index: TDistributionTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/distribution/TDistributionTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TDistributionTest.java    21 Feb 2004 21:35:17 -0000      1.12
  +++ TDistributionTest.java    28 Feb 2004 21:58:33 -0000      1.13
  @@ -129,23 +129,35 @@
           testProbability(1.476, .900);
       }
   
  +    /**
  +     * @see <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27243";>
  +     *      Bug report that prompted this unit test.</a>
  +     */
  +    public void testCumulativeProbabilityAgaintStackOverflow() {
  +     try {
  +             TDistributionImpl td = new TDistributionImpl(5.);
  +             double est;
  +             est = td.cumulativeProbability(.1);
  +             est = td.cumulativeProbability(.01);
  +     } catch(MathException ex) {
  +             fail(ex.getMessage());
  +     }
  +    }
  +    
       private void testProbability(double x, double expected) {
           try {
               double actual = t.cumulativeProbability(x);
               assertEquals(expected, actual, 10e-4);
           } catch (MathException e) {
  -            // TODO Auto-generated catch block
  -            e.printStackTrace();
  +             fail(e.getMessage());
           }
       }
  -
       private void testValue(double expected, double p) {
           try {
               double actual = t.inverseCumulativeProbability(p);
               assertEquals(expected, actual, 10e-4);
           } catch (MathException e) {
  -            // TODO Auto-generated catch block
  -            e.printStackTrace();
  +             fail(e.getMessage());
           }
       }
   }
  
  
  

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

Reply via email to