Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/18/15 13:01:38 (8 years ago)
Author:
ascheibe
Message:

#2510 merged r13227, r13235, r13236 into stable

Location:
stable
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Tests

  • stable/HeuristicLab.Tests/HeuristicLab.Encodings.BinaryVectorEncoding-3.3/NPointCrossoverTest.cs

    r12009 r13246  
    2020#endregion
    2121
    22 using HeuristicLab.Core;
    2322using HeuristicLab.Data;
    2423using HeuristicLab.Tests;
     
    3231  [TestClass()]
    3332  public class NPointCrossoverTest {
    34     /// <summary>
    35     ///A test for Cross
    36     ///</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 parents
    46       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 parents
    57       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 
    6933    /// <summary>
    7034    ///A test for Apply
     
    11680      try {
    11781        actual = NPointCrossover.Apply(random, parent1, parent2, n);
    118       } catch (System.ArgumentException) {
     82      }
     83      catch (System.ArgumentException) {
    11984        exceptionFired = true;
    12085      }
  • stable/HeuristicLab.Tests/HeuristicLab.Encodings.BinaryVectorEncoding-3.3/UniformCrossoverTest.cs

    r12009 r13246  
    2020#endregion
    2121
    22 using HeuristicLab.Core;
    2322using HeuristicLab.Tests;
    2423using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    3130  [TestClass()]
    3231  public class UniformCrossoverTest {
    33     /// <summary>
    34     ///A test for Cross
    35     ///</summary>
    36     [TestMethod]
    37     [TestCategory("Encodings.BinaryVector")]
    38     [TestProperty("Time", "short")]
    39     public void SinglePointCrossoverCrossTest() {
    40       UniformCrossover_Accessor target = new UniformCrossover_Accessor(new PrivateObject(typeof(UniformCrossover)));
    41       ItemArray<BinaryVector> 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<BinaryVector>(new BinaryVector[] { new BinaryVector(5), new BinaryVector(6), new BinaryVector(4) });
    47       exceptionFired = false;
    48       try {
    49         BinaryVector 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 parents
    56       random.Reset();
    57       parents = new ItemArray<BinaryVector>(new BinaryVector[] { new BinaryVector(4) });
    58       exceptionFired = false;
    59       try {
    60         BinaryVector actual;
    61         actual = target.Cross(random, parents);
    62       } catch (System.ArgumentException) {
    63         exceptionFired = true;
    64       }
    65       Assert.IsTrue(exceptionFired);
    66     }
    67 
    6832    /// <summary>
    6933    ///A test for Apply
     
    10266      try {
    10367        actual = UniformCrossover.Apply(random, parent1, parent2);
    104       } catch (System.ArgumentException) {
     68      }
     69      catch (System.ArgumentException) {
    10570        exceptionFired = true;
    10671      }
Note: See TracChangeset for help on using the changeset viewer.