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
This commit is contained in:
Vadim Zeitlin
2009-04-04 16:43:36 +00:00
parent 3879212eee
commit 599d12919c

View File

@@ -96,6 +96,15 @@ assertEquals(const char *expected,
assertEquals(wxString(expected), actual, sourceLine, message); 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 inline void
assertEquals(const wchar_t *expected, assertEquals(const wchar_t *expected,
const wxString& actual, const wxString& actual,
@@ -105,6 +114,15 @@ assertEquals(const wchar_t *expected,
assertEquals(wxString(expected), actual, sourceLine, message); 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 CPPUNIT_NS_END
// define an assertEquals() overload for the given types, this is a helper and // 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) \ #define WX_CPPUNIT_ALLOW_EQUALS_TO_INT(T) \
CPPUNIT_NS_BEGIN \ CPPUNIT_NS_BEGIN \
WX_CPPUNIT_ASSERT_EQUALS(int, T) \ WX_CPPUNIT_ASSERT_EQUALS(int, T) \
WX_CPPUNIT_ASSERT_EQUALS(T, int) \
WX_CPPUNIT_ASSERT_EQUALS(T, T) \ WX_CPPUNIT_ASSERT_EQUALS(T, T) \
CPPUNIT_NS_END CPPUNIT_NS_END
@@ -147,6 +166,7 @@ CPPUNIT_NS_END
#define WX_CPPUNIT_ALLOW_EQUALS_TO_INT(T) \ #define WX_CPPUNIT_ALLOW_EQUALS_TO_INT(T) \
CPPUNIT_NS_BEGIN \ CPPUNIT_NS_BEGIN \
WX_CPPUNIT_ASSERT_EQUALS(int, T) \ WX_CPPUNIT_ASSERT_EQUALS(int, T) \
WX_CPPUNIT_ASSERT_EQUALS(T, int) \
CPPUNIT_NS_END CPPUNIT_NS_END
#endif // VC6/!VC6 #endif // VC6/!VC6