summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel Hader <[email protected]>2026-06-14 12:58:14 -0500
committerDaniel Hader <[email protected]>2026-06-14 12:58:14 -0500
commit482ea0261cb9f0def49ce3df542b2a7f811262d1 (patch)
tree3bb961316b2ca856409b9f3b2145036ae9f5d704 /test
build and test environment using makefile and basic SDL3 setup
Diffstat (limited to 'test')
-rw-r--r--test/test_vec.c31
1 files changed, 31 insertions, 0 deletions
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 <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#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;
+}