145 |
145 |
146 void cx_testing_allocator_destroy(CxTestingAllocator *alloc) { |
146 void cx_testing_allocator_destroy(CxTestingAllocator *alloc) { |
147 free(alloc->tracked); |
147 free(alloc->tracked); |
148 } |
148 } |
149 |
149 |
150 bool cx_testing_allocator_used(CxTestingAllocator const *alloc) { |
150 bool cx_testing_allocator_used(const CxTestingAllocator *alloc) { |
151 return alloc->alloc_total > 0; |
151 return alloc->alloc_total > 0; |
152 } |
152 } |
153 |
153 |
154 bool cx_testing_allocator_verify(CxTestingAllocator const *alloc) { |
154 bool cx_testing_allocator_verify(const CxTestingAllocator *alloc) { |
155 return alloc->tracked_count == 0 && alloc->alloc_failed == 0 && alloc->free_failed == 0 |
155 return alloc->tracked_count == 0 && alloc->alloc_failed == 0 && alloc->free_failed == 0 |
156 && alloc->alloc_total == alloc->free_total; |
156 && alloc->alloc_total == alloc->free_total; |
157 } |
157 } |
158 |
158 |
159 // SELF-TEST |
159 // SELF-TEST |