You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2007/08/16 22:36:35 UTC
svn commit: r566833 - in /commons/proper/math/trunk:
src/test/org/apache/commons/math/analysis/
src/test/org/apache/commons/math/complex/
src/test/org/apache/commons/math/fraction/
src/test/org/apache/commons/math/linear/ src/test/org/apache/commons/ma...
Author: luc
Date: Thu Aug 16 13:36:33 2007
New Revision: 566833
URL: http://svn.apache.org/viewvc?view=rev&rev=566833
Log:
fixed numerous warnings in test code (unused fields/results, fields only set to null)
Modified:
commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/LaguerreSolverTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionLagrangeFormTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionNewtonFormTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialSplineFunctionTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/UnivariateRealSolverFactoryImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/UnivariateRealSolverUtilsTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/complex/ComplexUtilsTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/fraction/FractionFormatTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/fraction/FractionTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BigMatrixImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/random/AbstractRandomGeneratorTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/FrequencyTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/StatUtilsTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StatisticalSummaryValuesTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/SummaryStatisticsImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/inference/TTestTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/inference/TestUtilsTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/regression/SimpleRegressionTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/util/MathUtilsTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/util/TestBean.java
commons/proper/math/trunk/xdocs/changes.xml
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/LaguerreSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/LaguerreSolverTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/LaguerreSolverTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/LaguerreSolverTest.java Thu Aug 16 13:36:33 2007
@@ -169,7 +169,7 @@
try {
// bad function
UnivariateRealFunction f2 = new SinFunction();
- UnivariateRealSolver solver2 = new LaguerreSolver(f2);
+ new LaguerreSolver(f2);
fail("Expecting IllegalArgumentException - bad function");
} catch (IllegalArgumentException ex) {
// expected
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionLagrangeFormTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionLagrangeFormTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionLagrangeFormTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionLagrangeFormTest.java Thu Aug 16 13:36:33 2007
@@ -126,13 +126,12 @@
* Test of parameters for the polynomial.
*/
public void testParameters() throws Exception {
- PolynomialFunctionLagrangeForm p;
try {
// bad input array length
double x[] = { 1.0 };
double y[] = { 2.0 };
- p = new PolynomialFunctionLagrangeForm(x, y);
+ new PolynomialFunctionLagrangeForm(x, y);
fail("Expecting IllegalArgumentException - bad input array length");
} catch (IllegalArgumentException ex) {
// expected
@@ -141,7 +140,7 @@
// mismatch input arrays
double x[] = { 1.0, 2.0, 3.0, 4.0 };
double y[] = { 0.0, -4.0, -24.0 };
- p = new PolynomialFunctionLagrangeForm(x, y);
+ new PolynomialFunctionLagrangeForm(x, y);
fail("Expecting IllegalArgumentException - mismatch input arrays");
} catch (IllegalArgumentException ex) {
// expected
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionNewtonFormTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionNewtonFormTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionNewtonFormTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionNewtonFormTest.java Thu Aug 16 13:36:33 2007
@@ -125,13 +125,12 @@
* Test of parameters for the polynomial.
*/
public void testParameters() throws Exception {
- PolynomialFunctionNewtonForm p;
try {
// bad input array length
double a[] = { 1.0 };
double c[] = { 2.0 };
- p = new PolynomialFunctionNewtonForm(a, c);
+ new PolynomialFunctionNewtonForm(a, c);
fail("Expecting IllegalArgumentException - bad input array length");
} catch (IllegalArgumentException ex) {
// expected
@@ -140,7 +139,7 @@
// mismatch input arrays
double a[] = { 1.0, 2.0, 3.0, 4.0 };
double c[] = { 4.0, 3.0, 2.0, 1.0 };
- p = new PolynomialFunctionNewtonForm(a, c);
+ new PolynomialFunctionNewtonForm(a, c);
fail("Expecting IllegalArgumentException - mismatch input arrays");
} catch (IllegalArgumentException ex) {
// expected
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialFunctionTest.java Thu Aug 16 13:36:33 2007
@@ -132,13 +132,13 @@
/**
- * tests the firstDerivative function by comparision
+ * tests the firstDerivative function by comparison
*
* <p>This will test the functions
* <tt>f(x) = x^3 - 2x^2 + 6x + 3, g(x) = 3x^2 - 4x + 6</tt>
* and <tt>h(x) = 6x - 4</tt>
*/
- public void testfirstDerivativeComparision() throws MathException {
+ public void testfirstDerivativeComparison() throws MathException {
double[] f_coeff = { 3.0, 6.0, -2.0, 1.0 };
double[] g_coeff = { 6.0, -4.0, 3.0 };
double[] h_coeff = { -4.0, 6.0 };
@@ -155,9 +155,9 @@
assertEquals( f.derivative().value(-3.25), g.value(-3.25), tolerance );
// compare g' = h
+ assertEquals( g.derivative().value(Math.PI), h.value(Math.PI), tolerance );
+ assertEquals( g.derivative().value(Math.E), h.value(Math.E), tolerance );
-
- // compare f'' = h
}
}
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialSplineFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialSplineFunctionTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialSplineFunctionTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/PolynomialSplineFunctionTest.java Thu Aug 16 13:36:33 2007
@@ -63,24 +63,21 @@
assertEquals(3, spline.getN());
try { // too few knots
- spline =
- new PolynomialSplineFunction(new double[] {0}, polynomials);
+ new PolynomialSplineFunction(new double[] {0}, polynomials);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
}
try { // too many knots
- spline =
- new PolynomialSplineFunction(new double[] {0,1,2,3,4}, polynomials);
+ new PolynomialSplineFunction(new double[] {0,1,2,3,4}, polynomials);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
}
try { // knots not increasing
- spline =
- new PolynomialSplineFunction(new double[] {0,1, 3, 2}, polynomials);
+ new PolynomialSplineFunction(new double[] {0,1, 3, 2}, polynomials);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/UnivariateRealSolverFactoryImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/UnivariateRealSolverFactoryImplTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/UnivariateRealSolverFactoryImplTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/UnivariateRealSolverFactoryImplTest.java Thu Aug 16 13:36:33 2007
@@ -52,7 +52,7 @@
public void testNewBisectionSolverNull() {
try {
- UnivariateRealSolver solver = factory.newBisectionSolver(null);
+ factory.newBisectionSolver(null);
fail();
} catch(IllegalArgumentException ex) {
// success
@@ -67,7 +67,7 @@
public void testNewNewtonSolverNull() {
try {
- UnivariateRealSolver solver = factory.newNewtonSolver(null);
+ factory.newNewtonSolver(null);
fail();
} catch(IllegalArgumentException ex) {
// success
@@ -82,7 +82,7 @@
public void testNewBrentSolverNull() {
try {
- UnivariateRealSolver solver = factory.newBrentSolver(null);
+ factory.newBrentSolver(null);
fail();
} catch(IllegalArgumentException ex) {
// success
@@ -97,7 +97,7 @@
public void testNewSecantSolverNull() {
try {
- UnivariateRealSolver solver = factory.newSecantSolver(null);
+ factory.newSecantSolver(null);
fail();
} catch(IllegalArgumentException ex) {
// success
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/UnivariateRealSolverUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/UnivariateRealSolverUtilsTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/UnivariateRealSolverUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/UnivariateRealSolverUtilsTest.java Thu Aug 16 13:36:33 2007
@@ -40,20 +40,19 @@
public void testSolveBadParameters() throws MathException {
try { // bad endpoints
- double x = UnivariateRealSolverUtils.solve(sin,0.0, 4.0, 4.0);
+ UnivariateRealSolverUtils.solve(sin,0.0, 4.0, 4.0);
} catch (IllegalArgumentException ex) {
// expected
}
try { // bad accuracy
- double x = UnivariateRealSolverUtils.solve(sin, 0.0, 4.0, 0.0);
+ UnivariateRealSolverUtils.solve(sin, 0.0, 4.0, 0.0);
} catch (IllegalArgumentException ex) {
// expected
}
}
public void testSolveSin() throws MathException {
- double x = UnivariateRealSolverUtils.solve(sin, 1.0,
- 4.0);
+ double x = UnivariateRealSolverUtils.solve(sin, 1.0, 4.0);
assertEquals(Math.PI, x, 1.0e-4);
}
@@ -76,8 +75,7 @@
public void testSolveNoRoot() throws MathException {
try {
- double x = UnivariateRealSolverUtils.solve(sin, 1.0,
- 1.5);
+ UnivariateRealSolverUtils.solve(sin, 1.0, 1.5);
fail("Expecting IllegalArgumentException ");
} catch (IllegalArgumentException ex) {
// expected
@@ -93,8 +91,7 @@
public void testBracketCornerSolution() throws MathException {
try {
- double[] result = UnivariateRealSolverUtils.bracket(sin,
- 1.5, 0, 2.0);
+ UnivariateRealSolverUtils.bracket(sin, 1.5, 0, 2.0);
fail("Expecting ConvergenceException");
} catch (ConvergenceException ex) {
// expected
@@ -103,25 +100,25 @@
public void testBadParameters() throws MathException {
try { // null function
- double[] result = UnivariateRealSolverUtils.bracket(null, 1.5, 0, 2.0);
+ UnivariateRealSolverUtils.bracket(null, 1.5, 0, 2.0);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
}
try { // initial not between endpoints
- double[] result = UnivariateRealSolverUtils.bracket(sin, 2.5, 0, 2.0);
+ UnivariateRealSolverUtils.bracket(sin, 2.5, 0, 2.0);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
}
try { // endpoints not valid
- double[] result = UnivariateRealSolverUtils.bracket(sin, 1.5, 2.0, 1.0);
+ UnivariateRealSolverUtils.bracket(sin, 1.5, 2.0, 1.0);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
}
try { // bad maximum iterations
- double[] result = UnivariateRealSolverUtils.bracket(sin, 1.5, 0, 2.0, 0);
+ UnivariateRealSolverUtils.bracket(sin, 1.5, 0, 2.0, 0);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/complex/ComplexUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/complex/ComplexUtilsTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/complex/ComplexUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/complex/ComplexUtilsTest.java Thu Aug 16 13:36:33 2007
@@ -39,7 +39,6 @@
private Complex infNegInf = new Complex(inf, negInf);
private Complex infInf = new Complex(inf, inf);
private Complex negInfNegInf = new Complex(negInf, negInf);
- private Complex oneNaN = new Complex(1, nan);
private Complex infNaN = new Complex(inf, nan);
private Complex negInfNaN = new Complex(negInf, nan);
private Complex nanInf = new Complex(nan, inf);
@@ -48,11 +47,8 @@
private Complex nanZero = new Complex(nan, 0);
private Complex infZero = new Complex(inf, 0);
private Complex zeroInf = new Complex(0, inf);
- private Complex zeroNegInf = new Complex(0, negInf);
private Complex negInfZero = new Complex(negInf, 0);
- private ComplexFormat fmt = new ComplexFormat();
-
public void testAcos() {
Complex z = new Complex(3, 4);
Complex expected = new Complex(0.936812, -2.30551);
@@ -78,7 +74,7 @@
public void testAcosNull() {
try {
- Complex z = ComplexUtils.acos(null);
+ ComplexUtils.acos(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -108,7 +104,7 @@
public void testAsinNull() {
try {
- Complex z = ComplexUtils.asin(null);
+ ComplexUtils.asin(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -139,7 +135,7 @@
public void testAtanNull() {
try {
- Complex z = ComplexUtils.atan(null);
+ ComplexUtils.atan(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -169,7 +165,7 @@
public void testCosNull() {
try {
- Complex z = ComplexUtils.cos(null);
+ ComplexUtils.cos(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -199,7 +195,7 @@
public void testCoshNull() {
try {
- Complex z = ComplexUtils.cosh(null);
+ ComplexUtils.cosh(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -234,7 +230,7 @@
public void testExpNull() {
try {
- Complex z = ComplexUtils.exp(null);
+ ComplexUtils.exp(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -275,7 +271,7 @@
public void testlogNull() {
try {
- Complex z = ComplexUtils.log(null);
+ ComplexUtils.log(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -318,7 +314,7 @@
public void testPolar2ComplexIllegalModulus() {
try {
- Complex z = ComplexUtils.polar2Complex(-1, 0);
+ ComplexUtils.polar2Complex(-1, 0);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
@@ -405,13 +401,13 @@
public void testpowNull() {
try {
- Complex z = ComplexUtils.pow(null, Complex.ONE);
+ ComplexUtils.pow(null, Complex.ONE);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
}
try {
- Complex z = ComplexUtils.pow(Complex.ONE, null);
+ ComplexUtils.pow(Complex.ONE, null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -441,7 +437,7 @@
public void testSinNull() {
try {
- Complex z = ComplexUtils.sin(null);
+ ComplexUtils.sin(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -471,7 +467,7 @@
public void testsinhNull() {
try {
- Complex z = ComplexUtils.sinh(null);
+ ComplexUtils.sinh(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -539,7 +535,7 @@
public void testSqrtNull() {
try {
- Complex z = ComplexUtils.sqrt(null);
+ ComplexUtils.sqrt(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -558,7 +554,7 @@
public void testSqrt1zNull() {
try {
- Complex z = ComplexUtils.sqrt1z(null);
+ ComplexUtils.sqrt1z(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -593,7 +589,7 @@
public void testTanNull() {
try {
- Complex z = ComplexUtils.tan(null);
+ ComplexUtils.tan(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
@@ -627,7 +623,7 @@
public void testTanhNull() {
try {
- Complex z = ComplexUtils.tanh(null);
+ ComplexUtils.tanh(null);
fail("Expecting NullPointerException");
} catch (NullPointerException ex) {
// expected
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/fraction/FractionFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/fraction/FractionFormatTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/fraction/FractionFormatTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/fraction/FractionFormatTest.java Thu Aug 16 13:36:33 2007
@@ -233,14 +233,14 @@
public void testParseProperInvalidMinus() {
String source = "2 -2 / 3";
try {
- Fraction c = properFormat.parse(source);
+ properFormat.parse(source);
fail("invalid minus in improper fraction.");
} catch (ParseException ex) {
// expected
}
source = "2 2 / -3";
try {
- Fraction c = properFormat.parse(source);
+ properFormat.parse(source);
fail("invalid minus in improper fraction.");
} catch (ParseException ex) {
// expected
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/fraction/FractionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/fraction/FractionTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/fraction/FractionTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/fraction/FractionTest.java Thu Aug 16 13:36:33 2007
@@ -280,7 +280,7 @@
Fraction f1 = new Fraction(3, 5);
Fraction f2 = Fraction.ZERO;
try {
- Fraction f = f1.divide(f2);
+ f1.divide(f2);
fail("expecting ArithmeticException");
} catch (ArithmeticException ex) {}
@@ -417,7 +417,6 @@
public void testEqualsAndHashCode() {
Fraction zero = new Fraction(0,1);
Fraction nullFraction = null;
- int zeroHash = zero.hashCode();
assertTrue( zero.equals(zero));
assertFalse(zero.equals(nullFraction));
assertFalse(zero.equals(new Double(0)));
@@ -433,7 +432,7 @@
assertTrue(threeFourths.equals(Fraction.getReducedFraction(6, 8)));
assertTrue(Fraction.ZERO.equals(Fraction.getReducedFraction(0, -1)));
try {
- Fraction f = Fraction.getReducedFraction(1, 0);
+ Fraction.getReducedFraction(1, 0);
fail("expecting ArithmeticException");
} catch (ArithmeticException ex) {
// expected
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BigMatrixImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BigMatrixImplTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BigMatrixImplTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BigMatrixImplTest.java Thu Aug 16 13:36:33 2007
@@ -170,38 +170,38 @@
assertClose("double, BigDecimal", m1, m3, Double.MIN_VALUE);
assertClose("string, BigDecimal", m2, m3, Double.MIN_VALUE);
try {
- BigMatrix m4 = new BigMatrixImpl(new String[][] {{"0", "hello", "1"}});
+ new BigMatrixImpl(new String[][] {{"0", "hello", "1"}});
fail("Expecting NumberFormatException");
} catch (NumberFormatException ex) {
// expected
}
try {
- BigMatrix m4 = new BigMatrixImpl(new String[][] {});
+ new BigMatrixImpl(new String[][] {});
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
}
try {
- BigMatrix m4 = new BigMatrixImpl(new String[][] {{},{}});
+ new BigMatrixImpl(new String[][] {{},{}});
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
}
try {
- BigMatrix m4 = new BigMatrixImpl(new String[][] {{"a", "b"},{"c"}});
+ new BigMatrixImpl(new String[][] {{"a", "b"},{"c"}});
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
}
try {
- BigMatrix m4 = new BigMatrixImpl(0, 1);
+ new BigMatrixImpl(0, 1);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
}
try {
- BigMatrix m4 = new BigMatrixImpl(1, 0);
+ new BigMatrixImpl(1, 0);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
@@ -228,7 +228,7 @@
BigMatrixImpl m = new BigMatrixImpl(testData);
BigMatrixImpl m2 = new BigMatrixImpl(testData2);
try {
- BigMatrixImpl mPlusMInv = (BigMatrixImpl)m.add(m2);
+ m.add(m2);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
@@ -250,7 +250,7 @@
assertClose("m-n = m + -n",m.subtract(m2),
m2.scalarMultiply(new BigDecimal(-1d)).add(m),entryTolerance);
try {
- BigMatrix a = m.subtract(new BigMatrixImpl(testData2));
+ m.subtract(new BigMatrixImpl(testData2));
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -274,7 +274,7 @@
assertClose("identity multiply",m2.multiply(identity),
m2,entryTolerance);
try {
- BigMatrix a = m.multiply(new BigMatrixImpl(bigSingular));
+ m.multiply(new BigMatrixImpl(bigSingular));
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -342,26 +342,26 @@
asDouble(m.solve(asBigDecimal(testVector))),
normTolerance);
try {
- double[] x = asDouble(m.solve(asBigDecimal(testVector2)));
+ asDouble(m.solve(asBigDecimal(testVector2)));
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
}
BigMatrix bs = new BigMatrixImpl(bigSingular);
try {
- BigMatrix a = bs.solve(bs);
+ bs.solve(bs);
fail("Expecting InvalidMatrixException");
} catch (InvalidMatrixException ex) {
;
}
try {
- BigMatrix a = m.solve(bs);
+ m.solve(bs);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
}
try {
- BigMatrix a = (new BigMatrixImpl(testData2)).solve(bs);
+ new BigMatrixImpl(testData2).solve(bs);
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -388,7 +388,7 @@
assertEquals("nonsingular R test 2",-1d,m.getDeterminant().doubleValue(),normTolerance);
try {
- double a = new BigMatrixImpl(testData2).getDeterminant().doubleValue();
+ new BigMatrixImpl(testData2).getDeterminant().doubleValue();
fail("Expecting InvalidMatrixException");
} catch (InvalidMatrixException ex) {
;
@@ -401,7 +401,7 @@
assertEquals("identity trace",3d,m.getTrace().doubleValue(),entryTolerance);
m = new BigMatrixImpl(testData2);
try {
- double x = m.getTrace().doubleValue();
+ m.getTrace().doubleValue();
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -422,7 +422,7 @@
assertClose("identity operate",testVector,x,entryTolerance);
m = new BigMatrixImpl(bigSingular);
try {
- x = asDouble(m.operate(asBigDecimal(testVector)));
+ asDouble(m.operate(asBigDecimal(testVector)));
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -461,7 +461,7 @@
BigMatrixImpl m = new BigMatrixImpl(testData);
BigMatrixImpl mInv = new BigMatrixImpl(testDataInv);
BigMatrixImpl identity = new BigMatrixImpl(id);
- BigMatrixImpl m2 = new BigMatrixImpl(testData2);
+ new BigMatrixImpl(testData2);
assertClose("inverse multiply",m.preMultiply(mInv),
identity,entryTolerance);
assertClose("inverse multiply",mInv.preMultiply(m),
@@ -471,7 +471,7 @@
assertClose("identity multiply",identity.preMultiply(mInv),
mInv,entryTolerance);
try {
- BigMatrix a = m.preMultiply(new BigMatrixImpl(bigSingular));
+ m.preMultiply(new BigMatrixImpl(bigSingular));
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -483,13 +483,13 @@
assertClose("get row",m.getRowAsDoubleArray(0),testDataRow1,entryTolerance);
assertClose("get col",m.getColumnAsDoubleArray(2),testDataCol3,entryTolerance);
try {
- double[] x = m.getRowAsDoubleArray(10);
+ m.getRowAsDoubleArray(10);
fail("expecting MatrixIndexException");
} catch (MatrixIndexException ex) {
;
}
try {
- double[] x = m.getColumnAsDoubleArray(-1);
+ m.getColumnAsDoubleArray(-1);
fail("expecting MatrixIndexException");
} catch (MatrixIndexException ex) {
;
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java Thu Aug 16 13:36:33 2007
@@ -141,7 +141,7 @@
RealMatrixImpl m = new RealMatrixImpl(testData);
RealMatrixImpl m2 = new RealMatrixImpl(testData2);
try {
- RealMatrixImpl mPlusMInv = (RealMatrixImpl)m.add(m2);
+ m.add(m2);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
@@ -163,7 +163,7 @@
assertClose("m-n = m + -n",m.subtract(m2),
m2.scalarMultiply(-1d).add(m),entryTolerance);
try {
- RealMatrix a = m.subtract(new RealMatrixImpl(testData2));
+ m.subtract(new RealMatrixImpl(testData2));
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -187,7 +187,7 @@
assertClose("identity multiply",m2.multiply(identity),
m2,entryTolerance);
try {
- RealMatrix a = m.multiply(new RealMatrixImpl(bigSingular));
+ m.multiply(new RealMatrixImpl(bigSingular));
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -253,26 +253,26 @@
assertClose("inverse-operate",mInv.operate(testVector),
m.solve(testVector),normTolerance);
try {
- double[] x = m.solve(testVector2);
+ m.solve(testVector2);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
}
RealMatrix bs = new RealMatrixImpl(bigSingular);
try {
- RealMatrix a = bs.solve(bs);
+ bs.solve(bs);
fail("Expecting InvalidMatrixException");
} catch (InvalidMatrixException ex) {
;
}
try {
- RealMatrix a = m.solve(bs);
+ m.solve(bs);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
}
try {
- RealMatrix a = (new RealMatrixImpl(testData2)).solve(bs);
+ new RealMatrixImpl(testData2).solve(bs);
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -299,7 +299,7 @@
assertEquals("nonsingular R test 2",-1d,m.getDeterminant(),normTolerance);
try {
- double a = new RealMatrixImpl(testData2).getDeterminant();
+ new RealMatrixImpl(testData2).getDeterminant();
fail("Expecting InvalidMatrixException");
} catch (InvalidMatrixException ex) {
;
@@ -312,7 +312,7 @@
assertEquals("identity trace",3d,m.getTrace(),entryTolerance);
m = new RealMatrixImpl(testData2);
try {
- double x = m.getTrace();
+ m.getTrace();
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -333,7 +333,7 @@
assertClose("identity operate",testVector,x,entryTolerance);
m = new RealMatrixImpl(bigSingular);
try {
- x = m.operate(testVector);
+ m.operate(testVector);
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -372,7 +372,6 @@
RealMatrixImpl m = new RealMatrixImpl(testData);
RealMatrixImpl mInv = new RealMatrixImpl(testDataInv);
RealMatrixImpl identity = new RealMatrixImpl(id);
- RealMatrixImpl m2 = new RealMatrixImpl(testData2);
assertClose("inverse multiply",m.preMultiply(mInv),
identity,entryTolerance);
assertClose("inverse multiply",mInv.preMultiply(m),
@@ -382,7 +381,7 @@
assertClose("identity multiply",identity.preMultiply(mInv),
mInv,entryTolerance);
try {
- RealMatrix a = m.preMultiply(new RealMatrixImpl(bigSingular));
+ m.preMultiply(new RealMatrixImpl(bigSingular));
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -394,13 +393,13 @@
assertClose("get row",m.getRow(0),testDataRow1,entryTolerance);
assertClose("get col",m.getColumn(2),testDataCol3,entryTolerance);
try {
- double[] x = m.getRow(10);
+ m.getRow(10);
fail("expecting MatrixIndexException");
} catch (MatrixIndexException ex) {
;
}
try {
- double[] x = m.getColumn(-1);
+ m.getColumn(-1);
fail("expecting MatrixIndexException");
} catch (MatrixIndexException ex) {
;
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/random/AbstractRandomGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/random/AbstractRandomGeneratorTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/random/AbstractRandomGeneratorTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/random/AbstractRandomGeneratorTest.java Thu Aug 16 13:36:33 2007
@@ -44,7 +44,7 @@
public void testNextInt() {
try {
- int x = testGenerator.nextInt(-1);
+ testGenerator.nextInt(-1);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java Thu Aug 16 13:36:33 2007
@@ -43,7 +43,6 @@
protected long smallSampleSize = 1000;
protected double[] expected = {250,250,250,250};
protected int largeSampleSize = 10000;
- private int tolerance = 50;
private String[] hex =
{"0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"};
protected RandomDataImpl randomData = null;
@@ -73,7 +72,7 @@
/** test dispersion and failure modes for nextInt() */
public void testNextInt() {
try {
- int x = randomData.nextInt(4,3);
+ randomData.nextInt(4,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
@@ -100,7 +99,7 @@
/** test dispersion and failure modes for nextLong() */
public void testNextLong() {
try {
- long x = randomData.nextLong(4,3);
+ randomData.nextLong(4,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
@@ -127,7 +126,7 @@
/** test dispersion and failure modes for nextSecureLong() */
public void testNextSecureLong() {
try {
- long x = randomData.nextSecureLong(4,3);
+ randomData.nextSecureLong(4,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
@@ -154,7 +153,7 @@
/** test dispersion and failure modes for nextSecureInt() */
public void testNextSecureInt() {
try {
- long x = randomData.nextSecureInt(4,3);
+ randomData.nextSecureInt(4,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
@@ -186,13 +185,12 @@
*/
public void testNextPoisson() {
try {
- long x = randomData.nextPoisson(0);
+ randomData.nextPoisson(0);
fail("zero mean -- expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
}
Frequency f = new Frequency();
- long v = 0;
for (int i = 0; i<largeSampleSize; i++) {
try {
f.addValue(randomData.nextPoisson(4.0d));
@@ -207,13 +205,13 @@
new Double(cumFreq).doubleValue()/new Double(sumFreq).doubleValue();
assertEquals("cum Poisson(4)",cumPct,0.7851,0.2);
try {
- long x = randomData.nextPoisson(-1);
+ randomData.nextPoisson(-1);
fail("negative mean supplied -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
}
try {
- long x = randomData.nextPoisson(0);
+ randomData.nextPoisson(0);
fail("0 mean supplied -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
@@ -224,13 +222,13 @@
/** test dispersion and failute modes for nextHex() */
public void testNextHex() {
try {
- String x = randomData.nextHexString(-1);
+ randomData.nextHexString(-1);
fail("negative length supplied -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
}
try {
- String x = randomData.nextHexString(0);
+ randomData.nextHexString(0);
fail("zero length supplied -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
@@ -278,13 +276,13 @@
/** test dispersion and failute modes for nextHex() */
public void testNextSecureHex() {
try {
- String x = randomData.nextSecureHexString(-1);
+ randomData.nextSecureHexString(-1);
fail("negative length -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
}
try {
- String x = randomData.nextSecureHexString(0);
+ randomData.nextSecureHexString(0);
fail("zero length -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
@@ -332,13 +330,13 @@
/** test failure modes and dispersion of nextUniform() */
public void testNextUniform() {
try {
- double x = randomData.nextUniform(4,3);
+ randomData.nextUniform(4,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
}
try {
- double x = randomData.nextUniform(3,3);
+ randomData.nextUniform(3,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
@@ -378,7 +376,7 @@
/** test failure modes and distribution of nextGaussian() */
public void testNextGaussian() {
try {
- double x = randomData.nextGaussian(0,0);
+ randomData.nextGaussian(0,0);
fail("zero sigma -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
@@ -399,7 +397,7 @@
/** test failure modes and distribution of nextExponential() */
public void testNextExponential() {
try {
- double x = randomData.nextExponential(-1);
+ randomData.nextExponential(-1);
fail("negative mean -- expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
@@ -469,16 +467,16 @@
// test reseeding without first using the generators
RandomDataImpl rd = new RandomDataImpl();
rd.reSeed(100);
- double ret = rd.nextLong(1,2);
+ rd.nextLong(1,2);
RandomDataImpl rd2 = new RandomDataImpl();
rd2.reSeedSecure(2000);
- ret = rd2.nextSecureLong(1,2);
+ rd2.nextSecureLong(1,2);
rd = new RandomDataImpl();
rd.reSeed();
- ret = rd.nextLong(1,2);
+ rd.nextLong(1,2);
rd2 = new RandomDataImpl();
rd2.reSeedSecure();
- ret = rd2.nextSecureLong(1,2);
+ rd2.nextSecureLong(1,2);
}
/** tests for nextSample() sampling from Collection */
@@ -540,7 +538,6 @@
}
private int findSample(Object[] u, Object[] samp) {
- int result = -1;
for (int i = 0; i < u.length; i++) {
HashSet set = (HashSet) u[i];
HashSet sampSet = new HashSet();
@@ -596,7 +593,6 @@
}
private int findPerm(int[][] p, int[] samp) {
- int result = -1;
for (int i = 0; i < p.length; i++) {
boolean good = true;
for (int j = 0; j < samp.length; j++) {
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/FrequencyTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/FrequencyTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/FrequencyTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/FrequencyTest.java Thu Aug 16 13:36:33 2007
@@ -40,8 +40,6 @@
private int oneI = 1;
private int twoI = 2;
private int threeI=3;
- private String oneS = "1";
- private String twoS = "2";
private double tolerance = 10E-15;
private Frequency f = null;
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/StatUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/StatUtilsTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/StatUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/StatUtilsTest.java Thu Aug 16 13:36:33 2007
@@ -36,12 +36,8 @@
private double sumSq = 18;
private double sum = 8;
private double var = 0.666666666666666666667;
- private double std = Math.sqrt(var);
- private double n = 4;
private double min = 1;
private double max = 3;
- private double skewness = 0;
- private double kurtosis = 0.5;
private double tolerance = 10E-15;
private double nan = Double.NaN;
@@ -423,7 +419,7 @@
public void testGeometricMean() throws Exception {
double[] test = null;
try {
- double x = StatUtils.geometricMean(test);
+ StatUtils.geometricMean(test);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
// expected
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsImplTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsImplTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsImplTest.java Thu Aug 16 13:36:33 2007
@@ -41,10 +41,8 @@
private double n = 4;
private double min = 1;
private double max = 3;
- private double skewness = 0;
- private double kurtosis = 0.5;
private double tolerance = 10E-15;
-
+
public DescriptiveStatisticsImplTest(String name) {
super(name);
}
@@ -196,13 +194,13 @@
assertEquals("expecting max",5,u.getPercentile(99),10E-12);
assertEquals("expecting middle",3,u.getPercentile(50),10E-12);
try {
- double x = u.getPercentile(0);
+ u.getPercentile(0);
fail("expecting IllegalArgumentException for getPercentile(0)");
} catch (IllegalArgumentException ex) {
;
}
try {
- double x = u.getPercentile(120);
+ u.getPercentile(120);
fail("expecting IllegalArgumentException for getPercentile(120)");
} catch (IllegalArgumentException ex) {
;
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java Thu Aug 16 13:36:33 2007
@@ -42,8 +42,6 @@
private double n = 4;
private double min = 1;
private double max = 3;
- private double skewness = 0;
- private double kurtosis = 0.5;
private double tolerance = 10E-15;
public DescriptiveStatisticsTest(String name) {
@@ -251,13 +249,13 @@
assertEquals("expecting max",5,u.getPercentile(99),10E-12);
assertEquals("expecting middle",3,u.getPercentile(50),10E-12);
try {
- double x = u.getPercentile(0);
+ u.getPercentile(0);
fail("expecting IllegalArgumentException for getPercentile(0)");
} catch (IllegalArgumentException ex) {
;
}
try {
- double x = u.getPercentile(120);
+ u.getPercentile(120);
fail("expecting IllegalArgumentException for getPercentile(120)");
} catch (IllegalArgumentException ex) {
;
@@ -331,7 +329,7 @@
public void testNewInstanceClassNull() {
try {
- DescriptiveStatistics u = DescriptiveStatistics.newInstance((Class)null);
+ DescriptiveStatistics.newInstance((Class)null);
fail("null is not a valid descriptive statistics class");
} catch (NullPointerException ex) {
// success
@@ -347,7 +345,9 @@
DescriptiveStatisticsImpl.class);
assertNotNull(u);
assertTrue(u instanceof DescriptiveStatisticsImpl);
- } catch (Exception ex) {
+ } catch (InstantiationException ex) {
+ fail();
+ } catch (IllegalAccessException ex) {
fail();
}
}
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImplTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImplTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImplTest.java Thu Aug 16 13:36:33 2007
@@ -45,8 +45,6 @@
private double n = 4;
private double min = 1;
private double max = 3;
- private double skewness = 0;
- private double kurtosis = 0.5;
private double tolerance = 10E-15;
public ListUnivariateImplTest(String name) {
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java Thu Aug 16 13:36:33 2007
@@ -44,8 +44,6 @@
private double n = 4;
private double min = 1;
private double max = 3;
- private double skewness = 0;
- private double kurtosis = 0.5;
private double tolerance = 10E-15;
private TransformerMap transformers = new TransformerMap();
@@ -102,8 +100,6 @@
}
public void testN0andN1Conditions() throws Exception {
- List list = new ArrayList();
-
DescriptiveStatistics u = new ListUnivariateImpl(new ArrayList(),transformers);
assertTrue(
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StatisticalSummaryValuesTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StatisticalSummaryValuesTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StatisticalSummaryValuesTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StatisticalSummaryValuesTest.java Thu Aug 16 13:36:33 2007
@@ -54,7 +54,6 @@
public void testEqualsAndHashCode() {
StatisticalSummaryValues u = new StatisticalSummaryValues(1, 2, 3, 4, 5, 6);
StatisticalSummaryValues t = null;
- int emptyHash = u.hashCode();
assertTrue("reflexive", u.equals(u));
assertFalse("non-null compared to null", u.equals(t));
assertFalse("wrong type", u.equals(new Double(0)));
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/SummaryStatisticsImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/SummaryStatisticsImplTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/SummaryStatisticsImplTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/SummaryStatisticsImplTest.java Thu Aug 16 13:36:33 2007
@@ -117,7 +117,6 @@
}
public void testNaNContracts() {
- double nan = Double.NaN;
assertTrue("mean not NaN",Double.isNaN(u.getMean()));
assertTrue("min not NaN",Double.isNaN(u.getMin()));
assertTrue("std dev not NaN",Double.isNaN(u.getStandardDeviation()));
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/inference/TTestTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/inference/TTestTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/inference/TTestTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/inference/TTestTest.java Thu Aug 16 13:36:33 2007
@@ -32,11 +32,9 @@
protected TTest testStatistic = new TTestImpl();
private double[] tooShortObs = { 1.0 };
- private double[] nullObserved = null;
private double[] emptyObs = {};
private SummaryStatistics emptyStats = SummaryStatistics.newInstance();
- private SummaryStatistics nullStats = null;
- SummaryStatistics tooShortStats = null;
+ SummaryStatistics tooShortStats = null;
public TTestTest(String name) {
super(name);
@@ -74,14 +72,14 @@
testStatistic.tTest(mu, sampleStats), 10E-10);
try {
- testStatistic.t(mu, nullObserved);
+ testStatistic.t(mu, (double[]) null);
fail("arguments too short, IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
// expected
}
try {
- testStatistic.t(mu, nullStats);
+ testStatistic.t(mu, (SummaryStatistics) null);
fail("arguments too short, IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
// expected
@@ -289,8 +287,7 @@
double[] sample1 = {1d, 3d, 5d, 7d};
double[] sample2 = {0d, 6d, 11d, 2d};
double[] sample3 = {5d, 7d, 8d, 10d};
- double[] sample4 = {0d, 2d};
-
+
// Target values computed using R, version 1.8.1 (linux version)
assertEquals(-0.3133, testStatistic.pairedT(sample1, sample2), 1E-4);
assertEquals(0.774544295819, testStatistic.pairedTTest(sample1, sample2), 1E-10);
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/inference/TestUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/inference/TestUtilsTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/inference/TestUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/inference/TestUtilsTest.java Thu Aug 16 13:36:33 2007
@@ -193,11 +193,8 @@
}
private double[] tooShortObs = { 1.0 };
- private double[] nullObserved = null;
private double[] emptyObs = {};
private SummaryStatistics emptyStats = SummaryStatistics.newInstance();
- private SummaryStatistics nullStats = null;
- SummaryStatistics tooShortStats = null;
public void testOneSampleT() throws Exception {
double[] observed =
@@ -220,14 +217,14 @@
TestUtils.tTest(mu, sampleStats), 10E-10);
try {
- TestUtils.t(mu, nullObserved);
+ TestUtils.t(mu, (double[]) null);
fail("arguments too short, IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
// expected
}
try {
- TestUtils.t(mu, nullStats);
+ TestUtils.t(mu, (SummaryStatistics) null);
fail("arguments too short, IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
// expected
@@ -261,13 +258,13 @@
}
try {
- TestUtils.t(mu, tooShortStats);
+ TestUtils.t(mu, (SummaryStatistics) null);
fail("insufficient data to compute t statistic, IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
// exptected
}
try {
- TestUtils.tTest(mu, tooShortStats);
+ TestUtils.tTest(mu, (SummaryStatistics) null);
fail("insufficient data to perform t test, IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
// exptected
@@ -363,7 +360,7 @@
}
try {
- TestUtils.tTest(sampleStats1, tooShortStats, .01);
+ TestUtils.tTest(sampleStats1, (SummaryStatistics) null, .01);
fail("insufficient data, IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
// expected
@@ -377,7 +374,7 @@
}
try {
- TestUtils.tTest(sampleStats1, tooShortStats);
+ TestUtils.tTest(sampleStats1, (SummaryStatistics) null);
fail("insufficient data, IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
// expected
@@ -391,7 +388,7 @@
}
try {
- TestUtils.t(sampleStats1, tooShortStats);
+ TestUtils.t(sampleStats1, (SummaryStatistics) null);
fail("insufficient data, IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
// expected
@@ -435,8 +432,7 @@
double[] sample1 = {1d, 3d, 5d, 7d};
double[] sample2 = {0d, 6d, 11d, 2d};
double[] sample3 = {5d, 7d, 8d, 10d};
- double[] sample4 = {0d, 2d};
-
+
// Target values computed using R, version 1.8.1 (linux version)
assertEquals(-0.3133, TestUtils.pairedT(sample1, sample2), 1E-4);
assertEquals(0.774544295819, TestUtils.pairedTTest(sample1, sample2), 1E-10);
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/regression/SimpleRegressionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/regression/SimpleRegressionTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/regression/SimpleRegressionTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/regression/SimpleRegressionTest.java Thu Aug 16 13:36:33 2007
@@ -222,7 +222,7 @@
regression.getSlopeConfidenceInterval() < regression.getSlopeConfidenceInterval(0.01));
try {
- double x = regression.getSlopeConfidenceInterval(1);
+ regression.getSlopeConfidenceInterval(1);
fail("expecting IllegalArgumentException for alpha = 1");
} catch (IllegalArgumentException ex) {
;
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/util/MathUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/util/MathUtilsTest.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/util/MathUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/util/MathUtilsTest.java Thu Aug 16 13:36:33 2007
@@ -46,11 +46,11 @@
int bigNeg = Integer.MIN_VALUE;
assertEquals(big, MathUtils.addAndCheck(big, 0));
try {
- int res = MathUtils.addAndCheck(big, 1);
+ MathUtils.addAndCheck(big, 1);
fail("Expecting ArithmeticException");
} catch (ArithmeticException ex) {}
try {
- int res = MathUtils.addAndCheck(bigNeg, -1);
+ MathUtils.addAndCheck(bigNeg, -1);
fail("Expecting ArithmeticException");
} catch (ArithmeticException ex) {}
}
@@ -60,11 +60,11 @@
int bigNeg = Integer.MIN_VALUE;
assertEquals(big, MathUtils.mulAndCheck(big, 1));
try {
- int res = MathUtils.mulAndCheck(big, 2);
+ MathUtils.mulAndCheck(big, 2);
fail("Expecting ArithmeticException");
} catch (ArithmeticException ex) {}
try {
- int res = MathUtils.mulAndCheck(bigNeg, 2);
+ MathUtils.mulAndCheck(bigNeg, 2);
fail("Expecting ArithmeticException");
} catch (ArithmeticException ex) {}
}
@@ -74,20 +74,19 @@
int bigNeg = Integer.MIN_VALUE;
assertEquals(big, MathUtils.subAndCheck(big, 0));
try {
- int res = MathUtils.subAndCheck(big, -1);
+ MathUtils.subAndCheck(big, -1);
fail("Expecting ArithmeticException");
} catch (ArithmeticException ex) {}
try {
- int res = MathUtils.subAndCheck(bigNeg, 1);
+ MathUtils.subAndCheck(bigNeg, 1);
fail("Expecting ArithmeticException");
} catch (ArithmeticException ex) {}
}
public void testSubAndCheckErrorMessage() {
int big = Integer.MAX_VALUE;
- int bigNeg = Integer.MIN_VALUE;
try {
- int res = MathUtils.subAndCheck(big, -1);
+ MathUtils.subAndCheck(big, -1);
fail("Expecting ArithmeticException");
} catch (ArithmeticException ex) {
assertEquals("overflow: subtract", ex.getMessage());
@@ -136,27 +135,27 @@
public void testBinomialCoefficientFail() {
try {
- long x = MathUtils.binomialCoefficient(4,5);
+ MathUtils.binomialCoefficient(4,5);
fail ("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
}
try {
- double x = MathUtils.binomialCoefficientDouble(4,5);
+ MathUtils.binomialCoefficientDouble(4,5);
fail ("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
}
try {
- double x = MathUtils.binomialCoefficientLog(4,5);
+ MathUtils.binomialCoefficientLog(4,5);
fail ("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
}
try {
- long x = MathUtils.binomialCoefficient(67,34);
+ MathUtils.binomialCoefficient(67,34);
fail ("expecting ArithmeticException");
} catch (ArithmeticException ex) {
;
@@ -181,25 +180,25 @@
public void testFactorialFail() {
try {
- long x = MathUtils.factorial(-1);
+ MathUtils.factorial(-1);
fail ("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
}
try {
- double x = MathUtils.factorialDouble(-1);
+ MathUtils.factorialDouble(-1);
fail ("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
}
try {
- double x = MathUtils.factorialLog(-1);
+ MathUtils.factorialLog(-1);
fail ("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
;
}
try {
- double x = MathUtils.factorial(21);
+ MathUtils.factorial(21);
fail ("expecting ArithmeticException");
} catch (ArithmeticException ex) {
;
@@ -241,7 +240,7 @@
int test = 10;
while (!foundLimit) {
try {
- double x = MathUtils.binomialCoefficient(test, test / 2);
+ MathUtils.binomialCoefficient(test, test / 2);
} catch (ArithmeticException ex) {
foundLimit = true;
System.out.println
@@ -284,7 +283,7 @@
int test = 10;
while (!foundLimit) {
try {
- double x = MathUtils.factorial(test);
+ MathUtils.factorial(test);
} catch (ArithmeticException ex) {
foundLimit = true;
System.out.println
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/util/TestBean.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/util/TestBean.java?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/util/TestBean.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/util/TestBean.java Thu Aug 16 13:36:33 2007
@@ -22,11 +22,9 @@
*/
public class TestBean {
private Double x = new Double(1.0);
-
+
private String y = "1.0";
-
- private Double z = new Double(2.0);
-
+
/**
*
*/
@@ -66,7 +64,6 @@
*
*/
public void setZ(Double double1) {
- z = double1;
}
}
Modified: commons/proper/math/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/xdocs/changes.xml?view=diff&rev=566833&r1=566832&r2=566833
==============================================================================
--- commons/proper/math/trunk/xdocs/changes.xml (original)
+++ commons/proper/math/trunk/xdocs/changes.xml Thu Aug 16 13:36:33 2007
@@ -40,11 +40,14 @@
</properties>
<body>
<release version="1.2-SNAPSHOT" date="TBD">
+ <action dev="luc" type="fix">
+ Fixed numerous warnings in test code.
+ </action>
<action dev="luc" type="fix" issue="MATH-156" due-to="Tyler Ward">
Use the initial guess provided by the user in BrentSolver.solve(), thus
improving speed.
</action>
- <action dev="luc" type="update">
+ <action dev="luc" type="add">
Added the estimation optimization, geometry and ode package from the
Mantissa library.
</action>