Changeset 13529
- Timestamp:
- 01/17/16 15:16:27 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.Instances.DataAnalysis-3.3/TableFileParserTest.cs
r13525 r13529 601 601 // We only support DE-DE and InvariantCulture number formats 602 602 string tempFileName = Path.GetTempFileName(); 603 var deCultureInfo = CultureInfo.GetCultureInfo("DE-DE"); 603 604 WriteToFile(tempFileName, 604 605 "str\tdbl\tdbl\tdbl" + Environment.NewLine + 605 606 "1,3\t1,3\t0\t3" + Environment.NewLine + 606 607 "1,3\t\t0\t0" + Environment.NewLine + 607 "s\t n. 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 + 610 611 "s\t0\t0\t0"); 611 612 TableFileParser parser = new TableFileParser(); 612 613 try { 613 614 parser.Parse(tempFileName, 614 CultureInfo.GetCultureInfo("DE-DE").NumberFormat,615 CultureInfo.GetCultureInfo("DE-DE").DateTimeFormat,615 deCultureInfo.NumberFormat, 616 deCultureInfo.DateTimeFormat, 616 617 '\t', 617 parser.AreColumnNamesInFirstLine(tempFileName));618 true); 618 619 Assert.AreEqual(6, parser.Rows); 619 620 Assert.AreEqual(4, parser.Columns); … … 625 626 Assert.IsTrue(double.IsNaN((double)parser.Values[1][2])); 626 627 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])); 628 629 } finally { 629 630 File.Delete(tempFileName); … … 660 661 Assert.IsTrue(parser.Values[3] is List<double>); 661 662 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])); 663 664 Assert.IsTrue(double.IsPositiveInfinity((double)parser.Values[1][3])); // NOTE: in InvariantCulture +Infinity is not allowed (compare with DE-DE) 664 665 Assert.IsTrue(double.IsNegativeInfinity((double)parser.Values[1][4]));
Note: See TracChangeset
for help on using the changeset viewer.