|
|
@@ -16,6 +16,10 @@ struct non_default_constructible {
|
|
|
int value;
|
|
|
};
|
|
|
|
|
|
+struct aggregate {
|
|
|
+ int value{};
|
|
|
+};
|
|
|
+
|
|
|
struct listener {
|
|
|
template<typename Component>
|
|
|
static void sort(entt::registry ®istry) {
|
|
|
@@ -256,6 +260,14 @@ TEST(Registry, Functionalities) {
|
|
|
ASSERT_EQ(registry.capacity<char>(), entt::registry::size_type{});
|
|
|
}
|
|
|
|
|
|
+TEST(Registry, AssignOrReplaceAggregates) {
|
|
|
+ entt::registry registry;
|
|
|
+ const auto entity = registry.create();
|
|
|
+ auto &instance = registry.assign_or_replace<aggregate>(entity, 42);
|
|
|
+
|
|
|
+ ASSERT_EQ(instance.value, 42);
|
|
|
+}
|
|
|
+
|
|
|
TEST(Registry, Identifiers) {
|
|
|
entt::registry registry;
|
|
|
const auto pre = registry.create();
|