To close out BZ #28829, I need to add some degenerate test cases to BinomialDistributionTest. As I started to do this, I realized that adding more test points would be easier and we could eliminate duplication of code across test classes in the distributions package if we defined abstract test classes for discrete and continuous distributions that provided generic verification methods. The setup for the discrete case looks like this:

Abstract base class for [EMAIL PROTECTED] DiscreteDistribution} tests.
<p>
To create a concrete test class for a discrete 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().
<p>
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


Then one default method for each type of test runs through the test points / expected values and checks the test instance. To support tests using multiple instances, setXxx methods would also be provided for the instance and test data arrays. Similar setup for continuous. This will make it easier to add more test cases (including adding missing tests for discrete pdf calculations) and simplify development of new distribution test classes. Any objections?

Phil



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



Reply via email to