From a4fa298d952cf76a6b562a05940b29b4e63ccbbe Mon Sep 17 00:00:00 2001 From: Robear Selwans Date: Sun, 3 May 2026 20:07:16 +0300 Subject: [PATCH] Moved tests + Added more tests + Added memory testing to actions --- .gitea/workflows/run_tests.yaml | 6 +- meson.build | 22 ++-- str_test.c | 106 ------------------- log_test.c => tests/ev_log/basic_log.c | 0 tests/ev_log/meson.build | 8 ++ tests/ev_str/find_all.c | 23 ++++ tests/ev_str/find_first_mismatch.c | 16 +++ tests/ev_str/find_first_overlapping_prefix.c | 16 +++ tests/ev_str/meson.build | 18 ++++ tests/ev_str/new_format.c | 19 ++++ tests/ev_str/overlapping_push.c | 19 ++++ tests/ev_str/push_fmt_float.c | 25 +++++ tests/ev_str/push_variants.c | 29 +++++ tests/ev_str/replace_first.c | 20 ++++ tests/ev_str/slice.c | 24 +++++ tests/ev_str/stack_get_space.c | 12 +++ tests/ev_str/stack_global_heap.c | 26 +++++ tests/ev_types/meson.build | 8 ++ tostr_test.c => tests/ev_types/tostr.c | 0 tests/ev_vec/meson.build | 11 ++ tests/ev_vec/reducecap_free_elems.c | 28 +++++ tests/ev_vec/reducecap_updatelen.c | 23 ++++ tests/ev_vec/reducelen_free_elems.c | 25 +++++ tests/ev_vec/zero_cap_grow.c | 19 ++++ tests/meson.build | 4 + vec_test.c | 22 ---- 26 files changed, 386 insertions(+), 143 deletions(-) delete mode 100644 str_test.c rename log_test.c => tests/ev_log/basic_log.c (100%) create mode 100644 tests/ev_log/meson.build create mode 100644 tests/ev_str/find_all.c create mode 100644 tests/ev_str/find_first_mismatch.c create mode 100644 tests/ev_str/find_first_overlapping_prefix.c create mode 100644 tests/ev_str/meson.build create mode 100644 tests/ev_str/new_format.c create mode 100644 tests/ev_str/overlapping_push.c create mode 100644 tests/ev_str/push_fmt_float.c create mode 100644 tests/ev_str/push_variants.c create mode 100644 tests/ev_str/replace_first.c create mode 100644 tests/ev_str/slice.c create mode 100644 tests/ev_str/stack_get_space.c create mode 100644 tests/ev_str/stack_global_heap.c create mode 100644 tests/ev_types/meson.build rename tostr_test.c => tests/ev_types/tostr.c (100%) create mode 100644 tests/ev_vec/meson.build create mode 100644 tests/ev_vec/reducecap_free_elems.c create mode 100644 tests/ev_vec/reducecap_updatelen.c create mode 100644 tests/ev_vec/reducelen_free_elems.c create mode 100644 tests/ev_vec/zero_cap_grow.c create mode 100644 tests/meson.build delete mode 100644 vec_test.c diff --git a/.gitea/workflows/run_tests.yaml b/.gitea/workflows/run_tests.yaml index f0215c9..5a97fc5 100644 --- a/.gitea/workflows/run_tests.yaml +++ b/.gitea/workflows/run_tests.yaml @@ -13,9 +13,13 @@ jobs: - uses: actions/checkout@v4 - name: Configure run: meson setup build - - name: Run tests + + - name: Run Tests run: meson test -C build + - name: Run Memory Tests + run: meson test -C build --wrapper=valgrind + - name: Upload Meson Logs if: always() uses: christopherHX/gitea-upload-artifact@v4 diff --git a/meson.build b/meson.build index 835b6d6..2f976a1 100644 --- a/meson.build +++ b/meson.build @@ -40,18 +40,12 @@ headers_dep = declare_dependency( ] ) -# Tests -str_test = executable('str_test', 'str_test.c', dependencies: [str_dep], c_args: evh_c_args) -test('evstr', str_test) -vec_test = executable('vec_test', 'vec_test.c', dependencies: [vec_dep], c_args: evh_c_args) -test('evvec', vec_test) -log_test = executable('log_test', 'log_test.c', dependencies: [log_dep], c_args: evh_c_args) -test('evlog', log_test) +meson.override_dependency('ev_vec', vec_dep) +meson.override_dependency('ev_str', str_dep) +meson.override_dependency('ev_helpers', helpers_dep) +meson.override_dependency('ev_log', log_dep) +meson.override_dependency('evol-headers', headers_dep) -if meson.version().version_compare('>= 0.54.0') - meson.override_dependency('ev_vec', vec_dep) - meson.override_dependency('ev_str', str_dep) - meson.override_dependency('ev_helpers', helpers_dep) - meson.override_dependency('ev_log', log_dep) - meson.override_dependency('evol-headers', headers_dep) -endif +# if build_tests +subdir('tests') +#endif diff --git a/str_test.c b/str_test.c deleted file mode 100644 index ff6b773..0000000 --- a/str_test.c +++ /dev/null @@ -1,106 +0,0 @@ -#define EV_STR_IMPLEMENTATION -#include "ev_str.h" - -evstring global_str = evstr("Global 'Hello, World!'"); - -int main() -{ - const evstring stack_str = evstr("Stack 'Hello, World!'"); - printf("Stack String: %s, Length: %llu\n", stack_str, evstring_getLength(stack_str)); - printf("Global String: %s, Length: %llu\n", global_str, evstring_getLength(global_str)); - - evstring heap_str = evstring_new("Heap 'Hello, World!'"); - printf("Heap String: %s, Length: %llu\n", heap_str, evstring_getLength(heap_str)); - - evstring_view view = evstring_slice(stack_str, 0, -1); - printf("String View: %.*s\n", (i32)view.len, view.data + view.offset); - printf("View length: %llu\n", view.len); - - evstring heap_str2 = evstring_new(view); - printf("Heap String 2: %s, Length: %llu\n", heap_str2, evstring_getLength(heap_str2)); - evstring_free(heap_str2); - - - evstring_error_t push_str_res = evstring_push(&heap_str, "Hello, Sisyphus! %f", 0.001f); - printf("Push char*: %s, New Length: %llu\n", heap_str, evstring_getLength(heap_str)); - assert(push_str_res == EV_STR_ERR_NONE); - - evstring_error_t push_char_res = evstring_push(&heap_str, (char)'X'); - printf("Push char: %s, New Length: %llu\n", heap_str, evstring_getLength(heap_str)); - assert(push_char_res == EV_STR_ERR_NONE); - - evstring_error_t push_view_res = evstring_push(&heap_str, view); - printf("Push view: %s, New Length: %llu\n", heap_str, evstring_getLength(heap_str)); - assert(push_view_res == EV_STR_ERR_NONE); - - evstring str_fmt = evstring_new("%d, %d, %.*s", 1, 0, view.len, view.data + view.offset); - printf("Formatted String: %s\n", str_fmt); - - evstring rep_str = evstring_replaceFirst(heap_str, evstr("Hello"), evstr("Bye")); - printf("Replaced String: %s\n", rep_str); - evstring_free(rep_str); - - evstring_free(str_fmt); - evstring_free(heap_str); - - evstring_view search_results[8]; - evstring search_string = evstr("Hello, this is me saying `Hello` like someone who says 'Hello'"); - assert(evstring_findAll(search_string, evstr("Hello"), search_results) == 3); - assert(search_results[0].data == search_string); - assert(search_results[1].data == search_string); - assert(search_results[2].data == search_string); - assert(search_results[0].len == 5); - assert(search_results[1].len == 5); - assert(search_results[2].len == 5); - assert(search_results[0].offset == 0); - assert(search_results[1].offset == 26); - assert(search_results[2].offset == 56); - - { // PushFmt Bug - printf("PushFmt Bug"); - evstring heap_str = evstring_new("Heap 'Hello, World!'"); - printf("Heap String: %s, Length: %llu\n", heap_str, evstring_getLength(heap_str)); - - evstring_error_t res = evstring_push(&heap_str, "%.05f", 1.0f); - printf("Push Fmt #1: %s, New Length: %llu\n", heap_str, evstring_getLength(heap_str)); - assert(evstring_getLength(heap_str) == 27); - assert(strcmp(heap_str, "Heap 'Hello, World!'1.00000") == 0); - assert(res == EV_STR_ERR_NONE); - - /*evstring_push(&heap_str, "%.05f, %.05f, %.05f", 1.0f, 2.0f, 3.0f);*/ - res = evstring_push(&heap_str, "Something"); - printf("Push Fmt #2: %s, New Length: %llu\n", heap_str, evstring_getLength(heap_str)); - assert(evstring_getLength(heap_str) == 36); - assert(strcmp(heap_str, "Heap 'Hello, World!'1.00000Something") == 0); - assert(res == EV_STR_ERR_NONE); - - evstring_free(heap_str); - } - - { // Incorrectly handled mismatches - evstring text = evstr("aab"); - evstring query = evstr("ab"); - evstring_view match = evstring_findFirst(text, query); - assert(match.len == 2); - assert(match.offset == 1); - } - - { // Underflowing getSpace for stack strings - evstring stack_str = evstr("abc"); - assert(evstring_getSpace(stack_str) == 0); - } - - { // Overlapping push - evstring s = evstring_newFromStr("abc"); - assert(s != NULL); - - evstring_error_t err = evstring_pushStr(&s, s); - assert(err == EV_STR_ERR_NONE); - assert(strcmp(s, "abcabc") == 0); - - evstring_free(s); - } - - - return 0; -} diff --git a/log_test.c b/tests/ev_log/basic_log.c similarity index 100% rename from log_test.c rename to tests/ev_log/basic_log.c diff --git a/tests/ev_log/meson.build b/tests/ev_log/meson.build new file mode 100644 index 0000000..b62af9d --- /dev/null +++ b/tests/ev_log/meson.build @@ -0,0 +1,8 @@ +tests = [ + 'basic_log', +] + +foreach t : tests + exec = executable(t, t+'.c', dependencies: [log_dep], c_args: evh_c_args) + test(t, exec, suite: 'log') +endforeach diff --git a/tests/ev_str/find_all.c b/tests/ev_str/find_all.c new file mode 100644 index 0000000..82380bd --- /dev/null +++ b/tests/ev_str/find_all.c @@ -0,0 +1,23 @@ +#define EV_STR_IMPLEMENTATION +#include "ev_str.h" + +#include + +int main(void) +{ + evstring_view search_results[8]; + evstring search_string = evstr("Hello, this is me saying `Hello` like someone who says 'Hello'"); + + assert(evstring_findAll(search_string, evstr("Hello"), search_results) == 3); + assert(search_results[0].data == search_string); + assert(search_results[1].data == search_string); + assert(search_results[2].data == search_string); + assert(search_results[0].len == 5); + assert(search_results[1].len == 5); + assert(search_results[2].len == 5); + assert(search_results[0].offset == 0); + assert(search_results[1].offset == 26); + assert(search_results[2].offset == 56); + + return 0; +} diff --git a/tests/ev_str/find_first_mismatch.c b/tests/ev_str/find_first_mismatch.c new file mode 100644 index 0000000..2ba48ef --- /dev/null +++ b/tests/ev_str/find_first_mismatch.c @@ -0,0 +1,16 @@ +#define EV_STR_IMPLEMENTATION +#include "ev_str.h" + +#include + +int main(void) +{ + evstring text = evstr("aab"); + evstring query = evstr("ab"); + evstring_view match = evstring_findFirst(text, query); + + assert(match.len == 2); + assert(match.offset == 1); + + return 0; +} diff --git a/tests/ev_str/find_first_overlapping_prefix.c b/tests/ev_str/find_first_overlapping_prefix.c new file mode 100644 index 0000000..e99d266 --- /dev/null +++ b/tests/ev_str/find_first_overlapping_prefix.c @@ -0,0 +1,16 @@ +#define EV_STR_IMPLEMENTATION +#include "ev_str.h" + +#include + +int main(void) +{ + evstring text = evstr("aaab"); + evstring query = evstr("aab"); + evstring_view match = evstring_findFirst(text, query); + + assert(match.len == 3); + assert(match.offset == 1); + + return 0; +} diff --git a/tests/ev_str/meson.build b/tests/ev_str/meson.build new file mode 100644 index 0000000..caf0826 --- /dev/null +++ b/tests/ev_str/meson.build @@ -0,0 +1,18 @@ +tests = [ + 'stack_global_heap', + 'slice', + 'push_variants', + 'new_format', + 'replace_first', + 'find_all', + 'push_fmt_float', + 'find_first_mismatch', + 'find_first_overlapping_prefix', + 'stack_get_space', + 'overlapping_push', +] + +foreach t : tests + exec = executable(t, t+'.c', dependencies: [str_dep], c_args: evh_c_args) + test(t, exec, suite: 'str') +endforeach diff --git a/tests/ev_str/new_format.c b/tests/ev_str/new_format.c new file mode 100644 index 0000000..38ee613 --- /dev/null +++ b/tests/ev_str/new_format.c @@ -0,0 +1,19 @@ +#define EV_STR_IMPLEMENTATION +#include "ev_str.h" + +#include +#include + +int main(void) +{ + evstring source = evstr("Stack 'Hello, World!'"); + evstring_view view = evstring_slice(source, 0, -1); + + evstring str_fmt = evstring_new("%d, %d, %.*s", 1, 0, view.len, view.data + view.offset); + assert(str_fmt != NULL); + assert(strcmp(str_fmt, "1, 0, Stack 'Hello, World!'") == 0); + + evstring_free(str_fmt); + + return 0; +} diff --git a/tests/ev_str/overlapping_push.c b/tests/ev_str/overlapping_push.c new file mode 100644 index 0000000..a131d4b --- /dev/null +++ b/tests/ev_str/overlapping_push.c @@ -0,0 +1,19 @@ +#define EV_STR_IMPLEMENTATION +#include "ev_str.h" + +#include +#include + +int main(void) +{ + evstring s = evstring_newFromStr("abc"); + assert(s != NULL); + + evstring_error_t err = evstring_pushStr(&s, s); + assert(err == EV_STR_ERR_NONE); + assert(strcmp(s, "abcabc") == 0); + + evstring_free(s); + + return 0; +} diff --git a/tests/ev_str/push_fmt_float.c b/tests/ev_str/push_fmt_float.c new file mode 100644 index 0000000..551d6ea --- /dev/null +++ b/tests/ev_str/push_fmt_float.c @@ -0,0 +1,25 @@ +#define EV_STR_IMPLEMENTATION +#include "ev_str.h" + +#include +#include + +int main(void) +{ + evstring heap_str = evstring_new("Heap 'Hello, World!'"); + assert(heap_str != NULL); + + evstring_error_t res = evstring_push(&heap_str, "%.05f", 1.0f); + assert(res == EV_STR_ERR_NONE); + assert(evstring_getLength(heap_str) == 27); + assert(strcmp(heap_str, "Heap 'Hello, World!'1.00000") == 0); + + res = evstring_push(&heap_str, "Something"); + assert(res == EV_STR_ERR_NONE); + assert(evstring_getLength(heap_str) == 36); + assert(strcmp(heap_str, "Heap 'Hello, World!'1.00000Something") == 0); + + evstring_free(heap_str); + + return 0; +} diff --git a/tests/ev_str/push_variants.c b/tests/ev_str/push_variants.c new file mode 100644 index 0000000..98c2603 --- /dev/null +++ b/tests/ev_str/push_variants.c @@ -0,0 +1,29 @@ +#define EV_STR_IMPLEMENTATION +#include "ev_str.h" + +#include +#include + +int main(void) +{ + evstring heap_str = evstring_new("Heap 'Hello, World!'"); + assert(heap_str != NULL); + + evstring_error_t push_str_res = evstring_push(&heap_str, "Hello, Sisyphus! %f", 0.001f); + assert(push_str_res == EV_STR_ERR_NONE); + assert(strcmp(heap_str, "Heap 'Hello, World!'Hello, Sisyphus! 0.001000") == 0); + + evstring_error_t push_char_res = evstring_push(&heap_str, (char)'X'); + assert(push_char_res == EV_STR_ERR_NONE); + assert(strcmp(heap_str, "Heap 'Hello, World!'Hello, Sisyphus! 0.001000X") == 0); + + evstring source = evstr("Stack 'Hello, World!'"); + evstring_view view = evstring_slice(source, 0, -1); + evstring_error_t push_view_res = evstring_push(&heap_str, view); + assert(push_view_res == EV_STR_ERR_NONE); + assert(strcmp(heap_str, "Heap 'Hello, World!'Hello, Sisyphus! 0.001000XStack 'Hello, World!'") == 0); + + evstring_free(heap_str); + + return 0; +} diff --git a/tests/ev_str/replace_first.c b/tests/ev_str/replace_first.c new file mode 100644 index 0000000..a013b72 --- /dev/null +++ b/tests/ev_str/replace_first.c @@ -0,0 +1,20 @@ +#define EV_STR_IMPLEMENTATION +#include "ev_str.h" + +#include +#include + +int main(void) +{ + evstring text = evstring_new("Hello, Hello!"); + assert(text != NULL); + + evstring rep_str = evstring_replaceFirst(text, evstr("Hello"), evstr("Bye")); + assert(rep_str != NULL); + assert(strcmp(rep_str, "Bye, Hello!") == 0); + + evstring_free(rep_str); + evstring_free(text); + + return 0; +} diff --git a/tests/ev_str/slice.c b/tests/ev_str/slice.c new file mode 100644 index 0000000..469b4ee --- /dev/null +++ b/tests/ev_str/slice.c @@ -0,0 +1,24 @@ +#define EV_STR_IMPLEMENTATION +#include "ev_str.h" + +#include +#include + +int main(void) +{ + const evstring stack_str = evstr("Stack 'Hello, World!'"); + + evstring_view view = evstring_slice(stack_str, 0, -1); + assert(view.data == stack_str); + assert(view.offset == 0); + assert(view.len == evstring_getLength(stack_str)); + + evstring heap_str = evstring_new(view); + assert(heap_str != NULL); + assert(strcmp(heap_str, stack_str) == 0); + assert(evstring_getLength(heap_str) == evstring_getLength(stack_str)); + + evstring_free(heap_str); + + return 0; +} diff --git a/tests/ev_str/stack_get_space.c b/tests/ev_str/stack_get_space.c new file mode 100644 index 0000000..583254e --- /dev/null +++ b/tests/ev_str/stack_get_space.c @@ -0,0 +1,12 @@ +#define EV_STR_IMPLEMENTATION +#include "ev_str.h" + +#include + +int main(void) +{ + evstring stack_str = evstr("abc"); + assert(evstring_getSpace(stack_str) == 0); + + return 0; +} diff --git a/tests/ev_str/stack_global_heap.c b/tests/ev_str/stack_global_heap.c new file mode 100644 index 0000000..b9ca9ca --- /dev/null +++ b/tests/ev_str/stack_global_heap.c @@ -0,0 +1,26 @@ +#define EV_STR_IMPLEMENTATION +#include "ev_str.h" + +#include +#include + +static evstring global_str = evstr("Global 'Hello, World!'"); + +int main(void) +{ + const evstring stack_str = evstr("Stack 'Hello, World!'"); + assert(strcmp(stack_str, "Stack 'Hello, World!'") == 0); + assert(evstring_getLength(stack_str) == 21); + + assert(strcmp(global_str, "Global 'Hello, World!'") == 0); + assert(evstring_getLength(global_str) == 22); + + evstring heap_str = evstring_new("Heap 'Hello, World!'"); + assert(heap_str != NULL); + assert(strcmp(heap_str, "Heap 'Hello, World!'") == 0); + assert(evstring_getLength(heap_str) == 20); + + evstring_free(heap_str); + + return 0; +} diff --git a/tests/ev_types/meson.build b/tests/ev_types/meson.build new file mode 100644 index 0000000..eb47e39 --- /dev/null +++ b/tests/ev_types/meson.build @@ -0,0 +1,8 @@ +tests = [ + 'tostr', +] + +foreach t : tests + exec = executable(t, t+'.c', include_directories: headers_include, c_args: evh_c_args) + test(t, exec, suite: 'types') +endforeach diff --git a/tostr_test.c b/tests/ev_types/tostr.c similarity index 100% rename from tostr_test.c rename to tests/ev_types/tostr.c diff --git a/tests/ev_vec/meson.build b/tests/ev_vec/meson.build new file mode 100644 index 0000000..31f1526 --- /dev/null +++ b/tests/ev_vec/meson.build @@ -0,0 +1,11 @@ +tests = [ + 'zero_cap_grow', + 'reducecap_updatelen', + 'reducecap_free_elems', + 'reducelen_free_elems', +] + +foreach t : tests + exec = executable(t, t+'.c', dependencies: [vec_dep], c_args: evh_c_args) + test(t, exec, suite: 'vec') +endforeach diff --git a/tests/ev_vec/reducecap_free_elems.c b/tests/ev_vec/reducecap_free_elems.c new file mode 100644 index 0000000..d78a610 --- /dev/null +++ b/tests/ev_vec/reducecap_free_elems.c @@ -0,0 +1,28 @@ +#define EV_VEC_IMPLEMENTATION +#include "ev_vec.h" + +#include + +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); +} diff --git a/tests/ev_vec/reducecap_updatelen.c b/tests/ev_vec/reducecap_updatelen.c new file mode 100644 index 0000000..f18808b --- /dev/null +++ b/tests/ev_vec/reducecap_updatelen.c @@ -0,0 +1,23 @@ +#define EV_VEC_IMPLEMENTATION +#include "ev_vec.h" + +#include + +int main(void) +{ + assert(EV_VEC_GROWTH_RATE > 1); + + ev_vec(i32) v = ev_vec_init(i32); + assert(v != NULL); + + for(i32 i = 0; i < 5; i++) { + assert(ev_vec_push_impl(&v, &i) >= 0); + } + + ev_vec_error_t err = ev_vec_setcapacity(&v, 2); + assert(err != EV_VEC_ERR_NONE || ev_vec_len(&v) <= ev_vec_capacity(&v)); + + ev_vec_fini(&v); + + return 0; +} diff --git a/tests/ev_vec/reducelen_free_elems.c b/tests/ev_vec/reducelen_free_elems.c new file mode 100644 index 0000000..e56fa3f --- /dev/null +++ b/tests/ev_vec/reducelen_free_elems.c @@ -0,0 +1,25 @@ +#define EV_VEC_IMPLEMENTATION +#include "ev_vec.h" + +#include + +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); + + free_calls = 0; + assert(ev_vec_setlen(&v, 3) == EV_VEC_ERR_NONE); + assert(ev_vec_setlen(&v, 1) == EV_VEC_ERR_NONE); + assert(free_calls == 2); + + ev_vec_fini(&v); +} diff --git a/tests/ev_vec/zero_cap_grow.c b/tests/ev_vec/zero_cap_grow.c new file mode 100644 index 0000000..cecb51d --- /dev/null +++ b/tests/ev_vec/zero_cap_grow.c @@ -0,0 +1,19 @@ +#define EV_VEC_IMPLEMENTATION +#include "ev_vec.h" + +#include + +int main(void) +{ + ev_vec(i32) v = ev_vec_init(i32); + assert(v != NULL); + + assert(ev_vec_setcapacity(&v, 0) == EV_VEC_ERR_NONE); + assert(ev_vec_capacity(&v) == 0); + assert(ev_vec_grow(&v) == EV_VEC_ERR_NONE); + assert(ev_vec_capacity(&v) > 0); + + ev_vec_fini(&v); + + return 0; +} diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..ef46572 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,4 @@ +subdir('ev_log') +subdir('ev_str') +subdir('ev_types') +subdir('ev_vec') diff --git a/vec_test.c b/vec_test.c deleted file mode 100644 index 88883d5..0000000 --- a/vec_test.c +++ /dev/null @@ -1,22 +0,0 @@ -#define EV_VEC_IMPLEMENTATION -#include "ev_vec.h" - -#include - -int main(void) -{ - { - ev_vec(i32) v = ev_vec_init(i32); - assert(v != NULL); - - for(i32 i = 0; i < 5; i++) { - assert(ev_vec_push_impl(&v, &i) >= 0); - } - - ev_vec_error_t err = ev_vec_setcapacity(&v, 2); - assert(err != EV_VEC_ERR_NONE || ev_vec_len(&v) <= ev_vec_capacity(&v)); - - ev_vec_fini(&v); - } - return 0; -}