test/test_allocator.c

changeset 394
80c31ebd66c1
parent 392
c195c33de85d
child 396
3539dd99ab92
equal deleted inserted replaced
393:8c0421ccbb58 394:80c31ebd66c1
29 #include "cx/allocator.h" 29 #include "cx/allocator.h"
30 30
31 #include <CUnit/Basic.h> 31 #include <CUnit/Basic.h>
32 32
33 void test_default_allocator_available(void) { 33 void test_default_allocator_available(void) {
34 CU_ASSERT_PTR_EQUAL(cxDefaultAllocator->malloc, cx_malloc_stdlib) 34 struct cx_allocator_class clazz = cxDefaultAllocator->allocatorClass;
35 CU_ASSERT_PTR_EQUAL(cxDefaultAllocator->realloc, cx_realloc_stdlib) 35 CU_ASSERT_PTR_EQUAL(clazz.malloc, cx_malloc_stdlib)
36 CU_ASSERT_PTR_EQUAL(cxDefaultAllocator->calloc, cx_calloc_stdlib) 36 CU_ASSERT_PTR_EQUAL(clazz.realloc, cx_realloc_stdlib)
37 CU_ASSERT_PTR_EQUAL(cxDefaultAllocator->free, cx_free_stdlib) 37 CU_ASSERT_PTR_EQUAL(clazz.calloc, cx_calloc_stdlib)
38 CU_ASSERT_PTR_EQUAL(clazz.free, cx_free_stdlib)
38 } 39 }
39 40
40 void test_default_malloc(void) { 41 void test_default_malloc(void) {
41 void* test = cxMalloc(cxDefaultAllocator, 16); 42 void* test = cxMalloc(cxDefaultAllocator, 16);
42 CU_ASSERT_PTR_NOT_NULL(test); 43 CU_ASSERT_PTR_NOT_NULL(test);

mercurial