diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-06-13 17:17:42 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-06-13 17:17:42 +0000 |
| commit | 7f0766499db248afe9985a5700c22f9a8ce7ce6c (patch) | |
| tree | ba70577fe0ed4343b5127d1e8848cbe0ccebf4fe /src/cppunit/Asserter.cpp | |
| parent | abd178318ae3cdb6cc0a700e77414a33ef9297ca (diff) | |
| download | cppunit-7f0766499db248afe9985a5700c22f9a8ce7ce6c.tar.gz | |
Include/cppunit/NotEqualException.
include/cppunit/NotEqualException.h:
* src/cppunit/NotEqualException.cpp: removed.
* include/cppunit/Exception.h:
* src/cppunit/Exception.cpp: removed 'type' related stuffs.
* include/cppunit/TextTestResult.h:
* src/cppunit/TextTestResult.cpp: delegate printing to TextOutputter.
* examples/simple/ExampleTestCase.h:
* examples/simple/ExampleTestCase.cpp: reindented.
* src/qttestrunner/build:
* src/qttestrunner/qttestrunner.pro:
* src/qttestrunner/TestBrowserDlgImpl.h:
* src/qttestrunner/TestRunnerModel.h: applied Thomas Neidhart's patch,
'Some minor fixes to compile QTTestrunner under Linux.'.
Diffstat (limited to 'src/cppunit/Asserter.cpp')
| -rw-r--r-- | src/cppunit/Asserter.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/cppunit/Asserter.cpp b/src/cppunit/Asserter.cpp index 659e328..e43c19b 100644 --- a/src/cppunit/Asserter.cpp +++ b/src/cppunit/Asserter.cpp @@ -1,6 +1,6 @@ #include <cppunit/Asserter.h> +#include <cppunit/Exception.h> #include <cppunit/Message.h> -#include <cppunit/NotEqualException.h> namespace CppUnit @@ -45,20 +45,34 @@ failIf( bool shouldFail, 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 ) + const Message &additionalMessage, + std::string shortDescription ) { - Message message( "equality assertion failed", + Message message( shortDescription, "Expected: " + expected, "Actual : " + actual ); message.addDetail( additionalMessage ); fail( message, sourceLine ); } -*/ + + +void +failNotEqualIf( bool shouldFail, + std::string expected, + std::string actual, + const SourceLine &sourceLine, + const Message &additionalMessage, + std::string shortDescription ) +{ + if ( shouldFail ) + failNotEqual( expected, actual, sourceLine, additionalMessage, shortDescription ); +} + void failNotEqual( std::string expected, @@ -66,10 +80,10 @@ failNotEqual( std::string expected, const SourceLine &sourceLine, std::string additionalMessage ) { - throw NotEqualException( expected, - actual, - sourceLine, - additionalMessage ); + Message message; + if ( !additionalMessage.empty() ) + message.addDetail( additionalMessage ); + failNotEqual( expected, actual, sourceLine, message ); } |
