Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/17/10 08:07:31 (14 years ago)
Author:
gkronber
Message:

Adapted loading of test cases. #1026

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Tests/SymbolicSimplifierTest.cs

    r4236 r4237  
    5151
    5252      {
    53         SymbolicRegressionSolution solution = LoadSolution("RegressionSolution01.hl"); 
     53        SymbolicRegressionSolution solution = LoadSolution("RegressionSolution01.hl");
    5454        SymbolicRegressionSolution simplifiedSolution = SimplifySolution(solution);
    5555        AssertEqualEnumerations(solution.EstimatedValues, simplifiedSolution.EstimatedValues);
     
    8383
    8484    private SymbolicRegressionSolution LoadSolution(string fileName) {
    85       var result = (Result)ContentManager.Load(fileName);
    86       return (SymbolicRegressionSolution)result.Value;
     85      var doc = ContentManager.Load(fileName);
     86      Result result = doc as Result;
     87      if (result != null) {
     88        return (SymbolicRegressionSolution)result.Value;
     89      }
     90      SymbolicRegressionSolution solution = doc as SymbolicRegressionSolution;
     91      if (solution != null) {
     92        return solution;
     93      }
     94      Assert.Fail("Cannot load file " + fileName);
     95      throw new AssertFailedException();
    8796    }
    8897
     
    103112      var actualEnumerator = actual.GetEnumerator();
    104113      while (expectedEnumerator.MoveNext() & actualEnumerator.MoveNext()) {
    105         Assert.AreEqual(expectedEnumerator.Current, actualEnumerator.Current, 1E-6 * expectedEnumerator.Current);
     114        Assert.AreEqual(expectedEnumerator.Current, actualEnumerator.Current, Math.Abs(1E-6 * expectedEnumerator.Current));
    106115      }
    107116      if (expectedEnumerator.MoveNext() | actualEnumerator.MoveNext())
Note: See TracChangeset for help on using the changeset viewer.