From: Vadim Zeitlin Date: Sat, 4 Apr 2009 16:43:36 +0000 (+0000) Subject: allow symmetric comparisons to work too in CPPUNIT_ASSERT_EQUAL (e.g. wxString==char... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/599d12919c91f31245a70015652414557e2281b2 allow symmetric comparisons to work too in CPPUNIT_ASSERT_EQUAL (e.g. wxString==char*, size_t==int and not only char*==wxString, int==size_t) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/cppunit.h b/include/wx/cppunit.h index c965925b80..3f74a8af74 100644 --- a/include/wx/cppunit.h +++ b/include/wx/cppunit.h @@ -96,6 +96,15 @@ assertEquals(const char *expected, assertEquals(wxString(expected), actual, sourceLine, message); } +inline void +assertEquals(const wxString& expected, + const char *actual, + CppUnit::SourceLine sourceLine, + const std::string& message) +{ + assertEquals(expected, wxString(actual), sourceLine, message); +} + inline void assertEquals(const wchar_t *expected, const wxString& actual, @@ -105,6 +114,15 @@ assertEquals(const wchar_t *expected, assertEquals(wxString(expected), actual, sourceLine, message); } +inline void +assertEquals(const wxString& expected, + const wchar_t *actual, + CppUnit::SourceLine sourceLine, + const std::string& message) +{ + assertEquals(expected, wxString(actual), sourceLine, message); +} + CPPUNIT_NS_END // define an assertEquals() overload for the given types, this is a helper and @@ -137,6 +155,7 @@ CPPUNIT_NS_END #define WX_CPPUNIT_ALLOW_EQUALS_TO_INT(T) \ CPPUNIT_NS_BEGIN \ WX_CPPUNIT_ASSERT_EQUALS(int, T) \ + WX_CPPUNIT_ASSERT_EQUALS(T, int) \ WX_CPPUNIT_ASSERT_EQUALS(T, T) \ CPPUNIT_NS_END @@ -147,6 +166,7 @@ CPPUNIT_NS_END #define WX_CPPUNIT_ALLOW_EQUALS_TO_INT(T) \ CPPUNIT_NS_BEGIN \ WX_CPPUNIT_ASSERT_EQUALS(int, T) \ + WX_CPPUNIT_ASSERT_EQUALS(T, int) \ CPPUNIT_NS_END #endif // VC6/!VC6