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