added tests for wxCStrData::operator* and operator[]
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45538 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -54,6 +54,7 @@ private:
|
||||
CPPUNIT_TEST( ToDouble );
|
||||
CPPUNIT_TEST( WriteBuf );
|
||||
CPPUNIT_TEST( CStrDataTernaryOperator );
|
||||
CPPUNIT_TEST( CStrDataOperators );
|
||||
CPPUNIT_TEST( CStrDataImplicitConversion );
|
||||
CPPUNIT_TEST( ExplicitConversion );
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
@@ -81,6 +82,7 @@ private:
|
||||
void WriteBuf();
|
||||
void CStrDataTernaryOperator();
|
||||
void DoCStrDataTernaryOperator(bool cond);
|
||||
void CStrDataOperators();
|
||||
void CStrDataImplicitConversion();
|
||||
void ExplicitConversion();
|
||||
|
||||
@@ -696,6 +698,19 @@ void StringTestCase::DoCStrDataTernaryOperator(bool cond)
|
||||
CPPUNIT_ASSERT( CheckStr(empty, (cond ? wxEmptyString : empty.c_str())) );
|
||||
}
|
||||
|
||||
void StringTestCase::CStrDataOperators()
|
||||
{
|
||||
wxString s("hello");
|
||||
|
||||
CPPUNIT_ASSERT( s.c_str()[0] == 'h' );
|
||||
CPPUNIT_ASSERT( s.c_str()[1] == 'e' );
|
||||
CPPUNIT_ASSERT( s.c_str()[5] == '\0' );
|
||||
|
||||
CPPUNIT_ASSERT( *s.c_str() == 'h' );
|
||||
CPPUNIT_ASSERT( *(s.c_str() + 2) == 'l' );
|
||||
CPPUNIT_ASSERT( *(s.c_str() + 5) == '\0' );
|
||||
}
|
||||
|
||||
bool CheckStrChar(const wxString& expected, char *s)
|
||||
{ return CheckStr(expected, s); }
|
||||
bool CheckStrWChar(const wxString& expected, wchar_t *s)
|
||||
|
Reference in New Issue
Block a user