Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/19/16 18:24:53 (8 years ago)
Author:
mkommend
Message:

#1087: Copied unit tests from branch and adapted path of multi-objective test function project file.

Location:
trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3
Files:
1 added
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3/HyperVolumeTests.cs

    r14111 r14121  
    2020#endregion
    2121using System;
    22 using HeuristicLab.Problems.TestFunctions.MultiObjective;
    2322using Microsoft.VisualStudio.TestTools.UnitTesting;
    2423
    25 namespace MultiObjectiveTestfunctionTests {
     24namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
    2625  [TestClass]
    2726  public class HypervolumeTest {
     
    4039    /// </summary>
    4140    [TestMethod]
    42     [TestCategory("Problems.TestFunctions")]
    43     [TestProperty("Time", "short")]
    44     public void SinglePointTest() {
     41    [TestCategory("Problems.TestFunctions.MultiObjective")]
     42    [TestProperty("Time", "short")]
     43    public void HypervolumeTestSinglePoint() {
    4544
    4645      //Front with a single Point
     
    9796    /// </summary>
    9897    [TestMethod]
    99     [TestCategory("Problems.TestFunctions")]
    100     [TestProperty("Time", "short")]
    101     public void RandomSinglePointTest() {
    102       //Front with a single Point
    103       double[] point = new double[2];
    104       Random r = new Random();
     98    [TestCategory("Problems.TestFunctions.MultiObjective")]
     99    [TestProperty("Time", "short")]
     100    public void HypervolumeTestRandomSinglePoint() {
     101      //Front with a single Point
     102      double[] point = new double[2];
     103      var r = new System.Random();
    105104
    106105      point[0] = r.NextDouble();
     
    150149    /// </summary>
    151150    [TestMethod]
    152     [TestCategory("Problems.TestFunctions")]
    153     [TestProperty("Time", "short")]
    154     public void DiagonalPointTest() {
     151    [TestCategory("Problems.TestFunctions.MultiObjective")]
     152    [TestProperty("Time", "short")]
     153    public void HypervolumeTestDiagonalPoint() {
    155154      //Front with three points
    156155      double[] point1 = new double[2];
     
    200199    [TestMethod()]
    201200    [ExpectedException(typeof(ArgumentException))]
    202     [TestCategory("Problems.TestFunctions")]
    203     [TestProperty("Time", "short")]
    204     public void ReferencePointViolationNE() {
    205       //Front with a single Point
    206       double[] point = new double[2];
    207       point[0] = 0.5;
    208       point[1] = 0.5;
    209       double[][] front = { point };
    210 
    211       double[] referencePoint = new double[2];
    212       bool[] maximization;
    213 
    214       //Northeast
    215       maximization = new bool[] { true, true };
    216       referencePoint[0] = 1;
    217       referencePoint[1] = 1;
    218       double ne = Hypervolume.Calculate(front, referencePoint, maximization);
    219     }
    220 
    221     [TestMethod()]
    222     [ExpectedException(typeof(ArgumentException))]
    223     [TestCategory("Problems.TestFunctions")]
    224     [TestProperty("Time", "short")]
    225     public void ReferencePointViolationNW() {
     201    [TestCategory("Problems.TestFunctions.MultiObjective")]
     202    [TestProperty("Time", "short")]
     203    public void HypervolumeTestReferencePointViolationNE() {
     204      //Front with a single Point
     205      double[] point = new double[2];
     206      point[0] = 0.5;
     207      point[1] = 0.5;
     208      double[][] front = { point };
     209
     210      double[] referencePoint = new double[2];
     211      bool[] maximization;
     212
     213      //Northeast
     214      maximization = new bool[] { true, true };
     215      referencePoint[0] = 1;
     216      referencePoint[1] = 1;
     217      double ne = Hypervolume.Calculate(front, referencePoint, maximization);
     218    }
     219
     220    [TestMethod()]
     221    [ExpectedException(typeof(ArgumentException))]
     222    [TestCategory("Problems.TestFunctions.MultiObjective")]
     223    [TestProperty("Time", "short")]
     224    public void HypervolumeTestReferencePointViolationNW() {
    226225      //Front with a single Point
    227226      double[] point = new double[2];
     
    243242    [TestMethod()]
    244243    [ExpectedException(typeof(ArgumentException))]
    245     [TestCategory("Problems.TestFunctions")]
    246     [TestProperty("Time", "short")]
    247     public void ReferencePointViolationSW() {
     244    [TestCategory("Problems.TestFunctions.MultiObjective")]
     245    [TestProperty("Time", "short")]
     246    public void HypervolumeTestReferencePointViolationSW() {
    248247      //Front with a single Point
    249248      double[] point = new double[2];
     
    265264    [TestMethod()]
    266265    [ExpectedException(typeof(ArgumentException))]
    267     [TestCategory("Problems.TestFunctions")]
    268     [TestProperty("Time", "short")]
    269     public void ReferencePointViolationSE() {
     266    [TestCategory("Problems.TestFunctions.MultiObjective")]
     267    [TestProperty("Time", "short")]
     268    public void HypervolumeTestReferencePointViolationSE() {
    270269      //Front with a single Point
    271270      double[] point = new double[2];
     
    284283      Assert.AreEqual(0.25, se);
    285284    }
    286 
    287285  }
    288 
    289 
    290286}
Note: See TracChangeset for help on using the changeset viewer.