@@ -51,14 +51,14 @@ class TestFixture : public ErrorLogger {
5151 bool prepareTest (const char testname[]);
5252 std::string getLocationStr (const char * const filename, const unsigned int linenr) const ;
5353
54- void assert_ (const char * const filename, const unsigned int linenr, const bool condition) const ;
54+ bool assert_ (const char * const filename, const unsigned int linenr, const bool condition) const ;
5555
56- void assertEquals (const char * const filename, const unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg = emptyString) const ;
56+ bool assertEquals (const char * const filename, const unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg = emptyString) const ;
5757 void assertEqualsWithoutLineNumbers (const char * const filename, const unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg = emptyString) const ;
58- void assertEquals (const char * const filename, const unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg = emptyString) const ;
59- void assertEquals (const char * const filename, const unsigned int linenr, const char expected[], const char actual[], const std::string &msg = emptyString) const ;
60- void assertEquals (const char * const filename, const unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg = emptyString) const ;
61- void assertEquals (const char * const filename, const unsigned int linenr, const long long expected, const long long actual, const std::string &msg = emptyString) const ;
58+ bool assertEquals (const char * const filename, const unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg = emptyString) const ;
59+ bool assertEquals (const char * const filename, const unsigned int linenr, const char expected[], const char actual[], const std::string &msg = emptyString) const ;
60+ bool assertEquals (const char * const filename, const unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg = emptyString) const ;
61+ bool assertEquals (const char * const filename, const unsigned int linenr, const long long expected, const long long actual, const std::string &msg = emptyString) const ;
6262 void assertEqualsDouble (const char * const filename, const unsigned int linenr, const double expected, const double actual, const double tolerance, const std::string &msg = emptyString) const ;
6363
6464 void todoAssertEquals (const char * const filename, const unsigned int linenr, const std::string &wanted,
@@ -98,8 +98,8 @@ extern std::ostringstream errout;
9898extern std::ostringstream output;
9999
100100#define TEST_CASE ( NAME ) if ( prepareTest(#NAME) ) { setVerbose (false ); NAME (); }
101- #define ASSERT ( CONDITION ) assert_(__FILE__, __LINE__, CONDITION)
102- #define ASSERT_EQUALS ( EXPECTED , ACTUAL ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL)
101+ #define ASSERT ( CONDITION ) if (! assert_(__FILE__, __LINE__, CONDITION)) return
102+ #define ASSERT_EQUALS ( EXPECTED , ACTUAL ) if (! assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL)) return
103103#define ASSERT_EQUALS_WITHOUT_LINENUMBERS ( EXPECTED , ACTUAL ) assertEqualsWithoutLineNumbers(__FILE__, __LINE__, EXPECTED, ACTUAL)
104104#define ASSERT_EQUALS_DOUBLE ( EXPECTED , ACTUAL, TOLERANCE ) assertEqualsDouble(__FILE__, __LINE__, EXPECTED, ACTUAL, TOLERANCE)
105105#define ASSERT_EQUALS_MSG ( EXPECTED , ACTUAL, MSG ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL, MSG)
@@ -108,6 +108,7 @@ extern std::ostringstream output;
108108#define TODO_ASSERT_THROW ( CMD, EXCEPTION ) try { CMD ; } catch (const EXCEPTION&) { } catch (...) { assertThrow (__FILE__, __LINE__); }
109109#define TODO_ASSERT ( CONDITION ) { const bool condition=(CONDITION); todoAssertEquals (__FILE__, __LINE__, true , false , condition); }
110110#define TODO_ASSERT_EQUALS ( WANTED , CURRENT , ACTUAL ) todoAssertEquals(__FILE__, __LINE__, WANTED, CURRENT, ACTUAL)
111+ #define EXPECT_EQ ( EXPECTED, ACTUAL ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL)
111112#define REGISTER_TEST ( CLASSNAME ) namespace { CLASSNAME instance_##CLASSNAME; }
112113
113114#ifdef _WIN32
0 commit comments