test/util/TokenizedLineReaderTester.cpp
/**This operation checks the TokenizedLineReader when the token is changed to a
 * comma.*/
This operation checks the TokenizedLineReader when the token is changed to a
comma.
This operation checks the TokenizedLineReader when the token is changed to a comma .
BOOST_AUTO_TEST_CASE(checkCSVParsing)
{
	TokenizedLineReader<int> intReader;
	vector<int> iLine;
	auto intTestStream = std::make_shared<stringstream>(ios::in | ios::out);
	*intTestStream << intCSVString;
	intReader.setDelimiter(",");
	intReader.setInputStream(intTestStream);
	iLine = intReader.loadLine();
	BOOST_REQUIRE(!iLine.empty());
	BOOST_REQUIRE_EQUAL(5U, iLine.size());
	BOOST_REQUIRE_EQUAL(1, iLine.at(0));
	BOOST_REQUIRE_EQUAL(3, iLine.at(1));
	BOOST_REQUIRE_EQUAL(5, iLine.at(2));
	BOOST_REQUIRE_EQUAL(7, iLine.at(3));
	BOOST_REQUIRE_EQUAL(9, iLine.at(4));
	iLine = intReader.loadLine();
	BOOST_REQUIRE(!iLine.empty());
	BOOST_REQUIRE_EQUAL(4U, iLine.size());
	BOOST_REQUIRE_EQUAL(0, iLine.at(0));
	BOOST_REQUIRE_EQUAL(2, iLine.at(1));
	BOOST_REQUIRE_EQUAL(4, iLine.at(2));
	BOOST_REQUIRE_EQUAL(6, iLine.at(3));
	return;
}
BOOST_AUTO_TEST_CASE ( checkCSVParsing ) { TokenizedLineReader < int > intReader ; vector < int > iLine ; auto intTestStream = std :: make_shared < stringstream > ( ios :: in | ios :: out ) ; * intTestStream << intCSVString ; intReader . setDelimiter ( " " ) ; intReader . setInputStream ( intTestStream ) ; iLine = intReader . loadLine ( ) ; BOOST_REQUIRE ( ! iLine . empty ( ) ) ; BOOST_REQUIRE_EQUAL ( 5U , iLine . size ( ) ) ; BOOST_REQUIRE_EQUAL ( 1 , iLine . at ( 0 ) ) ; BOOST_REQUIRE_EQUAL ( 3 , iLine . at ( 1 ) ) ; BOOST_REQUIRE_EQUAL ( 5 , iLine . at ( 2 ) ) ; BOOST_REQUIRE_EQUAL ( 7 , iLine . at ( 3 ) ) ; BOOST_REQUIRE_EQUAL ( 9 , iLine . at ( 4 ) ) ; iLine = intReader . loadLine ( ) ; BOOST_REQUIRE ( ! iLine . empty ( ) ) ; BOOST_REQUIRE_EQUAL ( 4U , iLine . size ( ) ) ; BOOST_REQUIRE_EQUAL ( 0 , iLine . at ( 0 ) ) ; BOOST_REQUIRE_EQUAL ( 2 , iLine . at ( 1 ) ) ; BOOST_REQUIRE_EQUAL ( 4 , iLine . at ( 2 ) ) ; BOOST_REQUIRE_EQUAL ( 6 , iLine . at ( 3 ) ) ; return ; }
This operation checks the TokenizedLineReader when the token is changed to a
 comma.
This operation checks the TokenizedLineReader when the token is changed to a comma .
// Local Declarations //----- Check integers -----// // Create the input stream // Configure the delimiter // Load the int reader // Get the first line and check it // The second line should skipped because it is a comment so, get the fourth // line and check it