- Timestamp:
- 04/04/11 22:30:39 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/Tests/QAPLIBInstancesTest.cs
r5933 r5949 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.IO; 25 using System.Linq; 26 using System.Reflection; 23 27 using System.Text; 24 28 using HeuristicLab.Common; … … 38 42 } catch (Exception ex) { 39 43 failedInstances.AppendLine(instance + ": " + ex.Message); 44 } 45 } 46 Assert.IsTrue(failedInstances.Length == 0, "Following instances failed to load: " + Environment.NewLine + failedInstances.ToString()); 47 } 48 49 [TestMethod] 50 public void LoadAllEmbeddedSolutions() { 51 IEnumerable<string> solutionFiles = Assembly.GetAssembly(typeof(QuadraticAssignmentProblem)) 52 .GetManifestResourceNames() 53 .Where(x => x.EndsWith(".sln")); 54 QAPLIBSolutionParser parser = new QAPLIBSolutionParser(); 55 StringBuilder failedInstances = new StringBuilder(); 56 foreach (string solution in solutionFiles) { 57 using (Stream stream = Assembly.GetAssembly(typeof(QuadraticAssignmentProblem)).GetManifestResourceStream(solution)) { 58 parser.Reset(); 59 parser.Parse(stream, true); 60 if (parser.Error != null) 61 failedInstances.AppendLine(solution + ": " + parser.Error.Message); 40 62 } 41 63 } … … 63 85 failedInstances.AppendLine(instance + ": Reported quality: " + qap.BestKnownQuality.Value.ToString() + ", evaluated fitness: " + quality.ToString() + "."); 64 86 } 87 } else if (qap.BestKnownQuality != null) { 88 failedInstances.AppendLine(instance + ": The solution failed to load, only the quality value is available!"); 65 89 } 66 90
Note: See TracChangeset
for help on using the changeset viewer.