#include #include #include "util/alloc.h" #include "util/vec.h" int main(int argc, char **argv) { LEO_Allocator allocator = { malloc, realloc, free, NULL }; LEO_Vec vec; assert(LEO_Vec_init(&vec, sizeof(int), allocator) == LEO_Vec_OK); for (int i = 0; i < 100; i++) { assert(LEO_Vec_push(&vec, &i) == LEO_Vec_OK); } for (int i = 0; i < 100; i++) { int item; assert(LEO_Vec_get(&vec, i, &item) == LEO_Vec_OK); assert(item == i); } LEO_Vec_free(&vec); return 0; }