add min/max to vectors

This commit is contained in:
2023-11-29 14:39:59 -08:00
parent bb3d890ad6
commit 85b81148f7
4 changed files with 92 additions and 1 deletions

View File

@ -227,6 +227,13 @@ void test_vector() {
t = (int*)vec_at(v, 4);
assert(*t == e4);
const int *min = vec_min(v, vec_cmp_int);
const int *max = vec_max(v, vec_cmp_int);
printf("min: %d\n", *min);
printf("max: %d\n", *max);
assert(*min == e0);
assert(*max == e4);
t = (int*)vec_remove(v, 1);
assert(t != NULL);
assert(*t == 1);