1 #include <ObjectList.h>
2 #include <String.h>
3
SortItemTestPositive(const void * item1,const void * item2)4 static int SortItemTestPositive(const void *item1, const void *item2)
5 {
6 return 1;
7 }
8
SortItemTestNegative(const void * item1,const void * item2)9 static int SortItemTestNegative(const void *item1, const void *item2)
10 {
11 return -1;
12 }
13
SortItemTestEqual(const void * item1,const void * item2)14 static int SortItemTestEqual(const void *item1, const void *item2)
15 {
16 return 0;
17 }
18
main(int,char **)19 int main(int, char **)
20 {
21 _PointerList_ list;
22 for (int i = 0; i < 20; i++) {
23 list.AddItem(new BString("test"));
24 printf("List contains %d items, attempting sorts\n", i);
25 printf("Attempting positive test\n");
26 list.SortItems(SortItemTestPositive);
27 printf("Positive test completed, attempting negative test\n");
28 list.SortItems(SortItemTestNegative);
29 printf("Positive test completed, attempting equal test\n");
30 list.SortItems(SortItemTestEqual);
31 }
32 printf("All tests passed!\n");
33
34 return 0;
35 }
36