summaryrefslogtreecommitdiff
path: root/test/test_common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_common.cpp')
-rw-r--r--test/test_common.cpp29
1 files changed, 24 insertions, 5 deletions
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 <cstdlib>
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