@@ -0,0 +1,2456 @@
+/*%0A * Java Genetic Algorithm Library (@__identifier__@).%0A * Copyright (c) @__year__@ Franz Wilhelmst%C3%B6tter%0A *%0A * This library is free software; you can redistribute it and/or%0A * modify it under the terms of the GNU Lesser General Public%0A * License as published by the Free Software Foundation; either%0A * version 2.1 of the License, or (at your option) any later version.%0A *%0A * This library is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.%09See the GNU%0A * Lesser General Public License for more details.%0A *%0A * You should have received a copy of the GNU Lesser General Public%0A * License along with this library; if not, write to the Free Software%0A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA%0A *%0A * Author:%0A *    Franz Wilhelmst%C3%B6tter (franz.wilhelmstoetter@gmx.at)%0A *%0A */%0Apackage org.jenetics.internal.util;%0A%0Aimport java.util.Iterator;%0Aimport java.util.ListIterator;%0Aimport java.util.Random;%0A%0Aimport org.testng.Assert;%0Aimport org.testng.annotations.Test;%0A%0Aimport org.jenetics.util.math;%0A%0A/**%0A * @author %3Ca href=%22mailto:franz.wilhelmstoetter@gmx.at%22%3EFranz Wilhelmst%C3%B6tter%3C/a%3E%0A * @version %3Cem%3E$Date: 2013-07-10 $%3C/em%3E%0A */%0Apublic class ArrayProxyIteratorTest %7B%0A%0A%09@Test%0A%09public void iterateForward() %7B%0A%09%09final long seed = math.random.seed();%0A%09%09final Random random = new Random(seed);%0A%0A%09%09final ArrayProxy%3CInteger%3E proxy = new ArrayProxyImpl%3C%3E(1000);%0A%09%09for (int i = 0; i %3C proxy._length; ++i) %7B%0A%09%09%09proxy.set(i, random.nextInt());%0A%09%09%7D%0A%0A%09%09random.setSeed(seed);%0A%09%09final Iterator%3CInteger%3E it = new ArrayProxyIterator%3C%3E(proxy);%0A%09%09int count = 0;%0A%09%09while (it.hasNext()) %7B%0A%09%09%09Assert.assertEquals(it.next().intValue(), random.nextInt());%0A%09%09%09++count;%0A%09%09%7D%0A%0A%09%09Assert.assertEquals(count, proxy._length);%0A%09%7D%0A%0A%09@Test%0A%09public void iterateBackward() %7B%0A%09%09final long seed = math.random.seed();%0A%09%09final Random random = new Random(seed);%0A%0A%09%09final ArrayProxy%3CInteger%3E proxy = new ArrayProxyImpl%3C%3E(1000);%0A%09%09for (int i = proxy._length; --i %3E= 0;) %7B%0A%09%09%09proxy.set(i, random.nextInt());%0A%09%09%7D%0A%0A%09%09random.setSeed(seed);%0A%09%09final ListIterator%3CInteger%3E it = new ArrayProxyIterator%3C%3E(proxy);%0A%09%09while (it.hasNext()) %7B%0A%09%09%09it.next();%0A%09%09%7D%0A%0A%09%09int count = 0;%0A%09%09while (it.hasPrevious()) %7B%0A%09%09%09final int value = it.previous().intValue();%0A%09%09%09Assert.assertEquals(value, random.nextInt());%0A%09%09%09++count;%0A%09%09%7D%0A%0A%09%09Assert.assertEquals(count, proxy._length);%0A%09%7D%0A%0A%7D%0A

Add ListIterator implementation test.