39 lines
1.5 KiB
C++
39 lines
1.5 KiB
C++
|
|
#include <catch2/catch_test_macros.hpp>
|
||
|
|
#include <cmath>
|
||
|
|
#include <memory>
|
||
|
|
#include <optional>
|
||
|
|
#define CATCH_CONFIG_MAIN
|
||
|
|
#include "../src/Engine/Core/Kernel/CKernel.hpp"
|
||
|
|
#include "../src/Engine/Core/Component/Custom/CAbstractCustomComponent.hpp"
|
||
|
|
#include "../src/Engine/Core/Component/Rigidbody/CAbstractRigidbody.hpp"
|
||
|
|
|
||
|
|
#include <catch2/catch_all.hpp>
|
||
|
|
TEST_CASE("Entity component manager", "[ECManager]") {
|
||
|
|
//CosmicCore::CKernel kernel("eheh","hehe");
|
||
|
|
//kernel.start();
|
||
|
|
//std::shared_ptr<CosmicCore::CEntity> entity = std::make_shared<CosmicCore::CEntity>("nameEntity");
|
||
|
|
//entity->attachComponent<CosmicCore::CAbstractCustomComponent>();
|
||
|
|
//REQUIRE(!entity->getComponents(CosmicCore::EComponentType::COMPONENT_CUSTOM).empty());
|
||
|
|
//auto comp = entity->getComponents(CosmicCore::EComponentType::COMPONENT_CUSTOM);
|
||
|
|
//REQUIRE(!comp.empty());
|
||
|
|
|
||
|
|
//CosmicCore::CScene scene("scene");
|
||
|
|
//scene.addEntity(entity);
|
||
|
|
//REQUIRE(!scene.getEntity(0).expired());
|
||
|
|
//scene.removeEntity(0, true);
|
||
|
|
//REQUIRE(scene.getEntity(0).expired());
|
||
|
|
//std::shared_ptr<CosmicCore::CEntity> entity2 = std::make_shared<CosmicCore::CEntity>("nameEntity2");
|
||
|
|
//entity2->attachComponent<CosmicCore::CAbstractRigidBody>();
|
||
|
|
//scene.addEntity(entity2);
|
||
|
|
//REQUIRE(!scene.getEntity(0).expired());
|
||
|
|
|
||
|
|
CosmicCore::CEntityComponentManager eM;
|
||
|
|
eM.getEntities().emplace_back<CosmicCore::CEntity>("name");
|
||
|
|
REQUIRE(!eM.getEntities().empty());
|
||
|
|
REQUIRE(eM.getEntities()[0].value().get().getName() == "name");
|
||
|
|
eM.getEntities().erase(0);
|
||
|
|
REQUIRE(eM.getEntities().empty());
|
||
|
|
REQUIRE(!eM.getEntities()[0].has_value());
|
||
|
|
|
||
|
|
}
|