Free cookie consent management tool by TermsFeed Policy Generator

source: branches/GeneralizedQAP/UnitTests/TSPLIBInstanceProviderTest.cs @ 7465

Last change on this file since 7465 was 7465, checked in by abeham, 12 years ago

#1614

  • Added TSPLIB instances (TSP, ATSP, CVRP)
  • Improved parser for TSPLIB file format
  • Added ProblemInstanceProvider as an abstract base class which handles the feeding of consumers
File size: 1.2 KB
Line 
1using System;
2using System.Text;
3using HeuristicLab.Problems.Instances.TSPLIB;
4using Microsoft.VisualStudio.TestTools.UnitTesting;
5
6namespace UnitTests
7{
8   
9   
10    /// <summary>
11    ///This is a test class for TSPLIBInstanceProviderTest and is intended
12    ///to contain all TSPLIBInstanceProviderTest Unit Tests
13    ///</summary>
14  [TestClass()]
15  public class TSPLIBInstanceProviderTest {
16    /// <summary>
17    ///A test for GetInstance
18    ///</summary>
19    [TestMethod()]
20    public void GetTSPLIBTSPInstanceTest() {
21      TSPLIBTSPInstanceProvider target = new TSPLIBTSPInstanceProvider();
22      StringBuilder erroneousInstances = new StringBuilder();
23      int count = 0;
24      foreach (var id in target.GetInstanceDescriptors()) {
25        try {
26          target.GetInstance(id);
27        } catch (Exception ex) {
28          erroneousInstances.AppendLine(id.Name + ": " + ex.Message);
29        }
30        count++;
31      }
32      Assert.IsTrue(count > 0, "No problem instances were found.");
33      Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString());
34    }
35  }
36}
Note: See TracBrowser for help on using the repository browser.