Documentation for ParameterList
Former-commit-id: 5b8752a1d20eb894e17b271a019c379d867a4eb5
This commit is contained in:
52
tests/Engine/Core/ParameterList.cpp
Normal file
52
tests/Engine/Core/ParameterList.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user