Simplify: no need to unbox the Integers just to compare values
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1504687 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bedea0067e
commit
93f8389221
|
@ -23,7 +23,9 @@ public class OnePointCrossoverTest {
|
|||
|
||||
@Test
|
||||
public void testCrossover() {
|
||||
@SuppressWarnings("boxing")
|
||||
Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
|
||||
@SuppressWarnings("boxing")
|
||||
Integer[] p2 = new Integer[] {0,1,1,0,1,0,1,1,1};
|
||||
|
||||
BinaryChromosome p1c = new DummyBinaryChromosome(p1);
|
||||
|
@ -42,17 +44,17 @@ public class OnePointCrossoverTest {
|
|||
c2 = ((BinaryChromosome) pair.getSecond()).getRepresentation().toArray(c2);
|
||||
|
||||
// first and last values will be the same
|
||||
Assert.assertEquals((int) p1[0], (int) c1[0]);
|
||||
Assert.assertEquals((int) p2[0], (int) c2[0]);
|
||||
Assert.assertEquals((int) p1[p1.length-1], (int) c1[c1.length-1]);
|
||||
Assert.assertEquals((int) p2[p2.length-1], (int) c2[c2.length-1]);
|
||||
Assert.assertEquals(p1[0], c1[0]);
|
||||
Assert.assertEquals(p2[0], c2[0]);
|
||||
Assert.assertEquals(p1[p1.length-1], c1[c1.length-1]);
|
||||
Assert.assertEquals(p2[p2.length-1], c2[c2.length-1]);
|
||||
// moreover, in the above setting, the 2nd, 3rd and 7th values will be the same
|
||||
Assert.assertEquals((int) p1[2], (int) c1[2]);
|
||||
Assert.assertEquals((int) p2[2], (int) c2[2]);
|
||||
Assert.assertEquals((int) p1[3], (int) c1[3]);
|
||||
Assert.assertEquals((int) p2[3], (int) c2[3]);
|
||||
Assert.assertEquals((int) p1[7], (int) c1[7]);
|
||||
Assert.assertEquals((int) p2[7], (int) c2[7]);
|
||||
Assert.assertEquals(p1[2], c1[2]);
|
||||
Assert.assertEquals(p2[2], c2[2]);
|
||||
Assert.assertEquals(p1[3], c1[3]);
|
||||
Assert.assertEquals(p2[3], c2[3]);
|
||||
Assert.assertEquals(p1[7], c1[7]);
|
||||
Assert.assertEquals(p2[7], c2[7]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue