3#include <winpr/tchar.h>
4#include <winpr/collections.h>
6int TestArrayList(
int argc,
char* argv[])
11 const size_t elemsToInsert = 10;
16 wArrayList* arrayList = ArrayList_New(TRUE);
20 for (
size_t index = 0; index < elemsToInsert; index++)
22 if (!ArrayList_Append(arrayList, (
void*)index))
26 size_t count = ArrayList_Count(arrayList);
28 printf(
"ArrayList count: %" PRIuz
"\n", count);
30 SSIZE_T index = ArrayList_IndexOf(arrayList, (
void*)(
size_t)6, -1, -1);
32 printf(
"ArrayList index: %" PRIdz
"\n", index);
37 if (!ArrayList_Insert(arrayList, 5, (
void*)(
size_t)100))
40 index = ArrayList_IndexOf(arrayList, (
void*)(
size_t)6, -1, -1);
41 printf(
"ArrayList index: %" PRIdz
"\n", index);
46 ArrayList_Remove(arrayList, (
void*)(
size_t)100);
48 rc = ArrayList_IndexOf(arrayList, (
void*)(
size_t)6, -1, -1);
49 printf(
"ArrayList index: %" PRIdz
"\n", rc);
54 for (
size_t index = 0; index < elemsToInsert; index++)
56 val = (size_t)ArrayList_GetItem(arrayList, 0);
57 if (!ArrayList_RemoveAt(arrayList, 0))
62 printf(
"ArrayList: shifted %" PRIdz
" entries, expected value %" PRIdz
", got %" PRIdz
69 rc = ArrayList_IndexOf(arrayList, (
void*)elemsToInsert, -1, -1);
70 printf(
"ArrayList index: %" PRIdz
"\n", rc);
74 count = ArrayList_Count(arrayList);
75 printf(
"ArrayList count: %" PRIuz
"\n", count);
79 ArrayList_Clear(arrayList);
82 ArrayList_Free(arrayList);