Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8023


Ignore:
Timestamp:
06/18/12 10:04:24 (12 years ago)
Author:
abeham
Message:

#1775: fixed unit tests

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/DiscreteCrossover.cs

    r8019 r8023  
    4747    /// Performs a discrete crossover operation of any number of given parents.
    4848    /// </summary>
    49     /// <exception cref="ArgumentException">Thrown when the vectors of the parents are of different length.</exception>
     49    /// <exception cref="ArgumentException">Thrown when the vectors of the parents are of different length or when there are less than 2 parents.</exception>
    5050    /// <param name="random">A random number generator.</param>
    5151    /// <param name="parents">The list of parents for the crossover operation.</param>
    5252    /// <returns>The newly created integer vector, resulting from the crossover operation.</returns>
    5353    public static IntegerVector Apply(IRandom random, ItemArray<IntegerVector> parents) {
     54      if (parents.Length < 2) throw new ArgumentException("DiscreteCrossover: There are less than two parents to cross.");
    5455      int length = parents[0].Length;
    5556
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.IntegerVectorEncoding-3.3/DiscreteCrossoverTest.cs

    r8019 r8023  
    115115      // The following test is not based on published examples
    116116      random.Reset();
    117       random.DoubleNumbers = new double[] { 0, 0, 0.9, 0, 0.9 };
     117      random.IntNumbers = new int[] { 0, 0, 1, 0, 1 };
    118118      parent1 = new IntegerVector(new int[] { 2, 2, 3, 5, 1 });
    119119      parent2 = new IntegerVector(new int[] { 4, 1, 3, 2, 8 });
     
    124124      // The following test is not based on published examples
    125125      random.Reset();
    126       random.DoubleNumbers = new double[] { 0, 0, 0.9, 0, 0.9 };
     126      random.IntNumbers = new int[] { 0, 0, 1, 0, 1 };
    127127      parent1 = new IntegerVector(new int[] { 2, 2, 3, 5, 1, 9 }); // this parent is longer
    128128      parent2 = new IntegerVector(new int[] { 4, 1, 3, 2, 8 });
Note: See TracChangeset for help on using the changeset viewer.