code coverage
This commit is contained in:
@@ -262,8 +262,12 @@ class basic_registry {
|
||||
other.assure<Component>(static_cast<const pool_type<Component> &>(cpool));
|
||||
};
|
||||
|
||||
pdata->set = [](basic_registry &other, const Entity entt, const void *instance) {
|
||||
other.assign_or_replace<Component>(entt, *static_cast<const std::decay_t<Component> *>(instance));
|
||||
pdata->set = [](basic_registry &other, const Entity entt, [[maybe_unused]] const void *instance) {
|
||||
if constexpr(ENTT_ENABLE_ETO(Component)) {
|
||||
other.assign_or_replace<Component>(entt);
|
||||
} else {
|
||||
other.assign_or_replace<Component>(entt, *static_cast<const std::decay_t<Component> *>(instance));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1494,24 +1494,24 @@ TEST(Registry, StompExclude) {
|
||||
const auto prototype = registry.create();
|
||||
registry.assign<int>(prototype, 3);
|
||||
registry.assign<char>(prototype, 'c');
|
||||
registry.assign<empty_type>(prototype);
|
||||
|
||||
const auto entity = registry.create();
|
||||
registry.stomp(entity, prototype, registry, entt::exclude<char>);
|
||||
|
||||
ASSERT_TRUE(registry.has<int>(entity));
|
||||
ASSERT_TRUE((registry.has<int, empty_type>(entity)));
|
||||
ASSERT_FALSE(registry.has<char>(entity));
|
||||
ASSERT_EQ(registry.get<int>(entity), 3);
|
||||
|
||||
registry.replace<int>(prototype, 42);
|
||||
registry.stomp(entity, prototype, registry, entt::exclude<int>);
|
||||
|
||||
ASSERT_TRUE((registry.has<int, char>(entity)));
|
||||
ASSERT_TRUE((registry.has<int, char, empty_type>(entity)));
|
||||
ASSERT_EQ(registry.get<int>(entity), 3);
|
||||
ASSERT_EQ(registry.get<char>(entity), 'c');
|
||||
|
||||
registry.remove<int>(entity);
|
||||
registry.remove<char>(entity);
|
||||
registry.stomp(entity, prototype, registry, entt::exclude<int, char>);
|
||||
registry.remove<int, char, empty_type>(entity);
|
||||
registry.stomp(entity, prototype, registry, entt::exclude<int, char, empty_type>);
|
||||
|
||||
ASSERT_TRUE(registry.orphan(entity));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user