mirror of
https://github.com/thunderbrewhq/common.git
synced 2025-12-12 03:02:29 +00:00
feat(objectalloc): add ObjectAlloc and ObjectAllocAddHeap
This commit is contained in:
parent
2c03a4a5df
commit
d1bfb1394e
10 changed files with 238 additions and 0 deletions
17
test/ObjectAlloc.cpp
Normal file
17
test/ObjectAlloc.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue