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: 762087 $ $Date: 2009-04-05 10:20:18 -0400 (Sun, 05 Apr 2009) $

Field Summary
protected  double[] dataArray
           
protected  org.apache.commons.math.random.EmpiricalDistribution empiricalDistribution
           
protected  org.apache.commons.math.random.EmpiricalDistribution empiricalDistribution2
           
protected  File file
           
protected  URL url
           
 
Constructor Summary
EmpiricalDistributionTest(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 testLoadNullDoubleArray()
           
 void testLoadNullFile()
           
 void testLoadNullURL()
           
 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, format
 
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 File file

url

protected URL url

dataArray

protected double[] dataArray
Constructor Detail

EmpiricalDistributionTest

public EmpiricalDistributionTest(String name)
Method Detail

setUp

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

suite

public static junit.framework.Test suite()

testLoad

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

Throws:
Exception

testDoubleLoad

public void testDoubleLoad()
                    throws 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:
Exception

testNext

public void testNext()
              throws 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:
Exception

testNexFail

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


testGridTooFine

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

Throws:
Exception

testGridTooFat

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

Throws:
Exception

testBinIndexOverflow

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

Throws:
Exception

testSerialization

public void testSerialization()

testLoadNullDoubleArray

public void testLoadNullDoubleArray()

testLoadNullURL

public void testLoadNullURL()
                     throws Exception
Throws:
Exception

testLoadNullFile

public void testLoadNullFile()
                      throws Exception
Throws:
Exception


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.