Changeset 13246 for stable/HeuristicLab.Tests/HeuristicLab.Encodings.BinaryVectorEncoding-3.3/NPointCrossoverTest.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.BinaryVectorEncoding-3.3/NPointCrossoverTest.cs
r12009 r13246 20 20 #endregion 21 21 22 using HeuristicLab.Core;23 22 using HeuristicLab.Data; 24 23 using HeuristicLab.Tests; … … 32 31 [TestClass()] 33 32 public class NPointCrossoverTest { 34 /// <summary>35 ///A test for Cross36 ///</summary>37 [TestMethod]38 [TestCategory("Encodings.BinaryVector")]39 [TestProperty("Time", "short")]40 public void NPointCrossoverCrossTest() {41 NPointCrossover_Accessor target = new NPointCrossover_Accessor(new PrivateObject(typeof(NPointCrossover)));42 ItemArray<BinaryVector> 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 parents46 random.Reset();47 parents = new ItemArray<BinaryVector>(new BinaryVector[] { new BinaryVector(5), new BinaryVector(6), new BinaryVector(4) });48 exceptionFired = false;49 try {50 BinaryVector actual;51 actual = target.Cross(random, parents);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 parents57 random.Reset();58 parents = new ItemArray<BinaryVector>(new BinaryVector[] { new BinaryVector(4) });59 exceptionFired = false;60 try {61 BinaryVector actual;62 actual = target.Cross(random, parents);63 } catch (System.ArgumentException) {64 exceptionFired = true;65 }66 Assert.IsTrue(exceptionFired);67 }68 69 33 /// <summary> 70 34 ///A test for Apply … … 116 80 try { 117 81 actual = NPointCrossover.Apply(random, parent1, parent2, n); 118 } catch (System.ArgumentException) { 82 } 83 catch (System.ArgumentException) { 119 84 exceptionFired = true; 120 85 }
Note: See TracChangeset
for help on using the changeset viewer.