// TrfObject_t.cpp #include "TrfObject.h" #include "TrfObjectTest.h" #include #include #include using std::cout; using std::cerr; using std::endl; using std::string; //********************************************************************** 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; #ifdef DEFECT_NO_MEMBER_TEMPLATES ObjTable::register_type(TestObject()); #else ObjTable::register_type(); #endif { TestObject obj; assert( TestObject::get_static_type() != 0 ); assert( obj.get_creator() == TestObject::get_static_type() ); assert( obj.get_type() == TestObject::get_static_type() ); assert( obj.get_generic_type() == TestObject::get_static_type() ); ObjData data = obj.write_data(); assert( data.get_object_type() == "TestObject" ); } //******************************************************************** cout << ok_prefix << "------------- All tests passed. -------------" << endl; return 0; //******************************************************************** }