Alloc() doesn't clear the array any more, for consistency with reserve()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42571 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -149,6 +149,7 @@ private:
|
||||
CPPUNIT_TEST( wxArrayUShortTest );
|
||||
CPPUNIT_TEST( wxArrayIntTest );
|
||||
CPPUNIT_TEST( TestSTL );
|
||||
CPPUNIT_TEST( Alloc );
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
void wxStringArrayTest();
|
||||
@@ -156,6 +157,7 @@ private:
|
||||
void wxArrayUShortTest();
|
||||
void wxArrayIntTest();
|
||||
void TestSTL();
|
||||
void Alloc();
|
||||
|
||||
DECLARE_NO_COPY_CLASS(ArraysTestCase)
|
||||
};
|
||||
@@ -359,6 +361,20 @@ TestArrayOf(UShort);
|
||||
|
||||
TestArrayOf(Int);
|
||||
|
||||
void ArraysTestCase::Alloc()
|
||||
{
|
||||
wxArrayInt a;
|
||||
a.Add(17);
|
||||
a.Add(9);
|
||||
CPPUNIT_ASSERT_EQUAL( 2u, a.GetCount() );
|
||||
|
||||
a.Alloc(1000);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL( 2u, a.GetCount() );
|
||||
CPPUNIT_ASSERT_EQUAL( 17, a[0] );
|
||||
CPPUNIT_ASSERT_EQUAL( 9, a[1] );
|
||||
}
|
||||
|
||||
void ArraysTestCase::TestSTL()
|
||||
{
|
||||
wxArrayInt list1;
|
||||
|
Reference in New Issue
Block a user