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

This commit is contained in:
2026-09-20 14:19:07 -07:00
parent f6bcb3adbd
commit 513db7130b

23
tests/heap_test.cpp Normal file
View 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