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