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
This commit is contained in:
Vadim Zeitlin 2005-11-30 14:50:54 +00:00
parent de2589be08
commit b03cd7e68f

View File

@ -148,6 +148,15 @@ void StringTestCase::Format()
CPPUNIT_ASSERT( s1 == wxString::Format(_T("%03d"), 18) ); CPPUNIT_ASSERT( s1 == wxString::Format(_T("%03d"), 18) );
s2.Printf(_T("Number 18: %s\n"), s1.c_str()); s2.Printf(_T("Number 18: %s\n"), s1.c_str());
CPPUNIT_ASSERT( s2 == wxString::Format(_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() void StringTestCase::Constructors()