From 482ea0261cb9f0def49ce3df542b2a7f811262d1 Mon Sep 17 00:00:00 2001 From: Daniel Hader Date: Sun, 14 Jun 2026 12:58:14 -0500 Subject: build and test environment using makefile and basic SDL3 setup --- test/test_vec.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/test_vec.c (limited to 'test/test_vec.c') diff --git a/test/test_vec.c b/test/test_vec.c new file mode 100644 index 0000000..a9788eb --- /dev/null +++ b/test/test_vec.c @@ -0,0 +1,31 @@ +#include +#include +#include +#include "util/alloc.h" +#include "util/vec.h" + +int main(int argc, char **argv) { + + struct LEO_Allocator allocator = { + malloc, + realloc, + free, + NULL + }; + + struct 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; +} -- cgit v1.2.3