|
@@ -1,5 +1,6 @@
|
|
|
#include "tests/StackAllocatorTests.h"
|
|
|
#include "tests/Test.h"
|
|
|
+#include "utils/Array.h"
|
|
|
#include "memory/StackAllocator.h"
|
|
|
|
|
|
static void testBasicAllocation(Test& test) {
|
|
@@ -130,6 +131,13 @@ static void testArrayNotGrow(Test& test) {
|
|
|
test.checkEqual(4, a.grow(4), "last element on stack can grow 3");
|
|
|
}
|
|
|
|
|
|
+static void testObject(Test& test) {
|
|
|
+ StackAllocator::Object<Array<int, 1024 * 1024 * 4 >> a;
|
|
|
+ test.checkEqual(false, a.hasError(), "object fits in stack");
|
|
|
+ StackAllocator::Object<Array<int, 1024 * 1024 * 100 >> b;
|
|
|
+ test.checkEqual(true, b.hasError(), "object does not fit in stack");
|
|
|
+}
|
|
|
+
|
|
|
void StackAllocatorTests::test() {
|
|
|
Test test("StackAllocator");
|
|
|
testBasicAllocation(test);
|
|
@@ -141,5 +149,6 @@ void StackAllocatorTests::test() {
|
|
|
testArray(test);
|
|
|
testArrayGrow(test);
|
|
|
testArrayNotGrow(test);
|
|
|
+ testObject(test);
|
|
|
test.finalize();
|
|
|
}
|