Changeset 14353 for trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/SimulatedBinaryCrossoverTest.cs
- Timestamp:
- 10/23/16 19:31:18 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/SimulatedBinaryCrossoverTest.cs
r14185 r14353 20 20 #endregion 21 21 22 using HeuristicLab.Core; 22 23 using HeuristicLab.Data; 23 24 using HeuristicLab.Tests; … … 31 32 [TestClass()] 32 33 public class SimulatedBinaryCrossoverTest { 34 /// <summary> 35 ///A test for Cross 36 ///</summary> 37 [TestMethod()] 38 [TestCategory("Encodings.RealVector")] 39 [TestProperty("Time", "short")] 40 public void SimulatedBinaryCrossoverCrossTest() { 41 var privateObject = new PrivateObject(typeof(SimulatedBinaryCrossover)); 42 ItemArray<RealVector> parents; 43 TestRandom random = new TestRandom(); 44 bool exceptionFired; 45 // The following test checks if there is an exception when there are more than 2 parents 46 random.Reset(); 47 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) }); 48 exceptionFired = false; 49 try { 50 RealVector actual = (RealVector)privateObject.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<RealVector>(new RealVector[] { new RealVector(4) }); 59 exceptionFired = false; 60 try { 61 RealVector actual = (RealVector)privateObject.Invoke("Cross", random, parents); 62 } 63 catch (System.ArgumentException) { 64 exceptionFired = true; 65 } 66 Assert.IsTrue(exceptionFired); 67 } 68 33 69 /// <summary> 34 70 ///A test for Apply
Note: See TracChangeset
for help on using the changeset viewer.