Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/JSMShiftChangeManipulatorTest.cs @ 8888

Last change on this file since 8888 was 8888, checked in by abeham, 11 years ago

#1329:

  • Fixed failed test case (mutation is now working)
  • Removed TestRandom and used the one in the Tests namespace
  • Corrected namespaces
File size: 2.5 KB
Line 
1using HeuristicLab.Core;
2using HeuristicLab.Encodings.PermutationEncoding;
3using HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix;
4using HeuristicLab.Tests;
5using Microsoft.VisualStudio.TestTools.UnitTesting;
6
7namespace HeuristicLab.Encodings.ScheduleEncoding_33.Tests {
8
9
10  /// <summary>
11  ///This is a test class for JSMShiftChangeManipulatorTest and is intended
12  ///to contain all JSMShiftChangeManipulatorTest Unit Tests
13  ///</summary>
14  [TestClass()]
15  public class JSMShiftChangeManipulatorTest {
16
17
18    private TestContext testContextInstance;
19
20    /// <summary>
21    ///Gets or sets the test context which provides
22    ///information about and functionality for the current test run.
23    ///</summary>
24    public TestContext TestContext {
25      get {
26        return testContextInstance;
27      }
28      set {
29        testContextInstance = value;
30      }
31    }
32
33    #region Additional test attributes
34    //
35    //You can use the following additional attributes as you write your tests:
36    //
37    //Use ClassInitialize to run code before running the first test in the class
38    //[ClassInitialize()]
39    //public static void MyClassInitialize(TestContext testContext)
40    //{
41    //}
42    //
43    //Use ClassCleanup to run code after all tests in a class have run
44    //[ClassCleanup()]
45    //public static void MyClassCleanup()
46    //{
47    //}
48    //
49    //Use TestInitialize to run code before running each test
50    //[TestInitialize()]
51    //public void MyTestInitialize()
52    //{
53    //}
54    //
55    //Use TestCleanup to run code after each test has run
56    //[TestCleanup()]
57    //public void MyTestCleanup()
58    //{
59    //}
60    //
61    #endregion
62
63
64    /// <summary>
65    ///A test for Apply
66    ///</summary>
67    [TestMethod()]
68    public void ApplyTest() {
69      IRandom random = new TestRandom(new int[] { 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }, null);
70      JSMEncoding individual = TestUtils.CreateTestJSM1();
71      JSMShiftChangeManipulator.Apply(random, individual);
72      JSMEncoding expected = new JSMEncoding();
73      ItemList<Permutation> jsm = new ItemList<Permutation>();
74      for (int i = 0; i < 3; i++) {
75        jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 0, 1, 3, 2, 4, 5 }));
76        jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 0, 1, 3, 4, 2, 5 }));
77      }
78      expected.JobSequenceMatrix = jsm;
79
80      Assert.IsTrue(individual.Equals(expected));
81    }
82  }
83}
Note: See TracBrowser for help on using the repository browser.