Skip to content

Commit 3f3663a

Browse files
author
Toni Cebrián
committed
Return an empty tuple
1 parent 71ffb44 commit 3f3663a

File tree

5 files changed

+62
-4
lines changed

5 files changed

+62
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
dist
2+
*.swp

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
1212
# Testing
1313
find_package(CppUnit REQUIRED)
1414
add_executable(UnitTester test/main.cpp
15+
test/csv_iteratorTest.cpp
1516
)
1617

1718
target_link_libraries(UnitTester ${CPPUNIT_LIBRARIES})

include/csv_iterator.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef _CSV_ITERATOR_HPP_
2+
#define _CSV_ITERATOR_HPP_
3+
4+
#include <string>
5+
#include <vector>
6+
7+
namespace csv {
8+
template<class Tuple>
9+
class iterator {
10+
typedef std::vector<std::string>::iterator strIt;
11+
public:
12+
Tuple getTuple(std::vector<std::string>::iterator it){
13+
return Tuple();
14+
}
15+
};
16+
};
17+
#endif

test/csv_iteratorTest.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <cppunit/extensions/HelperMacros.h>
2+
#include "csv_iterator.hpp"
3+
4+
#include <vector>
5+
#include <string>
6+
#include <boost/tuple/tuple.hpp>
7+
#include <boost/tuple/tuple_comparison.hpp>
8+
#include <boost/tuple/tuple_io.hpp>
9+
10+
class csv_iteratorTest : public CppUnit::TestFixture {
11+
CPPUNIT_TEST_SUITE(csv_iteratorTest);
12+
CPPUNIT_TEST(testSimpleInts);
13+
CPPUNIT_TEST_SUITE_END();
14+
15+
public:
16+
17+
void setUp(){
18+
}
19+
20+
void tearDown(){
21+
}
22+
23+
void testSimpleInts(){
24+
typedef boost::tuple<int,int> record;
25+
std::vector<std::string> values = {"1","2"};
26+
csv::iterator<record> it;
27+
record obtained = it.getTuple(values.begin());
28+
record expected;
29+
30+
31+
CPPUNIT_ASSERT_EQUAL(expected, obtained);
32+
}
33+
};
34+
35+
CPPUNIT_TEST_SUITE_REGISTRATION(csv_iteratorTest);
36+
37+
38+
39+

test/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ int main(int argc, char* argv[]) {
2525
runner.run(controller);
2626

2727
// Write results into XML
28-
ofstream xmlFileOut("cpptestresults.xml");
29-
XmlOutputter xmlOut(&result, xmlFileOut);
30-
xmlOut.write();
31-
xmlFileOut.close();
28+
// ofstream xmlFileOut("cpptestresults.xml");
29+
// XmlOutputter xmlOut(&result, xmlFileOut);
30+
// xmlOut.write();
31+
// xmlFileOut.close();
3232

3333
// And to the console
3434
TextOutputter textOutput(&result, std::cout);

0 commit comments

Comments
 (0)