Documentation for ParameterList

Former-commit-id: 5b8752a1d20eb894e17b271a019c379d867a4eb5
This commit is contained in:
Gawaboumga
2016-02-21 14:23:46 +01:00
parent 040c8b099f
commit 01d5f18d27
2 changed files with 282 additions and 31 deletions

View File

@@ -0,0 +1,52 @@
#include <Nazara/Core/ParameterList.hpp>
#include <Catch/catch.hpp>
#include <Nazara/Core/String.hpp>
SCENARIO("ParameterList", "[CORE][PARAMETERLIST]")
{
GIVEN("An empty ParameterList")
{
Nz::ParameterList parameterList;
WHEN("We add String 'string'")
{
Nz::String string("string");
parameterList.SetParameter("string", string);
THEN("We can get it back")
{
Nz::String newString;
REQUIRE(parameterList.GetStringParameter("string", &newString));
REQUIRE(newString == string);
}
}
WHEN("We add Float '3.f'")
{
float fl = 3.f;
parameterList.SetParameter("float", fl);
THEN("We can get it back")
{
float newFl;
REQUIRE(parameterList.GetFloatParameter("float", &newFl));
REQUIRE(newFl == fl);
}
}
WHEN("We add Pointer to stack value")
{
int stackValue = 3;
void* ptrToStackValue = &stackValue; // Ugly conversion
parameterList.SetParameter("ptr", ptrToStackValue);
THEN("We can get it back")
{
void* newPtrToStackValue = nullptr;
REQUIRE(parameterList.GetPointerParameter("ptr", &newPtrToStackValue));
REQUIRE(newPtrToStackValue == ptrToStackValue);
}
}
}
}