summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/slang-test/unit-test-memory-arena.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/slang-test/unit-test-memory-arena.cpp b/tools/slang-test/unit-test-memory-arena.cpp
index 1b09ae9e7..e993d4f7a 100644
--- a/tools/slang-test/unit-test-memory-arena.cpp
+++ b/tools/slang-test/unit-test-memory-arena.cpp
@@ -169,6 +169,21 @@ static void memoryArenaUnitTest()
arena.reset();
blocks.Clear();
}
+ else if (var == 3)
+ {
+ arena.rewindToCursor(nullptr);
+ blocks.Clear();
+ }
+ else if (var == 4)
+ {
+ // Rewind to a random position
+ int rewindIndex = randGen.nextInt32UpTo(int32_t(blocks.Count()));
+ // rewind to this block
+ arena.rewindToCursor(blocks[rewindIndex].m_data);
+ // All the blocks (includign this one) and now deallocated
+ blocks.SetSize(rewindIndex);
+
+ }
else
{
size_t usedMemory = arena.calcTotalMemoryUsed();
@@ -248,6 +263,12 @@ static void memoryArenaUnitTest()
}
}
}
+ {
+ // Do lots of allocations and test out rewind
+
+
+
+ }
}
-SLANG_UNIT_TEST("MemoryArena", memoryArenaUnitTest); \ No newline at end of file
+SLANG_UNIT_TEST("MemoryArena", memoryArenaUnitTest);