// TrfReportingObject_t.cpp #include "TrfReportingObject.h" #include "TrfReportingObjectTest.h" #include #include #include #include "ReporterTest.h" using std::cout; using std::cerr; using std::endl; using std::string; using trf::ReporterPtr; using trf::Message; //********************************************************************** int main( ) { string component = "TrfObject"; string ok_prefix = component + " (I): "; string error_prefix = component + " test (E): "; cout << ok_prefix << "---------- Testing component " + component + ". ----------" << endl; // Make sure assert is enabled. bool assert_flag = false; assert ( ( assert_flag = true, assert_flag ) ); if ( ! assert_flag ) { cerr << "Assert is disabled" << endl; return 1; } //******************************************************************** cout << ok_prefix << "Construct a test object." << endl; { TrfReportingObjectTest obj; ReporterTest trep; assert( obj.reporters().size() == 0 ); obj.add_reporter(&trep); obj.add_reporter(&trep); assert( obj.reporters().size() == 2 ); assert( trep.count == 0 ); obj.make_reports(); assert( trep.count == 2 ); } //******************************************************************** cout << ok_prefix << "------------- All tests passed. -------------" << endl; return 0; //******************************************************************** }