Files
NazaraEngine/tests/SDK/NDK/System.cpp
Lynix 3f9988f75f UnitTests: Fix unit tests
Former-commit-id: 2ce788e02e887fc77b4e1778ade02e40bd377cd4 [formerly 22a98fbd268679a69754797cf2eeb6c70097fa2d] [formerly 3c6a3e8293b9715cd0b01f7b9d5592e86f65a936 [formerly 14c98743cee9ac56e6cc924ce3004c659dda6439]]
Former-commit-id: a7897fb09e78eba5fc055f03a1f5c886d6802a38 [formerly b71928574724e14bdbe74b7a28ea28fc79919d10]
Former-commit-id: c1900462b9a5def4daa9c3ca93f1bc00b875135c
2016-10-04 21:47:42 +02:00

50 lines
754 B
C++

#include <NDK/System.hpp>
#include <Catch/catch.hpp>
namespace
{
class TestSystem : public Ndk::System<TestSystem>
{
public:
TestSystem(int value) :
m_value(value)
{
}
int GetValue() const
{
return m_value;
}
~TestSystem() = default;
static Ndk::SystemIndex systemIndex;
private:
int m_value;
void OnUpdate(float elapsedTime) override
{
}
};
Ndk::SystemIndex TestSystem::systemIndex;
}
SCENARIO("System", "[NDK][SYSTEM]")
{
GIVEN("Our TestSystem")
{
TestSystem testSystem(666);
WHEN("We clone it")
{
std::unique_ptr<Ndk::BaseSystem> clone = testSystem.Clone();
THEN("We should get a copy")
{
REQUIRE(static_cast<TestSystem*>(clone.get())->GetValue() == 666);
}
}
}
}