Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6880 for trunk


Ignore:
Timestamp:
10/06/11 11:29:35 (13 years ago)
Author:
mkommend
Message:

#1653: Changed statistics unit test to use double.IsAlmost.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/StatisticCalculatorsTest.cs

    r6866 r6880  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Problems.DataAnalysis;
    2526using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    6061      {
    6162        for (int col = 0; col < cols; col++) {
    62           double scale = random.NextDouble() * 1E7;
     63          double scale = random.NextDouble();
    6364          IEnumerable<double> x = from rows in Enumerable.Range(0, n)
    6465                                  select testData[rows, col] * scale;
     
    7778          double variance = calculator.Variance;
    7879
    79           Assert.AreEqual(mean_alglib.ToString(), mean.ToString());
    80           Assert.AreEqual(variance_alglib.ToString(), variance.ToString());
     80          Assert.IsTrue(mean_alglib.IsAlmost(mean));
     81          Assert.IsTrue(variance_alglib.IsAlmost(variance));
    8182        }
    8283      }
     
    108109            double r2 = r2Calculator.RSquared;
    109110
    110             Assert.AreEqual(r2_alglib.ToString(), r2.ToString());
     111            Assert.IsTrue(r2_alglib.IsAlmost(r2));
    111112          }
    112113        }
Note: See TracChangeset for help on using the changeset viewer.