add vec_shrink

This commit is contained in:
2023-10-25 08:42:38 -07:00
parent ea2b8900dd
commit 203124ed6a
4 changed files with 226 additions and 0 deletions

View File

@ -236,6 +236,11 @@ void test_vector() {
t = (int*)vec_remove(v, 10);
assert(t == NULL);
printf("\ncap before shrink: %zu\n", vec_cap(v));
vec_shrink(v);
assert(vec_len(v) == vec_cap(v));
printf("cap after shrink: %zu\n", vec_cap(v));
vec_destroy(v);
free(v);
}