// GtrFieldPkg_t.cpp #include "GtrFieldPkg.hpp" #include #include #include "framework/Testing.hpp" #include "objstream/ObjTable.hpp" #include "trfbase/ObjDoublePtr.h" #include "run_config_fwk/RunConfigPkg.hpp" using std::cerr; using std::cout; using std::endl; using std::string; //********************************************************************** int main( ) { string component = "GtrFieldPkg"; 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; } //******************************************************************** // Construct package. cout << ok_prefix << "Construct GtrFieldPkg." << endl; RunConfigPkg* p1 = 0; makePackage(p1, "run_config_fwk", "RunConfigPkg"); assert(p1 != 0); GtrFieldPkg::initialize(); // Fetch field cout << ok_prefix << "Fetch global field." << endl; ObjDoublePtr pp; ObjTable::Status stat = ObjTable::get_object("bfield", pp); assert(stat == ObjTable::OK); assert(pp != 0); cout << "Bfield = " << *pp << endl; //****************************************************************** cout << ok_prefix << "------------- All tests passed. -------------" << endl; return 0; //******************************************************************** }