X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a059db11ff1cd569d91e0a0fafafa41c7733abdb..72a3ac9b55aa68d17af8f0667346b3c69bdb09a3:/tests/arrays/arrays.cpp diff --git a/tests/arrays/arrays.cpp b/tests/arrays/arrays.cpp index aaa0138cd6..a776a2c1db 100644 --- a/tests/arrays/arrays.cpp +++ b/tests/arrays/arrays.cpp @@ -125,12 +125,18 @@ int wxCMPFUNC_CONV name ## RevCompare(T* first, T* second) \ typedef unsigned short ushort; +DEFINE_COMPARE(Char, char); DEFINE_COMPARE(UShort, ushort); DEFINE_COMPARE(Int, int); +WX_DEFINE_ARRAY_CHAR(char, wxArrayChar); +WX_DEFINE_SORTED_ARRAY_CHAR(char, wxSortedArrayCharNoCmp); +WX_DEFINE_SORTED_ARRAY_CMP_CHAR(char, CharCompareValues, wxSortedArrayChar); + WX_DEFINE_ARRAY_SHORT(ushort, wxArrayUShort); WX_DEFINE_SORTED_ARRAY_SHORT(ushort, wxSortedArrayUShortNoCmp); WX_DEFINE_SORTED_ARRAY_CMP_SHORT(ushort, UShortCompareValues, wxSortedArrayUShort); + WX_DEFINE_SORTED_ARRAY_CMP_INT(int, IntCompareValues, wxSortedArrayInt); // ---------------------------------------------------------------------------- @@ -148,14 +154,18 @@ private: CPPUNIT_TEST( wxObjArrayTest ); CPPUNIT_TEST( wxArrayUShortTest ); CPPUNIT_TEST( wxArrayIntTest ); + CPPUNIT_TEST( wxArrayCharTest ); CPPUNIT_TEST( TestSTL ); + CPPUNIT_TEST( Alloc ); CPPUNIT_TEST_SUITE_END(); void wxStringArrayTest(); void wxObjArrayTest(); void wxArrayUShortTest(); void wxArrayIntTest(); + void wxArrayCharTest(); void TestSTL(); + void Alloc(); DECLARE_NO_COPY_CLASS(ArraysTestCase) }; @@ -357,8 +367,24 @@ void ArraysTestCase::wxArray ## name ## Test() \ TestArrayOf(UShort); +TestArrayOf(Char); + TestArrayOf(Int); +void ArraysTestCase::Alloc() +{ + wxArrayInt a; + a.Add(17); + a.Add(9); + CPPUNIT_ASSERT_EQUAL( size_t(2), a.GetCount() ); + + a.Alloc(1000); + + CPPUNIT_ASSERT_EQUAL( size_t(2), a.GetCount() ); + CPPUNIT_ASSERT_EQUAL( 17, a[0] ); + CPPUNIT_ASSERT_EQUAL( 9, a[1] ); +} + void ArraysTestCase::TestSTL() { wxArrayInt list1;