Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.Instances.DataAnalysis-3.3/RegressionInstanceProviderTest.cs @ 9794

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

#2088: Added test attributes to further tests

File size: 5.5 KB
RevLine 
[7870]1#region License Information
2/* HeuristicLab
[9456]3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[7870]4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Text;
24using Microsoft.VisualStudio.TestTools.UnitTesting;
25
[9764]26namespace HeuristicLab.Problems.Instances.DataAnalysis.Tests {
[7870]27  [TestClass()]
28  public class RegressionInstanceProviderTest {
29
[9773]30    [TestMethod]
[9782]31    [TestCategory("Problems.Instances")]
32    [TestProperty("Time", "medium")]
[7870]33    public void GetKeijzerInstanceTest() {
34      var target = new KeijzerInstanceProvider();
35      StringBuilder erroneousInstances = new StringBuilder();
36      int count = 0;
37      foreach (var id in target.GetDataDescriptors()) {
38        try {
39          target.LoadData(id);
[9782]40        } catch (Exception ex) {
[7870]41          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
42        }
43        count++;
44      }
45      Assert.IsTrue(count > 0, "No problem instances were found.");
46      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
47    }
48
[9773]49    [TestMethod]
[9782]50    [TestCategory("Problems.Instances")]
51    [TestProperty("Time", "short")]
[7870]52    public void GetKornInstanceTest() {
53      var target = new KornsInstanceProvider();
54      StringBuilder erroneousInstances = new StringBuilder();
55      int count = 0;
56      foreach (var id in target.GetDataDescriptors()) {
57        try {
58          target.LoadData(id);
[9782]59        } catch (Exception ex) {
[7870]60          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
61        }
62        count++;
63      }
64      Assert.IsTrue(count > 0, "No problem instances were found.");
65      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
66    }
67
[9773]68    [TestMethod]
[9782]69    [TestCategory("Problems.Instances")]
70    [TestProperty("Time", "short")]
[7870]71    public void GetNguyenInstanceTest() {
72      var target = new NguyenInstanceProvider();
73      StringBuilder erroneousInstances = new StringBuilder();
74      int count = 0;
75      foreach (var id in target.GetDataDescriptors()) {
76        try {
77          target.LoadData(id);
[9782]78        } catch (Exception ex) {
[7870]79          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
80        }
81        count++;
82      }
83      Assert.IsTrue(count > 0, "No problem instances were found.");
84      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
85    }
86
[9773]87    [TestMethod]
[9782]88    [TestCategory("Problems.Instances")]
89    [TestProperty("Time", "short")]
[7870]90    public void GetRealWorldInstanceTest() {
91      var target = new RegressionRealWorldInstanceProvider();
92      StringBuilder erroneousInstances = new StringBuilder();
93      int count = 0;
94      foreach (var id in target.GetDataDescriptors()) {
95        try {
96          target.LoadData(id);
[9782]97        } catch (Exception ex) {
[7870]98          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
99        }
100        count++;
101      }
102      Assert.IsTrue(count > 0, "No problem instances were found.");
103      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
104    }
105
[9773]106    [TestMethod]
[9782]107    [TestCategory("Problems.Instances")]
108    [TestProperty("Time", "short")]
[7870]109    public void GetVariousInstanceTest() {
110      var target = new VariousInstanceProvider();
111      StringBuilder erroneousInstances = new StringBuilder();
112      int count = 0;
113      foreach (var id in target.GetDataDescriptors()) {
114        try {
115          target.LoadData(id);
[9782]116        } catch (Exception ex) {
[7870]117          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
118        }
119        count++;
120      }
121      Assert.IsTrue(count > 0, "No problem instances were found.");
122      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
123    }
124
[9773]125    [TestMethod]
[9782]126    [TestCategory("Problems.Instances")]
127    [TestProperty("Time", "short")]
[7870]128    public void GetVladislavlevaInstanceTest() {
129      var target = new VladislavlevaInstanceProvider();
130      StringBuilder erroneousInstances = new StringBuilder();
131      int count = 0;
132      foreach (var id in target.GetDataDescriptors()) {
133        try {
134          target.LoadData(id);
[9782]135        } catch (Exception ex) {
[7870]136          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
137        }
138        count++;
139      }
140      Assert.IsTrue(count > 0, "No problem instances were found.");
141      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
142    }
143  }
144}
Note: See TracBrowser for help on using the repository browser.