Unit test for utilities in DumpUtils.h.
More...
#include <boost/test/unit_test.hpp>
#include "larcorealg/CoreUtils/DumpUtils.h"
#include <TVector3.h>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <array>
#include <sstream>
Go to the source code of this file.
|
| lar |
| LArSoft-specific namespace.
|
|
| lar::dump |
| Namespace for LArSoft dumping utilities.
|
|
Unit test for utilities in DumpUtils.h.
- Author
- Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.fnal..nosp@m.gov)
- Date
- February 28, 2017
Definition in file DumpUtils_test.cc.
#define BOOST_TEST_MODULE DumpUtils_test |
void ArrayDocumentationTest |
( |
| ) |
|
Definition at line 99 of file DumpUtils_test.cc.
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 }");
BEGIN_PROLOG could also be cout
Definition at line 86 of file DumpUtils_test.cc.
void ArrayTest_STLvector()
void ArrayTest_STLarray()
Definition at line 68 of file DumpUtils_test.cc.
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 }");
then echo ***************************************echo array
void ArrayTest_carray |
( |
| ) |
|
Definition at line 50 of file DumpUtils_test.cc.
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 }");
then echo ***************************************echo array
Definition at line 59 of file DumpUtils_test.cc.
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 }");
then echo ***************************************echo array
Definition at line 77 of file DumpUtils_test.cc.
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 }");
then echo ***************************************echo array
void ArrayTest_STLarray |
( |
| ) |
|
Definition at line 30 of file DumpUtils_test.cc.
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 }");
then echo ***************************************echo array
void ArrayTest_STLvector |
( |
| ) |
|
Definition at line 41 of file DumpUtils_test.cc.
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 }");
then echo ***************************************echo array
BOOST_AUTO_TEST_CASE |
( |
DumpArrays_testcase |
| ) |
|
BOOST_AUTO_TEST_CASE |
( |
DumpVectors_testcase |
| ) |
|
BOOST_AUTO_TEST_CASE |
( |
Dump3Dvectors_testcase |
| ) |
|
Definition at line 375 of file DumpUtils_test.cc.
void Vector3DdocumentationTest()
void Vector3DspecializationTest()
void Vector3DdocumentationTest |
( |
| ) |
|
Definition at line 308 of file DumpUtils_test.cc.
void Vector3DstringAppendDocumentationTest()
void Vector3DstringConcatDocumentationTest()
void Vector3DstreamOutputDocumentationTest()
void Vector3DspecializationTest |
( |
| ) |
|
Definition at line 343 of file DumpUtils_test.cc.
345 std::ostringstream sstr;
347 std::array<float, 3U> v;
350 BOOST_TEST(sstr.str() ==
"{ 0; 0; 0 }");
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
void Vector3DstreamOutputDocumentationTest |
( |
| ) |
|
Definition at line 232 of file DumpUtils_test.cc.
234 std::ostringstream sstr;
251 BOOST_TEST(sstr.str() ==
"{ 0; 0; 0 }");
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
BEGIN_PROLOG could also be cout
void Vector3DstringAppendDocumentationTest |
( |
| ) |
|
Definition at line 281 of file DumpUtils_test.cc.
283 std::ostringstream sstr;
299 std::string
s =
"Position: ";
303 BOOST_TEST(s ==
"Position: { 0; 0; 0 }");
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
then echo File list $list not found else cat $list while read file do echo $file sed s
BEGIN_PROLOG could also be cout
void Vector3DstringConcatDocumentationTest |
( |
| ) |
|
Definition at line 256 of file DumpUtils_test.cc.
258 std::ostringstream sstr;
276 BOOST_TEST(std::string(
e.what()) ==
"Position: { 0; 0; 0 }");
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
BEGIN_PROLOG could also be cout
Definition at line 220 of file DumpUtils_test.cc.
void Vector3Dtest_TVector3()
void Vector3Dtest_carray()
void Vector3Dtest_array()
void Vector3Dtest_array |
( |
| ) |
|
Definition at line 202 of file DumpUtils_test.cc.
203 std::ostringstream sstr;
204 double array[3] = { 1., 2., 4. };
206 BOOST_TEST(sstr.str() ==
"{ 1; 2; 4 }");
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
then echo ***************************************echo array
void Vector3Dtest_carray |
( |
| ) |
|
Definition at line 185 of file DumpUtils_test.cc.
186 std::ostringstream sstr;
187 float const array[3] = { 1., 2., 4. };
189 BOOST_TEST(sstr.str() ==
"{ 1; 2; 4 }");
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
then echo ***************************************echo array
void Vector3Dtest_cptr |
( |
| ) |
|
Definition at line 193 of file DumpUtils_test.cc.
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 }");
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
then echo ***************************************echo array
void Vector3Dtest_ptr |
( |
| ) |
|
Definition at line 210 of file DumpUtils_test.cc.
211 std::ostringstream sstr;
212 double array[3] = { 1., 2., 4. };
215 BOOST_TEST(sstr.str() ==
"{ 1; 2; 4 }");
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
then echo ***************************************echo array
void Vector3Dtest_TVector3 |
( |
| ) |
|
Definition at line 177 of file DumpUtils_test.cc.
178 std::ostringstream sstr;
179 TVector3 pos( 1., 2., 4. );
181 BOOST_TEST(sstr.str() ==
"{ 1; 2; 4 }");
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
void VectorDocumentationTest |
( |
| ) |
|
Definition at line 151 of file DumpUtils_test.cc.
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 }");
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
BEGIN_PROLOG could also be cout
Definition at line 142 of file DumpUtils_test.cc.
void VectorTest_STLvector()
void VectorTest_STLlist()
void VectorTest_STLlist |
( |
| ) |
|
Definition at line 133 of file DumpUtils_test.cc.
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 }");
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
void VectorTest_STLvector |
( |
| ) |
|
Definition at line 124 of file DumpUtils_test.cc.
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 }");
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.