registry: rename ::has to ::all_of
This commit is contained in:
@@ -284,12 +284,12 @@ if(registry.has<velocity>(entity)) {
|
||||
}
|
||||
```
|
||||
|
||||
The `has` and `any` member functions may also be useful if in doubt about
|
||||
The `all_of` and `any` member functions may also be useful if in doubt about
|
||||
whether or not an entity has all the components in a set or any of them:
|
||||
|
||||
```cpp
|
||||
// true if entity has all the given components
|
||||
bool all = registry.has<position, velocity>(entity);
|
||||
bool all = registry.all_of<position, velocity>(entity);
|
||||
|
||||
// true if entity has at least one of the given components
|
||||
bool any = registry.any<position, velocity>(entity);
|
||||
|
||||
@@ -220,13 +220,13 @@ struct basic_handle {
|
||||
|
||||
/**
|
||||
* @brief Checks if a handle has all the given components.
|
||||
* @sa basic_registry::has
|
||||
* @sa basic_registry::all_of
|
||||
* @tparam Component Components for which to perform the check.
|
||||
* @return True if the handle has all the components, false otherwise.
|
||||
*/
|
||||
template<typename... Component>
|
||||
[[nodiscard]] decltype(auto) has() const {
|
||||
return reg->template has<Component...>(entt);
|
||||
return reg->template all_of<Component...>(entt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -179,7 +179,7 @@ class basic_observer {
|
||||
struct matcher_handler<matcher<type_list<Reject...>, type_list<Require...>, AnyOf>> {
|
||||
template<std::size_t Index>
|
||||
static void maybe_valid_if(basic_observer &obs, basic_registry<Entity> ®, const Entity entt) {
|
||||
if(reg.template has<Require...>(entt) && !reg.template any<Reject...>(entt)) {
|
||||
if(reg.template all_of<Require...>(entt) && !reg.template any<Reject...>(entt)) {
|
||||
if(!obs.view.contains(entt)) {
|
||||
obs.view.emplace(entt);
|
||||
}
|
||||
@@ -217,9 +217,9 @@ class basic_observer {
|
||||
static void maybe_valid_if(basic_observer &obs, basic_registry<Entity> ®, const Entity entt) {
|
||||
if([®, entt]() {
|
||||
if constexpr(sizeof...(Ignore) == 0) {
|
||||
return reg.template has<AllOf..., Require...>(entt) && !reg.template any<NoneOf..., Reject...>(entt);
|
||||
return reg.template all_of<AllOf..., Require...>(entt) && !reg.template any<NoneOf..., Reject...>(entt);
|
||||
} else {
|
||||
return reg.template has<AllOf..., Require...>(entt) && ((std::is_same_v<Ignore..., NoneOf> || !reg.template any<NoneOf>(entt)) && ...) && !reg.template any<Reject...>(entt);
|
||||
return reg.template all_of<AllOf..., Require...>(entt) && ((std::is_same_v<Ignore..., NoneOf> || !reg.template any<NoneOf>(entt)) && ...) && !reg.template any<Reject...>(entt);
|
||||
}
|
||||
}())
|
||||
{
|
||||
|
||||
@@ -582,7 +582,7 @@ public:
|
||||
* Equivalent to the following snippet (pseudocode):
|
||||
*
|
||||
* @code{.cpp}
|
||||
* auto &component = registry.has<Component>(entity) ? registry.replace<Component>(entity, args...) : registry.emplace<Component>(entity, args...);
|
||||
* auto &component = registry.all_of<Component>(entity) ? registry.replace<Component>(entity, args...) : registry.emplace<Component>(entity, args...);
|
||||
* @endcode
|
||||
*
|
||||
* Prefer this function anyway because it has slightly better performance.
|
||||
@@ -698,7 +698,7 @@ public:
|
||||
* Equivalent to the following snippet (pseudocode):
|
||||
*
|
||||
* @code{.cpp}
|
||||
* if(registry.has<Component>(entity)) { registry.remove<Component>(entity) }
|
||||
* if(registry.all_of<Component>(entity)) { registry.remove<Component>(entity) }
|
||||
* @endcode
|
||||
*
|
||||
* Prefer this function anyway because it has slightly better performance.
|
||||
@@ -755,7 +755,7 @@ public:
|
||||
* @return True if the entity has all the components, false otherwise.
|
||||
*/
|
||||
template<typename... Component>
|
||||
[[nodiscard]] bool has(const entity_type entity) const {
|
||||
[[nodiscard]] bool all_of(const entity_type entity) const {
|
||||
ENTT_ASSERT(valid(entity));
|
||||
return [entity](auto *... cpool) { return ((cpool && cpool->contains(entity)) && ...); }(assure<Component>()...);
|
||||
}
|
||||
@@ -774,7 +774,7 @@ public:
|
||||
template<typename... Component>
|
||||
[[nodiscard]] bool any(const entity_type entity) const {
|
||||
ENTT_ASSERT(valid(entity));
|
||||
return (has<Component>(entity) || ...);
|
||||
return (all_of<Component>(entity) || ...);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -819,7 +819,7 @@ public:
|
||||
* Equivalent to the following snippet (pseudocode):
|
||||
*
|
||||
* @code{.cpp}
|
||||
* auto &component = registry.has<Component>(entity) ? registry.get<Component>(entity) : registry.emplace<Component>(entity, args...);
|
||||
* auto &component = registry.all_of<Component>(entity) ? registry.get<Component>(entity) : registry.emplace<Component>(entity, args...);
|
||||
* @endcode
|
||||
*
|
||||
* Prefer this function anyway because it has slightly better performance.
|
||||
|
||||
@@ -42,7 +42,7 @@ class basic_snapshot {
|
||||
while(first != last) {
|
||||
const auto entt = *(first++);
|
||||
|
||||
if(reg->template has<Component>(entt)) {
|
||||
if(reg->template all_of<Component>(entt)) {
|
||||
std::apply(archive, std::tuple_cat(std::make_tuple(entt), view.get(entt)));
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class basic_snapshot {
|
||||
|
||||
while(begin != last) {
|
||||
const auto entt = *(begin++);
|
||||
((reg->template has<Component>(entt) ? ++size[Index] : size[Index]), ...);
|
||||
((reg->template all_of<Component>(entt) ? ++size[Index] : size[Index]), ...);
|
||||
}
|
||||
|
||||
(get<Component>(archive, size[Index], first, last), ...);
|
||||
|
||||
@@ -75,7 +75,7 @@ TEST(PolyStorage, CopyEntity) {
|
||||
registry.emplace<int>(entity, 42);
|
||||
registry.emplace<char>(entity, 'c');
|
||||
|
||||
ASSERT_TRUE((registry.has<int, char>(entity)));
|
||||
ASSERT_TRUE((registry.all_of<int, char>(entity)));
|
||||
ASSERT_FALSE((registry.any<int, char>(other)));
|
||||
|
||||
registry.visit(entity, [&](const auto info) {
|
||||
@@ -83,8 +83,8 @@ TEST(PolyStorage, CopyEntity) {
|
||||
storage->emplace(registry, other, storage->get(entity));
|
||||
});
|
||||
|
||||
ASSERT_TRUE((registry.has<int, char>(entity)));
|
||||
ASSERT_TRUE((registry.has<int, char>(other)));
|
||||
ASSERT_TRUE((registry.all_of<int, char>(entity)));
|
||||
ASSERT_TRUE((registry.all_of<int, char>(other)));
|
||||
|
||||
ASSERT_EQ(registry.get<int>(entity), registry.get<int>(other));
|
||||
ASSERT_EQ(registry.get<char>(entity), registry.get<char>(other));
|
||||
@@ -125,10 +125,10 @@ TEST(PolyStorage, Constness) {
|
||||
auto cstorage = cregistry.storage(entt::type_id<int>());
|
||||
|
||||
ASSERT_DEATH(cstorage->remove(registry, std::begin(entity), std::end(entity)), ".*");
|
||||
ASSERT_TRUE(registry.has<int>(entity[0]));
|
||||
ASSERT_TRUE(registry.all_of<int>(entity[0]));
|
||||
|
||||
auto storage = registry.storage(entt::type_id<int>());
|
||||
storage->remove(registry, std::begin(entity), std::end(entity));
|
||||
|
||||
ASSERT_FALSE(registry.has<int>(entity[0]));
|
||||
ASSERT_FALSE(registry.all_of<int>(entity[0]));
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ TEST(Registry, Functionalities) {
|
||||
registry.emplace<int>(e1);
|
||||
registry.emplace<char>(e1);
|
||||
|
||||
ASSERT_TRUE(registry.has<>(e0));
|
||||
ASSERT_TRUE(registry.all_of<>(e0));
|
||||
ASSERT_FALSE(registry.any<>(e1));
|
||||
|
||||
ASSERT_EQ(registry.size<int>(), 1u);
|
||||
@@ -132,8 +132,8 @@ TEST(Registry, Functionalities) {
|
||||
|
||||
ASSERT_NE(e0, e1);
|
||||
|
||||
ASSERT_FALSE((registry.has<int, char>(e0)));
|
||||
ASSERT_TRUE((registry.has<int, char>(e1)));
|
||||
ASSERT_FALSE((registry.all_of<int, char>(e0)));
|
||||
ASSERT_TRUE((registry.all_of<int, char>(e1)));
|
||||
ASSERT_FALSE((registry.any<int, double>(e0)));
|
||||
ASSERT_TRUE((registry.any<int, double>(e1)));
|
||||
|
||||
@@ -149,8 +149,8 @@ TEST(Registry, Functionalities) {
|
||||
ASSERT_NO_THROW(registry.remove<int>(e1));
|
||||
ASSERT_NO_THROW(registry.remove<char>(e1));
|
||||
|
||||
ASSERT_TRUE((registry.has<int, char>(e0)));
|
||||
ASSERT_FALSE((registry.has<int, char>(e1)));
|
||||
ASSERT_TRUE((registry.all_of<int, char>(e0)));
|
||||
ASSERT_FALSE((registry.all_of<int, char>(e1)));
|
||||
ASSERT_TRUE((registry.any<int, double>(e0)));
|
||||
ASSERT_FALSE((registry.any<int, double>(e1)));
|
||||
|
||||
@@ -159,7 +159,7 @@ TEST(Registry, Functionalities) {
|
||||
registry.emplace_or_replace<int>(e2, registry.get<int>(e0));
|
||||
registry.emplace_or_replace<char>(e2, registry.get<char>(e0));
|
||||
|
||||
ASSERT_TRUE((registry.has<int, char>(e2)));
|
||||
ASSERT_TRUE((registry.all_of<int, char>(e2)));
|
||||
ASSERT_EQ(registry.get<int>(e0), 42);
|
||||
ASSERT_EQ(registry.get<char>(e0), 'c');
|
||||
|
||||
@@ -220,7 +220,7 @@ TEST(Registry, Functionalities) {
|
||||
ASSERT_EQ(registry.size<char>(), 1u);
|
||||
ASSERT_FALSE(registry.empty<int>());
|
||||
ASSERT_FALSE(registry.empty<char>());
|
||||
ASSERT_TRUE((registry.has<int, char>(e3)));
|
||||
ASSERT_TRUE((registry.all_of<int, char>(e3)));
|
||||
ASSERT_EQ(registry.get<int>(e3), 3);
|
||||
ASSERT_EQ(registry.get<char>(e3), 'c');
|
||||
|
||||
@@ -353,7 +353,7 @@ TEST(Registry, CreateManyEntitiesAtOnceWithListener) {
|
||||
registry.insert(std::begin(entities), std::end(entities), 'a');
|
||||
registry.insert<empty_type>(std::begin(entities), std::end(entities));
|
||||
|
||||
ASSERT_TRUE(registry.has<empty_type>(entities[0]));
|
||||
ASSERT_TRUE(registry.all_of<empty_type>(entities[0]));
|
||||
ASSERT_EQ(registry.get<char>(entities[2]), 'a');
|
||||
ASSERT_EQ(listener.counter, 6);
|
||||
}
|
||||
@@ -479,7 +479,7 @@ TEST(Registry, Each) {
|
||||
match = 0u;
|
||||
|
||||
registry.each([&](auto entity) {
|
||||
if(registry.has<int>(entity)) { ++match; }
|
||||
if(registry.all_of<int>(entity)) { ++match; }
|
||||
registry.create();
|
||||
++tot;
|
||||
});
|
||||
@@ -491,7 +491,7 @@ TEST(Registry, Each) {
|
||||
match = 0u;
|
||||
|
||||
registry.each([&](auto entity) {
|
||||
if(registry.has<int>(entity)) {
|
||||
if(registry.all_of<int>(entity)) {
|
||||
registry.destroy(entity);
|
||||
++match;
|
||||
}
|
||||
@@ -506,7 +506,7 @@ TEST(Registry, Each) {
|
||||
match = 0u;
|
||||
|
||||
registry.each([&](auto entity) {
|
||||
if(registry.has<int>(entity)) { ++match; }
|
||||
if(registry.all_of<int>(entity)) { ++match; }
|
||||
registry.destroy(entity);
|
||||
++tot;
|
||||
});
|
||||
@@ -1168,16 +1168,16 @@ TEST(Registry, Insert) {
|
||||
|
||||
registry.emplace<int>(e2);
|
||||
|
||||
ASSERT_FALSE(registry.has<float>(e0));
|
||||
ASSERT_FALSE(registry.has<float>(e1));
|
||||
ASSERT_FALSE(registry.has<float>(e2));
|
||||
ASSERT_FALSE(registry.all_of<float>(e0));
|
||||
ASSERT_FALSE(registry.all_of<float>(e1));
|
||||
ASSERT_FALSE(registry.all_of<float>(e2));
|
||||
|
||||
const auto icview = registry.view<int, char>();
|
||||
registry.insert(icview.begin(), icview.end(), 3.f);
|
||||
|
||||
ASSERT_EQ(registry.get<float>(e0), 3.f);
|
||||
ASSERT_EQ(registry.get<float>(e1), 3.f);
|
||||
ASSERT_FALSE(registry.has<float>(e2));
|
||||
ASSERT_FALSE(registry.all_of<float>(e2));
|
||||
|
||||
registry.clear<float>();
|
||||
float value[3]{0.f, 1.f, 2.f};
|
||||
@@ -1206,16 +1206,16 @@ TEST(Registry, Remove) {
|
||||
|
||||
registry.emplace<int>(e2);
|
||||
|
||||
ASSERT_TRUE(registry.has<int>(e0));
|
||||
ASSERT_TRUE(registry.has<int>(e1));
|
||||
ASSERT_TRUE(registry.has<int>(e2));
|
||||
ASSERT_TRUE(registry.all_of<int>(e0));
|
||||
ASSERT_TRUE(registry.all_of<int>(e1));
|
||||
ASSERT_TRUE(registry.all_of<int>(e2));
|
||||
|
||||
const auto view = registry.view<int, char>();
|
||||
registry.remove<int>(view.begin(), view.end());
|
||||
|
||||
ASSERT_FALSE(registry.has<int>(e0));
|
||||
ASSERT_FALSE(registry.has<int>(e1));
|
||||
ASSERT_TRUE(registry.has<int>(e2));
|
||||
ASSERT_FALSE(registry.all_of<int>(e0));
|
||||
ASSERT_FALSE(registry.all_of<int>(e1));
|
||||
ASSERT_TRUE(registry.all_of<int>(e2));
|
||||
}
|
||||
|
||||
TEST(Registry, NonOwningGroupInterleaved) {
|
||||
@@ -1315,7 +1315,7 @@ TEST(Registry, GetOrEmplace) {
|
||||
entt::registry registry;
|
||||
const auto entity = registry.create();
|
||||
const auto value = registry.get_or_emplace<int>(entity, 3);
|
||||
ASSERT_TRUE(registry.has<int>(entity));
|
||||
ASSERT_TRUE(registry.all_of<int>(entity));
|
||||
ASSERT_EQ(registry.get<int>(entity), value);
|
||||
ASSERT_EQ(registry.get<int>(entity), 3);
|
||||
}
|
||||
@@ -1363,12 +1363,12 @@ TEST(Registry, Dependencies) {
|
||||
registry.on_destroy<int>().connect<remove>();
|
||||
registry.emplace<double>(entity, .3);
|
||||
|
||||
ASSERT_FALSE(registry.has<int>(entity));
|
||||
ASSERT_FALSE(registry.all_of<int>(entity));
|
||||
ASSERT_EQ(registry.get<double>(entity), .3);
|
||||
|
||||
registry.emplace<int>(entity);
|
||||
|
||||
ASSERT_TRUE(registry.has<int>(entity));
|
||||
ASSERT_TRUE(registry.all_of<int>(entity));
|
||||
ASSERT_EQ(registry.get<double>(entity), .0);
|
||||
|
||||
registry.remove<int>(entity);
|
||||
@@ -1380,7 +1380,7 @@ TEST(Registry, Dependencies) {
|
||||
registry.emplace<int>(entity);
|
||||
|
||||
ASSERT_TRUE((registry.any<int, double>(entity)));
|
||||
ASSERT_FALSE(registry.has<double>(entity));
|
||||
ASSERT_FALSE(registry.all_of<double>(entity));
|
||||
}
|
||||
|
||||
TEST(Registry, StableEmplace) {
|
||||
|
||||
@@ -144,7 +144,7 @@ TEST(Snapshot, Dump) {
|
||||
ASSERT_EQ(registry.current(e1), v1);
|
||||
ASSERT_EQ(registry.get<int>(e2), 3);
|
||||
ASSERT_EQ(registry.get<char>(e3), '0');
|
||||
ASSERT_TRUE(registry.has<a_component>(e3));
|
||||
ASSERT_TRUE(registry.all_of<a_component>(e3));
|
||||
|
||||
ASSERT_TRUE(registry.empty<another_component>());
|
||||
}
|
||||
@@ -199,7 +199,7 @@ TEST(Snapshot, Partial) {
|
||||
|
||||
ASSERT_EQ(registry.get<int>(e0), 42);
|
||||
ASSERT_EQ(registry.get<char>(e0), 'c');
|
||||
ASSERT_FALSE(registry.has<double>(e0));
|
||||
ASSERT_FALSE(registry.all_of<double>(e0));
|
||||
ASSERT_EQ(registry.current(e1), v1);
|
||||
ASSERT_EQ(registry.get<int>(e2), 3);
|
||||
ASSERT_EQ(registry.get<char>(e3), '0');
|
||||
@@ -342,7 +342,7 @@ TEST(Snapshot, Continuous) {
|
||||
decltype(dst.size()) noncopyable_component_cnt{};
|
||||
|
||||
dst.each([&dst, &a_component_cnt](auto entt) {
|
||||
ASSERT_TRUE(dst.has<a_component>(entt));
|
||||
ASSERT_TRUE(dst.all_of<a_component>(entt));
|
||||
++a_component_cnt;
|
||||
});
|
||||
|
||||
@@ -582,8 +582,8 @@ TEST(Snapshot, SyncDataMembers) {
|
||||
ASSERT_FALSE(dst.valid(parent));
|
||||
ASSERT_FALSE(dst.valid(child));
|
||||
|
||||
ASSERT_TRUE(dst.has<what_a_component>(loader.map(parent)));
|
||||
ASSERT_TRUE(dst.has<what_a_component>(loader.map(child)));
|
||||
ASSERT_TRUE(dst.all_of<what_a_component>(loader.map(parent)));
|
||||
ASSERT_TRUE(dst.all_of<what_a_component>(loader.map(child)));
|
||||
|
||||
ASSERT_EQ(dst.get<what_a_component>(loader.map(parent)).bar, static_cast<entt::entity>(entt::null));
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ TEST(ViewPack, ShortestPool) {
|
||||
|
||||
for(const auto entt: pack) {
|
||||
ASSERT_EQ(entt::to_integral(entt), ++next);
|
||||
ASSERT_TRUE((registry.has<int, char>(entt)));
|
||||
ASSERT_TRUE((registry.all_of<int, char>(entt)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ TEST(ViewPack, LongestPool) {
|
||||
|
||||
for(const auto entt: pack) {
|
||||
ASSERT_EQ(entt::to_integral(entt), next--);
|
||||
ASSERT_TRUE((registry.has<int, char>(entt)));
|
||||
ASSERT_TRUE((registry.all_of<int, char>(entt)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -200,12 +200,12 @@ TEST_F(MetaCtor, ExternalMemberFunction) {
|
||||
entt::registry registry;
|
||||
const auto entity = registry.create();
|
||||
|
||||
ASSERT_FALSE(registry.has<clazz_t>(entity));
|
||||
ASSERT_FALSE(registry.all_of<clazz_t>(entity));
|
||||
|
||||
const auto any = ctor.invoke(std::ref(registry), entity, 3, 'c');
|
||||
|
||||
ASSERT_TRUE(any);
|
||||
ASSERT_TRUE(registry.has<clazz_t>(entity));
|
||||
ASSERT_TRUE(registry.all_of<clazz_t>(entity));
|
||||
ASSERT_EQ(registry.get<clazz_t>(entity).i, 3);
|
||||
ASSERT_EQ(registry.get<clazz_t>(entity).c, 'c');
|
||||
}
|
||||
|
||||
@@ -415,9 +415,9 @@ TEST_F(MetaFunc, ExternalMemberFunction) {
|
||||
entt::registry registry;
|
||||
const auto entity = registry.create();
|
||||
|
||||
ASSERT_FALSE(registry.has<func_t>(entity));
|
||||
ASSERT_FALSE(registry.all_of<func_t>(entity));
|
||||
|
||||
func.invoke({}, std::ref(registry), entity);
|
||||
|
||||
ASSERT_TRUE(registry.has<func_t>(entity));
|
||||
ASSERT_TRUE(registry.all_of<func_t>(entity));
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ TEST(Example, CustomIdentifier) {
|
||||
ASSERT_TRUE(registry.valid(entity));
|
||||
ASSERT_TRUE(entity != entt::null);
|
||||
|
||||
ASSERT_FALSE((registry.has<int, char>(entity)));
|
||||
ASSERT_FALSE((registry.all_of<int, char>(entity)));
|
||||
ASSERT_EQ(registry.try_get<int>(entity), nullptr);
|
||||
|
||||
registry.emplace<int>(entity, 42);
|
||||
|
||||
@@ -71,23 +71,23 @@ TEST(Snapshot, Full) {
|
||||
entt::snapshot_loader{destination}.entities(input).component<position, timer, relationship, entt::tag<"empty"_hs>>(input);
|
||||
|
||||
ASSERT_TRUE(destination.valid(e0));
|
||||
ASSERT_TRUE(destination.has<position>(e0));
|
||||
ASSERT_TRUE(destination.all_of<position>(e0));
|
||||
ASSERT_EQ(destination.get<position>(e0).x, 16.f);
|
||||
ASSERT_EQ(destination.get<position>(e0).y, 16.f);
|
||||
|
||||
ASSERT_TRUE(destination.valid(e1));
|
||||
ASSERT_TRUE(destination.has<position>(e1));
|
||||
ASSERT_TRUE(destination.all_of<position>(e1));
|
||||
ASSERT_EQ(destination.get<position>(e1).x, .8f);
|
||||
ASSERT_EQ(destination.get<position>(e1).y, .0f);
|
||||
ASSERT_TRUE(destination.has<relationship>(e1));
|
||||
ASSERT_TRUE(destination.all_of<relationship>(e1));
|
||||
ASSERT_EQ(destination.get<relationship>(e1).parent, e0);
|
||||
|
||||
ASSERT_FALSE(destination.valid(e2));
|
||||
ASSERT_EQ(destination.current(e2), v2);
|
||||
|
||||
ASSERT_TRUE(destination.valid(e3));
|
||||
ASSERT_TRUE(destination.has<timer>(e3));
|
||||
ASSERT_TRUE(destination.has<entt::tag<"empty"_hs>>(e3));
|
||||
ASSERT_TRUE(destination.all_of<timer>(e3));
|
||||
ASSERT_TRUE(destination.all_of<entt::tag<"empty"_hs>>(e3));
|
||||
ASSERT_EQ(destination.get<timer>(e3).duration, 1000);
|
||||
ASSERT_EQ(destination.get<timer>(e3).elapsed, 0);
|
||||
}
|
||||
@@ -144,10 +144,10 @@ TEST(Snapshot, Continuous) {
|
||||
auto l0 = loader.map(e0);
|
||||
|
||||
ASSERT_TRUE(destination.valid(l0));
|
||||
ASSERT_TRUE(destination.has<position>(l0));
|
||||
ASSERT_TRUE(destination.all_of<position>(l0));
|
||||
ASSERT_EQ(destination.get<position>(l0).x, 0.f);
|
||||
ASSERT_EQ(destination.get<position>(l0).y, 0.f);
|
||||
ASSERT_TRUE(destination.has<relationship>(l0));
|
||||
ASSERT_TRUE(destination.all_of<relationship>(l0));
|
||||
ASSERT_EQ(destination.get<relationship>(l0).parent, l0);
|
||||
|
||||
ASSERT_FALSE(destination.valid(e1));
|
||||
@@ -156,10 +156,10 @@ TEST(Snapshot, Continuous) {
|
||||
auto l1 = loader.map(e1);
|
||||
|
||||
ASSERT_TRUE(destination.valid(l1));
|
||||
ASSERT_TRUE(destination.has<position>(l1));
|
||||
ASSERT_TRUE(destination.all_of<position>(l1));
|
||||
ASSERT_EQ(destination.get<position>(l1).x, 1.f);
|
||||
ASSERT_EQ(destination.get<position>(l1).y, 1.f);
|
||||
ASSERT_TRUE(destination.has<relationship>(l1));
|
||||
ASSERT_TRUE(destination.all_of<relationship>(l1));
|
||||
ASSERT_EQ(destination.get<relationship>(l1).parent, l0);
|
||||
|
||||
ASSERT_FALSE(destination.valid(e2));
|
||||
@@ -168,10 +168,10 @@ TEST(Snapshot, Continuous) {
|
||||
auto l2 = loader.map(e2);
|
||||
|
||||
ASSERT_TRUE(destination.valid(l2));
|
||||
ASSERT_TRUE(destination.has<position>(l2));
|
||||
ASSERT_TRUE(destination.all_of<position>(l2));
|
||||
ASSERT_EQ(destination.get<position>(l2).x, .2f);
|
||||
ASSERT_EQ(destination.get<position>(l2).y, .2f);
|
||||
ASSERT_TRUE(destination.has<relationship>(l2));
|
||||
ASSERT_TRUE(destination.all_of<relationship>(l2));
|
||||
ASSERT_EQ(destination.get<relationship>(l2).parent, l0);
|
||||
|
||||
ASSERT_FALSE(destination.valid(e3));
|
||||
@@ -180,10 +180,10 @@ TEST(Snapshot, Continuous) {
|
||||
auto l3 = loader.map(e3);
|
||||
|
||||
ASSERT_TRUE(destination.valid(l3));
|
||||
ASSERT_TRUE(destination.has<timer>(l3));
|
||||
ASSERT_TRUE(destination.all_of<timer>(l3));
|
||||
ASSERT_EQ(destination.get<timer>(l3).duration, 1000);
|
||||
ASSERT_EQ(destination.get<timer>(l3).elapsed, 0);
|
||||
ASSERT_TRUE(destination.has<relationship>(l3));
|
||||
ASSERT_TRUE(destination.all_of<relationship>(l3));
|
||||
ASSERT_EQ(destination.get<relationship>(l3).parent, l2);
|
||||
ASSERT_TRUE(destination.has<entt::tag<"empty"_hs>>(l3));
|
||||
ASSERT_TRUE(destination.all_of<entt::tag<"empty"_hs>>(l3));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user