diff options
Diffstat (limited to 'src/cppunit/Asserter.cpp')
| -rw-r--r-- | src/cppunit/Asserter.cpp | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/src/cppunit/Asserter.cpp b/src/cppunit/Asserter.cpp index 29c5201..659e328 100644 --- a/src/cppunit/Asserter.cpp +++ b/src/cppunit/Asserter.cpp @@ -1,4 +1,5 @@ #include <cppunit/Asserter.h> +#include <cppunit/Message.h> #include <cppunit/NotEqualException.h> @@ -12,7 +13,15 @@ namespace Asserter void fail( std::string message, - SourceLine sourceLine ) + const SourceLine &sourceLine ) +{ + fail( Message( "assertion failed", message ), sourceLine ); +} + + +void +fail( const Message &message, + const SourceLine &sourceLine ) { throw Exception( message, sourceLine ); } @@ -20,18 +29,41 @@ fail( std::string message, void failIf( bool shouldFail, - std::string message, - SourceLine location ) + const Message &message, + const SourceLine &sourceLine ) { if ( shouldFail ) - fail( message, location ); + fail( message, sourceLine ); +} + + +void +failIf( bool shouldFail, + std::string message, + const SourceLine &sourceLine ) +{ + failIf( shouldFail, Message( "assertion failed", message ), sourceLine ); } +/* @@fixme Need to take NotEqualException down before including that change. +void +failNotEqual( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const Message &additionalMessage ) +{ + Message message( "equality assertion failed", + "Expected: " + expected, + "Actual : " + actual ); + message.addDetail( additionalMessage ); + fail( message, sourceLine ); +} +*/ void failNotEqual( std::string expected, std::string actual, - SourceLine sourceLine, + const SourceLine &sourceLine, std::string additionalMessage ) { throw NotEqualException( expected, @@ -45,7 +77,7 @@ void failNotEqualIf( bool shouldFail, std::string expected, std::string actual, - SourceLine sourceLine, + const SourceLine &sourceLine, std::string additionalMessage ) { if ( shouldFail ) |
