feat(objectalloc): add ObjectAlloc and ObjectAllocAddHeap

This commit is contained in:
fallenoak 2022-12-28 09:41:40 -06:00
parent 2c03a4a5df
commit d1bfb1394e
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
10 changed files with 238 additions and 0 deletions

17
test/ObjectAlloc.cpp Normal file
View file

@ -0,0 +1,17 @@
#include "common/ObjectAlloc.hpp"
#include "test/Test.hpp"
TEST_CASE("ObjectAllocAddHeap", "[objectalloc]") {
SECTION("creates a new heap and returns a heap id") {
struct Foo {
uint32_t field1;
uint32_t field2;
};
auto heapId1 = ObjectAllocAddHeap(sizeof(Foo), 1024, "Foo", true);
auto heapId2 = ObjectAllocAddHeap(sizeof(Foo), 1024, "Foo", true);
CHECK(heapId1 == 0);
CHECK(heapId2 == 1);
}
}