From 390b8241d313ab0a1410b589d5f3d1b75a1cafa0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 Apr 2009 23:55:05 +0000 Subject: [PATCH] revert r60023 and really fixed compilation problems caused by r60017 by providing assertEquals(const char *, const char *) overload as well git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/cppunit.h | 9 +++++++++ tests/strings/crt.cpp | 4 ++-- tests/strings/strings.cpp | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/wx/cppunit.h b/include/wx/cppunit.h index 3f74a8af74..2cdadbbd77 100644 --- a/include/wx/cppunit.h +++ b/include/wx/cppunit.h @@ -87,6 +87,15 @@ 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 char *actual, + CppUnit::SourceLine sourceLine, + const std::string& message) +{ + assertEquals(wxString(expected), wxString(actual), sourceLine, message); +} + inline void assertEquals(const char *expected, const wxString& actual, diff --git a/tests/strings/crt.cpp b/tests/strings/crt.cpp index 8233a9e8a2..61dc5afcc6 100644 --- a/tests/strings/crt.cpp +++ b/tests/strings/crt.cpp @@ -207,8 +207,8 @@ void CrtTestCase::Strpbrk() CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX.c_str(), s.mb_str()) ); CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWX.c_str(), s.wc_str()) ); - CPPUNIT_ASSERT_EQUAL( (char *)NULL, wxStrpbrk(strWX, "xyz") ); - CPPUNIT_ASSERT_EQUAL( (wchar_t *)NULL, wxStrpbrk(strWX.c_str(), L"xyz") ); + CPPUNIT_ASSERT( !wxStrpbrk(strWX, "xyz") ); + CPPUNIT_ASSERT( !wxStrpbrk(strWX.c_str(), L"xyz") ); } void CrtTestCase::Strnlen() diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index dd3e4a3133..87956929e2 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -943,9 +943,9 @@ void StringTestCase::ScopedBuffers() // but assigning it to wxCharBuffer makes a full copy wxCharBuffer buf(sbuf); CPPUNIT_ASSERT( buf.data() != literal ); - CPPUNIT_ASSERT_EQUAL( literal, buf ); + CPPUNIT_ASSERT_EQUAL( literal, buf.data() ); wxCharBuffer buf2 = sbuf; CPPUNIT_ASSERT( buf2.data() != literal ); - CPPUNIT_ASSERT_EQUAL( literal, buf ); + CPPUNIT_ASSERT_EQUAL( literal, buf.data() ); } -- 2.47.2