Skip to content
Snippets Groups Projects
Commit 32305c96 authored by Ansgar Burchardt's avatar Ansgar Burchardt Committed by Christoph Grüninger
Browse files

Add test for tuple in- and output.

parent fd11ee3e
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@
#include <cstdlib>
#include <iostream>
#include <ostream>
#include <sstream>
#include <string>
#include <vector>
......@@ -249,6 +250,30 @@ int tuple_tr1_test()
return ret;
}
int inputTest()
{
typedef std::tuple<int, int, int> Tuple;
const std::string data = "1, 2, 3";
const Tuple expected{1, 2, 3};
std::istringstream in(data);
Tuple t;
in >> t;
return t == expected ? 0 : 1;
}
int outputTest()
{
typedef std::tuple<int, int, int> Tuple;
const Tuple t{1, 2, 3};
const std::string expected = "1, 2, 3";
std::ostringstream out;
out << t;
return out.str() == expected ? 0 : 1;
}
int main(int, char**)
{
......@@ -259,6 +284,6 @@ int main(int, char**)
test(static_cast<tuple<float,int,double,char,std::string>& >(tuple_));
test(static_cast<const tuple<float,int,double,char,std::string>&>(tuple_));
return (copyTest()+iteratorTupleTest()+referenceTest()+lessTest()
+pointerTest()+constPointerTest()+tuple_tr1_test());
+pointerTest()+constPointerTest()+tuple_tr1_test()+inputTest()+outputTest());
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment