- Timestamp:
- 10/23/16 19:31:18 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/BlendAlphaBetaCrossoverTest.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 BlendAlphaBetaCrossoverTest { 34 /// <summary> 35 ///A test for Cross 36 ///</summary> 37 [TestMethod()] 38 [TestCategory("Encodings.RealVector")] 39 [TestProperty("Time", "short")] 40 public void BlendAlphaBetaCrossoverCrossTest() { 41 var privateObject = new PrivateObject(typeof(BlendAlphaBetaCrossover)); 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 var 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 var 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 -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/BlendAlphaCrossoverTest.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 BlendAlphaCrossoverTest { 34 /// <summary> 35 ///A test for Cross 36 ///</summary> 37 [TestMethod()] 38 [TestCategory("Encodings.RealVector")] 39 [TestProperty("Time", "short")] 40 public void BlendAlphaCrossoverCrossTest() { 41 var privateObject = 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 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 var 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 var 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 -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/DiscreteCrossoverTest.cs
r14185 r14353 31 31 [TestClass()] 32 32 public class DiscreteCrossoverTest { 33 /// <summary> 34 ///A test for Cross 35 ///</summary> 36 [TestMethod()] 37 [TestCategory("Encodings.RealVector")] 38 [TestProperty("Time", "short")] 39 public void DiscreteCrossoverCrossTest() { 40 var privateObject = new PrivateObject(typeof(DiscreteCrossover)); 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 less than 2 parents 45 random.Reset(); 46 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) }); 47 exceptionFired = false; 48 try { 49 var actual = (RealVector)privateObject.Invoke("Cross", random, parents); 50 } 51 catch (System.ArgumentException) { 52 exceptionFired = true; 53 } 54 Assert.IsTrue(exceptionFired); 55 } 56 33 57 /// <summary> 34 58 ///A test for Apply -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/HeuristicCrossoverTest.cs
r14185 r14353 20 20 #endregion 21 21 22 using HeuristicLab.Core; 22 23 using HeuristicLab.Tests; 23 24 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 30 31 [TestClass()] 31 32 public class HeuristicCrossoverTest { 33 /// <summary> 34 ///A test for Cross 35 ///</summary> 36 [TestMethod()] 37 [TestCategory("Encodings.RealVector")] 38 [TestProperty("Time", "short")] 39 public void HeuristicCrossoverCrossTest() { 40 var privateObject = new PrivateObject(typeof(HeuristicCrossover)); 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 parents 45 random.Reset(); 46 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) }); 47 exceptionFired = false; 48 try { 49 var actual = (RealVector)privateObject.Invoke("Cross", random, parents); 50 } 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 parents 56 random.Reset(); 57 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) }); 58 exceptionFired = false; 59 try { 60 var actual = (RealVector)privateObject.Invoke("Cross", random, parents); 61 } 62 catch (System.ArgumentException) { 63 exceptionFired = true; 64 } 65 Assert.IsTrue(exceptionFired); 66 } 67 32 68 /// <summary> 33 69 ///A test for Apply -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/LocalCrossoverTest.cs
r14185 r14353 20 20 #endregion 21 21 22 using HeuristicLab.Core; 22 23 using HeuristicLab.Tests; 23 24 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 30 31 [TestClass()] 31 32 public class LocalCrossoverTest { 33 /// <summary> 34 ///A test for Cross 35 ///</summary> 36 [TestMethod()] 37 [TestCategory("Encodings.RealVector")] 38 [TestProperty("Time", "short")] 39 public void LocalCrossoverCrossTest() { 40 var privateObject = new PrivateObject(typeof(LocalCrossover)); 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 parents 45 random.Reset(); 46 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) }); 47 exceptionFired = false; 48 try { 49 var actual = (RealVector)privateObject.Invoke("Cross", random, parents); 50 } 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 parents 56 random.Reset(); 57 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) }); 58 exceptionFired = false; 59 try { 60 var actual = (RealVector)privateObject.Invoke("Cross", random, parents); 61 } 62 catch (System.ArgumentException) { 63 exceptionFired = true; 64 } 65 Assert.IsTrue(exceptionFired); 66 } 67 32 68 /// <summary> 33 69 ///A test for Apply -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/RandomConvexCrossoverTest.cs
r14185 r14353 20 20 #endregion 21 21 22 using HeuristicLab.Core; 22 23 using HeuristicLab.Tests; 23 24 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 30 31 [TestClass()] 31 32 public class RandomConvexCrossoverTest { 33 /// <summary> 34 ///A test for Cross 35 ///</summary> 36 [TestMethod()] 37 [TestCategory("Encodings.RealVector")] 38 [TestProperty("Time", "short")] 39 public void RandomConvexCrossoverCrossTest() { 40 var privateObject = 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 parents 45 random.Reset(); 46 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) }); 47 exceptionFired = false; 48 try { 49 var actual = (RealVector)privateObject.Invoke("Cross", random, parents); 50 } 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 parents 56 random.Reset(); 57 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) }); 58 exceptionFired = false; 59 try { 60 var actual = (RealVector)privateObject.Invoke("Cross", random, parents); 61 } 62 catch (System.ArgumentException) { 63 exceptionFired = true; 64 } 65 Assert.IsTrue(exceptionFired); 66 } 67 32 68 /// <summary> 33 69 ///A test for Apply -
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 -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/SinglePointCrossoverTest.cs
r14185 r14353 20 20 #endregion 21 21 22 using HeuristicLab.Core; 22 23 using HeuristicLab.Tests; 23 24 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 30 31 [TestClass()] 31 32 public class SinglePointCrossoverTest { 33 /// <summary> 34 ///A test for Cross 35 ///</summary> 36 [TestMethod()] 37 [TestCategory("Encodings.RealVector")] 38 [TestProperty("Time", "short")] 39 public void SinglePointCrossoverCrossTest() { 40 var privateObject = 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 parents 45 random.Reset(); 46 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) }); 47 exceptionFired = false; 48 try { 49 var actual = (RealVector)privateObject.Invoke("Cross", random, parents); 50 } 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 parents 56 random.Reset(); 57 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) }); 58 exceptionFired = false; 59 try { 60 var actual = (RealVector)privateObject.Invoke("Cross", random, parents); 61 } 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 dimension 67 random.Reset(); 68 parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(1) }); 69 exceptionFired = false; 70 try { 71 var actual = (RealVector)privateObject.Invoke("Cross", random, parents); 72 } 73 catch (System.ArgumentException) { 74 exceptionFired = true; 75 } 76 Assert.IsTrue(exceptionFired); 77 } 78 32 79 /// <summary> 33 80 ///A test for Apply
Note: See TracChangeset
for help on using the changeset viewer.