test: registry emplace_or_replace empty - close #1228

This commit is contained in:
Michele Caini
2025-03-03 08:49:36 +01:00
parent 4d1501277d
commit fc01149121

View File

@@ -1100,6 +1100,21 @@ TEST(Registry, EmplaceOrReplace) {
ASSERT_EQ(ref, 0);
}
TEST(Registry, EmplaceOrReplaceEmpty) {
entt::registry registry{};
const auto entity = registry.create();
ASSERT_FALSE(registry.all_of<test::empty>(entity));
registry.emplace_or_replace<test::empty>(entity);
ASSERT_TRUE(registry.all_of<test::empty>(entity));
registry.emplace_or_replace<test::empty>(entity);
ASSERT_EQ(registry.storage<test::empty>().size(), 1u);
}
TEST(Registry, EmplaceOrReplaceAggregate) {
entt::registry registry{};
const auto entity = registry.create();