2017-09-05 00:43:43 +01:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <cpp-utils/system/memory.h>
|
|
|
|
#include <memory>
|
2017-09-10 14:27:14 +01:00
|
|
|
#include <cpp-utils/pointer/gcc_4_8_compatibility.h>
|
2017-09-05 00:43:43 +01:00
|
|
|
|
2018-09-11 18:53:21 -07:00
|
|
|
using cpputils::UnswappableAllocator;
|
2017-09-05 00:43:43 +01:00
|
|
|
|
2018-09-11 18:53:21 -07:00
|
|
|
TEST(MemoryTest, LockingSmallMemoryDoesntCrash) {
|
|
|
|
UnswappableAllocator allocator;
|
|
|
|
void *data = allocator.allocate(5);
|
|
|
|
allocator.free(data, 5);
|
2017-09-05 00:43:43 +01:00
|
|
|
}
|
|
|
|
|
2018-09-11 18:53:21 -07:00
|
|
|
TEST(MemoryTest, LockingLargeMemoryDoesntCrash) {
|
|
|
|
UnswappableAllocator allocator;
|
|
|
|
void *data = allocator.allocate(10240);
|
|
|
|
allocator.free(data, 10240);
|
2017-09-05 00:43:43 +01:00
|
|
|
}
|