int CTest::test_ensureCapacityI(int argc, char* argv[]) { PEL("CTest::test_ensureCapacityI") // Test for method void java.util.ArrayList.ensureCapacity(int) // TODO : There is no good way to test this as it only really impacts on // the private implementation. AutoPtr<IInteger32> testObject; CInteger32::New(10001, (IInteger32**)&testObject); int capacity = 20; AutoPtr<IArrayList> al; CArrayList::New(capacity, (IArrayList**)&al); int i = 0; for (i = 0; i < capacity / 2; i++) { AutoPtr<IInteger32> testObject1; CInteger32::New(1000 + i, (IInteger32**)&testObject1); al->AddEx(i, testObject1); } al->AddEx(i, testObject); int location = 0; al->IndexOf(testObject, &location); // try { al->EnsureCapacity(capacity); Int32 location2 = 0; assert(location == (al->IndexOf(testObject, &location2), location2)); Boolean isflag = FALSE; AutoPtr<IInterface> outface; ECode ec = al->RemoveEx(0, (IInterface**)&outface); PFL_EX("ec: %p, outface: %p", ec, outface.Get()) al->EnsureCapacity(capacity); PFL_EX("location: %d, location2: %d", location, (al->IndexOf(testObject, &location2), location2)) assert(--location == (al->IndexOf(testObject, &location2), location2)); al->EnsureCapacity(capacity + 2); assert(location == (al->IndexOf(testObject, &location2), location2)); // } catch (Exception e) { // fail("Exception during test : " + e.getMessage()); // } return 0; }