MATH-829
Removed unnecessary (and uninformative) "throws Exception" clauses in method signature. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1364028 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1fb8df0850
commit
aa5e60b456
|
@ -29,7 +29,7 @@ public class AbstractIntegerDistributionTest {
|
|||
protected final double p = diceDistribution.probability(1);
|
||||
|
||||
@Test
|
||||
public void testCumulativeProbabilitiesSingleArguments() throws Exception {
|
||||
public void testCumulativeProbabilitiesSingleArguments() {
|
||||
for (int i = 1; i < 7; i++) {
|
||||
Assert.assertEquals(p * i,
|
||||
diceDistribution.cumulativeProbability(i), Double.MIN_VALUE);
|
||||
|
@ -41,7 +41,7 @@ public class AbstractIntegerDistributionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCumulativeProbabilitiesRangeArguments() throws Exception {
|
||||
public void testCumulativeProbabilitiesRangeArguments() {
|
||||
int lower = 0;
|
||||
int upper = 6;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
|
|
@ -80,7 +80,7 @@ public class BinomialDistributionTest extends IntegerDistributionAbstractTest {
|
|||
|
||||
/** Test degenerate case p = 0 */
|
||||
@Test
|
||||
public void testDegenerate0() throws Exception {
|
||||
public void testDegenerate0() {
|
||||
BinomialDistribution dist = new BinomialDistribution(5, 0.0d);
|
||||
setDistribution(dist);
|
||||
setCumulativeTestPoints(new int[] { -1, 0, 1, 5, 10 });
|
||||
|
@ -98,7 +98,7 @@ public class BinomialDistributionTest extends IntegerDistributionAbstractTest {
|
|||
|
||||
/** Test degenerate case p = 1 */
|
||||
@Test
|
||||
public void testDegenerate1() throws Exception {
|
||||
public void testDegenerate1() {
|
||||
BinomialDistribution dist = new BinomialDistribution(5, 1.0d);
|
||||
setDistribution(dist);
|
||||
setCumulativeTestPoints(new int[] { -1, 0, 1, 2, 5, 10 });
|
||||
|
|
|
@ -33,7 +33,7 @@ public class CauchyDistributionTest extends RealDistributionAbstractTest {
|
|||
// --------------------- Override tolerance --------------
|
||||
protected double defaultTolerance = NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY;
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
setTolerance(defaultTolerance);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class CauchyDistributionTest extends RealDistributionAbstractTest {
|
|||
//---------------------------- Additional test cases -------------------------
|
||||
|
||||
@Test
|
||||
public void testInverseCumulativeProbabilityExtremes() throws Exception {
|
||||
public void testInverseCumulativeProbabilityExtremes() {
|
||||
setInverseCumulativeTestPoints(new double[] {0.0, 1.0});
|
||||
setInverseCumulativeTestValues(
|
||||
new double[] {Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY});
|
||||
|
|
|
@ -74,7 +74,7 @@ public class ChiSquaredDistributionTest extends RealDistributionAbstractTest {
|
|||
|
||||
// --------------------- Override tolerance --------------
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
setTolerance(1e-9);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class ChiSquaredDistributionTest extends RealDistributionAbstractTest {
|
|||
//---------------------------- Additional test cases -------------------------
|
||||
|
||||
@Test
|
||||
public void testSmallDf() throws Exception {
|
||||
public void testSmallDf() {
|
||||
setDistribution(new ChiSquaredDistribution(0.1d));
|
||||
setTolerance(1E-4);
|
||||
// quantiles computed using R version 1.8.1 (linux version)
|
||||
|
|
|
@ -33,7 +33,7 @@ public class ExponentialDistributionTest extends RealDistributionAbstractTest {
|
|||
|
||||
// --------------------- Override tolerance --------------
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
setTolerance(1E-9);
|
||||
}
|
||||
|
@ -71,21 +71,21 @@ public class ExponentialDistributionTest extends RealDistributionAbstractTest {
|
|||
//------------ Additional tests -------------------------------------------
|
||||
|
||||
@Test
|
||||
public void testCumulativeProbabilityExtremes() throws Exception {
|
||||
public void testCumulativeProbabilityExtremes() {
|
||||
setCumulativeTestPoints(new double[] {-2, 0});
|
||||
setCumulativeTestValues(new double[] {0, 0});
|
||||
verifyCumulativeProbabilities();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInverseCumulativeProbabilityExtremes() throws Exception {
|
||||
public void testInverseCumulativeProbabilityExtremes() {
|
||||
setInverseCumulativeTestPoints(new double[] {0, 1});
|
||||
setInverseCumulativeTestValues(new double[] {0, Double.POSITIVE_INFINITY});
|
||||
verifyInverseCumulativeProbabilities();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCumulativeProbability2() throws Exception {
|
||||
public void testCumulativeProbability2() {
|
||||
double actual = getDistribution().cumulativeProbability(0.25, 0.75);
|
||||
Assert.assertEquals(0.0905214, actual, 10e-4);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class FDistributionTest extends RealDistributionAbstractTest {
|
|||
|
||||
// --------------------- Override tolerance --------------
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
setTolerance(1e-9);
|
||||
}
|
||||
|
@ -68,14 +68,14 @@ public class FDistributionTest extends RealDistributionAbstractTest {
|
|||
//---------------------------- Additional test cases -------------------------
|
||||
|
||||
@Test
|
||||
public void testCumulativeProbabilityExtremes() throws Exception {
|
||||
public void testCumulativeProbabilityExtremes() {
|
||||
setCumulativeTestPoints(new double[] {-2, 0});
|
||||
setCumulativeTestValues(new double[] {0, 0});
|
||||
verifyCumulativeProbabilities();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInverseCumulativeProbabilityExtremes() throws Exception {
|
||||
public void testInverseCumulativeProbabilityExtremes() {
|
||||
setInverseCumulativeTestPoints(new double[] {0, 1});
|
||||
setInverseCumulativeTestValues(new double[] {0, Double.POSITIVE_INFINITY});
|
||||
verifyInverseCumulativeProbabilities();
|
||||
|
@ -105,7 +105,7 @@ public class FDistributionTest extends RealDistributionAbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLargeDegreesOfFreedom() throws Exception {
|
||||
public void testLargeDegreesOfFreedom() {
|
||||
FDistribution fd = new FDistribution(100000, 100000);
|
||||
double p = fd.cumulativeProbability(.999);
|
||||
double x = fd.inverseCumulativeProbability(p);
|
||||
|
@ -113,7 +113,7 @@ public class FDistributionTest extends RealDistributionAbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSmallDegreesOfFreedom() throws Exception {
|
||||
public void testSmallDegreesOfFreedom() {
|
||||
FDistribution fd = new FDistribution(1, 1);
|
||||
double p = fd.cumulativeProbability(0.975);
|
||||
double x = fd.inverseCumulativeProbability(p);
|
||||
|
|
|
@ -69,7 +69,7 @@ public class GammaDistributionTest extends RealDistributionAbstractTest {
|
|||
|
||||
// --------------------- Override tolerance --------------
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
setTolerance(1e-9);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class GammaDistributionTest extends RealDistributionAbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testProbabilities() throws Exception {
|
||||
public void testProbabilities() {
|
||||
testProbability(-1.000, 4.0, 2.0, .0000);
|
||||
testProbability(15.501, 4.0, 2.0, .9499);
|
||||
testProbability(0.504, 4.0, 1.0, .0018);
|
||||
|
@ -108,20 +108,20 @@ public class GammaDistributionTest extends RealDistributionAbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testValues() throws Exception {
|
||||
public void testValues() {
|
||||
testValue(15.501, 4.0, 2.0, .9499);
|
||||
testValue(0.504, 4.0, 1.0, .0018);
|
||||
testValue(10.011, 1.0, 2.0, .9933);
|
||||
testValue(5.000, 2.0, 2.0, .7127);
|
||||
}
|
||||
|
||||
private void testProbability(double x, double a, double b, double expected) throws Exception {
|
||||
private void testProbability(double x, double a, double b, double expected) {
|
||||
GammaDistribution distribution = new GammaDistribution( a, b );
|
||||
double actual = distribution.cumulativeProbability(x);
|
||||
Assert.assertEquals("probability for " + x, expected, actual, 10e-4);
|
||||
}
|
||||
|
||||
private void testValue(double expected, double a, double b, double p) throws Exception {
|
||||
private void testValue(double expected, double a, double b, double p) {
|
||||
GammaDistribution distribution = new GammaDistribution( a, b );
|
||||
double actual = distribution.inverseCumulativeProbability(p);
|
||||
Assert.assertEquals("critical value for " + p, expected, actual, 10e-4);
|
||||
|
@ -156,7 +156,7 @@ public class GammaDistributionTest extends RealDistributionAbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testInverseCumulativeProbabilityExtremes() throws Exception {
|
||||
public void testInverseCumulativeProbabilityExtremes() {
|
||||
setInverseCumulativeTestPoints(new double[] {0, 1});
|
||||
setInverseCumulativeTestValues(new double[] {0, Double.POSITIVE_INFINITY});
|
||||
verifyInverseCumulativeProbabilities();
|
||||
|
|
|
@ -85,7 +85,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
|
|||
|
||||
/** Verify that if there are no failures, mass is concentrated on sampleSize */
|
||||
@Test
|
||||
public void testDegenerateNoFailures() throws Exception {
|
||||
public void testDegenerateNoFailures() {
|
||||
HypergeometricDistribution dist = new HypergeometricDistribution(5,5,3);
|
||||
setDistribution(dist);
|
||||
setCumulativeTestPoints(new int[] {-1, 0, 1, 3, 10 });
|
||||
|
@ -103,7 +103,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
|
|||
|
||||
/** Verify that if there are no successes, mass is concentrated on 0 */
|
||||
@Test
|
||||
public void testDegenerateNoSuccesses() throws Exception {
|
||||
public void testDegenerateNoSuccesses() {
|
||||
HypergeometricDistribution dist = new HypergeometricDistribution(5,0,3);
|
||||
setDistribution(dist);
|
||||
setCumulativeTestPoints(new int[] {-1, 0, 1, 3, 10 });
|
||||
|
@ -121,7 +121,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
|
|||
|
||||
/** Verify that if sampleSize = populationSize, mass is concentrated on numberOfSuccesses */
|
||||
@Test
|
||||
public void testDegenerateFullSample() throws Exception {
|
||||
public void testDegenerateFullSample() {
|
||||
HypergeometricDistribution dist = new HypergeometricDistribution(5,3,5);
|
||||
setDistribution(dist);
|
||||
setCumulativeTestPoints(new int[] {-1, 0, 1, 3, 10 });
|
||||
|
|
|
@ -131,7 +131,7 @@ public abstract class IntegerDistributionAbstractTest {
|
|||
* Verifies that probability density calculations match expected values
|
||||
* using current test instance data
|
||||
*/
|
||||
protected void verifyDensities() throws Exception {
|
||||
protected void verifyDensities() {
|
||||
for (int i = 0; i < densityTestPoints.length; i++) {
|
||||
Assert.assertEquals("Incorrect density value returned for " + densityTestPoints[i],
|
||||
densityTestValues[i],
|
||||
|
@ -143,7 +143,7 @@ public abstract class IntegerDistributionAbstractTest {
|
|||
* Verifies that cumulative probability density calculations match expected values
|
||||
* using current test instance data
|
||||
*/
|
||||
protected void verifyCumulativeProbabilities() throws Exception {
|
||||
protected void verifyCumulativeProbabilities() {
|
||||
for (int i = 0; i < cumulativeTestPoints.length; i++) {
|
||||
Assert.assertEquals("Incorrect cumulative probability value returned for " + cumulativeTestPoints[i],
|
||||
cumulativeTestValues[i],
|
||||
|
@ -156,7 +156,7 @@ public abstract class IntegerDistributionAbstractTest {
|
|||
* Verifies that inverse cumulative probability density calculations match expected values
|
||||
* using current test instance data
|
||||
*/
|
||||
protected void verifyInverseCumulativeProbabilities() throws Exception {
|
||||
protected void verifyInverseCumulativeProbabilities() {
|
||||
for (int i = 0; i < inverseCumulativeTestPoints.length; i++) {
|
||||
Assert.assertEquals("Incorrect inverse cumulative probability value returned for "
|
||||
+ inverseCumulativeTestPoints[i], inverseCumulativeTestValues[i],
|
||||
|
@ -171,7 +171,7 @@ public abstract class IntegerDistributionAbstractTest {
|
|||
* using default test instance data
|
||||
*/
|
||||
@Test
|
||||
public void testDensities() throws Exception {
|
||||
public void testDensities() {
|
||||
verifyDensities();
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ public abstract class IntegerDistributionAbstractTest {
|
|||
* using default test instance data
|
||||
*/
|
||||
@Test
|
||||
public void testCumulativeProbabilities() throws Exception {
|
||||
public void testCumulativeProbabilities() {
|
||||
verifyCumulativeProbabilities();
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ public abstract class IntegerDistributionAbstractTest {
|
|||
* using default test instance data
|
||||
*/
|
||||
@Test
|
||||
public void testInverseCumulativeProbabilities() throws Exception {
|
||||
public void testInverseCumulativeProbabilities() {
|
||||
verifyInverseCumulativeProbabilities();
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ public abstract class IntegerDistributionAbstractTest {
|
|||
* Verifies that illegal arguments are correctly handled
|
||||
*/
|
||||
@Test
|
||||
public void testIllegalArguments() throws Exception {
|
||||
public void testIllegalArguments() {
|
||||
try {
|
||||
distribution.cumulativeProbability(1, 0);
|
||||
Assert.fail("Expecting MathIllegalArgumentException for bad cumulativeProbability interval");
|
||||
|
@ -240,7 +240,7 @@ public abstract class IntegerDistributionAbstractTest {
|
|||
* Test sampling
|
||||
*/
|
||||
@Test
|
||||
public void testSampling() throws Exception {
|
||||
public void testSampling() {
|
||||
int[] densityPoints = makeDensityTestPoints();
|
||||
double[] densityValues = makeDensityTestValues();
|
||||
int sampleSize = 1000;
|
||||
|
|
|
@ -30,7 +30,7 @@ public class KolmogorovSmirnovDistributionTest {
|
|||
private static final double TOLERANCE = 10e-10;
|
||||
|
||||
@Test
|
||||
public void testCumulativeDensityFunction() throws Exception {
|
||||
public void testCumulativeDensityFunction() {
|
||||
|
||||
KolmogorovSmirnovDistribution dist;
|
||||
|
||||
|
|
|
@ -100,14 +100,14 @@ public class LogNormalDistributionTest extends RealDistributionAbstractTest {
|
|||
|
||||
// --------------------- Override tolerance --------------
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
setTolerance(LogNormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
|
||||
}
|
||||
|
||||
//---------------------------- Additional test cases -------------------------
|
||||
|
||||
private void verifyQuantiles() throws Exception {
|
||||
private void verifyQuantiles() {
|
||||
LogNormalDistribution distribution = (LogNormalDistribution)getDistribution();
|
||||
double mu = distribution.getScale();
|
||||
double sigma = distribution.getShape();
|
||||
|
@ -119,7 +119,7 @@ public class LogNormalDistributionTest extends RealDistributionAbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testQuantiles() throws Exception {
|
||||
public void testQuantiles() {
|
||||
setCumulativeTestValues(new double[] {0, 0.0396495152787,
|
||||
0.16601209243, 0.272533253269,
|
||||
0.357618409638, 0.426488363093,
|
||||
|
@ -156,7 +156,7 @@ public class LogNormalDistributionTest extends RealDistributionAbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testInverseCumulativeProbabilityExtremes() throws Exception {
|
||||
public void testInverseCumulativeProbabilityExtremes() {
|
||||
setInverseCumulativeTestPoints(new double[] {0, 1});
|
||||
setInverseCumulativeTestValues(
|
||||
new double[] {0, Double.POSITIVE_INFINITY});
|
||||
|
@ -206,7 +206,7 @@ public class LogNormalDistributionTest extends RealDistributionAbstractTest {
|
|||
* Verifies fixes for JIRA MATH-167, MATH-414
|
||||
*/
|
||||
@Test
|
||||
public void testExtremeValues() throws Exception {
|
||||
public void testExtremeValues() {
|
||||
LogNormalDistribution d = new LogNormalDistribution(0, 1);
|
||||
for (int i = 0; i < 1e5; i++) { // make sure no convergence exception
|
||||
double upperTail = d.cumulativeProbability(i);
|
||||
|
|
|
@ -63,14 +63,14 @@ public class NormalDistributionTest extends RealDistributionAbstractTest {
|
|||
// --------------------- Override tolerance --------------
|
||||
protected double defaultTolerance = NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY;
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
setTolerance(defaultTolerance);
|
||||
}
|
||||
|
||||
//---------------------------- Additional test cases -------------------------
|
||||
|
||||
private void verifyQuantiles() throws Exception {
|
||||
private void verifyQuantiles() {
|
||||
NormalDistribution distribution = (NormalDistribution) getDistribution();
|
||||
double mu = distribution.getMean();
|
||||
double sigma = distribution.getStandardDeviation();
|
||||
|
@ -84,7 +84,7 @@ public class NormalDistributionTest extends RealDistributionAbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testQuantiles() throws Exception {
|
||||
public void testQuantiles() {
|
||||
setDensityTestValues(new double[] {0.0385649760808, 0.172836231799, 0.284958771715, 0.172836231799, 0.0385649760808,
|
||||
0.00316560600853, 9.55930184035e-05, 1.06194251052e-06});
|
||||
verifyQuantiles();
|
||||
|
@ -104,7 +104,7 @@ public class NormalDistributionTest extends RealDistributionAbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testInverseCumulativeProbabilityExtremes() throws Exception {
|
||||
public void testInverseCumulativeProbabilityExtremes() {
|
||||
setInverseCumulativeTestPoints(new double[] {0, 1});
|
||||
setInverseCumulativeTestValues(
|
||||
new double[] {Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY});
|
||||
|
@ -149,7 +149,7 @@ public class NormalDistributionTest extends RealDistributionAbstractTest {
|
|||
* Verifies fixes for JIRA MATH-167, MATH-414
|
||||
*/
|
||||
@Test
|
||||
public void testExtremeValues() throws Exception {
|
||||
public void testExtremeValues() {
|
||||
NormalDistribution distribution = new NormalDistribution(0, 1);
|
||||
for (int i = 0; i < 100; i++) { // make sure no convergence exception
|
||||
double lowerTail = distribution.cumulativeProbability(-i);
|
||||
|
|
|
@ -89,7 +89,7 @@ public class PascalDistributionTest extends IntegerDistributionAbstractTest {
|
|||
|
||||
/** Test degenerate case p = 0 */
|
||||
@Test
|
||||
public void testDegenerate0() throws Exception {
|
||||
public void testDegenerate0() {
|
||||
setDistribution(new PascalDistribution(5, 0.0d));
|
||||
setCumulativeTestPoints(new int[] {-1, 0, 1, 5, 10 });
|
||||
setCumulativeTestValues(new double[] {0d, 0d, 0d, 0d, 0d});
|
||||
|
@ -104,7 +104,7 @@ public class PascalDistributionTest extends IntegerDistributionAbstractTest {
|
|||
|
||||
/** Test degenerate case p = 1 */
|
||||
@Test
|
||||
public void testDegenerate1() throws Exception {
|
||||
public void testDegenerate1() {
|
||||
setDistribution(new PascalDistribution(5, 1.0d));
|
||||
setCumulativeTestPoints(new int[] {-1, 0, 1, 2, 5, 10 });
|
||||
setCumulativeTestValues(new double[] {0d, 1d, 1d, 1d, 1d, 1d});
|
||||
|
|
|
@ -112,7 +112,7 @@ public class PoissonDistributionTest extends IntegerDistributionAbstractTest {
|
|||
* P(9900 ≤ X ≤ 10200) for X = Po(10000)
|
||||
*/
|
||||
@Test
|
||||
public void testNormalApproximateProbability() throws Exception {
|
||||
public void testNormalApproximateProbability() {
|
||||
PoissonDistribution dist = new PoissonDistribution(100);
|
||||
double result = dist.normalApproximateProbability(110)
|
||||
- dist.normalApproximateProbability(89);
|
||||
|
@ -129,7 +129,7 @@ public class PoissonDistributionTest extends IntegerDistributionAbstractTest {
|
|||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testDegenerateInverseCumulativeProbability() throws Exception {
|
||||
public void testDegenerateInverseCumulativeProbability() {
|
||||
PoissonDistribution dist = new PoissonDistribution(DEFAULT_TEST_POISSON_PARAMETER);
|
||||
Assert.assertEquals(Integer.MAX_VALUE, dist.inverseCumulativeProbability(1.0d));
|
||||
Assert.assertEquals(0, dist.inverseCumulativeProbability(0d));
|
||||
|
@ -179,7 +179,7 @@ public class PoissonDistributionTest extends IntegerDistributionAbstractTest {
|
|||
* JIRA: MATH-282
|
||||
*/
|
||||
@Test
|
||||
public void testCumulativeProbabilitySpecial() throws Exception {
|
||||
public void testCumulativeProbabilitySpecial() {
|
||||
PoissonDistribution dist;
|
||||
dist = new PoissonDistribution(9120);
|
||||
checkProbability(dist, 9075);
|
||||
|
@ -190,7 +190,7 @@ public class PoissonDistributionTest extends IntegerDistributionAbstractTest {
|
|||
checkProbability(dist, 6950);
|
||||
}
|
||||
|
||||
private void checkProbability(PoissonDistribution dist, int x) throws Exception {
|
||||
private void checkProbability(PoissonDistribution dist, int x) {
|
||||
double p = dist.cumulativeProbability(x);
|
||||
Assert.assertFalse("NaN cumulative probability returned for mean = " +
|
||||
dist.getMean() + " x = " + x, Double.isNaN(p));
|
||||
|
@ -199,7 +199,7 @@ public class PoissonDistributionTest extends IntegerDistributionAbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLargeMeanInverseCumulativeProbability() throws Exception {
|
||||
public void testLargeMeanInverseCumulativeProbability() {
|
||||
double mean = 1.0;
|
||||
while (mean <= 100000.0) { // Extended test value: 1E7. Reduced to limit run time.
|
||||
PoissonDistribution dist = new PoissonDistribution(mean);
|
||||
|
|
|
@ -116,7 +116,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
* Setup sets all test instance data to default values
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
distribution = makeDistribution();
|
||||
cumulativeTestPoints = makeCumulativeTestPoints();
|
||||
cumulativeTestValues = makeCumulativeTestValues();
|
||||
|
@ -129,7 +129,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
* Cleans up test instance data
|
||||
*/
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
public void tearDown() {
|
||||
distribution = null;
|
||||
cumulativeTestPoints = null;
|
||||
cumulativeTestValues = null;
|
||||
|
@ -144,7 +144,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
* Verifies that cumulative probability density calculations match expected values
|
||||
* using current test instance data
|
||||
*/
|
||||
protected void verifyCumulativeProbabilities() throws Exception {
|
||||
protected void verifyCumulativeProbabilities() {
|
||||
// verify cumulativeProbability(double)
|
||||
for (int i = 0; i < cumulativeTestPoints.length; i++) {
|
||||
TestUtils.assertEquals("Incorrect cumulative probability value returned for "
|
||||
|
@ -175,7 +175,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
* Verifies that inverse cumulative probability density calculations match expected values
|
||||
* using current test instance data
|
||||
*/
|
||||
protected void verifyInverseCumulativeProbabilities() throws Exception {
|
||||
protected void verifyInverseCumulativeProbabilities() {
|
||||
for (int i = 0; i < inverseCumulativeTestPoints.length; i++) {
|
||||
TestUtils.assertEquals("Incorrect inverse cumulative probability value returned for "
|
||||
+ inverseCumulativeTestPoints[i], inverseCumulativeTestValues[i],
|
||||
|
@ -187,7 +187,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
/**
|
||||
* Verifies that density calculations match expected values
|
||||
*/
|
||||
protected void verifyDensities() throws Exception {
|
||||
protected void verifyDensities() {
|
||||
for (int i = 0; i < cumulativeTestPoints.length; i++) {
|
||||
TestUtils.assertEquals("Incorrect probability density value returned for "
|
||||
+ cumulativeTestPoints[i], densityTestValues[i],
|
||||
|
@ -203,7 +203,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
* using default test instance data
|
||||
*/
|
||||
@Test
|
||||
public void testCumulativeProbabilities() throws Exception {
|
||||
public void testCumulativeProbabilities() {
|
||||
verifyCumulativeProbabilities();
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
* using default test instance data
|
||||
*/
|
||||
@Test
|
||||
public void testInverseCumulativeProbabilities() throws Exception {
|
||||
public void testInverseCumulativeProbabilities() {
|
||||
verifyInverseCumulativeProbabilities();
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
* for default test instance data
|
||||
*/
|
||||
@Test
|
||||
public void testDensities() throws Exception {
|
||||
public void testDensities() {
|
||||
verifyDensities();
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
* Verifies that probability computations are consistent
|
||||
*/
|
||||
@Test
|
||||
public void testConsistency() throws Exception {
|
||||
public void testConsistency() {
|
||||
for (int i=1; i < cumulativeTestPoints.length; i++) {
|
||||
|
||||
// check that cdf(x, x) = 0
|
||||
|
@ -252,7 +252,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
* Verifies that illegal arguments are correctly handled
|
||||
*/
|
||||
@Test
|
||||
public void testIllegalArguments() throws Exception {
|
||||
public void testIllegalArguments() {
|
||||
try {
|
||||
distribution.cumulativeProbability(1, 0);
|
||||
Assert.fail("Expecting MathIllegalArgumentException for bad cumulativeProbability interval");
|
||||
|
@ -277,7 +277,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
* Test sampling
|
||||
*/
|
||||
@Test
|
||||
public void testSampling() throws Exception {
|
||||
public void testSampling() {
|
||||
final int sampleSize = 1000;
|
||||
distribution.reseedRandomGenerator(1000); // Use fixed seed
|
||||
double[] sample = distribution.sample(sampleSize);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class TDistributionTest extends RealDistributionAbstractTest {
|
|||
|
||||
// --------------------- Override tolerance --------------
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
setTolerance(1E-9);
|
||||
}
|
||||
|
@ -72,14 +72,14 @@ public class TDistributionTest extends RealDistributionAbstractTest {
|
|||
* Bug report that prompted this unit test.</a>
|
||||
*/
|
||||
@Test
|
||||
public void testCumulativeProbabilityAgainstStackOverflow() throws Exception {
|
||||
public void testCumulativeProbabilityAgainstStackOverflow() {
|
||||
TDistribution td = new TDistribution(5.);
|
||||
td.cumulativeProbability(.1);
|
||||
td.cumulativeProbability(.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSmallDf() throws Exception {
|
||||
public void testSmallDf() {
|
||||
setDistribution(new TDistribution(1d));
|
||||
// quantiles computed using R version 2.9.2
|
||||
setCumulativeTestPoints(new double[] {-318.308838986, -31.8205159538, -12.7062047362,
|
||||
|
@ -95,7 +95,7 @@ public class TDistributionTest extends RealDistributionAbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testInverseCumulativeProbabilityExtremes() throws Exception {
|
||||
public void testInverseCumulativeProbabilityExtremes() {
|
||||
setInverseCumulativeTestPoints(new double[] {0, 1});
|
||||
setInverseCumulativeTestValues(
|
||||
new double[] {Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY});
|
||||
|
|
|
@ -31,7 +31,7 @@ public class TriangularDistributionTest extends RealDistributionAbstractTest {
|
|||
// --- Override tolerance -------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
setTolerance(1e-4);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class UniformRealDistributionTest extends RealDistributionAbstractTest {
|
|||
// --- Override tolerance -------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
setTolerance(1e-4);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class WeibullDistributionTest extends RealDistributionAbstractTest {
|
|||
//---------------------------- Additional test cases -------------------------
|
||||
|
||||
@Test
|
||||
public void testInverseCumulativeProbabilityExtremes() throws Exception {
|
||||
public void testInverseCumulativeProbabilityExtremes() {
|
||||
setInverseCumulativeTestPoints(new double[] {0.0, 1.0});
|
||||
setInverseCumulativeTestValues(
|
||||
new double[] {0.0, Double.POSITIVE_INFINITY});
|
||||
|
|
|
@ -98,7 +98,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextIntIAE() throws Exception {
|
||||
public void testNextIntIAE() {
|
||||
try {
|
||||
randomData.nextInt(4, 3);
|
||||
Assert.fail("MathIllegalArgumentException expected");
|
||||
|
@ -108,7 +108,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextIntNegativeToPositiveRange() throws Exception {
|
||||
public void testNextIntNegativeToPositiveRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextIntUniform(-3, 5);
|
||||
checkNextIntUniform(-3, 6);
|
||||
|
@ -116,7 +116,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextIntNegativeRange() throws Exception {
|
||||
public void testNextIntNegativeRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextIntUniform(-7, -4);
|
||||
checkNextIntUniform(-15, -2);
|
||||
|
@ -124,7 +124,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextIntPositiveRange() throws Exception {
|
||||
public void testNextIntPositiveRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextIntUniform(0, 3);
|
||||
checkNextIntUniform(2, 12);
|
||||
|
@ -133,7 +133,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
|
||||
private void checkNextIntUniform(int min, int max) throws Exception {
|
||||
private void checkNextIntUniform(int min, int max) {
|
||||
final Frequency freq = new Frequency();
|
||||
for (int i = 0; i < smallSampleSize; i++) {
|
||||
final int value = randomData.nextInt(min, max);
|
||||
|
@ -164,7 +164,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextLongNegativeToPositiveRange() throws Exception {
|
||||
public void testNextLongNegativeToPositiveRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextLongUniform(-3, 5);
|
||||
checkNextLongUniform(-3, 6);
|
||||
|
@ -172,7 +172,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextLongNegativeRange() throws Exception {
|
||||
public void testNextLongNegativeRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextLongUniform(-7, -4);
|
||||
checkNextLongUniform(-15, -2);
|
||||
|
@ -180,14 +180,14 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextLongPositiveRange() throws Exception {
|
||||
public void testNextLongPositiveRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextLongUniform(0, 3);
|
||||
checkNextLongUniform(2, 12);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkNextLongUniform(int min, int max) throws Exception {
|
||||
private void checkNextLongUniform(int min, int max) {
|
||||
final Frequency freq = new Frequency();
|
||||
for (int i = 0; i < smallSampleSize; i++) {
|
||||
final long value = randomData.nextLong(min, max);
|
||||
|
@ -219,7 +219,7 @@ public class RandomDataTest {
|
|||
|
||||
@Test
|
||||
@Retry(3)
|
||||
public void testNextSecureLongNegativeToPositiveRange() throws Exception {
|
||||
public void testNextSecureLongNegativeToPositiveRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextSecureLongUniform(-3, 5);
|
||||
checkNextSecureLongUniform(-3, 6);
|
||||
|
@ -228,7 +228,7 @@ public class RandomDataTest {
|
|||
|
||||
@Test
|
||||
@Retry(3)
|
||||
public void testNextSecureLongNegativeRange() throws Exception {
|
||||
public void testNextSecureLongNegativeRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextSecureLongUniform(-7, -4);
|
||||
checkNextSecureLongUniform(-15, -2);
|
||||
|
@ -237,14 +237,14 @@ public class RandomDataTest {
|
|||
|
||||
@Test
|
||||
@Retry(3)
|
||||
public void testNextSecureLongPositiveRange() throws Exception {
|
||||
public void testNextSecureLongPositiveRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextSecureLongUniform(0, 3);
|
||||
checkNextSecureLongUniform(2, 12);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkNextSecureLongUniform(int min, int max) throws Exception {
|
||||
private void checkNextSecureLongUniform(int min, int max) {
|
||||
final Frequency freq = new Frequency();
|
||||
for (int i = 0; i < smallSampleSize; i++) {
|
||||
final long value = randomData.nextSecureLong(min, max);
|
||||
|
@ -276,7 +276,7 @@ public class RandomDataTest {
|
|||
|
||||
@Test
|
||||
@Retry(3)
|
||||
public void testNextSecureIntNegativeToPositiveRange() throws Exception {
|
||||
public void testNextSecureIntNegativeToPositiveRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextSecureIntUniform(-3, 5);
|
||||
checkNextSecureIntUniform(-3, 6);
|
||||
|
@ -285,7 +285,7 @@ public class RandomDataTest {
|
|||
|
||||
@Test
|
||||
@Retry(3)
|
||||
public void testNextSecureIntNegativeRange() throws Exception {
|
||||
public void testNextSecureIntNegativeRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextSecureIntUniform(-7, -4);
|
||||
checkNextSecureIntUniform(-15, -2);
|
||||
|
@ -294,14 +294,14 @@ public class RandomDataTest {
|
|||
|
||||
@Test
|
||||
@Retry(3)
|
||||
public void testNextSecureIntPositiveRange() throws Exception {
|
||||
public void testNextSecureIntPositiveRange() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextSecureIntUniform(0, 3);
|
||||
checkNextSecureIntUniform(2, 12);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkNextSecureIntUniform(int min, int max) throws Exception {
|
||||
private void checkNextSecureIntUniform(int min, int max) {
|
||||
final Frequency freq = new Frequency();
|
||||
for (int i = 0; i < smallSampleSize; i++) {
|
||||
final int value = randomData.nextSecureInt(min, max);
|
||||
|
@ -363,7 +363,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextPoissonConsistency() throws Exception {
|
||||
public void testNextPoissonConsistency() {
|
||||
|
||||
// Small integral means
|
||||
for (int i = 1; i < 100; i++) {
|
||||
|
@ -389,7 +389,7 @@ public class RandomDataTest {
|
|||
* distributions are the same. If the null hypothesis can be rejected with confidence
|
||||
* 1 - alpha, the check fails.
|
||||
*/
|
||||
public void checkNextPoissonConsistency(double mean) throws Exception {
|
||||
public void checkNextPoissonConsistency(double mean) {
|
||||
// Generate sample values
|
||||
final int sampleSize = 1000; // Number of deviates to generate
|
||||
final int minExpectedCount = 7; // Minimum size of expected bin count
|
||||
|
@ -511,7 +511,7 @@ public class RandomDataTest {
|
|||
|
||||
/** test dispersion and failure modes for nextHex() */
|
||||
@Test
|
||||
public void testNextHex() throws Exception {
|
||||
public void testNextHex() {
|
||||
try {
|
||||
randomData.nextHexString(-1);
|
||||
Assert.fail("negative length supplied -- MathIllegalArgumentException expected");
|
||||
|
@ -560,7 +560,7 @@ public class RandomDataTest {
|
|||
/** test dispersion and failure modes for nextHex() */
|
||||
@Test
|
||||
@Retry(3)
|
||||
public void testNextSecureHex() throws Exception {
|
||||
public void testNextSecureHex() {
|
||||
try {
|
||||
randomData.nextSecureHexString(-1);
|
||||
Assert.fail("negative length -- MathIllegalArgumentException expected");
|
||||
|
@ -641,34 +641,34 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextUniformUniformPositiveBounds() throws Exception {
|
||||
public void testNextUniformUniformPositiveBounds() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextUniformUniform(0, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNextUniformUniformNegativeToPositiveBounds() throws Exception {
|
||||
public void testNextUniformUniformNegativeToPositiveBounds() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextUniformUniform(-3, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNextUniformUniformNegaiveBounds() throws Exception {
|
||||
public void testNextUniformUniformNegaiveBounds() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextUniformUniform(-7, -3);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNextUniformUniformMaximalInterval() throws Exception {
|
||||
public void testNextUniformUniformMaximalInterval() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkNextUniformUniform(-Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkNextUniformUniform(double min, double max) throws Exception {
|
||||
private void checkNextUniformUniform(double min, double max) {
|
||||
// Set up bin bounds - min, binBound[0], ..., binBound[binCount-2], max
|
||||
final int binCount = 5;
|
||||
final double binSize = max / binCount - min/binCount; // Prevent overflow in extreme value case
|
||||
|
@ -736,7 +736,7 @@ public class RandomDataTest {
|
|||
|
||||
/** test failure modes and distribution of nextExponential() */
|
||||
@Test
|
||||
public void testNextExponential() throws Exception {
|
||||
public void testNextExponential() {
|
||||
try {
|
||||
randomData.nextExponential(-1);
|
||||
Assert.fail("negative mean -- expecting MathIllegalArgumentException");
|
||||
|
@ -921,7 +921,7 @@ public class RandomDataTest {
|
|||
|
||||
/** tests for nextPermutation */
|
||||
@Test
|
||||
public void testNextPermutation() throws Exception {
|
||||
public void testNextPermutation() {
|
||||
int[][] p = { { 0, 1, 2 }, { 0, 2, 1 }, { 1, 0, 2 }, { 1, 2, 0 },
|
||||
{ 2, 0, 1 }, { 2, 1, 0 } };
|
||||
long[] observed = { 0, 0, 0, 0, 0, 0 };
|
||||
|
@ -990,7 +990,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextInversionDeviate() throws Exception {
|
||||
public void testNextInversionDeviate() {
|
||||
// Set the seed for the default random generator
|
||||
randomData.reSeed(100);
|
||||
double[] quantiles = new double[10];
|
||||
|
@ -1012,7 +1012,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextBeta() throws Exception {
|
||||
public void testNextBeta() {
|
||||
double[] quartiles = TestUtils.getDistributionQuartiles(new BetaDistribution(2,5));
|
||||
long[] counts = new long[4];
|
||||
randomData.reSeed(1000);
|
||||
|
@ -1024,7 +1024,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextCauchy() throws Exception {
|
||||
public void testNextCauchy() {
|
||||
double[] quartiles = TestUtils.getDistributionQuartiles(new CauchyDistribution(1.2, 2.1));
|
||||
long[] counts = new long[4];
|
||||
randomData.reSeed(1000);
|
||||
|
@ -1036,7 +1036,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextChiSquare() throws Exception {
|
||||
public void testNextChiSquare() {
|
||||
double[] quartiles = TestUtils.getDistributionQuartiles(new ChiSquaredDistribution(12));
|
||||
long[] counts = new long[4];
|
||||
randomData.reSeed(1000);
|
||||
|
@ -1048,7 +1048,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextF() throws Exception {
|
||||
public void testNextF() {
|
||||
double[] quartiles = TestUtils.getDistributionQuartiles(new FDistribution(12, 5));
|
||||
long[] counts = new long[4];
|
||||
randomData.reSeed(1000);
|
||||
|
@ -1060,7 +1060,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextGamma() throws Exception {
|
||||
public void testNextGamma() {
|
||||
double[] quartiles;
|
||||
long[] counts;
|
||||
|
||||
|
@ -1086,7 +1086,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextT() throws Exception {
|
||||
public void testNextT() {
|
||||
double[] quartiles = TestUtils.getDistributionQuartiles(new TDistribution(10));
|
||||
long[] counts = new long[4];
|
||||
randomData.reSeed(1000);
|
||||
|
@ -1098,7 +1098,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextWeibull() throws Exception {
|
||||
public void testNextWeibull() {
|
||||
double[] quartiles = TestUtils.getDistributionQuartiles(new WeibullDistribution(1.2, 2.1));
|
||||
long[] counts = new long[4];
|
||||
randomData.reSeed(1000);
|
||||
|
@ -1110,7 +1110,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextBinomial() throws Exception {
|
||||
public void testNextBinomial() {
|
||||
BinomialDistributionTest testInstance = new BinomialDistributionTest();
|
||||
int[] densityPoints = testInstance.makeDensityTestPoints();
|
||||
double[] densityValues = testInstance.makeDensityTestValues();
|
||||
|
@ -1136,7 +1136,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextHypergeometric() throws Exception {
|
||||
public void testNextHypergeometric() {
|
||||
HypergeometricDistributionTest testInstance = new HypergeometricDistributionTest();
|
||||
int[] densityPoints = testInstance.makeDensityTestPoints();
|
||||
double[] densityValues = testInstance.makeDensityTestValues();
|
||||
|
@ -1162,7 +1162,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextPascal() throws Exception {
|
||||
public void testNextPascal() {
|
||||
PascalDistributionTest testInstance = new PascalDistributionTest();
|
||||
int[] densityPoints = testInstance.makeDensityTestPoints();
|
||||
double[] densityValues = testInstance.makeDensityTestValues();
|
||||
|
@ -1187,7 +1187,7 @@ public class RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNextZipf() throws Exception {
|
||||
public void testNextZipf() {
|
||||
ZipfDistributionTest testInstance = new ZipfDistributionTest();
|
||||
int[] densityPoints = testInstance.makeDensityTestPoints();
|
||||
double[] densityValues = testInstance.makeDensityTestValues();
|
||||
|
|
|
@ -101,7 +101,7 @@ public abstract class RandomGeneratorAbstractTest extends RandomDataTest {
|
|||
* other tests and the generator is not reseeded, so this is a fixed seed
|
||||
* test.
|
||||
*/
|
||||
public void testNextIntDirect() throws Exception {
|
||||
public void testNextIntDirect() {
|
||||
// Set up test values - end of the array filled randomly
|
||||
int[] testValues = new int[] {4, 10, 12, 32, 100, 10000, 0, 0, 0, 0};
|
||||
for (int i = 6; i < 10; i++) {
|
||||
|
@ -337,7 +337,7 @@ public abstract class RandomGeneratorAbstractTest extends RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNexBytes() throws Exception {
|
||||
public void testNexBytes() {
|
||||
long[] count = new long[256];
|
||||
byte[] bytes = new byte[10];
|
||||
double[] expected = new double[256];
|
||||
|
@ -359,7 +359,7 @@ public abstract class RandomGeneratorAbstractTest extends RandomDataTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSeeding() throws Exception {
|
||||
public void testSeeding() {
|
||||
// makeGenerator initializes with fixed seed
|
||||
RandomGenerator gen = makeGenerator();
|
||||
RandomGenerator gen1 = makeGenerator();
|
||||
|
@ -372,7 +372,7 @@ public abstract class RandomGeneratorAbstractTest extends RandomDataTest {
|
|||
checkSameSequence(gen, gen1);
|
||||
}
|
||||
|
||||
private void checkSameSequence(RandomGenerator gen1, RandomGenerator gen2) throws Exception {
|
||||
private void checkSameSequence(RandomGenerator gen1, RandomGenerator gen2) {
|
||||
final int len = 11; // Needs to be an odd number to check MATH-723
|
||||
final double[][] values = new double[2][len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
|
Loading…
Reference in New Issue