Changeset 13235 for trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.BinaryVectorEncoding-3.3/UniformCrossoverTest.cs
- Timestamp:
- 11/17/15 19:45:30 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.BinaryVectorEncoding-3.3/UniformCrossoverTest.cs
r12012 r13235 20 20 #endregion 21 21 22 using HeuristicLab.Core;23 22 using HeuristicLab.Tests; 24 23 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 31 30 [TestClass()] 32 31 public class UniformCrossoverTest { 33 /// <summary>34 ///A test for Cross35 ///</summary>36 [TestMethod]37 [TestCategory("Encodings.BinaryVector")]38 [TestProperty("Time", "short")]39 public void SinglePointCrossoverCrossTest() {40 UniformCrossover_Accessor target = new UniformCrossover_Accessor(new PrivateObject(typeof(UniformCrossover)));41 ItemArray<BinaryVector> parents;42 TestRandom random = new TestRandom();43 bool exceptionFired;44 // The following test checks if there is an exception when there are more than 2 parents45 random.Reset();46 parents = new ItemArray<BinaryVector>(new BinaryVector[] { new BinaryVector(5), new BinaryVector(6), new BinaryVector(4) });47 exceptionFired = false;48 try {49 BinaryVector actual;50 actual = target.Cross(random, parents);51 } catch (System.ArgumentException) {52 exceptionFired = true;53 }54 Assert.IsTrue(exceptionFired);55 // The following test checks if there is an exception when there are less than 2 parents56 random.Reset();57 parents = new ItemArray<BinaryVector>(new BinaryVector[] { new BinaryVector(4) });58 exceptionFired = false;59 try {60 BinaryVector actual;61 actual = target.Cross(random, parents);62 } catch (System.ArgumentException) {63 exceptionFired = true;64 }65 Assert.IsTrue(exceptionFired);66 }67 68 32 /// <summary> 69 33 ///A test for Apply … … 102 66 try { 103 67 actual = UniformCrossover.Apply(random, parent1, parent2); 104 } catch (System.ArgumentException) { 68 } 69 catch (System.ArgumentException) { 105 70 exceptionFired = true; 106 71 }
Note: See TracChangeset
for help on using the changeset viewer.