Changeset 13246 for stable/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/RandomConvexCrossoverTest.cs
- Timestamp:
- 11/18/15 13:01:38 (8 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13227,13235-13236
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Tests
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Tests merged: 13227,13235-13236
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/RandomConvexCrossoverTest.cs
r12009 r13246 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 RandomConvexCrossoverTest { 33 /// <summary>34 ///A test for Cross35 ///</summary>36 [TestMethod()]37 [TestCategory("Encodings.RealVector")]38 [TestProperty("Time", "short")]39 public void RandomConvexCrossoverCrossTest() {40 RandomConvexCrossover_Accessor target = new RandomConvexCrossover_Accessor(new PrivateObject(typeof(RandomConvexCrossover)));41 ItemArray<RealVector> 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<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) });47 exceptionFired = false;48 try {49 RealVector 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<RealVector>(new RealVector[] { new RealVector(4) });58 exceptionFired = false;59 try {60 RealVector 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 … … 92 56 try { 93 57 actual = RandomConvexCrossover.Apply(random, parent1, parent2); 94 } catch (System.ArgumentException) { 58 } 59 catch (System.ArgumentException) { 95 60 exceptionFired = true; 96 61 }
Note: See TracChangeset
for help on using the changeset viewer.