Changeset 3048 for trunk/sources/HeuristicLab.Encodings.IntVector/3.3/Tests/SinglePointCrossoverTest.cs
- Timestamp:
- 03/15/10 23:49:54 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.IntVector/3.3/Tests/SinglePointCrossoverTest.cs
r3032 r3048 68 68 public void SinglePointCrossoverCrossTest() { 69 69 SinglePointCrossover_Accessor target = new SinglePointCrossover_Accessor(new PrivateObject(typeof(SinglePointCrossover))); 70 ItemArray<IntArray Data> parents;70 ItemArray<IntArray> parents; 71 71 TestRandom random = new TestRandom(); 72 72 bool exceptionFired; 73 73 // The following test checks if there is an exception when there are more than 2 parents 74 74 random.Reset(); 75 parents = new ItemArray<IntArray Data>(new IntArrayData[] { new IntArrayData(5), new IntArrayData(6), new IntArrayData(4) });75 parents = new ItemArray<IntArray>(new IntArray[] { new IntArray(5), new IntArray(6), new IntArray(4) }); 76 76 exceptionFired = false; 77 77 try { 78 IntArray Dataactual;78 IntArray actual; 79 79 actual = target.Cross(random, parents); 80 80 } … … 85 85 // The following test checks if there is an exception when there are less than 2 parents 86 86 random.Reset(); 87 parents = new ItemArray<IntArray Data>(new IntArrayData[] { new IntArrayData(4) });87 parents = new ItemArray<IntArray>(new IntArray[] { new IntArray(4) }); 88 88 exceptionFired = false; 89 89 try { 90 IntArray Dataactual;90 IntArray actual; 91 91 actual = target.Cross(random, parents); 92 92 } catch (System.ArgumentException) { … … 102 102 public void SinglePointCrossoverApplyTest() { 103 103 TestRandom random = new TestRandom(); 104 IntArray Dataparent1, parent2, expected, actual;104 IntArray parent1, parent2, expected, actual; 105 105 bool exceptionFired; 106 106 // The following test is not based on published examples 107 107 random.Reset(); 108 108 random.IntNumbers = new int[] { 3 }; 109 parent1 = new IntArray Data(new int[] { 2, 2, 3, 5, 1 });110 parent2 = new IntArray Data(new int[] { 4, 1, 3, 2, 8 });111 expected = new IntArray Data(new int[] { 2, 2, 3, 2, 8 });109 parent1 = new IntArray(new int[] { 2, 2, 3, 5, 1 }); 110 parent2 = new IntArray(new int[] { 4, 1, 3, 2, 8 }); 111 expected = new IntArray(new int[] { 2, 2, 3, 2, 8 }); 112 112 actual = SinglePointCrossover.Apply(random, parent1, parent2); 113 113 Assert.IsTrue(Auxiliary.IntVectorIsEqualByPosition(actual, expected)); … … 115 115 random.Reset(); 116 116 random.IntNumbers = new int[] { 2 }; 117 parent1 = new IntArray Data(new int[] { 2, 2, 3, 5, 1, 9 }); // this parent is longer118 parent2 = new IntArray Data(new int[] { 4, 1, 3, 2, 8 });117 parent1 = new IntArray(new int[] { 2, 2, 3, 5, 1, 9 }); // this parent is longer 118 parent2 = new IntArray(new int[] { 4, 1, 3, 2, 8 }); 119 119 exceptionFired = false; 120 120 try {
Note: See TracChangeset
for help on using the changeset viewer.