Changeset 3059 for trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Tests/DiscreteCrossoverTest.cs
- Timestamp:
- 03/16/10 10:35:28 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Tests/DiscreteCrossoverTest.cs
r3053 r3059 68 68 public void DiscreteCrossoverCrossTest() { 69 69 DiscreteCrossover_Accessor target = new DiscreteCrossover_Accessor(new PrivateObject(typeof(DiscreteCrossover))); 70 ItemArray<Int Array> parents;70 ItemArray<IntegerVector> 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 less than 2 parents 74 74 random.Reset(); 75 parents = new ItemArray<Int Array>(new IntArray[] { new IntArray(4) });75 parents = new ItemArray<IntegerVector>(new IntegerVector[] { new IntegerVector(4) }); 76 76 exceptionFired = false; 77 77 try { … … 90 90 public void DiscreteCrossoverApplyTest() { 91 91 TestRandom random = new TestRandom(); 92 Int Arrayparent1, parent2, expected, actual;92 IntegerVector parent1, parent2, expected, actual; 93 93 bool exceptionFired; 94 94 // The following test is not based on published examples 95 95 random.Reset(); 96 96 random.DoubleNumbers = new double[] { 0, 0, 0.9, 0, 0.9 }; 97 parent1 = new Int Array(new int[] { 2, 2, 3, 5, 1 });98 parent2 = new Int Array(new int[] { 4, 1, 3, 2, 8 });99 expected = new Int Array(new int[] { 2, 2, 3, 5, 8 });97 parent1 = new IntegerVector(new int[] { 2, 2, 3, 5, 1 }); 98 parent2 = new IntegerVector(new int[] { 4, 1, 3, 2, 8 }); 99 expected = new IntegerVector(new int[] { 2, 2, 3, 5, 8 }); 100 100 actual = DiscreteCrossover.Apply(random, parent1, parent2); 101 101 Assert.IsTrue(Auxiliary.IntVectorIsEqualByPosition(actual, expected)); … … 104 104 random.Reset(); 105 105 random.DoubleNumbers = new double[] { 0, 0, 0.9, 0, 0.9 }; 106 parent1 = new Int Array(new int[] { 2, 2, 3, 5, 1, 9 }); // this parent is longer107 parent2 = new Int Array(new int[] { 4, 1, 3, 2, 8 });106 parent1 = new IntegerVector(new int[] { 2, 2, 3, 5, 1, 9 }); // this parent is longer 107 parent2 = new IntegerVector(new int[] { 4, 1, 3, 2, 8 }); 108 108 exceptionFired = false; 109 109 try {
Note: See TracChangeset
for help on using the changeset viewer.