test: Added test for init and destroy

Also changed a few things like destroy tanking a double pointer so that
is more secure and making sure before hand that capacity is not that
ridiculous of a size, still, shit can get pass but generally is fine
This commit is contained in:
2026-04-15 17:17:54 -06:00
parent 1d7f9676ec
commit 7662af09f8
3 changed files with 152 additions and 32 deletions

View File

@@ -16,6 +16,7 @@ typedef enum {
ARRLIST_OK = 0,
ARRLIST_OUT_OF_BOUNDS,
ARRLIST_BAD_ALLOC,
ARRLIST_ALLOC_OVERFLOW,
ARRLIST_EMPTY,
ARRLIST_NULL_ARG,
ARRLIST_INVALID_ELEM_SIZE,
@@ -23,7 +24,7 @@ typedef enum {
} ArrayListErr;
ArrayList *arraylist_init(size_t capacity, size_t elem_size);
ArrayListErr arraylist_destroy(ArrayList *arr);
ArrayListErr arraylist_destroy(ArrayList **arr);
ArrayListErr arraylist_clear(ArrayList *arr);
size_t arraylist_size(const ArrayList *arr);