1#include <cppunit/Asserter.h> 2#include <cppunit/NotEqualException.h> 3 4 5using std::string; 6 7namespace CppUnit 8{ 9 10 11namespace Asserter 12{ 13 14 15void 16fail( string message, 17 SourceLine sourceLine ) 18{ 19 throw Exception( message, sourceLine ); 20} 21 22 23void 24failIf( bool shouldFail, 25 string message, 26 SourceLine location ) 27{ 28 if ( shouldFail ) 29 fail( message, location ); 30} 31 32 33void 34failNotEqual( string expected, 35 string actual, 36 SourceLine sourceLine, 37 string additionalMessage ) 38{ 39 throw NotEqualException( expected, 40 actual, 41 sourceLine, 42 additionalMessage ); 43} 44 45 46void 47failNotEqualIf( bool shouldFail, 48 string expected, 49 string actual, 50 SourceLine sourceLine, 51 string additionalMessage ) 52{ 53 if ( shouldFail ) 54 failNotEqual( expected, actual, sourceLine, additionalMessage ); 55} 56 57 58} // namespace Asserter 59} // namespace CppUnit 60