summaryrefslogtreecommitdiff
path: root/test/test_common.cpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-10-17 19:42:29 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-10-17 19:42:29 -0500
commit8249b28bea29e8ce17eac12776a60ec3f9e47176 (patch)
tree98318d7564b5f618cfb59e23cc6b918fcab88ee8 /test/test_common.cpp
parentb32e83ece42cec5aa9dee370bcdf349d23dbc8ba (diff)
Rename InvalidInput to ArgumentInvalid.
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