/*
 * Java Genetic Algorithm Library (@!identifier!@).
 * Copyright (c) @!year!@ Franz Wilhelmstötter
 *  
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * Author:
 *     Franz Wilhelmstötter (franz.wilhelmstoetter@gmx.at)
 *     
 */
package org.jenetics;

import java.io.IOException;

import javolution.xml.stream.XMLStreamException;

import org.testng.annotations.Test;

/**
 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
 * @version $Id$
 */
public class PermutationChromosomeTest {

	@Test
	public void xmlSerialize() throws XMLStreamException {
		SerializeUtils.testXMLSerialization(new PermutationChromosome(10));
	}
	
	@Test
	public void objectSerialize() throws IOException {
		SerializeUtils.testSerialization(new PermutationChromosome(10));
	}
	
}

@@ -1022,24 +1022,119 @@
 Exception;%0A%0A
+import org.jenetics.util.Array;%0Aimport org.jenetics.util.ArrayUtils;%0Aimport org.testng.Assert;%0A
 import org.t
@@ -1306,16 +1306,877 @@
 eTest %7B%0A
+%09%0A%09@Test%0A%09public void create() %7B%0A%09%09PermutationChromosome c = new PermutationChromosome(50, true);%0A%09%09final Array%3CInteger64Gene%3E array = c.toArray().copy();%0A%09%09Assert.assertFalse(isSorted(array));%0A%09%09%0A%09%09ArrayUtils.sort(array);%0A%09%09for (int i = 0; i %3C array.length(); ++i) %7B%0A%09%09%09Assert.assertEquals(array.get(i).intValue(), i);%0A%09%09%7D%0A%09%7D%0A%09%0A%09@Test%0A%09public void create2() %7B%0A%09%09PermutationChromosome c = new PermutationChromosome(50, false);%0A%09%09final Array%3CInteger64Gene%3E array = c.toArray().copy();%0A%09%09Assert.assertTrue(isSorted(array));%0A%09%09%0A%09%09for (int i = 0; i %3C array.length(); ++i) %7B%0A%09%09%09Assert.assertEquals(array.get(i).intValue(), i);%0A%09%09%7D%0A%09%7D%0A%09%0A%09private boolean isSorted(final Array%3CInteger64Gene%3E array) %7B%0A%09%09boolean sorted = true;%0A%09%09for (int i = 0; i %3C array.length() - 1 && sorted; ++i) %7B%0A%09%09%09sorted = array.get(i).compareTo(array.get(i + 1)) %3C= 0;%0A%09%09%7D%0A%09%09return sorted;%0A%09%7D%0A%09
 %0A%09@Test%0A

Add PermutationChromosome creation tests.