Documentation for MemoryPool

Former-commit-id: 8464b058829189b16cc2336de6454a38f9ee3bdf
This commit is contained in:
Gawaboumga
2016-02-21 14:21:56 +01:00
parent 5c3b16f4a7
commit de5a994a5c
3 changed files with 115 additions and 9 deletions

View File

@@ -0,0 +1,28 @@
#include <Nazara/Core/MemoryPool.hpp>
#include <Catch/catch.hpp>
#include <Nazara/Math/Vector2.hpp>
SCENARIO("MemoryPool", "[CORE][MEMORYPOOL]")
{
GIVEN("A MemoryPool to contain one Nz::Vector2<int>")
{
Nz::MemoryPool memoryPool(sizeof(Nz::Vector2<int>), 1, false);
WHEN("We construct a Nz::Vector2<int>")
{
Nz::Vector2<int>* vector2 = memoryPool.New<Nz::Vector2<int>>(1, 2);
THEN("Memory is available")
{
vector2->x = 3;
REQUIRE(*vector2 == Nz::Vector2<int>(3, 2));
}
THEN("We can destroy the vector2")
{
memoryPool.Delete(vector2);
}
}
}
}