Lines Matching refs:list

67 	void Initialize(_PointerList_& list, int size);
68 void Print(const _PointerList_& list);
69 void MakeEmpty(_PointerList_& list);
71 bool IsSorted(const _PointerList_& list, int32 n);
72 bool IsSorted(const _PointerList_& list) { return IsSorted(list, list.CountItems()); }
73 bool IsHSorted(const _PointerList_& list) { return IsSorted(list, list.CountItems()-1); }
74 int IndexOf(const _PointerList_& list, int value);
75 Item* ItemFor(const _PointerList_& list, int value);
98 // Add size number of new items to the list.
99 void PointerListTest::Initialize(_PointerList_& list, int size)
102 list.AddItem(CreateItem());
106 // Print the list to stderr
107 void PointerListTest::Print(const _PointerList_& list)
109 const int32 n = list.CountItems();
111 Item* item = (Item*)list.ItemAt(i);
124 // delete the Items in the list
125 void PointerListTest::MakeEmpty(_PointerList_& list)
127 const int32 n = list.CountItems();
129 Item* item = (Item*)list.ItemAt(i);
134 list.MakeEmpty();
154 // is the list sorted
155 bool PointerListTest::IsSorted(const _PointerList_& list, int32 n)
159 Item* item = (Item*)list.ItemAt(i);
170 int PointerListTest::IndexOf(const _PointerList_& list, int value)
172 int n = list.CountItems();
174 Item* item = (Item*)list.ItemAt(i);
182 Item* PointerListTest::ItemFor(const _PointerList_& list, int value)
184 int32 index = IndexOf(list, value);
186 list.ItemAt(index);
195 _PointerList_ list;
197 assert(list.Owning() == false);
199 assert(list.CountItems() == 0);
200 Initialize(list, 10);
202 assert(list.CountItems() == 10);
208 MakeEmpty(list);
215 _PointerList_ list(10, true);
216 assert(list.CountItems() == 0);
217 assert(list.Owning() == true);
220 Initialize(list, 10);
221 assert(list.CountItems() == 10);
224 _PointerList_* clone = new _PointerList_(list);
228 MakeEmpty(list);
238 _PointerList_ list;
239 Initialize(list, i);
241 _PointerList_ clone(list);
242 assert(Equals(list, clone));
245 list.SortItems(Item::Compare);
246 assert(IsSorted(list));
255 // HSortItems seems to put the first item at the end of the list
261 MakeEmpty(list);
281 _PointerList_ list;
282 Initialize(list, i);
286 _PointerList_ clone(list);
288 assert(Equals(list, clone));
292 list.SortItems(::Compare, gData);
294 assert(IsSorted(list));
296 watch = new BStopWatch("SortItems (sorted list)");
297 list.SortItems(::Compare, gData);
299 assert(IsSorted(list));
308 // HSortItems seems to put the first item at the end of the list
317 MakeEmpty(list);
324 _PointerList_* list = (_PointerList_*)data;
325 list->AddItem(item);
336 _PointerList_ list;
337 Initialize(list, 10);
338 assert(list.CountItems() == 10);
341 list.EachElement(CopyTo, &clone);
342 assert(clone.CountItems() == list.CountItems());
344 void* item = list.EachElement(FirstItem, NULL);
345 assert (item == list.ItemAt(0));
347 MakeEmpty(list);
352 _PointerList_ list;
353 Initialize(list, 10);
354 list.SortItems(Item::Compare);
355 assert(IsSorted(list));
363 Item* item = (Item*)list.ItemAt(i);
366 Item* found = (Item*)list.BinarySearch(item, Item::Compare);
369 found = (Item*)list.BinarySearch(item, ::Compare, gData);
372 found = (Item*)list.BinarySearch(&notInListLow, Item::Compare);
375 found = (Item*)list.BinarySearch(&notInListLow, ::Compare, gData);
378 found = (Item*)list.BinarySearch(&notInListHigh, Item::Compare);
381 found = (Item*)list.BinarySearch(&notInListHigh, ::Compare, gData);
385 MakeEmpty(list);
404 _PointerList_ list;
405 Initialize(list, 10);
406 list.SortItems(Item::Compare);
407 assert(IsSorted(list));
414 Item* item = (Item*)list.ItemAt(i);
418 int index = IndexOf(list, item->Value());
420 searchIndex = list.BinarySearchIndex(item, Item::Compare);
423 searchIndex = list.BinarySearchIndex(item, ::Compare, gData);
426 searchIndex = list.BinarySearchIndexByPredicate(&value, ValuePredicate);
430 searchIndex = list.BinarySearchIndex(&notInListLow, Item::Compare);
433 searchIndex = list.BinarySearchIndex(&notInListLow, ::Compare, gData);
437 searchIndex = list.BinarySearchIndexByPredicate(&value, ValuePredicate);
441 searchIndex = list.BinarySearchIndex(&notInListHigh, Item::Compare);
442 assert(searchIndex == -(list.CountItems()+1));
444 searchIndex = list.BinarySearchIndex(&notInListHigh, ::Compare, gData);
445 assert(searchIndex == -(list.CountItems()+1));
448 searchIndex = list.BinarySearchIndexByPredicate(&value, ValuePredicate);
449 assert(searchIndex == -(list.CountItems()+1));
452 MakeEmpty(list);
455 list.AddItem(new Item(2 * i));
458 assert(IndexOf(list, 3) == -1);
460 int index = list.BinarySearchIndex(&notInList, Item::Compare);
463 index = list.BinarySearchIndex(&notInList, ::Compare, gData);
467 index = list.BinarySearchIndexByPredicate(&value, ValuePredicate);
470 MakeEmpty(list);
475 _PointerList_ list;
476 Initialize(list, 10);
478 // list.EachElement(NULL, NULL);
479 // list.SortItems(NULL);
480 // list.SortItems(NULL, NULL);
481 // list.HSortItems(NULL);
482 // list.HSortItems(NULL, NULL);
483 // list.BinarySearch(NULL, NULL);
484 // list.BinarySearch(NULL, NULL, NULL);
485 // list.BinarySearchIndex(NULL, NULL);
486 // list.BinarySearchIndex(NULL, NULL, NULL);
487 // list.BinarySearchIndexByPredicate(NULL, NULL);
488 assert(!list.ReplaceItem(-1, NULL));
489 assert(!list.ReplaceItem(100, NULL));