Former-commit-id: c8c0f11725d2e5b6c6da6dc3ab11f0eda065094f [formerly c2977e388c70ba7ccdf52f9eb97d7fe71ed6f4cf] [formerly 73c0d0759a6c9cad05dff59bff486f99fde336b6 [formerly 96a6e52ba5c97fd3a107fed5d11738466bd53f7e]] Former-commit-id: c6a193ee5ccb07a40a74719937dbf224ad22081e [formerly 5f275dc02a44bd2ee54f6d926338ddfe388f565b] Former-commit-id: e35640a20ac2269f96b75998e56fcba2fdbf6f00
43 lines
710 B
C++
43 lines
710 B
C++
#include <NDK/Component.hpp>
|
|
#include <Catch/catch.hpp>
|
|
|
|
namespace
|
|
{
|
|
class TestComponent : public Ndk::Component<TestComponent>
|
|
{
|
|
public:
|
|
TestComponent(int value) :
|
|
m_value(value)
|
|
{
|
|
}
|
|
|
|
int GetValue() const
|
|
{
|
|
return m_value;
|
|
}
|
|
|
|
int m_value;
|
|
|
|
static Ndk::ComponentIndex componentIndex;
|
|
};
|
|
|
|
Ndk::ComponentIndex TestComponent::componentIndex;
|
|
}
|
|
|
|
SCENARIO("Component", "[NDK][COMPONENT]")
|
|
{
|
|
GIVEN("Our TestComponent")
|
|
{
|
|
TestComponent testComponent(42);
|
|
|
|
WHEN("We clone it")
|
|
{
|
|
std::unique_ptr<Ndk::BaseComponent> clone = testComponent.Clone();
|
|
|
|
THEN("We should get a copy")
|
|
{
|
|
REQUIRE(static_cast<TestComponent*>(clone.get())->GetValue() == 42);
|
|
}
|
|
}
|
|
}
|
|
} |