test/test_allocator.cpp

changeset 522
b91c50d023f4
parent 514
6f9d97a53d67
equal deleted inserted replaced
521:e5dc54131d55 522:b91c50d023f4
74 } 74 }
75 75
76 TEST(Allocator, FailingReallocate) { 76 TEST(Allocator, FailingReallocate) {
77 // Mock an allocator that always returns nullptr on realloc 77 // Mock an allocator that always returns nullptr on realloc
78 cx_allocator_class mock_cl; 78 cx_allocator_class mock_cl;
79 mock_cl.realloc = [](void* p, void* d, size_t n) -> void* { return nullptr; }; 79 mock_cl.realloc = [](
80 [[maybe_unused]]void *p,
81 [[maybe_unused]]void *d,
82 [[maybe_unused]]size_t n
83 ) -> void * { return nullptr; };
80 cx_allocator_s mock{&mock_cl, nullptr}; 84 cx_allocator_s mock{&mock_cl, nullptr};
81 85
82 void *test = calloc(8, 1); 86 void *test = calloc(8, 1);
83 memcpy(test, "Test", 5); 87 memcpy(test, "Test", 5);
84 void *original = test; 88 void *original = test;

mercurial