X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1416fc5ff62141ff5d27790f513de59233ab5746..6ea2bc50c8f343b1919c5583706163fd157ddc6f:/tests/lists/lists.cpp?ds=sidebyside diff --git a/tests/lists/lists.cpp b/tests/lists/lists.cpp index ef259ba552..64b1f2b2ae 100644 --- a/tests/lists/lists.cpp +++ b/tests/lists/lists.cpp @@ -152,23 +152,43 @@ void ListsTestCase::wxStdListTest() list1.clear(); CPPUNIT_ASSERT( list1.empty() ); - list1.insert(list1.end(), (int *)1); - list1.insert(list1.end(), (int *)2); + it = list1.insert(list1.end(), (int *)1); + CPPUNIT_ASSERT_EQUAL( (int *)1, *it ); + CPPUNIT_ASSERT( it == list1.begin() ); CPPUNIT_ASSERT_EQUAL( (int *)1, list1.front() ); + + it = list1.insert(list1.end(), (int *)2); + CPPUNIT_ASSERT_EQUAL( (int *)2, *it ); + CPPUNIT_ASSERT( ++it == list1.end() ); CPPUNIT_ASSERT_EQUAL( (int *)2, list1.back() ); + it = list1.begin(); + wxListInt::iterator it2 = list1.insert(++it, (int *)3); + CPPUNIT_ASSERT_EQUAL( (int *)3, *it2 ); + it = list1.begin(); it = list1.erase(++it, list1.end()); CPPUNIT_ASSERT_EQUAL( 1, list1.size() ); CPPUNIT_ASSERT( it == list1.end() ); + + wxListInt list2; + list2.push_back((int *)3); + list2.push_back((int *)4); + list1.insert(list1.begin(), list2.begin(), list2.end()); + CPPUNIT_ASSERT_EQUAL( 3, list1.size() ); + CPPUNIT_ASSERT_EQUAL( (int *)3, list1.front() ); + + list1.insert(list1.end(), list2.begin(), list2.end()); + CPPUNIT_ASSERT_EQUAL( 5, list1.size() ); + CPPUNIT_ASSERT_EQUAL( (int *)4, list1.back() ); } void ListsTestCase::wxListCtorTest() { { wxListBazs list1; - list1.Append(new Baz(_T("first"))); - list1.Append(new Baz(_T("second"))); + list1.Append(new Baz(wxT("first"))); + list1.Append(new Baz(wxT("second"))); CPPUNIT_ASSERT( list1.GetCount() == 2 ); CPPUNIT_ASSERT( Baz::GetNumber() == 2 );