From: Vadim Zeitlin Date: Wed, 30 Nov 2005 14:50:54 +0000 (+0000) Subject: added test for wxString::Format() string truncation for longer strings X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b03cd7e68f3e69f0184ae049a259e0ad2873f7a9?ds=inline added test for wxString::Format() string truncation for longer strings git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36304 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index 090b49aaab..870bea107a 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -148,6 +148,15 @@ void StringTestCase::Format() CPPUNIT_ASSERT( s1 == wxString::Format(_T("%03d"), 18) ); s2.Printf(_T("Number 18: %s\n"), s1.c_str()); CPPUNIT_ASSERT( s2 == wxString::Format(_T("Number 18: %s\n"), s1.c_str()) ); + + static const size_t lengths[] = { 1, 512, 1024, 1025, 2048, 4096, 4097 }; + for ( size_t n = 0; n < WXSIZEOF(lengths); n++ ) + { + const size_t len = lengths[n]; + + wxString s(_T('Z'), len); + CPPUNIT_ASSERT_EQUAL( len, wxString::Format(_T("%s"), s.c_str()).length()); + } } void StringTestCase::Constructors()