Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/17/16 15:16:27 (9 years ago)
Author:
gkronber
Message:

#2071: fix of unit test fail on builder

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.Instances.DataAnalysis-3.3/TableFileParserTest.cs

    r13525 r13529  
    601601      // We only support DE-DE and InvariantCulture number formats
    602602      string tempFileName = Path.GetTempFileName();
     603      var deCultureInfo = CultureInfo.GetCultureInfo("DE-DE");
    603604      WriteToFile(tempFileName,
    604605      "str\tdbl\tdbl\tdbl" + Environment.NewLine +
    605606      "1,3\t1,3\t0\t3" + Environment.NewLine +
    606607      "1,3\t\t0\t0" + Environment.NewLine +
    607       "s\tn. def.\t0\t0" + Environment.NewLine +
    608       "s\t+unendlich\t0\t0" + Environment.NewLine +
    609       "s\t-unendlich\t0\t0" + Environment.NewLine +
     608      "s\t" + double.NaN.ToString(deCultureInfo) + "\t0\t0" + Environment.NewLine + // double.NaN might have a different string representation on different systems (even when using the same CultureInfo)
     609      "s\t" + double.PositiveInfinity.ToString(deCultureInfo) + "\t0\t0" + Environment.NewLine +
     610      "s\t" + double.NegativeInfinity.ToString(deCultureInfo) + "\t0\t0" + Environment.NewLine +
    610611      "s\t0\t0\t0");
    611612      TableFileParser parser = new TableFileParser();
    612613      try {
    613614        parser.Parse(tempFileName,
    614           CultureInfo.GetCultureInfo("DE-DE").NumberFormat,
    615           CultureInfo.GetCultureInfo("DE-DE").DateTimeFormat,
     615          deCultureInfo.NumberFormat,
     616          deCultureInfo.DateTimeFormat,
    616617          '\t',
    617           parser.AreColumnNamesInFirstLine(tempFileName));
     618          true);
    618619        Assert.AreEqual(6, parser.Rows);
    619620        Assert.AreEqual(4, parser.Columns);
     
    625626        Assert.IsTrue(double.IsNaN((double)parser.Values[1][2]));
    626627        Assert.IsTrue(double.IsPositiveInfinity((double)parser.Values[1][3])); // NOTE: in DE-DE NumberFormat just "unendlich" is not allowed (compare with InvariantCulture)
    627         Assert.IsTrue(double.IsNegativeInfinity((double)parser.Values[1][4])); 
     628        Assert.IsTrue(double.IsNegativeInfinity((double)parser.Values[1][4]));
    628629      } finally {
    629630        File.Delete(tempFileName);
     
    660661        Assert.IsTrue(parser.Values[3] is List<double>);
    661662        Assert.IsTrue(double.IsNaN((double)parser.Values[1][1])); // missing value
    662         Assert.IsTrue(double.IsNaN((double)parser.Values[1][2])); 
     663        Assert.IsTrue(double.IsNaN((double)parser.Values[1][2]));
    663664        Assert.IsTrue(double.IsPositiveInfinity((double)parser.Values[1][3])); // NOTE: in InvariantCulture +Infinity is not allowed (compare with DE-DE)
    664665        Assert.IsTrue(double.IsNegativeInfinity((double)parser.Values[1][4]));
Note: See TracChangeset for help on using the changeset viewer.