#include <cppunit/CompilerOutputter.h>
#include "wx/afterstd.h"
+#include "wx/string.h"
+
///////////////////////////////////////////////////////////////////////////////
// Set of helpful test macros.
#define WXTEST_FAIL_WITH_CONDITION(suiteName, Condition, testMethod) \
WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, CPPUNIT_TEST_FAIL(testMethod))
-// Use this macro to compare a wxString with a literal string.
-#define WX_ASSERT_STR_EQUAL(p, s) CPPUNIT_ASSERT_EQUAL(wxString(p), s)
+CPPUNIT_NS_BEGIN
+
+// provide an overload of cppunit assertEquals(T, T) which can be used to
+// compare wxStrings directly with C strings
+inline void
+assertEquals(const char *expected,
+ const wxString& actual,
+ CppUnit::SourceLine sourceLine,
+ const std::string& message)
+{
+ assertEquals(wxString(expected), actual, sourceLine, message);
+}
+
+inline void
+assertEquals(const wchar_t *expected,
+ const wxString& actual,
+ CppUnit::SourceLine sourceLine,
+ const std::string& message)
+{
+ assertEquals(wxString(expected), actual, sourceLine, message);
+}
+
+// and another to be able to specify (usually literal) ints as expected values
+// for functions returning size_t
+inline void
+assertEquals(int expected,
+ size_t actual,
+ CppUnit::SourceLine sourceLine,
+ const std::string& message)
+{
+ assertEquals(size_t(expected), actual, sourceLine, message);
+}
-// Use this macro to compare a size_t with a literal integer
-#define WX_ASSERT_SIZET_EQUAL(n, m) CPPUNIT_ASSERT_EQUAL(((size_t)n), m)
+CPPUNIT_NS_END
// Use this macro to compare a wxArrayString with the pipe-separated elements
// of the given string