Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 7870 was 7870, checked in by sforsten, 12 years ago

#1784:

  • added unit test for regression and classification ProblemInstanceProvider
  • changed namespace for the TableFileParserTest
File size: 5.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 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    public void GetKeijzerInstanceTest() {
32      var target = new KeijzerInstanceProvider();
33      StringBuilder erroneousInstances = new StringBuilder();
34      int count = 0;
35      foreach (var id in target.GetDataDescriptors()) {
36        try {
37          target.LoadData(id);
38        }
39        catch (Exception ex) {
40          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
41        }
42        count++;
43      }
44      Assert.IsTrue(count > 0, "No problem instances were found.");
45      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
46    }
47
48    [TestMethod()]
49    public void GetKornInstanceTest() {
50      var target = new KornsInstanceProvider();
51      StringBuilder erroneousInstances = new StringBuilder();
52      int count = 0;
53      foreach (var id in target.GetDataDescriptors()) {
54        try {
55          target.LoadData(id);
56        }
57        catch (Exception ex) {
58          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
59        }
60        count++;
61      }
62      Assert.IsTrue(count > 0, "No problem instances were found.");
63      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
64    }
65
66    [TestMethod()]
67    public void GetNguyenInstanceTest() {
68      var target = new NguyenInstanceProvider();
69      StringBuilder erroneousInstances = new StringBuilder();
70      int count = 0;
71      foreach (var id in target.GetDataDescriptors()) {
72        try {
73          target.LoadData(id);
74        }
75        catch (Exception ex) {
76          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
77        }
78        count++;
79      }
80      Assert.IsTrue(count > 0, "No problem instances were found.");
81      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
82    }
83
84    [TestMethod()]
85    public void GetRealWorldInstanceTest() {
86      var target = new RegressionRealWorldInstanceProvider();
87      StringBuilder erroneousInstances = new StringBuilder();
88      int count = 0;
89      foreach (var id in target.GetDataDescriptors()) {
90        try {
91          target.LoadData(id);
92        }
93        catch (Exception ex) {
94          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
95        }
96        count++;
97      }
98      Assert.IsTrue(count > 0, "No problem instances were found.");
99      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
100    }
101
102    [TestMethod()]
103    public void GetVariousInstanceTest() {
104      var target = new VariousInstanceProvider();
105      StringBuilder erroneousInstances = new StringBuilder();
106      int count = 0;
107      foreach (var id in target.GetDataDescriptors()) {
108        try {
109          target.LoadData(id);
110        }
111        catch (Exception ex) {
112          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
113        }
114        count++;
115      }
116      Assert.IsTrue(count > 0, "No problem instances were found.");
117      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
118    }
119
120    [TestMethod()]
121    public void GetVladislavlevaInstanceTest() {
122      var target = new VladislavlevaInstanceProvider();
123      StringBuilder erroneousInstances = new StringBuilder();
124      int count = 0;
125      foreach (var id in target.GetDataDescriptors()) {
126        try {
127          target.LoadData(id);
128        }
129        catch (Exception ex) {
130          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
131        }
132        count++;
133      }
134      Assert.IsTrue(count > 0, "No problem instances were found.");
135      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
136    }
137  }
138}
Note: See TracBrowser for help on using the repository browser.