corrected expected test results to conform to current wxTOKEN_RET_EMPTY behaviour; added the value of loop index for which the test fails to the diagnostic messages
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36549 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -93,10 +93,10 @@ gs_testData[] =
|
||||
{ _T("1:2::3:"), _T(":"), wxTOKEN_RET_DELIMS, 4 },
|
||||
{ _T("1:2::3:"), _T(":"), wxTOKEN_STRTOK, 3 },
|
||||
|
||||
{ _T("1:2::3::"), _T(":"), wxTOKEN_DEFAULT, 5 },
|
||||
{ _T("1:2::3::"), _T(":"), wxTOKEN_DEFAULT, 4 },
|
||||
{ _T("1:2::3::"), _T(":"), wxTOKEN_RET_EMPTY, 4 },
|
||||
{ _T("1:2::3::"), _T(":"), wxTOKEN_RET_EMPTY_ALL, 6 },
|
||||
{ _T("1:2::3::"), _T(":"), wxTOKEN_RET_DELIMS, 5 },
|
||||
{ _T("1:2::3::"), _T(":"), wxTOKEN_RET_DELIMS, 4 },
|
||||
{ _T("1:2::3::"), _T(":"), wxTOKEN_STRTOK, 3 },
|
||||
|
||||
{ _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_DEFAULT, 4 },
|
||||
@@ -108,6 +108,13 @@ gs_testData[] =
|
||||
{ _T("01-02/99"), _T("/-"), wxTOKEN_RET_DELIMS, 3 },
|
||||
};
|
||||
|
||||
// helper function returning the string showing the index for which the test
|
||||
// fails in the diagnostic message
|
||||
static std::string Nth(size_t n)
|
||||
{
|
||||
return wxString::Format(_T("for loop index %lu"), (unsigned long)n).mb_str();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the tests
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -119,7 +126,7 @@ void TokenizerTestCase::GetCount()
|
||||
const TokenizerTestData& ttd = gs_testData[n];
|
||||
|
||||
wxStringTokenizer tkz(ttd.str, ttd.delims, ttd.mode);
|
||||
CPPUNIT_ASSERT_EQUAL( ttd.count, tkz.CountTokens() );
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE( Nth(n), ttd.count, tkz.CountTokens() );
|
||||
|
||||
size_t count = 0;
|
||||
while ( tkz.HasMoreTokens() )
|
||||
@@ -128,7 +135,7 @@ void TokenizerTestCase::GetCount()
|
||||
count++;
|
||||
}
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL( ttd.count, count );
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE( Nth(n), ttd.count, count );
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user