Lines Matching refs:bparr

86     void dumpBigPtrArray(const BigPtrArray& bparr)  in dumpBigPtrArray()  argument
89 for (int i = 0; i < bparr.Count(); i++) in dumpBigPtrArray()
90 …i,%i]: %i\n", i, static_cast<BigPtrEntryMock*>(bparr[i])->Position(), static_cast<BigPtrEntryMock*… in dumpBigPtrArray()
96 void fillBigPtrArray(BigPtrArray& bparr, sal_uLong numEntries) in fillBigPtrArray() argument
99 bparr.Insert(new BigPtrEntryMock(i), bparr.Count()); in fillBigPtrArray()
109 bool checkElementPositions(const BigPtrArray& bparr) in checkElementPositions() argument
111 for (int i = 0; i < bparr.Count(); i++) in checkElementPositions()
113 if (static_cast<BigPtrEntryMock*>(bparr[i])->Position() != i) in checkElementPositions()
119 void releaseBigPtrArrayContent(BigPtrArray& bparr) in releaseBigPtrArrayContent() argument
121 for (int i = 0; i < bparr.Count(); i++) in releaseBigPtrArrayContent()
122 delete bparr[i]; in releaseBigPtrArrayContent()
146 BigPtrArray bparr; in TEST_F() local
148 ASSERT_TRUE(bparr.Count() == 0) << "BigPtrArray ctor failed";; in TEST_F()
157 BigPtrArray bparr; in TEST_F() local
161 sal_uLong oldCount = bparr.Count(); in TEST_F()
162 bparr.Insert(new BigPtrEntryMock(i), 0); in TEST_F()
163 ASSERT_TRUE((bparr.Count() == oldCount + 1)) << "test_insert_entries_at_front failed"; in TEST_F()
170 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == j) << "test_insert_entries_at_f… in TEST_F()
173 ASSERT_TRUE(checkElementPositions(bparr)) << "test_insert_entries_at_front failed"; in TEST_F()
175 releaseBigPtrArrayContent(bparr); in TEST_F()
176 dumpBigPtrArray(bparr); in TEST_F()
185 BigPtrArray bparr; in TEST_F() local
187 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
188 dumpBigPtrArray(bparr); in TEST_F()
190 sal_uLong oldCount = bparr.Count(); in TEST_F()
192 bparr.Insert(new BigPtrEntryMock(NUM_ENTRIES), bparr.Count() / 2); in TEST_F()
196 …ASSERT_TRUE((oldCount + 1 == bparr.Count() && static_cast<BigPtrEntryMock*>(bparr[bparr.Count() / … in TEST_F()
198 ASSERT_TRUE(checkElementPositions(bparr)) << "test_insert_entries_in_the_middle failed"; in TEST_F()
200 releaseBigPtrArrayContent(bparr); in TEST_F()
201 dumpBigPtrArray(bparr); in TEST_F()
210 BigPtrArray bparr; in TEST_F() local
212 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
213 dumpBigPtrArray(bparr); in TEST_F()
215 int oldCount = bparr.Count(); in TEST_F()
218 bparr.Insert(new BigPtrEntryMock(j), i); in TEST_F()
222 ASSERT_TRUE((oldCount + 5 == bparr.Count())) << "test_insert_at_already_used_index failed"; in TEST_F()
224 for (int i = 0, j = -5; i < bparr.Count(); i++, j++) in TEST_F()
226 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == j) << "test_insert_at_already_u… in TEST_F()
229 ASSERT_TRUE(checkElementPositions(bparr)) << "test_insert_at_already_used_index failed"; in TEST_F()
231 releaseBigPtrArrayContent(bparr); in TEST_F()
232 dumpBigPtrArray(bparr); in TEST_F()
239 BigPtrArray bparr; in TEST_F() local
241 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
242 dumpBigPtrArray(bparr); in TEST_F()
244 sal_uLong oldCount = bparr.Count(); in TEST_F()
245 bparr.Insert(new BigPtrEntryMock(NUM_ENTRIES), bparr.Count()); in TEST_F()
247 …ASSERT_TRUE((oldCount + 1 == bparr.Count() && static_cast<BigPtrEntryMock*>(bparr[bparr.Count()-1]… in TEST_F()
249 ASSERT_TRUE(checkElementPositions(bparr)) << "test_insert_at_end failed"; in TEST_F()
251 releaseBigPtrArrayContent(bparr); in TEST_F()
252 dumpBigPtrArray(bparr); in TEST_F()
261 BigPtrArray bparr; in TEST_F() local
263 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
264 dumpBigPtrArray(bparr); in TEST_F()
268 sal_uLong oldCount = bparr.Count(); in TEST_F()
270 delete bparr[0]; // release content in TEST_F()
271 bparr.Remove(0); // remove item from container in TEST_F()
273 ASSERT_TRUE((oldCount - 1 == bparr.Count())) << "test_remove_at_front failed (wrong count)"; in TEST_F()
275 for (int j = 0, k = i + 1; j < bparr.Count(); j++, k++) in TEST_F()
277 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[j])->getCount() == k) << "test_remove_at_front fai… in TEST_F()
280 ASSERT_TRUE(checkElementPositions(bparr)) << "test_remove_at_front failed"; in TEST_F()
282 dumpBigPtrArray(bparr); in TEST_F()
292 BigPtrArray bparr; in TEST_F() local
294 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
295 dumpBigPtrArray(bparr); in TEST_F()
299 sal_uLong oldCount = bparr.Count(); in TEST_F()
300 delete bparr[i]; in TEST_F()
301 bparr.Remove(i); in TEST_F()
303 ASSERT_TRUE((oldCount - 1 == bparr.Count())) << "test_remove_at_back failed (wrong count)"; in TEST_F()
305 for (int j = 0; j < bparr.Count(); j++) in TEST_F()
307 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[j])->getCount() == j) << "test_remove_at_back fail… in TEST_F()
310 ASSERT_TRUE(checkElementPositions(bparr)) << "test_remove_at_back failed"; in TEST_F()
312 dumpBigPtrArray(bparr); in TEST_F()
322 BigPtrArray bparr; in TEST_F() local
324 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
325 dumpBigPtrArray(bparr); in TEST_F()
327 while (bparr.Count()) in TEST_F()
329 sal_uLong oldCount = bparr.Count(); in TEST_F()
330 int oldElement = static_cast<BigPtrEntryMock*>(bparr[bparr.Count() / 2])->getCount(); in TEST_F()
332 delete bparr[bparr.Count() / 2]; in TEST_F()
333 bparr.Remove(bparr.Count() / 2); in TEST_F()
335 … ASSERT_TRUE((oldCount - 1 == bparr.Count())) << "test_remove_in_the_middle failed (wrong count)"; in TEST_F()
337 for (int i = 0; i < bparr.Count(); i++) in TEST_F()
339 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() != oldElement) << "test_remove_in_… in TEST_F()
342 ASSERT_TRUE(checkElementPositions(bparr)) << "test_remove_in_the_middle failed"; in TEST_F()
344 dumpBigPtrArray(bparr); in TEST_F()
353 BigPtrArray bparr; in TEST_F() local
355 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
356 dumpBigPtrArray(bparr); in TEST_F()
358 while(bparr.Count()) in TEST_F()
360 sal_uLong nRemove = (bparr.Count() > 3) ? 3 : bparr.Count(); in TEST_F()
361 sal_uLong oldCount = bparr.Count(); in TEST_F()
364 delete bparr[i]; in TEST_F()
366 bparr.Remove(0, nRemove); in TEST_F()
368 …ASSERT_TRUE((oldCount - nRemove == bparr.Count())) << "test_remove_multiple_elements_at_once faile… in TEST_F()
370 ASSERT_TRUE(checkElementPositions(bparr)) << "test_remove_multiple_elements_at_once failed"; in TEST_F()
372 dumpBigPtrArray(bparr); in TEST_F()
380 BigPtrArray bparr; in TEST_F() local
382 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
383 dumpBigPtrArray(bparr); in TEST_F()
385 releaseBigPtrArrayContent(bparr); in TEST_F()
386 bparr.Remove(0, bparr.Count()); in TEST_F()
388 ASSERT_TRUE(bparr.Count() == 0) << "test_remove_all_elements_at_once failed"; in TEST_F()
390 dumpBigPtrArray(bparr); in TEST_F()
397 BigPtrArray bparr; in TEST_F() local
399 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
400 dumpBigPtrArray(bparr); in TEST_F()
404 bparr.Move(i, i + 2); in TEST_F()
405 dumpBigPtrArray(bparr); in TEST_F()
410 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i + 1)) << "test_move_elements… in TEST_F()
413 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[NUM_ENTRIES -1])->getCount() == 0) << "test_move_e… in TEST_F()
415 … ASSERT_TRUE(checkElementPositions(bparr)) << "test_move_elements_from_lower_to_higher_pos failed"; in TEST_F()
417 releaseBigPtrArrayContent(bparr); in TEST_F()
424 BigPtrArray bparr; in TEST_F() local
426 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
427 dumpBigPtrArray(bparr); in TEST_F()
431 bparr.Move(i, i - 1); in TEST_F()
432 dumpBigPtrArray(bparr); in TEST_F()
435 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[0])->getCount() == (NUM_ENTRIES - 1)) << "test_mov… in TEST_F()
439 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i - 1)) << "test_move_elements… in TEST_F()
442 … ASSERT_TRUE(checkElementPositions(bparr)) << "test_move_elements_from_higher_to_lower_pos failed"; in TEST_F()
444 releaseBigPtrArrayContent(bparr); in TEST_F()
451 BigPtrArray bparr; in TEST_F() local
453 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
454 dumpBigPtrArray(bparr); in TEST_F()
458 bparr.Move(i, i); in TEST_F()
462 ASSERT_TRUE(checkElementPositions(bparr)) << "test_move_to_same_position failed"; in TEST_F()
465 dumpBigPtrArray(bparr); in TEST_F()
469 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == i) << "test_move_to_same_positi… in TEST_F()
473 ASSERT_TRUE(checkElementPositions(bparr)) << "test_move_to_same_position failed"; in TEST_F()
476 releaseBigPtrArrayContent(bparr); in TEST_F()
477 dumpBigPtrArray(bparr); in TEST_F()
484 BigPtrArray bparr; in TEST_F() local
486 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
487 dumpBigPtrArray(bparr); in TEST_F()
491 delete bparr[i]; in TEST_F()
492 bparr.Replace(i, new BigPtrEntryMock(j)); in TEST_F()
493 dumpBigPtrArray(bparr); in TEST_F()
498 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (NUM_ENTRIES - i - 1)) << "test… in TEST_F()
501 ASSERT_TRUE(checkElementPositions(bparr)) << "test_replace_elements failed"; in TEST_F()
503 releaseBigPtrArrayContent(bparr); in TEST_F()
510 BigPtrArray bparr; in TEST_F() local
512 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
513 dumpBigPtrArray(bparr); in TEST_F()
516 bparr.ForEach(AddToCount, &addCount); in TEST_F()
520 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i+1)) << "test_for_each failed… in TEST_F()
523 releaseBigPtrArrayContent(bparr); in TEST_F()
524 dumpBigPtrArray(bparr); in TEST_F()
531 BigPtrArray bparr; in TEST_F() local
533 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
534 dumpBigPtrArray(bparr); in TEST_F()
537 bparr.ForEach(0, NUM_ENTRIES / 2, AddToCount, &addCount); in TEST_F()
542 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i+1)) << "test_for_some1 faile… in TEST_F()
547 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i)) << "test_for_some1 failed"; in TEST_F()
550 releaseBigPtrArrayContent(bparr); in TEST_F()
551 dumpBigPtrArray(bparr); in TEST_F()
558 BigPtrArray bparr; in TEST_F() local
560 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
561 dumpBigPtrArray(bparr); in TEST_F()
564 bparr.ForEach(NUM_ENTRIES / 2, NUM_ENTRIES, AddToCount, &addCount); in TEST_F()
569 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i)) << "test_for_some2 failed"; in TEST_F()
574 …ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i+1)) << "test_for_some2 faile… in TEST_F()
577 releaseBigPtrArrayContent(bparr); in TEST_F()
578 dumpBigPtrArray(bparr); in TEST_F()
585 BigPtrArray bparr; in TEST_F() local
587 fillBigPtrArray(bparr, NUM_ENTRIES); in TEST_F()
588 dumpBigPtrArray(bparr); in TEST_F()
591 bparr.ForEach(0, 0, AddToCount, &addCount); in TEST_F()
595 … ASSERT_TRUE(static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == i) << "test_for_some3 failed"; in TEST_F()
597 releaseBigPtrArrayContent(bparr); in TEST_F()
643 BigPtrArray bparr; in test_insert_at_end() local
645 bparr.Insert(new BigPtrEntryMock(i), bparr.Count()); in test_insert_at_end()
647 releaseBigPtrArrayContent(bparr); in test_insert_at_end()
657 BigPtrArray bparr; in test_insert_at_front() local
659 bparr.Insert(new BigPtrEntryMock(i), 0); in test_insert_at_front()
661 releaseBigPtrArrayContent(bparr); in test_insert_at_front()