//
// To run all the regex tests:
// test regex
-//
+//
// Some tests must be skipped since they use features which we do not make
// available through wxRegEx. To see the list of tests that have been skipped
// turn on verbose logging, e.g.:
// test --verbose regex
-//
+//
// The tests here are for the builtin library, tests for wxRegEx in general
// should go in wxregex.cpp
//
// The tests are generated from Henry Spencer's reg.test, additional test
// can be added in wxreg.test. These test files are then turned into a C++
// include file 'regex.inc' (included below) using a script 'regex.pl'.
-//
+//
// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
+#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#include "wx/wx.h"
#endif
-#include "wx/regex.h"
-#include "wx/cppunit.h"
-#include <stdexcept>
-
-using namespace std;
-using namespace CppUnit;
// many of the tests are specific to the builtin regex lib, so only attempts
// to do them when using the builtin regex lib.
//
#ifdef wxHAS_REGEX_ADVANCED
+#include "wx/regex.h"
+#include <string>
+#include <vector>
+
+using CppUnit::Test;
+using CppUnit::TestCase;
+using CppUnit::TestSuite;
+using CppUnit::Exception;
+
+using std::string;
+using std::vector;
///////////////////////////////////////////////////////////////////////////////
// The test case - an instance represents a single test
m_advanced(false)
{
bool badconv = m_pattern == convError() || m_data == convError();
- vector<const char *>::const_iterator it;
+ //RN: Removing the std:: here will break MSVC6 compilation
+ std::vector<const char *>::const_iterator it;
for (it = expected.begin(); it != expected.end(); ++it) {
m_expected.push_back(Conv(*it));
}
failIf(badconv, _T("cannot convert to default character encoding"));
-
+
// the flags need further parsing...
parseFlags(m_flags);
{
size_t nLen1 = wxWcslen(s1);
size_t nLen2 = wxWcslen(s2);
-
+
if (nLen1 != nLen2)
return nLen1 - nLen2;
-
- return wxMemcmp(s1, s2, nLen1);
+
+ return wxTmemcmp(s1, s2, nLen1);
}
// convert a string from UTF8 to the internal encoding
doTest(wxRE_ADVANCED);
#endif
}
-
+
// Try the test for a single flavour of expression
//
void RegExTestCase::doTest(int flavor)
for (it = m_expected.begin(); it != m_expected.end(); ++it)
str << _T(" ") << quote(*it);
-
+
if (str.length() > 77)
str = str.substr(0, 74) + _T("...");
for (size_t i = 0; i < arg.length(); i++) {
wxUChar ch = arg[i];
const wxChar *p = wxStrchr(needEscape, ch);
-
+
if (p)
str += wxString::Format(_T("\\%c"), escapes[p - needEscape]);
else if (wxIscntrl(ch))
expected_results.push_back(expected);
va_end(ap);
-
+
try {
addTest(new RegExTestCase(
name, mode, id, flags, pattern, data, expected_results));