diff -r 343eac5ac824 -r 33c95cfc088e tests/test_allocator.c --- a/tests/test_allocator.c Fri May 23 14:00:24 2025 +0200 +++ b/tests/test_allocator.c Sat May 24 00:04:11 2025 +0200 @@ -46,6 +46,15 @@ cxFree(cxStdlibAllocator, test); } +CX_TEST(test_allocator_stdlib_zalloc) { + void *test = cxZalloc(cxStdlibAllocator, 16); + CX_TEST_DO { + CX_TEST_ASSERT(test != NULL); + CX_TEST_ASSERT(0 == memcmp(test, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16)); + } + cxFree(cxStdlibAllocator, test); +} + CX_TEST(test_allocator_stdlib_calloc) { char *test = cxCalloc(cxStdlibAllocator, 8, 2); CX_TEST_DO { @@ -110,6 +119,15 @@ cxFreeDefault(test); } +CX_TEST(test_allocator_default_zalloc) { + void *test = cxZallocDefault(16); + CX_TEST_DO { + CX_TEST_ASSERT(test != NULL); + CX_TEST_ASSERT(0 == memcmp(test, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16)); + } + cxFreeDefault(test); +} + CX_TEST(test_allocator_default_calloc) { char *test = cxCallocDefault(8, 2); CX_TEST_DO { @@ -270,12 +288,14 @@ CxTestSuite *suite = cx_test_suite_new("allocator"); cx_test_register(suite, test_allocator_stdlib_malloc); + cx_test_register(suite, test_allocator_stdlib_zalloc); cx_test_register(suite, test_allocator_stdlib_calloc); cx_test_register(suite, test_allocator_stdlib_realloc); cx_test_register(suite, test_allocator_stdlib_reallocarray); cx_test_register(suite, test_allocator_stdlib_reallocarray_overflow); cx_test_register(suite, test_allocator_stdlib_free); cx_test_register(suite, test_allocator_default_malloc); + cx_test_register(suite, test_allocator_default_zalloc); cx_test_register(suite, test_allocator_default_calloc); cx_test_register(suite, test_allocator_default_realloc); cx_test_register(suite, test_allocator_default_reallocarray);