// Miss_t.cpp #include "Miss.h" #include "MissTest.h" #include #include #include "trfutil/trfstream.h" #include "ETrack.h" using std::cout; using std::cerr; using std::endl; using std::string; using trf::trf_format; using trf::SurfacePtr; //********************************************************************** int main( ) { string component = "Miss"; 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 << trf_format; cout << ok_prefix << "Test constructor." << endl; MissTest miss(1,0.5); cout << miss << endl; //******************************************************************** cout << ok_prefix << "Test cloning." << endl; Miss* pmiss2 = miss.new_copy(); cout << *pmiss2 << endl; //******************************************************************** cout << ok_prefix << "Test access." << endl; SurfTest srf(1); assert( pmiss2->get_surface().pure_equal(srf) ); assert( pmiss2->get_likelihood() == 0.5 ); //******************************************************************** cout << ok_prefix << "Test update." << endl; ETrack tre( SurfacePtr(srf.new_pure_surface()) ); pmiss2->update(tre); assert( miss.get_likelihood() == 0.5 ); assert( pmiss2->get_likelihood() == 0.5*0.9 ); //******************************************************************** cout << ok_prefix << "------------- All tests passed. -------------" << endl; return 0; //******************************************************************** }