X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f69577be06770f2039acfd3d694581a8a3806dc7..c0b0635cf69537ca32377bad5650b39402cb21b6:/tests/regex/regex.cpp?ds=sidebyside diff --git a/tests/regex/regex.cpp b/tests/regex/regex.cpp index 27517c8f8a..261435e8ed 100644 --- a/tests/regex/regex.cpp +++ b/tests/regex/regex.cpp @@ -45,10 +45,6 @@ #include "wx/cppunit.h" #include -#ifdef __DMC__ - #include -#endif - using namespace std; using namespace CppUnit; @@ -148,6 +144,17 @@ RegExTestCase::RegExTestCase( #endif } +int wxWcscmp(const wchar_t* s1, const wchar_t* s2) +{ + size_t nLen1 = wxWcslen(s1); + size_t nLen2 = wxWcslen(s2); + + if (nLen1 != nLen2) + return nLen1 - nLen2; + + return wxMemcmp(s1, s2, nLen1); +} + // convert a string from UTF8 to the internal encoding // wxString RegExTestCase::Conv(const char *str) @@ -155,7 +162,7 @@ wxString RegExTestCase::Conv(const char *str) const wxWCharBuffer wstr = wxConvUTF8.cMB2WC(str); const wxWC2WXbuf buf = wxConvCurrent->cWC2WX(wstr); - if (!buf || wcscmp(wxConvCurrent->cWX2WC(buf), wstr) != 0) + if (!buf || wxWcscmp(wxConvCurrent->cWX2WC(buf), wstr) != 0) return convError(); else return buf; @@ -323,36 +330,15 @@ wxString RegExTestCase::quote(const wxString& arg) /////////////////////////////////////////////////////////////////////////////// // Test suite -// -// In a non-unicode build the regex is affected by the current locale, so -// this derived TestSuite is used. It sets the locale in it's run() method -// for the duration of the regex tests. class RegExTestSuite : public TestSuite { public: - RegExTestSuite(string name); - void run(TestResult *result); + RegExTestSuite(string name) : TestSuite(name) { } void add(const char *mode, const char *id, const char *flags, const char *pattern, const char *data, const char *expected, ...); }; -// constructor, sets the locale so that it is set when the tests are added -// -RegExTestSuite::RegExTestSuite(string name) : TestSuite(name) -{ - setlocale(LC_ALL, ""); -} - -// run the test suite, sets the locale again since it may have been changed -// by another test since this suite was crated -// -void RegExTestSuite::run(TestResult *result) -{ - setlocale(LC_ALL, ""); - TestSuite::run(result); -} - // Add a testcase to the suite // void RegExTestSuite::add(