Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataPreprocessing/HeuristicLab.Tests/HeuristicLab.Problems.Instances.DataAnalysis-3.3/RegressionInstanceProviderTest.cs @ 11111

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

#2088: Added test attributes to further tests

File size: 5.5 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
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
26namespace HeuristicLab.Problems.Instances.DataAnalysis.Tests {
27  [TestClass()]
28  public class RegressionInstanceProviderTest {
29
30    [TestMethod]
31    [TestCategory("Problems.Instances")]
32    [TestProperty("Time", "medium")]
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);
40        } catch (Exception ex) {
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
49    [TestMethod]
50    [TestCategory("Problems.Instances")]
51    [TestProperty("Time", "short")]
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);
59        } catch (Exception ex) {
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
68    [TestMethod]
69    [TestCategory("Problems.Instances")]
70    [TestProperty("Time", "short")]
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);
78        } catch (Exception ex) {
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
87    [TestMethod]
88    [TestCategory("Problems.Instances")]
89    [TestProperty("Time", "short")]
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);
97        } catch (Exception ex) {
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
106    [TestMethod]
107    [TestCategory("Problems.Instances")]
108    [TestProperty("Time", "short")]
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);
116        } catch (Exception ex) {
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
125    [TestMethod]
126    [TestCategory("Problems.Instances")]
127    [TestProperty("Time", "short")]
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);
135        } catch (Exception ex) {
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.