// ClusterContainerStandard_t.cpp #include "ClusterContainerStandard.h" #include #include #include #include "trfbase/SurfTest.h" #include "trfbase/HitTest.h" using std::cout; using std::cerr; using std::endl; using std::string; using namespace trf; //********************************************************************** int main( ) { string component = "ClusterContainerStandard"; 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 << "Test default constructor." << endl; { ClusterContainerStandard box; assert( box.get_clusters().size() == 0 ); } //******************************************************************** cout << ok_prefix << "Test list constructor." << endl; { SurfTest srf1(1); SurfTest srf2(2); SurfTest srf3(3); ClusterTest clu1(srf1,1); ClusterTest clu2(srf1,1); ClusterTest clu3(srf1,1); ClusterList clusters; clusters.push_back(&clu1); clusters.push_back(&clu2); clusters.push_back(&clu3); ClusterContainerStandard box(clusters); assert( box.get_clusters().size() == 3 ); assert( box.get_clusters().front() == &clu1); assert( box.get_clusters().back() == &clu3); } //******************************************************************** cout << ok_prefix << "Test adding clusters." << endl; { SurfTest srf1(1); SurfTest srf2(2); SurfTest srf3(3); ClusterTest clu1(srf1,1); ClusterTest clu2(srf1,1); ClusterTest clu3(srf1,1); ClusterList clusters; ClusterContainerStandard box; box.add_cluster(&clu1); box.add_cluster(&clu2); box.add_cluster(&clu3); assert( box.get_clusters().size() == 3 ); assert( box.get_clusters().front() == &clu1); assert( box.get_clusters().back() == &clu3); } //******************************************************************** cout << ok_prefix << "------------- All tests passed. -------------" << endl; return 0; //******************************************************************** }