Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17950


Ignore:
Timestamp:
04/19/21 11:02:22 (4 years ago)
Author:
gkronber
Message:

#3117: fixed comparison of values in InterpreterConsistencyTests (again). The latest fail was for v1 == v2 == 0 which should be fixed now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs

    r17949 r17950  
    321321              var v2 = valuesMatrix[n][row];
    322322              if (double.IsNaN(v1) && double.IsNaN(v2)) continue;
    323               if (Math.Abs(1.0 - v1 / v2) >= delta) {
     323              if (v1 != v2 && Math.Abs(1.0 - v1 / v2) >= delta) {
    324324                Console.WriteLine(formatter.Format(tree));
    325325                foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList()) {
     
    349349              }
    350350              string errorMessage = string.Format("Interpreters {0} and {1} do not agree on tree {2} and row {3} (seed = {4}).", interpreters[m].Name, interpreters[n].Name, i, row, seed);
    351               Assert.IsTrue(double.IsPositiveInfinity(v1) && double.IsPositiveInfinity(v2) ||
    352                             double.IsNaN(v1) && double.IsNaN(v2) ||
    353                             double.IsNegativeInfinity(v1) && double.IsNegativeInfinity(v2) ||
     351              Assert.IsTrue(double.IsNaN(v1) && double.IsNaN(v2) ||
     352                            v1 == v2 || // in particular 0 = 0
    354353                            Math.Abs(1.0 - v1 / v2) < delta, errorMessage);
    355354            }
Note: See TracChangeset for help on using the changeset viewer.