org.apache.commons.math.random
Class EmpiricalDistributionTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.math.RetryTestCase
              extended by org.apache.commons.math.random.EmpiricalDistributionTest
All Implemented Interfaces:
junit.framework.Test

public final class EmpiricalDistributionTest
extends RetryTestCase

Test cases for the EmpiricalDistribution class

Version:
$Revision: 610789 $ $Date: 2008-01-10 06:46:49 -0700 (Thu, 10 Jan 2008) $

Field Summary
protected  double[] dataArray
           
protected  org.apache.commons.math.random.EmpiricalDistribution empiricalDistribution
           
protected  org.apache.commons.math.random.EmpiricalDistribution empiricalDistribution2
           
protected  java.io.File file
           
protected  java.net.URL url
           
 
Constructor Summary
EmpiricalDistributionTest(java.lang.String name)
           
 
Method Summary
 void setUp()
           
static junit.framework.Test suite()
           
 void testBinIndexOverflow()
          Test bin index overflow problem (BZ 36450)
 void testDoubleLoad()
          Test EmpiricalDistrbution.load(double[]) using data taken from sample data file.
Check that the sampleCount, mu and sigma match data in the sample data file.
 void testGridTooFat()
          How about too fat?
 void testGridTooFine()
          Make sure we can handle a grid size that is too fine
 void testLoad()
          Test EmpiricalDistrbution.load() using sample data file.
Check that the sampleCount, mu and sigma match data in the sample data file.
 void testNexFail()
          Make sure exception thrown if digest getNext is attempted before loading empiricalDistribution.
 void testNext()
          Generate 1000 random values and make sure they look OK.
Note that there is a non-zero (but very small) probability that these tests will fail even if the code is working as designed.
 void testSerialization()
           
 
Methods inherited from class org.apache.commons.math.RetryTestCase
runTest
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

empiricalDistribution

protected org.apache.commons.math.random.EmpiricalDistribution empiricalDistribution

empiricalDistribution2

protected org.apache.commons.math.random.EmpiricalDistribution empiricalDistribution2

file

protected java.io.File file

url

protected java.net.URL url

dataArray

protected double[] dataArray
Constructor Detail

EmpiricalDistributionTest

public EmpiricalDistributionTest(java.lang.String name)
Method Detail

setUp

public void setUp()
           throws java.io.IOException
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.io.IOException

suite

public static junit.framework.Test suite()

testLoad

public void testLoad()
              throws java.lang.Exception
Test EmpiricalDistrbution.load() using sample data file.
Check that the sampleCount, mu and sigma match data in the sample data file.

Throws:
java.lang.Exception

testDoubleLoad

public void testDoubleLoad()
                    throws java.lang.Exception
Test EmpiricalDistrbution.load(double[]) using data taken from sample data file.
Check that the sampleCount, mu and sigma match data in the sample data file.

Throws:
java.lang.Exception

testNext

public void testNext()
              throws java.lang.Exception
Generate 1000 random values and make sure they look OK.
Note that there is a non-zero (but very small) probability that these tests will fail even if the code is working as designed.

Throws:
java.lang.Exception

testNexFail

public void testNexFail()
Make sure exception thrown if digest getNext is attempted before loading empiricalDistribution.


testGridTooFine

public void testGridTooFine()
                     throws java.lang.Exception
Make sure we can handle a grid size that is too fine

Throws:
java.lang.Exception

testGridTooFat

public void testGridTooFat()
                    throws java.lang.Exception
How about too fat?

Throws:
java.lang.Exception

testBinIndexOverflow

public void testBinIndexOverflow()
                          throws java.lang.Exception
Test bin index overflow problem (BZ 36450)

Throws:
java.lang.Exception

testSerialization

public void testSerialization()


Copyright © 2003-2008 The Apache Software Foundation. All Rights Reserved.