Use UnitTest-Cpp library for testing

This commit is contained in:
Ilusha 2024-03-15 16:03:33 +03:00 committed by Ilya Shurupov
parent 79d018ffb4
commit b8bcf58a29
53 changed files with 1046 additions and 1383 deletions

View file

@ -13,7 +13,10 @@ using namespace tp;
// ----------------------- Release Implementation ---------------------------- //
void* HeapAlloc::allocate(ualni aBlockSize) { return malloc(aBlockSize); }
void HeapAlloc::deallocate(void* aPtr) { free(aPtr); }
void HeapAlloc::deallocate(void* aPtr) {
if (!aPtr) return;
free(aPtr);
}
HeapAlloc::~HeapAlloc() {}
#else
@ -45,6 +48,8 @@ void* HeapAlloc::allocate(ualni aBlockSize) {
}
void HeapAlloc::deallocate(void* aPtr) {
if (!aPtr) return;
auto head = ((MemHeadLocal*) (aPtr)) - 1;
mNumAllocations--;
@ -60,7 +65,7 @@ void HeapAlloc::deallocate(void* aPtr) {
HeapAlloc::~HeapAlloc() {
if (mNumAllocations) {
DEBUG_BREAK("Destruction of not freed Allocator")
DEBUG_ASSERT(0 && "Destruction of not freed Allocator")
#ifdef MEM_STACK_TRACE
// TODO : log leaks and free them up