Former-commit-id: c8c0f11725d2e5b6c6da6dc3ab11f0eda065094f [formerly c2977e388c70ba7ccdf52f9eb97d7fe71ed6f4cf] [formerly 73c0d0759a6c9cad05dff59bff486f99fde336b6 [formerly 96a6e52ba5c97fd3a107fed5d11738466bd53f7e]] Former-commit-id: c6a193ee5ccb07a40a74719937dbf224ad22081e [formerly 5f275dc02a44bd2ee54f6d926338ddfe388f565b] Former-commit-id: e35640a20ac2269f96b75998e56fcba2fdbf6f00
50 lines
753 B
C++
50 lines
753 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() == 42);
|
|
}
|
|
}
|
|
}
|
|
} |