|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.commons.math.distribution.IntegerDistributionAbstractTest
public abstract class IntegerDistributionAbstractTest
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.
Constructor Summary | |
---|---|
IntegerDistributionAbstractTest(String name)
Constructor for IntegerDistributionAbstractTest. |
Method Summary | |
---|---|
protected int[] |
getCumulativeTestPoints()
|
protected double[] |
getCumulativeTestValues()
|
protected int[] |
getDensityTestPoints()
|
protected double[] |
getDensityTestValues()
|
protected org.apache.commons.math.distribution.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 org.apache.commons.math.distribution.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(org.apache.commons.math.distribution.IntegerDistribution distribution)
|
protected void |
setInverseCumulativeTestPoints(double[] inverseCumulativeTestPoints)
|
protected void |
setInverseCumulativeTestValues(int[] inverseCumulativeTestValues)
|
protected void |
setTolerance(double tolerance)
|
protected void |
setUp()
Setup sets all test instance data to default values |
protected void |
tearDown()
Cleans up test instance data |
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 |
testFloatingPointArguments()
Verifies that floating point arguments are correctly handled by cumulativeProbablility(-,-) JIRA: MATH-184 |
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 |
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 junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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 |
Constructor Detail |
---|
public IntegerDistributionAbstractTest(String name)
name
- Method Detail |
---|
public abstract org.apache.commons.math.distribution.IntegerDistribution makeDistribution()
public abstract int[] makeDensityTestPoints()
public abstract double[] makeDensityTestValues()
public abstract int[] makeCumulativeTestPoints()
public abstract double[] makeCumulativeTestValues()
public abstract double[] makeInverseCumulativeTestPoints()
public abstract int[] makeInverseCumulativeTestValues()
protected void setUp() throws Exception
setUp
in class junit.framework.TestCase
Exception
protected void tearDown() throws Exception
tearDown
in class junit.framework.TestCase
Exception
protected void verifyDensities() throws Exception
Exception
protected void verifyCumulativeProbabilities() throws Exception
Exception
protected void verifyInverseCumulativeProbabilities() throws Exception
Exception
public void testDensities() throws Exception
Exception
public void testCumulativeProbabilities() throws Exception
Exception
public void testFloatingPointArguments() throws Exception
Exception
public void testInverseCumulativeProbabilities() throws Exception
Exception
public void testIllegalArguments() throws Exception
Exception
protected int[] getCumulativeTestPoints()
protected void setCumulativeTestPoints(int[] cumulativeTestPoints)
cumulativeTestPoints
- The cumulativeTestPoints to set.protected double[] getCumulativeTestValues()
protected void setCumulativeTestValues(double[] cumulativeTestValues)
cumulativeTestValues
- The cumulativeTestValues to set.protected int[] getDensityTestPoints()
protected void setDensityTestPoints(int[] densityTestPoints)
densityTestPoints
- The densityTestPoints to set.protected double[] getDensityTestValues()
protected void setDensityTestValues(double[] densityTestValues)
densityTestValues
- The densityTestValues to set.protected org.apache.commons.math.distribution.IntegerDistribution getDistribution()
protected void setDistribution(org.apache.commons.math.distribution.IntegerDistribution distribution)
distribution
- The distribution to set.protected double[] getInverseCumulativeTestPoints()
protected void setInverseCumulativeTestPoints(double[] inverseCumulativeTestPoints)
inverseCumulativeTestPoints
- The inverseCumulativeTestPoints to set.protected int[] getInverseCumulativeTestValues()
protected void setInverseCumulativeTestValues(int[] inverseCumulativeTestValues)
inverseCumulativeTestValues
- The inverseCumulativeTestValues to set.protected double getTolerance()
protected void setTolerance(double tolerance)
tolerance
- The tolerance to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |