Add tests for Heap allocator
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
This commit is contained in:
23
tests/heap_test.cpp
Normal file
23
tests/heap_test.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include "mimir.h"
|
||||||
|
|
||||||
|
#include "test_util.h"
|
||||||
|
|
||||||
|
namespace mimir_tests {
|
||||||
|
|
||||||
|
TEST(Heap, InitialState)
|
||||||
|
{
|
||||||
|
mimir::init();
|
||||||
|
mimir::Heap heap;
|
||||||
|
EXPECT_EQ(heap.getUsed(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Heap, OutOfMemory)
|
||||||
|
{
|
||||||
|
mimir::init();
|
||||||
|
mimir::Heap heap;
|
||||||
|
EXPECT_TRUE(heap.init(1ULL << 24, 1ULL << 46));
|
||||||
|
EXPECT_TRUE(heap.alloc(1ULL << 49) == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // namespace mimir_tests
|
||||||
Reference in New Issue
Block a user