OpenWalnut  1.5.0dev
WDataSetCSV_test.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WDATASETCSV_TEST_H
26 #define WDATASETCSV_TEST_H
27 
28 #include <memory>
29 #include <string>
30 #include <vector>
31 
32 #include <cxxtest/TestSuite.h>
33 
34 #include "../WDataSetCSV.h"
35 
36 /**
37  * test class of the WDataSetCSV class
38  */
39 class WDataSetCSVTest : public CxxTest::TestSuite
40 {
41  /**
42  * WDataSetCSV object, which is created during the tests
43  */
45 
46  /**
47  * WDataSetCSV::ContentSPtr object, represents the header, while creation of csvDataSet
48  */
50 
51  /**
52  * WDataSetCSV::ContentSPtr object, represents the data, while creation of csvDataSet
53  */
55 public:
56  /**
57  * setUp method, runs before each test
58  */
59  void setUp()
60  {
61  std::vector< std::string > vecHeader;
62  std::vector< std::string > vecData;
63 
66 
67  // initialize m_header
68  vecHeader.push_back( "cell00" );
69  vecHeader.push_back( "cell01" );
70  m_header->push_back( vecHeader );
71 
72  // initialize m_data
73  for( int idx = 0; idx < 5; idx++ )
74  {
75  vecData.clear();
76  vecData.push_back( "cell"+ std::to_string( idx ) + "0" );
77  vecData.push_back( "cell"+ std::to_string( idx ) + "1" );
78  m_data->push_back( vecData );
79  }
80 
82  }
83 
84  /**
85  * tearDown method, runs after each test
86  */
87  void tearDown()
88  {
89  }
90 
91  /**
92  * Test getHeader() method
93  */
95  {
96  TS_ASSERT_EQUALS( csvDataSet.getHeader(), m_header );
97  }
98 
99  /**
100  * Test getData() method
101  */
102  void testGetData()
103  {
104  TS_ASSERT_EQUALS( csvDataSet.getData(), m_data );
105  }
106 };
107 
108 #endif // WDATASETCSV_TEST_H
test class of the WDataSetCSV class
WDataSetCSV::ContentSPtr m_data
WDataSetCSV::ContentSPtr object, represents the data, while creation of csvDataSet.
void testGetData()
Test getData() method.
void setUp()
setUp method, runs before each test
WDataSetCSV::ContentSPtr m_header
WDataSetCSV::ContentSPtr object, represents the header, while creation of csvDataSet.
void tearDown()
tearDown method, runs after each test
WDataSetCSV csvDataSet
WDataSetCSV object, which is created during the tests.
void testGetHeader()
Test getHeader() method.
Represents a CSV dataset.
Definition: WDataSetCSV.h:38
std::shared_ptr< std::vector< std::vector< std::string > > > ContentSPtr
represents a pointer to the Content
Definition: WDataSetCSV.h:52
WDataSetCSV::ContentSPtr getData()
Getter method to receive csv data.
Definition: WDataSetCSV.cpp:46
WDataSetCSV::ContentSPtr getHeader()
Getter method to receive csv header.
Definition: WDataSetCSV.cpp:41
std::vector< std::vector< std::string > > Content
represents a vector containing a vector of strings.
Definition: WDataSetCSV.h:47