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 struct cx_allocator_class clazz = cxDefaultAllocator->allocatorClass; |
34 cx_allocator_class* clazz = cxDefaultAllocator->cl; |
35 CU_ASSERT_PTR_EQUAL(clazz.malloc, cx_malloc_stdlib) |
35 CU_ASSERT_PTR_EQUAL(clazz->malloc, cx_malloc_stdlib) |
36 CU_ASSERT_PTR_EQUAL(clazz.realloc, cx_realloc_stdlib) |
36 CU_ASSERT_PTR_EQUAL(clazz->realloc, cx_realloc_stdlib) |
37 CU_ASSERT_PTR_EQUAL(clazz.calloc, cx_calloc_stdlib) |
37 CU_ASSERT_PTR_EQUAL(clazz->calloc, cx_calloc_stdlib) |
38 CU_ASSERT_PTR_EQUAL(clazz.free, cx_free_stdlib) |
38 CU_ASSERT_PTR_EQUAL(clazz->free, cx_free_stdlib) |
39 } |
39 } |
40 |
40 |
41 void test_default_malloc(void) { |
41 void test_default_malloc(void) { |
42 void* test = cxMalloc(cxDefaultAllocator, 16); |
42 void* test = cxMalloc(cxDefaultAllocator, 16); |
43 CU_ASSERT_PTR_NOT_NULL(test); |
43 CU_ASSERT_PTR_NOT_NULL(test); |