|
|
@@ -663,28 +663,58 @@ TEST(NonOwningGroup, IterableGroupAlgorithmCompatibility) {
|
|
|
TEST(NonOwningGroup, Storage) {
|
|
|
entt::registry registry;
|
|
|
const auto entity = registry.create();
|
|
|
- const auto group = registry.group(entt::get<int, const char>);
|
|
|
+ const auto group = registry.group(entt::get<int, const char>, entt::exclude<double, const float>);
|
|
|
|
|
|
static_assert(std::is_same_v<decltype(group.storage<0u>()), entt::storage_type_t<int> &>);
|
|
|
static_assert(std::is_same_v<decltype(group.storage<int>()), entt::storage_type_t<int> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<const int>()), entt::storage_type_t<int> &>);
|
|
|
static_assert(std::is_same_v<decltype(group.storage<1u>()), const entt::storage_type_t<char> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<char>()), const entt::storage_type_t<char> &>);
|
|
|
static_assert(std::is_same_v<decltype(group.storage<const char>()), const entt::storage_type_t<char> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<2u>()), entt::storage_type_t<double> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<double>()), entt::storage_type_t<double> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<const double>()), entt::storage_type_t<double> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<3u>()), const entt::storage_type_t<float> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<float>()), const entt::storage_type_t<float> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<const float>()), const entt::storage_type_t<float> &>);
|
|
|
|
|
|
ASSERT_EQ(group.size(), 0u);
|
|
|
|
|
|
group.storage<int>().emplace(entity);
|
|
|
+ group.storage<double>().emplace(entity);
|
|
|
registry.emplace<char>(entity);
|
|
|
+ registry.emplace<float>(entity);
|
|
|
|
|
|
- ASSERT_EQ(group.size(), 1u);
|
|
|
+ ASSERT_EQ(group.size(), 0u);
|
|
|
+ ASSERT_EQ(group.begin(), group.end());
|
|
|
ASSERT_TRUE(group.storage<int>().contains(entity));
|
|
|
ASSERT_TRUE(group.storage<const char>().contains(entity));
|
|
|
+ ASSERT_TRUE(group.storage<double>().contains(entity));
|
|
|
+ ASSERT_TRUE(group.storage<const float>().contains(entity));
|
|
|
+ ASSERT_TRUE((registry.all_of<int, char, double, float>(entity)));
|
|
|
+
|
|
|
+ group.storage<double>().erase(entity);
|
|
|
+ registry.erase<float>(entity);
|
|
|
+
|
|
|
+ ASSERT_EQ(group.size(), 1u);
|
|
|
+ ASSERT_NE(group.begin(), group.end());
|
|
|
+ ASSERT_TRUE(group.storage<const int>().contains(entity));
|
|
|
+ ASSERT_TRUE(group.storage<char>().contains(entity));
|
|
|
+ ASSERT_FALSE(group.storage<const double>().contains(entity));
|
|
|
+ ASSERT_FALSE(group.storage<float>().contains(entity));
|
|
|
ASSERT_TRUE((registry.all_of<int, char>(entity)));
|
|
|
+ ASSERT_FALSE((registry.any_of<double, float>(entity)));
|
|
|
|
|
|
group.storage<0u>().erase(entity);
|
|
|
|
|
|
ASSERT_EQ(group.size(), 0u);
|
|
|
+ ASSERT_EQ(group.begin(), group.end());
|
|
|
+ ASSERT_FALSE(group.storage<0u>().contains(entity));
|
|
|
ASSERT_TRUE(group.storage<1u>().contains(entity));
|
|
|
- ASSERT_FALSE((registry.all_of<int, char>(entity)));
|
|
|
+ ASSERT_FALSE(group.storage<2u>().contains(entity));
|
|
|
+ ASSERT_FALSE(group.storage<3u>().contains(entity));
|
|
|
+ ASSERT_TRUE((registry.all_of<char>(entity)));
|
|
|
+ ASSERT_FALSE((registry.any_of<int, double, float>(entity)));
|
|
|
}
|
|
|
|
|
|
TEST(OwningGroup, Functionalities) {
|
|
|
@@ -1443,26 +1473,56 @@ TEST(OwningGroup, IterableGroupAlgorithmCompatibility) {
|
|
|
TEST(OwningGroup, Storage) {
|
|
|
entt::registry registry;
|
|
|
const auto entity = registry.create();
|
|
|
- const auto group = registry.group<int>(entt::get<const char>);
|
|
|
+ const auto group = registry.group<int>(entt::get<const char>, entt::exclude<double, const float>);
|
|
|
|
|
|
static_assert(std::is_same_v<decltype(group.storage<0u>()), entt::storage_type_t<int> &>);
|
|
|
static_assert(std::is_same_v<decltype(group.storage<int>()), entt::storage_type_t<int> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<const int>()), entt::storage_type_t<int> &>);
|
|
|
static_assert(std::is_same_v<decltype(group.storage<1u>()), const entt::storage_type_t<char> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<char>()), const entt::storage_type_t<char> &>);
|
|
|
static_assert(std::is_same_v<decltype(group.storage<const char>()), const entt::storage_type_t<char> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<2u>()), entt::storage_type_t<double> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<double>()), entt::storage_type_t<double> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<const double>()), entt::storage_type_t<double> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<3u>()), const entt::storage_type_t<float> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<float>()), const entt::storage_type_t<float> &>);
|
|
|
+ static_assert(std::is_same_v<decltype(group.storage<const float>()), const entt::storage_type_t<float> &>);
|
|
|
|
|
|
ASSERT_EQ(group.size(), 0u);
|
|
|
|
|
|
group.storage<int>().emplace(entity);
|
|
|
+ group.storage<double>().emplace(entity);
|
|
|
registry.emplace<char>(entity);
|
|
|
+ registry.emplace<float>(entity);
|
|
|
|
|
|
- ASSERT_EQ(group.size(), 1u);
|
|
|
+ ASSERT_EQ(group.size(), 0u);
|
|
|
+ ASSERT_EQ(group.begin(), group.end());
|
|
|
ASSERT_TRUE(group.storage<int>().contains(entity));
|
|
|
ASSERT_TRUE(group.storage<const char>().contains(entity));
|
|
|
+ ASSERT_TRUE(group.storage<double>().contains(entity));
|
|
|
+ ASSERT_TRUE(group.storage<const float>().contains(entity));
|
|
|
+ ASSERT_TRUE((registry.all_of<int, char, double, float>(entity)));
|
|
|
+
|
|
|
+ group.storage<double>().erase(entity);
|
|
|
+ registry.erase<float>(entity);
|
|
|
+
|
|
|
+ ASSERT_EQ(group.size(), 1u);
|
|
|
+ ASSERT_NE(group.begin(), group.end());
|
|
|
+ ASSERT_TRUE(group.storage<const int>().contains(entity));
|
|
|
+ ASSERT_TRUE(group.storage<char>().contains(entity));
|
|
|
+ ASSERT_FALSE(group.storage<const double>().contains(entity));
|
|
|
+ ASSERT_FALSE(group.storage<float>().contains(entity));
|
|
|
ASSERT_TRUE((registry.all_of<int, char>(entity)));
|
|
|
+ ASSERT_FALSE((registry.any_of<double, float>(entity)));
|
|
|
|
|
|
group.storage<0u>().erase(entity);
|
|
|
|
|
|
ASSERT_EQ(group.size(), 0u);
|
|
|
+ ASSERT_EQ(group.begin(), group.end());
|
|
|
+ ASSERT_FALSE(group.storage<0u>().contains(entity));
|
|
|
ASSERT_TRUE(group.storage<1u>().contains(entity));
|
|
|
- ASSERT_FALSE((registry.all_of<int, char>(entity)));
|
|
|
+ ASSERT_FALSE(group.storage<2u>().contains(entity));
|
|
|
+ ASSERT_FALSE(group.storage<3u>().contains(entity));
|
|
|
+ ASSERT_TRUE((registry.all_of<char>(entity)));
|
|
|
+ ASSERT_FALSE((registry.any_of<int, double, float>(entity)));
|
|
|
}
|