|
DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
|
Go to the documentation of this file. 1 #ifndef DD4HEP_DDTEST_H
2 #define DD4HEP_DDTEST_H
36 DDTest(
const std::string& testname, std::ostream& stream=std::cout ) :
45 _out <<
"****************************** TEST_BEGIN ******************************" << std::endl << std::endl;
54 std::stringstream sstr ;
57 sstr <<
"[" <<
_testname <<
"] number of tests PASSED : " <<
_passed << std::endl ;
58 sstr <<
"[" <<
_testname <<
"] number of tests FAILED : " <<
_failed << std::endl ;
62 sstr <<
"****************************** " ;
63 sstr << (
_failed == 0 ?
"TEST_PASSED" :
"TEST_FAILED" ) ;
64 sstr <<
" ******************************" ;
65 sstr << std::endl << std::endl ;
76 template <
class V1,
class V2 >
77 void operator()(
const V1& v1,
const V2& v2,
const std::string& name ) {
81 std::stringstream sstr ;
82 sstr <<
" " << name<<
" : [" << v1 <<
"] != [" << v2 <<
"]" ;
88 std::stringstream sstr ;
89 sstr <<
" " << name<<
" : [" << v1 <<
"] == [" << v2 <<
"]" ;
99 template <
class Cond >
104 std::stringstream sstr ;
105 sstr <<
" " << name<<
" : [" << c <<
"] " ;
107 error( sstr.str() ) ;
111 std::stringstream sstr ;
112 sstr <<
" " << name<<
" : [" << c <<
"] " ;
121 void log(
const std::string& msg ){
127 void pass(
const std::string& msg ){
138 void error(
const std::string& msg ){
143 std::stringstream errmsg;
145 errmsg <<
"[" <<
_testname <<
"] ##################### TEST_FAILED ######################" << std::endl;
146 errmsg <<
"[" <<
_testname <<
"] ### ERROR: " << msg << std::endl;
147 errmsg <<
"[" <<
_testname <<
"] ########################################################" << std::endl;
150 _out << errmsg.str();
159 _out <<
"FATAL ERROR OCCURRED, program will exit now !!" << std::endl ;
171 std::ostream&
_out = std::cout;
const char * last_test_status()
void operator()(const V1 &v1, const V2 &v2, const std::string &name)
DDTest & operator=(const DDTest ©)=delete
Assignment operator.
void pass(const std::string &msg)
Simple class for defining unit tests.
DDTest()=delete
Default constructor.
DDTest(const DDTest ©)=delete
Copy constructor.
void fatal_error(const std::string &msg)
void operator()(const Cond &c, const std::string &name)
DDTest(const std::string &testname, std::ostream &stream=std::cout)
void error(const std::string &msg)
Namespace for the AIDA detector description toolkit.
void log(const std::string &msg)