mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-06 19:22:20 +00:00
updating unit test
This commit is contained in:
@@ -31,7 +31,7 @@ TEST_CASE("Collision test", "[Component][System]")
|
|||||||
pos.position.y = 1;
|
pos.position.y = 1;
|
||||||
pos.position.z = 1;
|
pos.position.z = 1;
|
||||||
} catch (std::exception &e) {};
|
} catch (std::exception &e) {};
|
||||||
}, 5.0);
|
}, [](Entity &, const Entity &){}, 5.0);
|
||||||
Entity &entity = wal.scene->getEntities()[0];
|
Entity &entity = wal.scene->getEntities()[0];
|
||||||
REQUIRE(entity.getComponent<PositionComponent>().position == Vector3f());
|
REQUIRE(entity.getComponent<PositionComponent>().position == Vector3f());
|
||||||
|
|
||||||
@@ -68,17 +68,17 @@ TEST_CASE("Collsion test with movable", "[Component][System]")
|
|||||||
wal.scene = std::shared_ptr<Scene>(new Scene);
|
wal.scene = std::shared_ptr<Scene>(new Scene);
|
||||||
wal.scene->addEntity("player")
|
wal.scene->addEntity("player")
|
||||||
.addComponent<PositionComponent>()
|
.addComponent<PositionComponent>()
|
||||||
.addComponent<CollisionComponent>([](Entity &actual, const Entity &) {
|
.addComponent<CollisionComponent>([](Entity &actual, const Entity &) {}, [](Entity &actual, const Entity &) {}, 5.0)
|
||||||
try {
|
|
||||||
auto &mov = actual.getComponent<MovableComponent>();
|
|
||||||
mov._velocity = {0, 0, 0};
|
|
||||||
} catch (std::exception &e) {};
|
|
||||||
}, 5.0)
|
|
||||||
.addComponent<MovableComponent>();
|
.addComponent<MovableComponent>();
|
||||||
|
|
||||||
wal.scene->addEntity("block")
|
wal.scene->addEntity("block")
|
||||||
.addComponent<PositionComponent>(0, 0, 0)
|
.addComponent<PositionComponent>(0, 0, 0)
|
||||||
.addComponent<CollisionComponent>(1);
|
.addComponent<CollisionComponent>([](Entity &actual, const Entity &){}, [](Entity &actual, const Entity &) {
|
||||||
|
try {
|
||||||
|
auto &mov = actual.getComponent<MovableComponent>();
|
||||||
|
mov.resetVelocity();
|
||||||
|
} catch (std::exception &e) {};
|
||||||
|
}, 1);
|
||||||
Entity &entity = wal.scene->getEntities()[0];
|
Entity &entity = wal.scene->getEntities()[0];
|
||||||
REQUIRE(entity.getComponent<PositionComponent>().position == Vector3f());
|
REQUIRE(entity.getComponent<PositionComponent>().position == Vector3f());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user