more code coverage

This commit is contained in:
2018-12-27 13:42:54 +07:00
parent 2c2b0b9e38
commit db62454eab

View File

@@ -71,6 +71,7 @@ TEST_CASE("detail") {
REQUIRE(s.has(42u));
REQUIRE_FALSE(s.has(84u));
REQUIRE(s.find(42u) == s.begin());
REQUIRE(s.find_index(42u).second);
REQUIRE(s.find_index(42u).first == 0u);
REQUIRE(s.get_index(42u) == 0u);
@@ -231,6 +232,14 @@ TEST_CASE("registry") {
REQUIRE_FALSE(w.destroy_entity(e1));
REQUIRE_FALSE(w.destroy_entity(e2));
}
{
ecs::registry w;
const auto e1 = w.create_entity();
w.destroy_entity(e1);
const auto e2 = w.create_entity();
REQUIRE(e1 == e2);
}
}
SECTION("component_assigning") {
{
@@ -355,6 +364,14 @@ TEST_CASE("registry") {
REQUIRE_FALSE(ww.find_component<velocity_c>(e2));
}
}
{
ecs::registry w;
auto e1 = w.create_entity();
e1.assign_component<position_c>(1, 2);
e1.assign_component<position_c>(3, 4);
REQUIRE(e1.get_component<position_c>().x == 3);
REQUIRE(e1.get_component<position_c>().y == 4);
}
{
ecs::registry w;