11 #define BOOST_TEST_MODULE DumpUtils_test 12 #include <boost/test/unit_test.hpp> 31 std::ostringstream sstr;
34 std::array<float, 5>
const array = {{ 1., 2., 3., 4., 6. }};
35 sstr << lar::dump::array<5>(
array);
36 BOOST_TEST(sstr.str() ==
"{ 1; 2; 3; 4; 6 }");
38 (
std::string(lar::dump::array<5>(array)) ==
"{ 1; 2; 3; 4; 6 }");
42 std::ostringstream sstr;
43 std::vector<float>
const array = { 1., 2., 3., 4., 6. };
44 sstr << lar::dump::array<5>(
array);
45 BOOST_TEST(sstr.str() ==
"{ 1; 2; 3; 4; 6 }");
47 (
std::string(lar::dump::array<5>(array)) ==
"{ 1; 2; 3; 4; 6 }");
51 std::ostringstream sstr;
52 float const array[5] = { 1., 2., 3., 4., 6. };
53 sstr << lar::dump::array<5>(
array);
54 BOOST_TEST(sstr.str() ==
"{ 1; 2; 3; 4; 6 }");
56 (
std::string(lar::dump::array<5>(array)) ==
"{ 1; 2; 3; 4; 6 }");
60 std::ostringstream sstr;
61 float const array[5] = { 1., 2., 3., 4., 6. };
62 float const* ptr =
array;
63 sstr << lar::dump::array<5>(ptr);
64 BOOST_TEST(sstr.str() ==
"{ 1; 2; 3; 4; 6 }");
65 BOOST_TEST(
std::string(lar::dump::array<5>(ptr)) ==
"{ 1; 2; 3; 4; 6 }");
69 std::ostringstream sstr;
70 double array[5] = { 1., 2., 3., 4., 6. };
71 sstr << lar::dump::array<5>(
array);
72 BOOST_TEST(sstr.str() ==
"{ 1; 2; 3; 4; 6 }");
74 (
std::string(lar::dump::array<5>(array)) ==
"{ 1; 2; 3; 4; 6 }");
78 std::ostringstream sstr;
79 double array[5] = { 1., 2., 3., 4., 6. };
81 sstr << lar::dump::array<5>(ptr);
82 BOOST_TEST(sstr.str() ==
"{ 1; 2; 3; 4; 6 }");
83 BOOST_TEST(
std::string(lar::dump::array<5>(ptr)) ==
"{ 1; 2; 3; 4; 6 }");
101 std::ostringstream sstr;
114 double const data[5] = { 1., 2., 3., 4., 6. };
115 std::cout <<
"Data: " << lar::dump::array<5>(
data) <<
std::endl;
117 sstr << lar::dump::array<5>(
data);
118 BOOST_TEST(sstr.str() ==
"{ 1; 2; 3; 4; 6 }");
125 std::ostringstream sstr;
126 std::vector<float>
const v = { 1., 2., 3., 4., 6. };
128 BOOST_TEST(sstr.str() ==
"{ 1; 2; 3; 4; 6 }");
130 (
std::string(lar::dump::vector(v)) ==
"{ 1; 2; 3; 4; 6 }");
134 std::ostringstream sstr;
135 std::list<float>
const v = { 1., 2., 3., 4., 6. };
137 BOOST_TEST(sstr.str() ==
"{ 1; 2; 3; 4; 6 }");
139 (
std::string(lar::dump::vector(v)) ==
"{ 1; 2; 3; 4; 6 }");
153 std::ostringstream sstr;
167 std::vector<double>
data = { 1., 2., 3., 4., 6. };
170 sstr << lar::dump::array<5>(
data);
171 BOOST_TEST(sstr.str() ==
"{ 1; 2; 3; 4; 6 }");
178 std::ostringstream sstr;
179 TVector3
pos( 1., 2., 4. );
181 BOOST_TEST(sstr.str() ==
"{ 1; 2; 4 }");
182 BOOST_TEST(
std::string(lar::dump::vector3D(pos)) ==
"{ 1; 2; 4 }");
186 std::ostringstream sstr;
187 float const array[3] = { 1., 2., 4. };
189 BOOST_TEST(sstr.str() ==
"{ 1; 2; 4 }");
190 BOOST_TEST(
std::string(lar::dump::vector3D(array)) ==
"{ 1; 2; 4 }");
194 std::ostringstream sstr;
195 float const array[3] = { 1., 2., 4. };
196 float const* ptr =
array;
198 BOOST_TEST(sstr.str() ==
"{ 1; 2; 4 }");
199 BOOST_TEST(
std::string(lar::dump::vector3D(ptr)) ==
"{ 1; 2; 4 }");
203 std::ostringstream sstr;
204 double array[3] = { 1., 2., 4. };
206 BOOST_TEST(sstr.str() ==
"{ 1; 2; 4 }");
207 BOOST_TEST(
std::string(lar::dump::vector3D(array)) ==
"{ 1; 2; 4 }");
211 std::ostringstream sstr;
212 double array[3] = { 1., 2., 4. };
215 BOOST_TEST(sstr.str() ==
"{ 1; 2; 4 }");
216 BOOST_TEST(
std::string(lar::dump::vector3D(ptr)) ==
"{ 1; 2; 4 }");
234 std::ostringstream sstr;
251 BOOST_TEST(sstr.str() ==
"{ 0; 0; 0 }");
258 std::ostringstream sstr;
276 BOOST_TEST(
std::string(e.what()) ==
"Position: { 0; 0; 0 }");
283 std::ostringstream sstr;
303 BOOST_TEST(s ==
"Position: { 0; 0; 0 }");
323 template <
typename T>
332 template <
typename Stream>
334 { out <<
"{ " << a[0] <<
"; " << a[1] <<
"; " << a[2] <<
" }"; }
345 std::ostringstream sstr;
347 std::array<float, 3U>
v;
350 BOOST_TEST(sstr.str() ==
"{ 0; 0; 0 }");
void ArrayTest_STLvector()
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
void Vector3DstringAppendDocumentationTest()
void Vector3DdocumentationTest()
void Vector3Dtest_TVector3()
VectorDumper(Vector_t const &a)
void Vector3DstringConcatDocumentationTest()
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
auto array(Array const &a)
Returns a manipulator which will print the specified array.
void VectorDocumentationTest()
void Vector3DspecializationTest()
Vector_t const & v
A reference to the vector to be printed.
void Vector3Dtest_carray()
void operator()(Stream &&out) const
Inserts the content of the stored vector into the specified stream.
void ArrayTest_STLarray()
Collection of utilities for dumping data on screen.
auto array(Array const &a)
Returns a manipulator which will print the specified array.
LArSoft-specific namespace.
BOOST_AUTO_TEST_CASE(DumpArrays_testcase)
void Vector3DstreamOutputDocumentationTest()
void VectorTest_STLvector()
std::array< T, 3U > Vector_t
Manipulator managing the dump of the vector content into a stream.
void Vector3Dtest_array()
void ArrayDocumentationTest()
void VectorTest_STLlist()
QTextStream & endl(QTextStream &s)