Changeset 2930 for trunk/sources/HeuristicLab.Encodings.Permutation/3.3/Tests/Swap3ManipulatorTest.cs
- Timestamp:
- 03/04/10 15:15:44 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.Permutation/3.3/Tests/Swap3ManipulatorTest.cs
r2929 r2930 21 21 22 22 using Microsoft.VisualStudio.TestTools.UnitTesting; 23 using HeuristicLab.Encodings.Permutation; 23 24 24 25 namespace HeuristicLab.Encodings.Permutation_33.Tests { … … 83 84 public void Swap3ManipulatorApplyTest() { 84 85 TestRandom random = new TestRandom(); 85 Permutation parent, expected;86 Permutation.Permutation parent, expected; 86 87 // Test manipulator 87 88 random.Reset(); 88 89 random.IntNumbers = new int[] { 1, 3, 6 }; 89 90 random.DoubleNumbers = new double[] { 0 }; 90 parent = new Permutation (new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 });91 parent = new Permutation.Permutation(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }); 91 92 Assert.IsTrue(parent.Validate()); 92 93 93 expected = new Permutation (new int[] { 0, 3, 2, 6, 4, 5, 1, 7, 8 });94 expected = new Permutation.Permutation(new int[] { 0, 3, 2, 6, 4, 5, 1, 7, 8 }); 94 95 Assert.IsTrue(expected.Validate()); 95 96 Swap3Manipulator.Apply(random, parent); 96 97 Assert.IsTrue(parent.Validate()); 97 98 Assert.IsTrue(Auxiliary.PermutationIsEqualByPosition(expected, parent)); 98 99 // perform a test when the two permutations are of unequal length100 random.Reset();101 bool exceptionFired = false;102 try {103 CyclicCrossover.Apply(random, new Permutation(8), new Permutation(6));104 }105 catch (System.ArgumentException) {106 exceptionFired = true;107 }108 Assert.IsTrue(exceptionFired);109 }110 111 /// <summary>112 ///A test for Swap3Manipulator Constructor113 ///</summary>114 [TestMethod()]115 public void Swap3ManipulatorConstructorTest() {116 Swap3Manipulator target = new Swap3Manipulator();117 99 } 118 100 }
Note: See TracChangeset
for help on using the changeset viewer.