// Quality_t.cpp #include "QualityTest.h" #include #include #include using std::string; using std::cout; using std::cerr; using std::endl; // If QualityTest had a source file, this would go there. void* TestQuality::_mytype = &TestQuality::_mytype; //********************************************************************** int main( ) { string component = "Quality"; 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 qualities." << endl; TestQuality good(3,3.3); TestQuality better(4,4.1); TestQuality bad(2,3.5); // validity assert( good.is_valid() ); assert( better.is_valid() ); assert( ! bad.is_valid() ); // comparison assert( good.is_better_than(bad) ); assert( ! bad.is_better_than(good) ); assert( better.is_better_than(good) ); assert( ! good.is_better_than(better) ); //******************************************************************** cout << ok_prefix << "------------- All tests passed. -------------" << endl; return 0; //******************************************************************** }