Changeset 2930 for trunk/sources/HeuristicLab.Encodings.Permutation/3.3/Tests/OrderCrossover2Test.cs
- Timestamp:
- 03/04/10 15:15:44 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.Permutation/3.3/Tests/OrderCrossover2Test.cs
r2929 r2930 1 1 using HeuristicLab.Core; 2 2 using Microsoft.VisualStudio.TestTools.UnitTesting; 3 using HeuristicLab.Encodings.Permutation; 3 4 4 5 namespace HeuristicLab.Encodings.Permutation_33.Tests { … … 68 69 bool exceptionFired = false; 69 70 try { 70 target.Cross(random, new ItemArray<Permutation >(newPermutation[] {71 new Permutation (4), new Permutation(4), newPermutation(4)}));71 target.Cross(random, new ItemArray<Permutation.Permutation>(new Permutation.Permutation[] { 72 new Permutation.Permutation(4), new Permutation.Permutation(4), new Permutation.Permutation(4)})); 72 73 } catch (System.InvalidOperationException) { 73 74 exceptionFired = true; … … 82 83 public void OrderCrossover2ApplyTest() { 83 84 TestRandom random = new TestRandom(); 84 Permutation parent1, parent2, expected, actual;85 Permutation.Permutation parent1, parent2, expected, actual; 85 86 // The following test is based on an example from Affenzeller, M. et al. 2009. Genetic Algorithms and Genetic Programming - Modern Concepts and Practical Applications. CRC Press. p. 135. 86 87 random.Reset(); 87 88 random.IntNumbers = new int[] { 5, 7 }; 88 parent1 = new Permutation (new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });89 parent1 = new Permutation.Permutation(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }); 89 90 Assert.IsTrue(parent1.Validate()); 90 parent2 = new Permutation (new int[] { 2, 5, 6, 0, 9, 1, 3, 8, 4, 7 });91 parent2 = new Permutation.Permutation(new int[] { 2, 5, 6, 0, 9, 1, 3, 8, 4, 7 }); 91 92 Assert.IsTrue(parent2.Validate()); 92 expected = new Permutation (new int[] { 2, 0, 9, 1, 3, 5, 6, 7, 8, 4 });93 expected = new Permutation.Permutation(new int[] { 2, 0, 9, 1, 3, 5, 6, 7, 8, 4 }); 93 94 Assert.IsTrue(expected.Validate()); 94 95 actual = OrderCrossover2.Apply(random, parent1, parent2); … … 100 101 bool exceptionFired = false; 101 102 try { 102 OrderCrossover.Apply(random, new Permutation (8), newPermutation(6));103 OrderCrossover.Apply(random, new Permutation.Permutation(8), new Permutation.Permutation(6)); 103 104 } catch (System.ArgumentException) { 104 105 exceptionFired = true; … … 106 107 Assert.IsTrue(exceptionFired); 107 108 } 108 109 /// <summary>110 ///A test for OrderCrossover2 Constructor111 ///</summary>112 [TestMethod()]113 public void OrderCrossover2ConstructorTest() {114 OrderCrossover2 target = new OrderCrossover2();115 }116 109 } 117 110 }
Note: See TracChangeset
for help on using the changeset viewer.