fix the bug in insert(end(), value) and added unit test for it
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56299 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b547eb0f86
commit
b9f9065e28
@ -1007,7 +1007,10 @@ private:
|
||||
} \
|
||||
iterator insert(const iterator& it, const_reference v) \
|
||||
{ \
|
||||
Insert(it.m_node, (const_base_reference)v); \
|
||||
if ( it == end() ) \
|
||||
Append((const_base_reference)v); \
|
||||
else \
|
||||
Insert(it.m_node, (const_base_reference)v); \
|
||||
iterator itprev(it); \
|
||||
return itprev--; \
|
||||
} \
|
||||
@ -1017,7 +1020,7 @@ private:
|
||||
Insert(it.m_node, (const_base_reference)v); \
|
||||
} \
|
||||
void insert(const iterator& it, \
|
||||
const const_iterator& first, const const_iterator& last)\
|
||||
const_iterator first, const const_iterator& last) \
|
||||
{ \
|
||||
for(; first != last; ++first) \
|
||||
Insert(it.m_node, (const_base_reference)*first); \
|
||||
|
@ -157,6 +157,14 @@ void ListsTestCase::wxStdListTest()
|
||||
{
|
||||
CPPUNIT_ASSERT( *it == i + &i );
|
||||
}
|
||||
|
||||
list1.clear();
|
||||
CPPUNIT_ASSERT( list1.empty() );
|
||||
|
||||
list1.insert(list1.end(), (int *)1);
|
||||
list1.insert(list1.end(), (int *)2);
|
||||
CPPUNIT_ASSERT_EQUAL( (int *)1, list1.front() );
|
||||
CPPUNIT_ASSERT_EQUAL( (int *)2, list1.back() );
|
||||
}
|
||||
|
||||
void ListsTestCase::wxListCtorTest()
|
||||
|
Loading…
Reference in New Issue
Block a user