Warning fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36158 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell
2005-11-11 16:55:03 +00:00
parent ece291c7d2
commit 0519aac9db

View File

@@ -256,16 +256,18 @@ void RegExTestCase::doTest(int flavor)
return; return;
// check wxRegEx has correctly counted the number of subexpressions // check wxRegEx has correctly counted the number of subexpressions
failIf(m_expected.size() != re.GetMatchCount(), wxString msg;
wxString::Format(_T("GetMatchCount() == %d, expected %d"), msg << _T("GetMatchCount() == ") << re.GetMatchCount()
re.GetMatchCount(), m_expected.size())); << _T(", expected ") << m_expected.size();
failIf(m_expected.size() != re.GetMatchCount(), msg);
wxString result;
size_t start, len;
for (size_t i = 0; i < m_expected.size(); i++) { for (size_t i = 0; i < m_expected.size(); i++) {
failIf(!re.GetMatch(&start, &len, i), wxString::Format( wxString result;
_T("wxRegEx::GetMatch failed for match %d"), i)); size_t start, len;
msg.clear();
msg << _T("wxRegEx::GetMatch failed for match ") << i;
failIf(!re.GetMatch(&start, &len, i), msg);
// m - check the match returns the strings given // m - check the match returns the strings given
if (m_mode == 'm') if (m_mode == 'm')
@@ -276,14 +278,17 @@ void RegExTestCase::doTest(int flavor)
// i - check the match returns the offsets given // i - check the match returns the offsets given
else if (m_mode == 'i') else if (m_mode == 'i')
if (start < INT_MAX) if (start > INT_MAX)
result = wxString::Format(_T("%d %d"), start, start + len - 1);
else
result = _T("-1 -1"); result = _T("-1 -1");
else if (start + len > 0)
result << start << _T(" ") << start + len - 1;
else
result << start << _T(" -1");
failIf(result != m_expected[i], wxString::Format( msg.clear();
_T("match(%d) == %s, expected == %s"), i, msg << _T("match(") << i << _T(") == ") << quote(result)
quote(result).c_str(), quote(m_expected[i]).c_str())); << _T(", expected == ") << quote(m_expected[i]);
failIf(result != m_expected[i], msg);
} }
} }