org.apache.commons.math3.distribution
Class IntegerDistributionAbstractTest

java.lang.Object
  extended by org.apache.commons.math3.distribution.IntegerDistributionAbstractTest
Direct Known Subclasses:
BinomialDistributionTest, HypergeometricDistributionTest, PascalDistributionTest, PoissonDistributionTest, UniformIntegerDistributionTest, ZipfDistributionTest

public abstract class IntegerDistributionAbstractTest
extends Object

Abstract base class for IntegerDistribution tests.

To create a concrete test class for an integer distribution implementation, implement makeDistribution() to return a distribution instance to use in tests and each of the test data generation methods below. In each case, the test points and test values arrays returned represent parallel arrays of inputs and expected values for the distribution returned by makeDistribution().

makeDensityTestPoints() -- arguments used to test probability density calculation makeDensityTestValues() -- expected probability densities makeCumulativeTestPoints() -- arguments used to test cumulative probabilities makeCumulativeTestValues() -- expected cumulative probabilites makeInverseCumulativeTestPoints() -- arguments used to test inverse cdf evaluation makeInverseCumulativeTestValues() -- expected inverse cdf values

To implement additional test cases with different distribution instances and test data, use the setXxx methods for the instance data in test cases and call the verifyXxx methods to verify results.

Version:
$Id: IntegerDistributionAbstractTest.java 1364028 2012-07-21 00:42:49Z erans $

Constructor Summary
IntegerDistributionAbstractTest()
           
 
Method Summary
protected  int[] getCumulativeTestPoints()
           
protected  double[] getCumulativeTestValues()
           
protected  int[] getDensityTestPoints()
           
protected  double[] getDensityTestValues()
           
protected  IntegerDistribution getDistribution()
           
protected  double[] getInverseCumulativeTestPoints()
           
protected  int[] getInverseCumulativeTestValues()
           
protected  double getTolerance()
           
abstract  int[] makeCumulativeTestPoints()
          Creates the default cumulative probability density test input values
abstract  double[] makeCumulativeTestValues()
          Creates the default cumulative probability density test expected values
abstract  int[] makeDensityTestPoints()
          Creates the default probability density test input values
abstract  double[] makeDensityTestValues()
          Creates the default probability density test expected values
abstract  IntegerDistribution makeDistribution()
          Creates the default discrete distribution instance to use in tests.
abstract  double[] makeInverseCumulativeTestPoints()
          Creates the default inverse cumulative probability test input values
abstract  int[] makeInverseCumulativeTestValues()
          Creates the default inverse cumulative probability density test expected values
protected  void setCumulativeTestPoints(int[] cumulativeTestPoints)
           
protected  void setCumulativeTestValues(double[] cumulativeTestValues)
           
protected  void setDensityTestPoints(int[] densityTestPoints)
           
protected  void setDensityTestValues(double[] densityTestValues)
           
protected  void setDistribution(IntegerDistribution distribution)
           
protected  void setInverseCumulativeTestPoints(double[] inverseCumulativeTestPoints)
           
protected  void setInverseCumulativeTestValues(int[] inverseCumulativeTestValues)
           
protected  void setTolerance(double tolerance)
           
 void setUp()
          Setup sets all test instance data to default values
 void tearDown()
          Cleans up test instance data
 void testConsistencyAtSupportBounds()
           
 void testCumulativeProbabilities()
          Verifies that cumulative probability density calculations match expected values using default test instance data
 void testDensities()
          Verifies that probability density calculations match expected values using default test instance data
 void testIllegalArguments()
          Verifies that illegal arguments are correctly handled
 void testInverseCumulativeProbabilities()
          Verifies that inverse cumulative probability density calculations match expected values using default test instance data
 void testSampling()
          Test sampling
protected  void verifyCumulativeProbabilities()
          Verifies that cumulative probability density calculations match expected values using current test instance data
protected  void verifyDensities()
          Verifies that probability density calculations match expected values using current test instance data
protected  void verifyInverseCumulativeProbabilities()
          Verifies that inverse cumulative probability density calculations match expected values using current test instance data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerDistributionAbstractTest

public IntegerDistributionAbstractTest()
Method Detail

makeDistribution

public abstract IntegerDistribution makeDistribution()
Creates the default discrete distribution instance to use in tests.


makeDensityTestPoints

public abstract int[] makeDensityTestPoints()
Creates the default probability density test input values


makeDensityTestValues

public abstract double[] makeDensityTestValues()
Creates the default probability density test expected values


makeCumulativeTestPoints

public abstract int[] makeCumulativeTestPoints()
Creates the default cumulative probability density test input values


makeCumulativeTestValues

public abstract double[] makeCumulativeTestValues()
Creates the default cumulative probability density test expected values


makeInverseCumulativeTestPoints

public abstract double[] makeInverseCumulativeTestPoints()
Creates the default inverse cumulative probability test input values


makeInverseCumulativeTestValues

public abstract int[] makeInverseCumulativeTestValues()
Creates the default inverse cumulative probability density test expected values


setUp

public void setUp()
Setup sets all test instance data to default values


tearDown

public void tearDown()
Cleans up test instance data


verifyDensities

protected void verifyDensities()
Verifies that probability density calculations match expected values using current test instance data


verifyCumulativeProbabilities

protected void verifyCumulativeProbabilities()
Verifies that cumulative probability density calculations match expected values using current test instance data


verifyInverseCumulativeProbabilities

protected void verifyInverseCumulativeProbabilities()
Verifies that inverse cumulative probability density calculations match expected values using current test instance data


testDensities

public void testDensities()
Verifies that probability density calculations match expected values using default test instance data


testCumulativeProbabilities

public void testCumulativeProbabilities()
Verifies that cumulative probability density calculations match expected values using default test instance data


testInverseCumulativeProbabilities

public void testInverseCumulativeProbabilities()
Verifies that inverse cumulative probability density calculations match expected values using default test instance data


testConsistencyAtSupportBounds

public void testConsistencyAtSupportBounds()

testIllegalArguments

public void testIllegalArguments()
Verifies that illegal arguments are correctly handled


testSampling

public void testSampling()
Test sampling


getCumulativeTestPoints

protected int[] getCumulativeTestPoints()
Returns:
Returns the cumulativeTestPoints.

setCumulativeTestPoints

protected void setCumulativeTestPoints(int[] cumulativeTestPoints)
Parameters:
cumulativeTestPoints - The cumulativeTestPoints to set.

getCumulativeTestValues

protected double[] getCumulativeTestValues()
Returns:
Returns the cumulativeTestValues.

setCumulativeTestValues

protected void setCumulativeTestValues(double[] cumulativeTestValues)
Parameters:
cumulativeTestValues - The cumulativeTestValues to set.

getDensityTestPoints

protected int[] getDensityTestPoints()
Returns:
Returns the densityTestPoints.

setDensityTestPoints

protected void setDensityTestPoints(int[] densityTestPoints)
Parameters:
densityTestPoints - The densityTestPoints to set.

getDensityTestValues

protected double[] getDensityTestValues()
Returns:
Returns the densityTestValues.

setDensityTestValues

protected void setDensityTestValues(double[] densityTestValues)
Parameters:
densityTestValues - The densityTestValues to set.

getDistribution

protected IntegerDistribution getDistribution()
Returns:
Returns the distribution.

setDistribution

protected void setDistribution(IntegerDistribution distribution)
Parameters:
distribution - The distribution to set.

getInverseCumulativeTestPoints

protected double[] getInverseCumulativeTestPoints()
Returns:
Returns the inverseCumulativeTestPoints.

setInverseCumulativeTestPoints

protected void setInverseCumulativeTestPoints(double[] inverseCumulativeTestPoints)
Parameters:
inverseCumulativeTestPoints - The inverseCumulativeTestPoints to set.

getInverseCumulativeTestValues

protected int[] getInverseCumulativeTestValues()
Returns:
Returns the inverseCumulativeTestValues.

setInverseCumulativeTestValues

protected void setInverseCumulativeTestValues(int[] inverseCumulativeTestValues)
Parameters:
inverseCumulativeTestValues - The inverseCumulativeTestValues to set.

getTolerance

protected double getTolerance()
Returns:
Returns the tolerance.

setTolerance

protected void setTolerance(double tolerance)
Parameters:
tolerance - The tolerance to set.


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