]> git.saurik.com Git - wxWidgets.git/commitdiff
corrected expected test results to conform to current wxTOKEN_RET_EMPTY behaviour...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 23 Dec 2005 23:38:22 +0000 (23:38 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 23 Dec 2005 23:38:22 +0000 (23:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36549 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/strings/tokenizer.cpp

index 6205988e6a0de0281c0d6ba91a4332b6da749745..4bb97f3f81762649c8598ed0e0390f4ac4a2f4fe 100644 (file)
@@ -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 );
     }
 }