From 822c2b9f650ec99be652f4d3c5919c42ec553e47 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 23 Dec 2005 23:38:22 +0000 Subject: [PATCH] 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 --- tests/strings/tokenizer.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/strings/tokenizer.cpp b/tests/strings/tokenizer.cpp index 6205988e6a..4bb97f3f81 100644 --- a/tests/strings/tokenizer.cpp +++ b/tests/strings/tokenizer.cpp @@ -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 ); } } -- 2.45.2