Free cookie consent management tool by TermsFeed Policy Generator

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

#2510 merged r13227, r13235, r13236 into stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Tests

  • stable/HeuristicLab.Tests/HeuristicLab.Encodings.RealVectorEncoding-3.3/SimulatedBinaryCrossoverTest.cs

    r12009 r13246  
    2020#endregion
    2121
    22 using HeuristicLab.Core;
    2322using HeuristicLab.Data;
    2423using HeuristicLab.Tests;
     
    3231  [TestClass()]
    3332  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       SimulatedBinaryCrossover_Accessor target = new SimulatedBinaryCrossover_Accessor(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;
    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<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 
    6933    /// <summary>
    7034    ///A test for Apply
     
    9660      try {
    9761        actual = SimulatedBinaryCrossover.Apply(random, parent1, parent2, contiguity);
    98       } catch (System.ArgumentException) {
     62      }
     63      catch (System.ArgumentException) {
    9964        exceptionFired = true;
    10065      }
     
    10974      try {
    11075        actual = SimulatedBinaryCrossover.Apply(random, parent1, parent2, contiguity);
    111       } catch (System.ArgumentException) {
     76      }
     77      catch (System.ArgumentException) {
    11278        exceptionFired = true;
    11379      }
Note: See TracChangeset for help on using the changeset viewer.