Changeset 14029 for branches/crossvalidation-2434/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/SinglePointCrossoverTest.cs
- Timestamp:
- 07/08/16 14:40:02 (8 years ago)
- Location:
- branches/crossvalidation-2434
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/crossvalidation-2434
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Tests
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/SinglePointCrossoverTest.cs
r12012 r14029 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 SinglePointCrossoverTest { 33 /// <summary>34 ///A test for Cross35 ///</summary>36 [TestMethod()]37 [TestCategory("Encodings.RealVector")]38 [TestProperty("Time", "short")]39 public void SinglePointCrossoverCrossTest() {40 SinglePointCrossover_Accessor target = new SinglePointCrossover_Accessor(new PrivateObject(typeof(SinglePointCrossover)));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 // The following test checks if there is an exception when the vector has just one dimension67 random.Reset();68 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(1) });69 exceptionFired = false;70 try {71 RealVector actual;72 actual = target.Cross(random, parents);73 } catch (System.ArgumentException) {74 exceptionFired = true;75 }76 Assert.IsTrue(exceptionFired);77 }78 79 32 /// <summary> 80 33 ///A test for Apply … … 103 56 try { 104 57 actual = SinglePointCrossover.Apply(random, parent1, parent2); 105 } catch (System.ArgumentException) { 58 } 59 catch (System.ArgumentException) { 106 60 exceptionFired = true; 107 61 }
Note: See TracChangeset
for help on using the changeset viewer.