This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-statistics.git
commit d3b023dc5ff93986ae3b9a0d712b677581297612 Author: aherbert <aherb...@apache.org> AuthorDate: Wed Jun 24 12:18:00 2020 +0100 Consistent section order for test classes Override tolerance Implementations for abstract methods Additional test cases Change makeDistribution to return correct distribution type --- .../distribution/BinomialDistributionTest.java | 6 +++--- .../distribution/CauchyDistributionTest.java | 7 ++++--- .../distribution/ChiSquaredDistributionTest.java | 18 +++++++++--------- .../ConstantContinuousDistributionTest.java | 6 +++--- .../distribution/ExponentialDistributionTest.java | 4 ++-- .../statistics/distribution/FDistributionTest.java | 18 +++++++++--------- .../statistics/distribution/GammaDistributionTest.java | 6 +++--- .../distribution/GeometricDistributionTest.java | 6 +++--- .../distribution/GumbelDistributionTest.java | 4 ++-- .../distribution/HypergeometricDistributionTest.java | 6 +++--- .../distribution/LaplaceDistributionTest.java | 4 ++-- .../statistics/distribution/LevyDistributionTest.java | 4 ++-- .../distribution/LogNormalDistributionTest.java | 18 +++++++++--------- .../distribution/LogisticsDistributionTest.java | 4 ++-- .../distribution/NakagamiDistributionTest.java | 4 ++-- .../distribution/NormalDistributionTest.java | 6 +++--- .../distribution/ParetoDistributionTest.java | 18 +++++++++--------- .../distribution/PascalDistributionTest.java | 9 +++++---- .../distribution/PoissonDistributionTest.java | 6 +++--- .../statistics/distribution/TDistributionTest.java | 6 +++--- .../distribution/TriangularDistributionTest.java | 6 +++--- .../UniformContinuousDistributionTest.java | 6 +++--- .../distribution/UniformDiscreteDistributionTest.java | 6 +++--- .../distribution/WeibullDistributionTest.java | 4 ++-- .../statistics/distribution/ZipfDistributionTest.java | 8 ++++---- 25 files changed, 96 insertions(+), 94 deletions(-) diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/BinomialDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/BinomialDistributionTest.java index 7d05aef..c427f9d 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/BinomialDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/BinomialDistributionTest.java @@ -27,14 +27,14 @@ import org.junit.jupiter.api.Test; */ public class BinomialDistributionTest extends DiscreteDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(1e-12); } - // -------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default discrete distribution instance to use in tests. */ @Override @@ -91,7 +91,7 @@ public class BinomialDistributionTest extends DiscreteDistributionAbstractTest { return new int[] {0, 2, 3, 4, 5, 5, 10, 10, 10, 9, 9, 10}; } - // ----------------- Additional test cases --------------------------------- + //-------------------- Additional test cases ------------------------------- /** Test degenerate case p = 0 */ @Test diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/CauchyDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/CauchyDistributionTest.java index f690a64..cedf9a2 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/CauchyDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/CauchyDistributionTest.java @@ -29,7 +29,8 @@ import org.junit.jupiter.api.Test; */ public class CauchyDistributionTest extends ContinuousDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- + protected double defaultTolerance = 1e-7; @BeforeEach @@ -37,7 +38,7 @@ public class CauchyDistributionTest extends ContinuousDistributionAbstractTest { setTolerance(defaultTolerance); } - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default continuous distribution instance to use in tests. */ @Override @@ -67,7 +68,7 @@ public class CauchyDistributionTest extends ContinuousDistributionAbstractTest { 1.49599158008e-06, 0.000149550440335, 0.000933076881878, 0.00370933207799, 0.0144742330437}; } - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testInverseCumulativeProbabilityExtremes() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ChiSquaredDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ChiSquaredDistributionTest.java index 6d123e2..4fc17b0 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ChiSquaredDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ChiSquaredDistributionTest.java @@ -28,7 +28,14 @@ import org.junit.jupiter.api.Test; */ public class ChiSquaredDistributionTest extends ContinuousDistributionAbstractTest { - //-------------- Implementations for abstract methods ----------------------- + //---------------------- Override tolerance -------------------------------- + + @BeforeEach + public void customSetUp() { + setTolerance(1e-9); + } + + //-------------- Implementations for abstract methods ---------------------- /** Creates the default continuous distribution instance to use in tests. */ @Override @@ -72,14 +79,7 @@ public class ChiSquaredDistributionTest extends ContinuousDistributionAbstractTe 0.000433630076361, 0.00412780610309, 0.00999340341045, 0.0193246438937, 0.0368460089216}; } - // --------------------- Override tolerance -------------- - - @BeforeEach - public void customSetUp() { - setTolerance(1e-9); - } - - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testSmallDf() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ConstantContinuousDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ConstantContinuousDistributionTest.java index 54abde1..bc4a2cf 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ConstantContinuousDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ConstantContinuousDistributionTest.java @@ -26,14 +26,14 @@ import org.junit.jupiter.api.Test; */ public class ConstantContinuousDistributionTest extends ContinuousDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(0); } - //--- Implementations for abstract methods -------------------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default uniform real distribution instance to use in tests. */ @Override @@ -69,7 +69,7 @@ public class ConstantContinuousDistributionTest extends ContinuousDistributionAb } } - //--- Additional test cases ----------------------------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testMoments() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ExponentialDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ExponentialDistributionTest.java index 9fe3c14..e4dedd3 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ExponentialDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ExponentialDistributionTest.java @@ -29,14 +29,14 @@ import org.junit.jupiter.api.Test; */ public class ExponentialDistributionTest extends ContinuousDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(1e-9); } - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default continuous distribution instance to use in tests. */ @Override diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/FDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/FDistributionTest.java index e9cbacc..69877c0 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/FDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/FDistributionTest.java @@ -28,7 +28,14 @@ import org.junit.jupiter.api.Test; */ public class FDistributionTest extends ContinuousDistributionAbstractTest { - //-------------- Implementations for abstract methods ----------------------- + //---------------------- Override tolerance -------------------------------- + + @BeforeEach + public void customSetUp() { + setTolerance(1e-9); + } + + //-------------- Implementations for abstract methods ---------------------- /** Creates the default continuous distribution instance to use in tests. */ @Override @@ -57,14 +64,7 @@ public class FDistributionTest extends ContinuousDistributionAbstractTest { 0.000133443915657, 0.00286681303403, 0.00969192007502, 0.0242883861471, 0.0605491314658}; } - // --------------------- Override tolerance -------------- - - @BeforeEach - public void customSetUp() { - setTolerance(1e-9); - } - - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testCumulativeProbabilityExtremes() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java index bb6f263..a2d2f48 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java @@ -38,14 +38,14 @@ public class GammaDistributionTest extends ContinuousDistributionAbstractTest { private static final double HALF_LOG_2_PI = 0.5 * Math.log(2.0 * Math.PI); - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(1e-9); } - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default continuous distribution instance to use in tests. */ @Override @@ -74,7 +74,7 @@ public class GammaDistributionTest extends ContinuousDistributionAbstractTest { 0.000394468852816, 0.00366559696761, 0.00874649473311, 0.0166712508128, 0.0311798227954}; } - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testParameterAccessors() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GeometricDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GeometricDistributionTest.java index f91c777..02cfd59 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GeometricDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GeometricDistributionTest.java @@ -26,14 +26,14 @@ import org.junit.jupiter.api.Test; */ public class GeometricDistributionTest extends DiscreteDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(1e-12); } - // -------------- Implementations for abstract methods -------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default discrete distribution instance to use in tests. */ @Override @@ -153,7 +153,7 @@ public class GeometricDistributionTest extends DiscreteDistributionAbstractTest }; } - // ----------------- Additional test cases --------------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testParameterAccessors() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GumbelDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GumbelDistributionTest.java index dc5b054..61268f2 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GumbelDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GumbelDistributionTest.java @@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test; */ public class GumbelDistributionTest extends ContinuousDistributionAbstractTest { - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- @Override public GumbelDistribution makeDistribution() { @@ -55,7 +55,7 @@ public class GumbelDistributionTest extends ContinuousDistributionAbstractTest { }; } - // ----------------- Additional test cases --------------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testInverseCumulativeProbabilityExtremes() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/HypergeometricDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/HypergeometricDistributionTest.java index 4a8e3ea..c48f15f 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/HypergeometricDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/HypergeometricDistributionTest.java @@ -31,14 +31,14 @@ import org.junit.jupiter.api.Test; */ public class HypergeometricDistributionTest extends DiscreteDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(1e-12); } - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default discrete distribution instance to use in tests. */ @Override @@ -102,7 +102,7 @@ public class HypergeometricDistributionTest extends DiscreteDistributionAbstract return new int[] {0, 0, 1, 1, 1, 1, 5, 4, 4, 4, 4, 5}; } - //-------------------- Additional test cases ------------------------------ + //-------------------- Additional test cases ------------------------------- /** Verify that if there are no failures, mass is concentrated on sampleSize */ @Test diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LaplaceDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LaplaceDistributionTest.java index d7b8b76..da54db5 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LaplaceDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LaplaceDistributionTest.java @@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test; */ public class LaplaceDistributionTest extends ContinuousDistributionAbstractTest { - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- @Override public LaplaceDistribution makeDistribution() { @@ -55,7 +55,7 @@ public class LaplaceDistributionTest extends ContinuousDistributionAbstractTest }; } - // ----------------- Additional test cases --------------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testInverseCumulativeProbabilityExtremes() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LevyDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LevyDistributionTest.java index 37c20ee..9ab0958 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LevyDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LevyDistributionTest.java @@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test; public class LevyDistributionTest extends ContinuousDistributionAbstractTest { - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- @Override public LevyDistribution makeDistribution() { @@ -66,7 +66,7 @@ public class LevyDistributionTest extends ContinuousDistributionAbstractTest { -2.650679030597d, -3.644945255983d}; } - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testParameterAccessors() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LogNormalDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LogNormalDistributionTest.java index 14982fb..7f74e25 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LogNormalDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LogNormalDistributionTest.java @@ -28,7 +28,14 @@ import org.junit.jupiter.api.Test; */ public class LogNormalDistributionTest extends ContinuousDistributionAbstractTest { - //-------------- Implementations for abstract methods ----------------------- + //---------------------- Override tolerance -------------------------------- + + @BeforeEach + public void customSetUp() { + setTolerance(1e-7); + } + + //-------------- Implementations for abstract methods ---------------------- /** Creates the default real distribution instance to use in tests. */ @Override @@ -95,14 +102,7 @@ public class LogNormalDistributionTest extends ContinuousDistributionAbstractTes //return Arrays.copyOfRange(points, 1, points.length - 4); } - // --------------------- Override tolerance -------------- - - @BeforeEach - public void customSetUp() { - setTolerance(1e-7); - } - - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- private void verifyQuantiles() { LogNormalDistribution distribution = (LogNormalDistribution)getDistribution(); diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LogisticsDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LogisticsDistributionTest.java index b0b7c3d..8170b54 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LogisticsDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/LogisticsDistributionTest.java @@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test; */ public class LogisticsDistributionTest extends ContinuousDistributionAbstractTest { - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- @Override public LogisticDistribution makeDistribution() { @@ -55,7 +55,7 @@ public class LogisticsDistributionTest extends ContinuousDistributionAbstractTes }; } - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testInverseCumulativeProbabilityExtremes() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NakagamiDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NakagamiDistributionTest.java index c2f0cf9..542bffc 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NakagamiDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NakagamiDistributionTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test; */ public class NakagamiDistributionTest extends ContinuousDistributionAbstractTest { - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- @Override public NakagamiDistribution makeDistribution() { @@ -56,7 +56,7 @@ public class NakagamiDistributionTest extends ContinuousDistributionAbstractTest }; } - //----------------- Additional test cases --------------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testParameterAccessors() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NormalDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NormalDistributionTest.java index 144edec..e979adc 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NormalDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NormalDistributionTest.java @@ -31,14 +31,14 @@ public class NormalDistributionTest extends ContinuousDistributionAbstractTest { private static final double DEFAULT_TOLERANCE = 1e-7; - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(DEFAULT_TOLERANCE); } - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default real distribution instance to use in tests. */ @Override @@ -68,7 +68,7 @@ public class NormalDistributionTest extends ContinuousDistributionAbstractTest { 0.00240506434076, 0.0190372444310, 0.0417464784322, 0.0736683145538, 0.125355951380}; } - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- private void verifyQuantiles() { // Requires the current instance set by setDistribution(...) diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ParetoDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ParetoDistributionTest.java index 2b73694..96431ba 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ParetoDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ParetoDistributionTest.java @@ -27,7 +27,14 @@ import org.junit.jupiter.api.Test; */ public class ParetoDistributionTest extends ContinuousDistributionAbstractTest { - //-------------- Implementations for abstract methods ----------------------- + //---------------------- Override tolerance -------------------------------- + + @BeforeEach + public void customSetUp() { + setTolerance(1e-7); + } + + //-------------- Implementations for abstract methods ---------------------- /** Creates the default real distribution instance to use in tests. */ @Override @@ -83,14 +90,7 @@ public class ParetoDistributionTest extends ContinuousDistributionAbstractTest { return points2; } - // --------------------- Override tolerance -------------- - - @BeforeEach - public void customSetUp() { - setTolerance(1e-7); - } - - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- private void verifyQuantiles() { ParetoDistribution distribution = (ParetoDistribution)getDistribution(); diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/PascalDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/PascalDistributionTest.java index 9b29cbf..c8de173 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/PascalDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/PascalDistributionTest.java @@ -28,7 +28,8 @@ import org.junit.jupiter.api.Test; */ public class PascalDistributionTest extends DiscreteDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- + protected double defaultTolerance = 1e-7; @BeforeEach @@ -36,11 +37,11 @@ public class PascalDistributionTest extends DiscreteDistributionAbstractTest { setTolerance(defaultTolerance); } - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default discrete distribution instance to use in tests. */ @Override - public DiscreteDistribution makeDistribution() { + public PascalDistribution makeDistribution() { return new PascalDistribution(10, 0.70); } @@ -85,7 +86,7 @@ public class PascalDistributionTest extends DiscreteDistributionAbstractTest { return new int[] {0, 0, 0, 0, 1, 1, 14, 11, 10, 9, 8, Integer.MAX_VALUE}; } - //----------------- Additional test cases --------------------------------- + //-------------------- Additional test cases ------------------------------- /** Test degenerate case p = 0 */ @Test diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/PoissonDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/PoissonDistributionTest.java index d949470..13d8d53 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/PoissonDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/PoissonDistributionTest.java @@ -31,14 +31,14 @@ public class PoissonDistributionTest extends DiscreteDistributionAbstractTest { */ private static final double DEFAULT_TEST_POISSON_PARAMETER = 4.0; - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(1e-12); } - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** * Creates the default discrete distribution instance to use in tests. @@ -120,7 +120,7 @@ public class PoissonDistributionTest extends DiscreteDistributionAbstractTest { return new int[] {0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 10, 20}; } - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- /** * Test the normal approximation of the Poisson distribution by diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/TDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/TDistributionTest.java index f91137c..84004c9 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/TDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/TDistributionTest.java @@ -27,14 +27,14 @@ import org.junit.jupiter.api.Test; */ public class TDistributionTest extends ContinuousDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(1e-9); } - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default continuous distribution instance to use in tests. */ @Override @@ -64,7 +64,7 @@ public class TDistributionTest extends ContinuousDistributionAbstractTest { 0.000756494565517, 0.0109109752919, 0.0303377878006, 0.0637967988952, 0.128289492005}; } - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- /** * @see <a href="https://issues.apache.orgg/bugzilla/show_bug.cgi?id=27243"> diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/TriangularDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/TriangularDistributionTest.java index f8ebd9a..079d05b 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/TriangularDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/TriangularDistributionTest.java @@ -27,14 +27,14 @@ import org.junit.jupiter.api.Test; */ public class TriangularDistributionTest extends ContinuousDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(1e-4); } - //--- Implementations for abstract methods -------------------------------- + //-------------- Implementations for abstract methods ---------------------- /** * Creates the default triangular distribution instance to use in tests. @@ -130,7 +130,7 @@ public class TriangularDistributionTest extends ContinuousDistributionAbstractTe 0}; } - //--- Additional test cases ----------------------------------------------- + //-------------------- Additional test cases ------------------------------- /** Test lower bound getter. */ @Test diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UniformContinuousDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UniformContinuousDistributionTest.java index 94a4555..3c86bd8 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UniformContinuousDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UniformContinuousDistributionTest.java @@ -27,14 +27,14 @@ import org.junit.jupiter.api.Test; */ public class UniformContinuousDistributionTest extends ContinuousDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(1e-4); } - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default uniform real distribution instance to use in tests. */ @Override @@ -64,7 +64,7 @@ public class UniformContinuousDistributionTest extends ContinuousDistributionAbs return new double[] {0, d, d, d, d, d, d, d, d, d, d, 0}; } - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- /** Test lower bound getter. */ @Test diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UniformDiscreteDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UniformDiscreteDistributionTest.java index 740e073..be79fbe 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UniformDiscreteDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UniformDiscreteDistributionTest.java @@ -28,14 +28,14 @@ import org.apache.commons.numbers.core.Precision; */ public class UniformDiscreteDistributionTest extends DiscreteDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(1e-9); } - //--- Implementations for abstract methods -------------------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default discrete distribution instance to use in tests. */ @Override @@ -82,7 +82,7 @@ public class UniformDiscreteDistributionTest extends DiscreteDistributionAbstrac return new int[] {-3, -3, -3, -3, -3, -3, -2, 1, 5, 5, 5, 5, 5, 5}; } - //--- Additional test cases ----------------------------------------------- + //-------------------- Additional test cases ------------------------------- /** Test mean/variance. */ @Test diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/WeibullDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/WeibullDistributionTest.java index 9bfef32..932661e 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/WeibullDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/WeibullDistributionTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test; */ public class WeibullDistributionTest extends ContinuousDistributionAbstractTest { - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default continuous distribution instance to use in tests. */ @Override @@ -58,7 +58,7 @@ public class WeibullDistributionTest extends ContinuousDistributionAbstractTest 0.353441418887, 0.000788590320203, 0.00737060094841, 0.0177576041516, 0.0343043442574, 0.065664589369}; } - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testInverseCumulativeProbabilitySmallPAccuracy() { diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ZipfDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ZipfDistributionTest.java index 99eab17..2f3166a 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ZipfDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ZipfDistributionTest.java @@ -29,18 +29,18 @@ import org.junit.jupiter.api.Test; */ public class ZipfDistributionTest extends DiscreteDistributionAbstractTest { - // --------------------- Override tolerance -------------- + //---------------------- Override tolerance -------------------------------- @BeforeEach public void customSetUp() { setTolerance(1e-12); } - //-------------- Implementations for abstract methods ----------------------- + //-------------- Implementations for abstract methods ---------------------- /** Creates the default discrete distribution instance to use in tests. */ @Override - public DiscreteDistribution makeDistribution() { + public ZipfDistribution makeDistribution() { return new ZipfDistribution(10, 1); } @@ -99,7 +99,7 @@ public class ZipfDistributionTest extends DiscreteDistributionAbstractTest { } - //---------------------------- Additional test cases ------------------------- + //-------------------- Additional test cases ------------------------------- @Test public void testParameterAccessors() {