#include #include #include #include #include namespace { class TestSystem : public Ndk::System { public: TestSystem() { Requires(); Excludes(); } ~TestSystem() = default; static Ndk::SystemIndex systemIndex; private: void OnUpdate(float /*elapsedTime*/) override { } }; Ndk::SystemIndex TestSystem::systemIndex; } SCENARIO("BaseSystem", "[NDK][BASESYSTEM]") { GIVEN("Our TestSystem") { Ndk::World world; Ndk::BaseSystem& system = world.AddSystem(); REQUIRE(&system.GetWorld() == &world); WHEN("We add an entity") { Ndk::EntityHandle entity = world.CreateEntity(); entity->AddComponent(); THEN("System should have it") { world.Update(1.f); REQUIRE(system.HasEntity(entity)); } } WHEN("We add an entity with excluded component") { Ndk::EntityHandle entity = world.CreateEntity(); entity->AddComponent(); entity->AddComponent(); THEN("System should not have it") { world.Update(1.f); REQUIRE(!system.HasEntity(entity)); } } } }