X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c33230b1c14f47b0f57e38a5c8133cf253b0e2a4..38aae140acbfd562df1388ae76108efcc52f871c:/tests/regex/wxregextest.cpp diff --git a/tests/regex/wxregextest.cpp b/tests/regex/wxregextest.cpp index 6e798a1821..0f5061ee0e 100644 --- a/tests/regex/wxregextest.cpp +++ b/tests/regex/wxregextest.cpp @@ -4,10 +4,10 @@ // Author: Vadim Zeitlin, Mike Wetherell // RCS-ID: $Id$ // Copyright: Vadim Zeitlin, Mike Wetherell -// Licence: wxWidgets licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#include "wx/wxprec.h" +#include "testprec.h" #ifdef __BORLANDC__ # pragma hdrstop @@ -20,12 +20,13 @@ #if wxUSE_REGEX #include "wx/regex.h" -#include "wx/cppunit.h" #include "wx/tokenzr.h" #include -using namespace std; -using namespace CppUnit; +using CppUnit::Test; +using CppUnit::TestCase; +using CppUnit::TestSuite; +using std::string; /////////////////////////////////////////////////////////////////////////////// @@ -103,7 +104,7 @@ void RegExMatchTestCase::runTest() CPPUNIT_ASSERT_MESSAGE("match failed", ok); wxStringTokenizer tkz(wxString(m_expected, *wxConvCurrent), - _T("\t"), wxTOKEN_RET_EMPTY); + wxT("\t"), wxTOKEN_RET_EMPTY); size_t i; for (i = 0; i < re.GetMatchCount() && tkz.HasMoreTokens(); i++) { @@ -111,7 +112,7 @@ void RegExMatchTestCase::runTest() wxString result = re.GetMatch(m_text, i); wxString msgstr; - msgstr.Printf(_T("\\%d == '%s' (expected '%s')"), + msgstr.Printf(wxT("\\%d == '%s' (expected '%s')"), (int)i, result.c_str(), expected.c_str()); CPPUNIT_ASSERT_MESSAGE((const char*)msgstr.mb_str(), @@ -143,7 +144,7 @@ public: m_expected(expected), m_count(count), m_flags(flags) - { } + { } protected: void runTest(); @@ -165,10 +166,10 @@ void RegExReplaceTestCase::runTest() size_t nRepl = re.Replace(&text, m_repl); wxString msgstr; - msgstr.Printf(_T("returns '%s' (expected '%s')"), text.c_str(), m_expected.c_str()); + msgstr.Printf(wxT("returns '%s' (expected '%s')"), text.c_str(), m_expected.c_str()); CPPUNIT_ASSERT_MESSAGE((const char*)msgstr.mb_str(), text == m_expected); - msgstr.Printf(_T("matches %d times (expected %d)"), nRepl, m_count); + msgstr.Printf(wxT("matches %d times (expected %d)"), (int)nRepl, (int)m_count); CPPUNIT_ASSERT_MESSAGE((const char*)msgstr.mb_str(), nRepl == m_count); } @@ -257,7 +258,7 @@ void wxRegExTestSuite::add( int flags /*=wxRE_DEFAULT*/) { addTest(new RegExCompileTestCase( - (_T("/") + Conv(pattern) + _T("/") + FlagStr(flags)).mb_str(), + (wxT("/") + Conv(pattern) + wxT("/") + FlagStr(flags)).mb_str(), Conv(pattern), correct, flags)); } @@ -271,9 +272,9 @@ void wxRegExTestSuite::add( { wxString name; - name << _T("'") << Conv(text) << _T("' =~ /") << Conv(pattern) << _T("/") + name << wxT("'") << Conv(text) << wxT("' =~ /") << Conv(pattern) << wxT("/") << FlagStr(flags); - name.Replace(_T("\n"), _T("\\n")); + name.Replace(wxT("\n"), wxT("\\n")); addTest(new RegExMatchTestCase(name.mb_str(), Conv(pattern), Conv(text), expected, flags)); @@ -291,9 +292,9 @@ void wxRegExTestSuite::add( { wxString name; - name << _T("'") << Conv(text) << _T("' =~ s/") << Conv(pattern) << _T("/") - << Conv(replacement) << _T("/g") << FlagStr(flags); - name.Replace(_T("\n"), _T("\\n")); + name << wxT("'") << Conv(text) << wxT("' =~ s/") << Conv(pattern) << wxT("/") + << Conv(replacement) << wxT("/g") << FlagStr(flags); + name.Replace(wxT("\n"), wxT("\\n")); addTest(new RegExReplaceTestCase( name.mb_str(), Conv(pattern), Conv(text), @@ -313,25 +314,25 @@ wxString wxRegExTestSuite::FlagStr(int flags) switch (flags & (1 << i)) { case 0: break; #ifdef wxHAS_REGEX_ADVANCED - case wxRE_ADVANCED: str += _T(" | wxRE_ADVANCED"); break; + case wxRE_ADVANCED: str += wxT(" | wxRE_ADVANCED"); break; #endif - case wxRE_BASIC: str += _T(" | wxRE_BASIC"); break; - case wxRE_ICASE: str += _T(" | wxRE_ICASE"); break; - case wxRE_NOSUB: str += _T(" | wxRE_NOSUB"); break; - case wxRE_NEWLINE: str += _T(" | wxRE_NEWLINE"); break; - case wxRE_NOTBOL: str += _T(" | wxRE_NOTBOL"); break; - case wxRE_NOTEOL: str += _T(" | wxRE_NOTEOL"); break; + case wxRE_BASIC: str += wxT(" | wxRE_BASIC"); break; + case wxRE_ICASE: str += wxT(" | wxRE_ICASE"); break; + case wxRE_NOSUB: str += wxT(" | wxRE_NOSUB"); break; + case wxRE_NEWLINE: str += wxT(" | wxRE_NEWLINE"); break; + case wxRE_NOTBOL: str += wxT(" | wxRE_NOTBOL"); break; + case wxRE_NOTEOL: str += wxT(" | wxRE_NOTEOL"); break; default: wxFAIL; break; } } - return _T(" (") + str.Mid(3) + _T(")"); -}; + return wxT(" (") + str.Mid(3) + wxT(")"); +} // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION(wxRegExTestSuite); -// also include in it's own registry so that these tests can be run alone +// also include in its own registry so that these tests can be run alone CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(wxRegExTestSuite, "wxRegExTestSuite");