Changeset 14029 for branches/crossvalidation-2434/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/BlendAlphaCrossoverTest.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/BlendAlphaCrossoverTest.cs
r12012 r14029 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 BlendAlphaCrossoverTest { 34 /// <summary>35 ///A test for Cross36 ///</summary>37 [TestMethod()]38 [TestCategory("Encodings.RealVector")]39 [TestProperty("Time", "short")]40 public void BlendAlphaCrossoverCrossTest() {41 BlendAlphaCrossover_Accessor target = new BlendAlphaCrossover_Accessor(new PrivateObject(typeof(BlendAlphaCrossover)));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 parents46 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;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<RealVector>(new RealVector[] { new RealVector(4) });59 exceptionFired = false;60 try {61 RealVector 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 … … 106 70 try { 107 71 actual = BlendAlphaCrossover.Apply(random, parent1, parent2, alpha); 108 } catch (System.ArgumentException) { 72 } 73 catch (System.ArgumentException) { 109 74 exceptionFired = true; 110 75 } … … 120 85 try { 121 86 actual = BlendAlphaCrossover.Apply(random, parent1, parent2, alpha); 122 } catch (System.ArgumentException) { 87 } 88 catch (System.ArgumentException) { 123 89 exceptionFired = true; 124 90 }
Note: See TracChangeset
for help on using the changeset viewer.