From 8249b28bea29e8ce17eac12776a60ec3f9e47176 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Thu, 17 Oct 2024 19:42:29 -0500 Subject: Rename InvalidInput to ArgumentInvalid. --- test/test_common.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'test/test_common.cpp') diff --git a/test/test_common.cpp b/test/test_common.cpp index 5a26e09..d3e1704 100644 --- a/test/test_common.cpp +++ b/test/test_common.cpp @@ -16,21 +16,40 @@ */ #include "test_common.hpp" -#include "fud_allocator.hpp" #include namespace fud { -void* fudAlloc(size_t size) { +void* MockFudAlloc::operator()(size_t size) +{ return malloc(size); } -void* fudRealloc(void* ptr, size_t size) { - return realloc(ptr, size); +void MockFudDealloc::operator()(void* pointer) +{ + return free(pointer); +} + +MockFudAlloc globalDefaultMockAlloc{}; + +MockFudDealloc globalDefaultMockDealloc{}; + +void* MockFudAllocator::allocate(size_t size) { + return (*m_allocator)(size); +} + +void MockFudAllocator::deallocate(void* pointer) { + return (*m_deallocator)(pointer); +} + +MockFudAllocator globalMockFudAlloc{}; + +void* fudAlloc(size_t size) { + return globalMockFudAlloc.allocate(size); } void fudFree(void* ptr) { - return free(ptr); + return globalMockFudAlloc.deallocate(ptr); } } // namespace fud -- cgit v1.2.3