Changeset 14353 for trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.BinaryVectorEncoding-3.3/UniformCrossoverTest.cs
- Timestamp:
- 10/23/16 19:31:18 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.BinaryVectorEncoding-3.3/UniformCrossoverTest.cs
r14185 r14353 20 20 #endregion 21 21 22 using HeuristicLab.Core; 22 23 using HeuristicLab.Tests; 23 24 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 30 31 [TestClass()] 31 32 public class UniformCrossoverTest { 33 /// <summary> 34 ///A test for Cross 35 ///</summary> 36 [TestMethod] 37 [TestCategory("Encodings.BinaryVector")] 38 [TestProperty("Time", "short")] 39 public void SinglePointCrossoverCrossTest() { 40 var target = 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 parents 45 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 = (BinaryVector)target.Invoke("Cross", random, parents); 51 } 52 catch (System.ArgumentException) { 53 exceptionFired = true; 54 } 55 Assert.IsTrue(exceptionFired); 56 // The following test checks if there is an exception when there are less than 2 parents 57 random.Reset(); 58 parents = new ItemArray<BinaryVector>(new BinaryVector[] { new BinaryVector(4) }); 59 exceptionFired = false; 60 try { 61 BinaryVector actual; 62 actual = (BinaryVector)target.Invoke("Cross", random, parents); 63 } 64 catch (System.ArgumentException) { 65 exceptionFired = true; 66 } 67 Assert.IsTrue(exceptionFired); 68 } 69 32 70 /// <summary> 33 71 ///A test for Apply
Note: See TracChangeset
for help on using the changeset viewer.