29 lines
466 B
C
29 lines
466 B
C
#define EV_VEC_IMPLEMENTATION
|
|
#include "ev_vec.h"
|
|
|
|
#include <assert.h>
|
|
|
|
static int free_calls = 0;
|
|
|
|
static void count_free(void *self)
|
|
{
|
|
(void)self;
|
|
free_calls++;
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
ev_vec(i32) v = ev_vec_init(i32, free = count_free);
|
|
assert(v != NULL);
|
|
|
|
for(i32 i = 0; i < 5; i++) {
|
|
assert(ev_vec_push_impl(&v, &i) >= 0);
|
|
}
|
|
|
|
free_calls = 0;
|
|
assert(ev_vec_setcapacity(&v, 3) == EV_VEC_ERR_NONE);
|
|
assert(free_calls == 2);
|
|
|
|
ev_vec_fini(&v);
|
|
}
|