Boxing OK here

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1504723 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2013-07-18 23:41:02 +00:00
parent 95175f882a
commit 7d57ff6d78
12 changed files with 22 additions and 9 deletions

View File

@ -115,7 +115,7 @@ public class PerfTestUtils {
// Timed block.
final long start = System.nanoTime();
for (int i = 0; i < repeatChunk; i++) {
result[i] = r.call();
result[i] = r.call().doubleValue();
}
final long stop = System.nanoTime();
@ -158,6 +158,7 @@ public class PerfTestUtils {
* {@code call} method (i.e. the time taken by each timed block divided
* by {@code repeatChunk}).
*/
@SuppressWarnings("boxing")
public static StatisticalSummary[] timeAndReport(String title,
int repeatChunk,
int repeatStat,

View File

@ -68,6 +68,7 @@ public class HermiteParametricTest extends GaussianQuadratureAbstractTest {
*
* @return the collection of parameters for this parameterized test.
*/
@SuppressWarnings("boxing") // OK here
@Parameters
public static Collection<Object[]> getParameters() {
final ArrayList<Object[]> parameters = new ArrayList<Object[]>();

View File

@ -66,6 +66,7 @@ public class LegendreHighPrecisionParametricTest extends GaussianQuadratureAbstr
*
* @return the collection of parameters for this parameterized test.
*/
@SuppressWarnings("boxing") // OK here
@Parameters
public static Collection<Object[]> getParameters() {
final ArrayList<Object[]> parameters = new ArrayList<Object[]>();

View File

@ -66,6 +66,7 @@ public class LegendreParametricTest extends GaussianQuadratureAbstractTest {
*
* @return the collection of parameters for this parameterized test.
*/
@SuppressWarnings("boxing") // OK here
@Parameters
public static Collection<Object[]> getParameters() {
final ArrayList<Object[]> parameters = new ArrayList<Object[]>();

View File

@ -93,6 +93,7 @@ public class RootsOfUnityTest {
final double tol = 10 * Math.ulp(1.0);
for (int k = 0; k < n; k++) {
final double t = 2.0 * FastMath.PI * k / n;
@SuppressWarnings("boxing")
final String msg = String.format("n = %d, k = %d", n, k);
Assert.assertEquals(msg, FastMath.cos(t), roots.getReal(k), tol);
Assert.assertEquals(msg, FastMath.sin(t), roots.getImaginary(k), tol);

View File

@ -282,6 +282,7 @@ public class BetaDistributionTest {
}
@SuppressWarnings("boxing")
private void checkDensity(double alpha, double beta, double[] x, double[] expected) {
BetaDistribution d = new BetaDistribution(alpha, beta);
for (int i = 0; i < x.length; i++) {

View File

@ -45,8 +45,8 @@ public class MultivariateNormalMixtureModelDistributionTest {
final List<Pair<Double, MultivariateNormalDistribution>> comp = d.getComponents();
Assert.assertEquals(1d / 3, comp.get(0).getFirst(), Math.ulp(1d));
Assert.assertEquals(2d / 3, comp.get(1).getFirst(), Math.ulp(1d));
Assert.assertEquals(1d / 3, comp.get(0).getFirst().doubleValue(), Math.ulp(1d));
Assert.assertEquals(2d / 3, comp.get(1).getFirst().doubleValue(), Math.ulp(1d));
}
@Test(expected=MathArithmeticException.class)

View File

@ -24,6 +24,7 @@ import java.util.List;
import org.junit.Assert;
import org.junit.Test;
@SuppressWarnings("boxing")
public class RandomKeyTest {
@Test(expected=IllegalArgumentException.class)

View File

@ -32,6 +32,7 @@ public class UniformCrossoverTest {
private static final List<Integer> p1 = new ArrayList<Integer>(LEN);
private static final List<Integer> p2 = new ArrayList<Integer>(LEN);
@SuppressWarnings("boxing")
@BeforeClass
public static void setUpBeforeClass() {
for (int i = 0; i < LEN; i++) {
@ -83,8 +84,8 @@ public class UniformCrossoverTest {
}
}
Assert.assertEquals(1.0 - ratio, Double.valueOf((double) from1 / LEN), 0.1);
Assert.assertEquals(ratio, Double.valueOf((double) from2 / LEN), 0.1);
Assert.assertEquals(1.0 - ratio, (double) from1 / LEN, 0.1);
Assert.assertEquals(ratio, (double) from2 / LEN, 0.1);
from1 = 0;
from2 = 0;
@ -98,14 +99,16 @@ public class UniformCrossoverTest {
}
}
Assert.assertEquals(ratio, Double.valueOf((double) from1 / LEN), 0.1);
Assert.assertEquals(1.0 - ratio, Double.valueOf((double) from2 / LEN), 0.1);
Assert.assertEquals(ratio, (double) from1 / LEN, 0.1);
Assert.assertEquals(1.0 - ratio, (double) from2 / LEN, 0.1);
}
}
@Test(expected = DimensionMismatchException.class)
public void testCrossoverDimensionMismatchException(){
@SuppressWarnings("boxing")
final Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
@SuppressWarnings("boxing")
final Integer[] p2 = new Integer[] {0,1,1,0,1};
final BinaryChromosome p1c = new DummyBinaryChromosome(p1);
@ -117,6 +120,7 @@ public class UniformCrossoverTest {
@Test(expected = MathIllegalArgumentException.class)
public void testCrossoverInvalidFixedLengthChromosomeFirst() {
@SuppressWarnings("boxing")
final Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
final BinaryChromosome p1c = new DummyBinaryChromosome(p1);
final Chromosome p2c = new Chromosome() {
@ -132,6 +136,7 @@ public class UniformCrossoverTest {
@Test(expected = MathIllegalArgumentException.class)
public void testCrossoverInvalidFixedLengthChromosomeSecond() {
@SuppressWarnings("boxing")
final Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
final BinaryChromosome p2c = new DummyBinaryChromosome(p1);
final Chromosome p1c = new Chromosome() {

View File

@ -156,7 +156,7 @@ public class MultidimensionalCounterTest {
if (!iter.hasNext()) {
Assert.fail("Too short");
}
final int uniDimIndex = iter.next();
final int uniDimIndex = iter.next().intValue();
Assert.assertEquals("Wrong iteration at " + i, i, uniDimIndex);
for (int dimIndex = 0; dimIndex < nDim; dimIndex++) {

View File

@ -32,6 +32,7 @@ import org.junit.Test;
/**
* Test cases for the {@link OpenIntToDoubleHashMap}.
*/
@SuppressWarnings("boxing")
public class OpenIntToDoubleHashMapTest {
private Map<Integer, Double> javaMap = new HashMap<Integer, Double>();

View File

@ -26,7 +26,7 @@ public class PairTest {
final Pair<Integer, Double> p
= new Pair<Integer, Double>(new Integer(1), new Double(2));
Assert.assertEquals(new Integer(1), p.getKey());
Assert.assertEquals(new Double(2), p.getValue(), Math.ulp(1d));
Assert.assertEquals(2, p.getValue().doubleValue(), Math.ulp(1d));
}
@Test