Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6962


Ignore:
Timestamp:
11/08/11 10:43:20 (13 years ago)
Author:
gkronber
Message:

#1671 Added unit tests for CSV files with integer values (as for example produced by Excel)

File:
1 edited

Legend:

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

    r6866 r6962  
    185185
    186186    [TestMethod]
     187    public void ParseEnglishCSVWithoutCommasWithoutSpace() {
     188      string tempFileName = Path.GetTempFileName();
     189      WriteToFile(tempFileName,
     190@"0,0,0,3
     1910,0,0,0
     1920,0,0,0
     1930,0,0,0
     1940,0,0,0
     1950,0,0,0");
     196      TableFileParser parser = new TableFileParser();
     197      try {
     198        parser.Parse(tempFileName);
     199        Assert.AreEqual(6, parser.Rows);
     200        Assert.AreEqual(4, parser.Columns);
     201        Assert.AreEqual((double)parser.Values[3][0], 3);
     202      }
     203      finally {
     204        File.Delete(tempFileName);
     205      }
     206    }
     207
     208    [TestMethod]
    187209    public void ParseEnglishCSVWithoutCommasWithNames() {
    188210      string tempFileName = Path.GetTempFileName();
     
    1952170, 0, 0, 0
    1962180, 0, 0, 0");
     219      TableFileParser parser = new TableFileParser();
     220      try {
     221        parser.Parse(tempFileName);
     222        Assert.AreEqual(6, parser.Rows);
     223        Assert.AreEqual(4, parser.Columns);
     224        Assert.AreEqual((double)parser.Values[3][0], 3);
     225      }
     226      finally {
     227        File.Delete(tempFileName);
     228      }
     229    }
     230
     231    [TestMethod]
     232    public void ParseEnglishCSVWithoutCommasWithoutSpacesWithNames() {
     233      string tempFileName = Path.GetTempFileName();
     234      WriteToFile(tempFileName,
     235@"x01,x02,x03,x04
     2360,0,0,3
     2370,0,0,0
     2380,0,0,0
     2390,0,0,0
     2400,0,0,0
     2410,0,0,0");
    197242      TableFileParser parser = new TableFileParser();
    198243      try {
Note: See TracChangeset for help on using the changeset viewer.