test: minor changes
This commit is contained in:
@@ -131,7 +131,7 @@ TEST(AllocateUnique, UsesAllocatorConstruction) {
|
||||
#endif
|
||||
|
||||
TEST(UsesAllocatorConstructionArgs, NoUsesAllocatorConstruction) {
|
||||
const auto value = 42;
|
||||
const auto value = 4;
|
||||
const auto args = entt::uses_allocator_construction_args<int>(std::allocator<int>{}, value);
|
||||
|
||||
ASSERT_EQ(std::tuple_size_v<decltype(args)>, 1u);
|
||||
@@ -140,7 +140,7 @@ TEST(UsesAllocatorConstructionArgs, NoUsesAllocatorConstruction) {
|
||||
}
|
||||
|
||||
TEST(UsesAllocatorConstructionArgs, LeadingAllocatorConvention) {
|
||||
const auto value = 42;
|
||||
const auto value = 4;
|
||||
const auto args = entt::uses_allocator_construction_args<std::tuple<int, char>>(std::allocator<int>{}, value, 'c');
|
||||
|
||||
ASSERT_EQ(std::tuple_size_v<decltype(args)>, 4u);
|
||||
@@ -149,7 +149,7 @@ TEST(UsesAllocatorConstructionArgs, LeadingAllocatorConvention) {
|
||||
}
|
||||
|
||||
TEST(UsesAllocatorConstructionArgs, TrailingAllocatorConvention) {
|
||||
const auto size = 42u;
|
||||
const auto size = 4u;
|
||||
const auto args = entt::uses_allocator_construction_args<std::vector<int>>(std::allocator<int>{}, size);
|
||||
|
||||
ASSERT_EQ(std::tuple_size_v<decltype(args)>, 2u);
|
||||
@@ -158,7 +158,7 @@ TEST(UsesAllocatorConstructionArgs, TrailingAllocatorConvention) {
|
||||
}
|
||||
|
||||
TEST(UsesAllocatorConstructionArgs, PairPiecewiseConstruct) {
|
||||
const auto size = 42u;
|
||||
const auto size = 4u;
|
||||
const auto tup = std::make_tuple(size);
|
||||
const auto args = entt::uses_allocator_construction_args<std::pair<int, std::vector<int>>>(std::allocator<int>{}, std::piecewise_construct, std::make_tuple(3), tup);
|
||||
|
||||
@@ -175,7 +175,7 @@ TEST(UsesAllocatorConstructionArgs, PairNoArgs) {
|
||||
}
|
||||
|
||||
TEST(UsesAllocatorConstructionArgs, PairValues) {
|
||||
const auto size = 42u;
|
||||
const auto size = 4u;
|
||||
const auto args = entt::uses_allocator_construction_args<std::pair<int, std::vector<int>>>(std::allocator<int>{}, 3, size);
|
||||
|
||||
ASSERT_EQ(std::tuple_size_v<decltype(args)>, 3u);
|
||||
@@ -184,24 +184,24 @@ TEST(UsesAllocatorConstructionArgs, PairValues) {
|
||||
}
|
||||
|
||||
TEST(UsesAllocatorConstructionArgs, PairConstLValueReference) {
|
||||
const auto value = std::make_pair(3, 42u);
|
||||
const auto value = std::make_pair(3, 4u);
|
||||
const auto args = entt::uses_allocator_construction_args<std::pair<int, std::vector<int>>>(std::allocator<int>{}, value);
|
||||
|
||||
ASSERT_EQ(std::tuple_size_v<decltype(args)>, 3u);
|
||||
testing::StaticAssertTypeEq<decltype(args), const std::tuple<std::piecewise_construct_t, std::tuple<const int &>, std::tuple<const unsigned int &, const std::allocator<int> &>>>();
|
||||
ASSERT_EQ(std::get<0>(std::get<1>(args)), 3);
|
||||
ASSERT_EQ(std::get<0>(std::get<2>(args)), 42u);
|
||||
ASSERT_EQ(std::get<0>(std::get<2>(args)), 4u);
|
||||
}
|
||||
|
||||
TEST(UsesAllocatorConstructionArgs, PairRValueReference) {
|
||||
[[maybe_unused]] const auto args = entt::uses_allocator_construction_args<std::pair<int, std::vector<int>>>(std::allocator<int>{}, std::make_pair(3, 42u));
|
||||
[[maybe_unused]] const auto args = entt::uses_allocator_construction_args<std::pair<int, std::vector<int>>>(std::allocator<int>{}, std::make_pair(3, 4u));
|
||||
|
||||
ASSERT_EQ(std::tuple_size_v<decltype(args)>, 3u);
|
||||
testing::StaticAssertTypeEq<decltype(args), const std::tuple<std::piecewise_construct_t, std::tuple<int &&>, std::tuple<unsigned int &&, const std::allocator<int> &>>>();
|
||||
}
|
||||
|
||||
TEST(MakeObjUsingAllocator, Functionalities) {
|
||||
const auto size = 42u;
|
||||
const auto size = 4u;
|
||||
test::throwing_allocator<int> allocator{};
|
||||
|
||||
allocator.throw_counter<int>(0u);
|
||||
|
||||
@@ -87,10 +87,10 @@ TEST(TypeInfo, Order) {
|
||||
}
|
||||
|
||||
TEST(TypeId, Functionalities) {
|
||||
const int value = 42;
|
||||
const int value = 4;
|
||||
|
||||
ASSERT_EQ(entt::type_id(value), entt::type_id<int>());
|
||||
ASSERT_EQ(entt::type_id(42), entt::type_id<int>());
|
||||
ASSERT_EQ(entt::type_id(4), entt::type_id<int>());
|
||||
|
||||
ASSERT_EQ(entt::type_id<int>(), entt::type_id<int>());
|
||||
ASSERT_EQ(entt::type_id<int &>(), entt::type_id<int &&>());
|
||||
|
||||
@@ -34,14 +34,14 @@ TYPED_TEST(Entity, Traits) {
|
||||
constexpr entity_type tombstone{entt::tombstone};
|
||||
constexpr entity_type null{entt::null};
|
||||
|
||||
const entity_type entity = traits_type::construct(42u, 1u);
|
||||
const entity_type entity = traits_type::construct(4u, 1u);
|
||||
const entity_type other = traits_type::construct(3u, 0u);
|
||||
|
||||
ASSERT_EQ(entt::to_integral(entity), entt::to_integral(entity));
|
||||
ASSERT_NE(entt::to_integral(entity), entt::to_integral<entity_type>(entt::null));
|
||||
ASSERT_NE(entt::to_integral(entity), entt::to_integral(entity_type{}));
|
||||
|
||||
ASSERT_EQ(entt::to_entity(entity), 42u);
|
||||
ASSERT_EQ(entt::to_entity(entity), 4u);
|
||||
ASSERT_EQ(entt::to_version(entity), 1u);
|
||||
ASSERT_EQ(entt::to_entity(other), 3u);
|
||||
ASSERT_EQ(entt::to_version(other), 0u);
|
||||
@@ -107,7 +107,7 @@ TYPED_TEST(Entity, Null) {
|
||||
ASSERT_TRUE(entt::null == entt::null);
|
||||
ASSERT_FALSE(entt::null != entt::null);
|
||||
|
||||
const entity_type entity{42u};
|
||||
const entity_type entity{4u};
|
||||
|
||||
ASSERT_EQ(traits_type::combine(entt::null, entt::to_integral(entity)), (traits_type::construct(entt::to_entity(null), entt::to_version(entity))));
|
||||
ASSERT_EQ(traits_type::combine(entt::null, entt::to_integral(null)), null);
|
||||
@@ -130,7 +130,7 @@ TYPED_TEST(Entity, Tombstone) {
|
||||
ASSERT_TRUE(entt::tombstone == entt::tombstone);
|
||||
ASSERT_FALSE(entt::tombstone != entt::tombstone);
|
||||
|
||||
const entity_type entity{42u};
|
||||
const entity_type entity{4u};
|
||||
|
||||
ASSERT_EQ(traits_type::combine(entt::to_integral(entity), entt::tombstone), (traits_type::construct(entt::to_entity(entity), entt::to_version(tombstone))));
|
||||
ASSERT_EQ(traits_type::combine(entt::tombstone, entt::to_integral(tombstone)), tombstone);
|
||||
|
||||
@@ -101,8 +101,8 @@ TEST(Registry, Functionalities) {
|
||||
|
||||
ASSERT_EQ(registry.storage<entt::entity>().size(), 0u);
|
||||
ASSERT_EQ(registry.storage<entt::entity>().free_list(), 0u);
|
||||
ASSERT_NO_THROW(registry.storage<entt::entity>().reserve(42));
|
||||
ASSERT_EQ(registry.storage<entt::entity>().capacity(), 42u);
|
||||
ASSERT_NO_THROW(registry.storage<entt::entity>().reserve(4));
|
||||
ASSERT_EQ(registry.storage<entt::entity>().capacity(), 4u);
|
||||
ASSERT_TRUE(registry.storage<entt::entity>().empty());
|
||||
|
||||
ASSERT_EQ(registry.storage<int>().size(), 0u);
|
||||
@@ -138,7 +138,7 @@ TEST(Registry, Functionalities) {
|
||||
ASSERT_EQ(registry.try_get<double>(e0), nullptr);
|
||||
ASSERT_EQ(registry.try_get<double>(e1), nullptr);
|
||||
|
||||
ASSERT_EQ(registry.emplace<int>(e0, 42), 42);
|
||||
ASSERT_EQ(registry.emplace<int>(e0, 4), 4);
|
||||
ASSERT_EQ(registry.emplace<char>(e0, 'c'), 'c');
|
||||
ASSERT_NO_THROW(registry.erase<int>(e1));
|
||||
ASSERT_NO_THROW(registry.erase<char>(e1));
|
||||
@@ -154,17 +154,17 @@ TEST(Registry, Functionalities) {
|
||||
registry.emplace_or_replace<char>(e2, registry.get<char>(e0));
|
||||
|
||||
ASSERT_TRUE((registry.all_of<int, char>(e2)));
|
||||
ASSERT_EQ(registry.get<int>(e0), 42);
|
||||
ASSERT_EQ(registry.get<int>(e0), 4);
|
||||
ASSERT_EQ(registry.get<char>(e0), 'c');
|
||||
|
||||
ASSERT_NE(registry.try_get<int>(e0), nullptr);
|
||||
ASSERT_NE(registry.try_get<char>(e0), nullptr);
|
||||
ASSERT_EQ(registry.try_get<double>(e0), nullptr);
|
||||
ASSERT_EQ(*registry.try_get<int>(e0), 42);
|
||||
ASSERT_EQ(*registry.try_get<int>(e0), 4);
|
||||
ASSERT_EQ(*registry.try_get<char>(e0), 'c');
|
||||
|
||||
ASSERT_EQ(std::get<0>(registry.get<int, char>(e0)), 42);
|
||||
ASSERT_EQ(*std::get<0>(registry.try_get<int, char, double>(e0)), 42);
|
||||
ASSERT_EQ(std::get<0>(registry.get<int, char>(e0)), 4);
|
||||
ASSERT_EQ(*std::get<0>(registry.try_get<int, char, double>(e0)), 4);
|
||||
ASSERT_EQ(std::get<1>(static_cast<const entt::registry &>(registry).get<int, char>(e0)), 'c');
|
||||
ASSERT_EQ(*std::get<1>(static_cast<const entt::registry &>(registry).try_get<int, char, double>(e0)), 'c');
|
||||
|
||||
|
||||
@@ -287,8 +287,8 @@ TEST(Flow, Sync) {
|
||||
ENTT_DEBUG_TEST(FlowDeathTest, NoBind) {
|
||||
entt::flow flow{};
|
||||
|
||||
ASSERT_DEATH(flow.ro(42), "");
|
||||
ASSERT_DEATH(flow.rw(42), "");
|
||||
ASSERT_DEATH(flow.ro(4), "");
|
||||
ASSERT_DEATH(flow.rw(4), "");
|
||||
|
||||
flow.bind(0);
|
||||
|
||||
|
||||
@@ -86,5 +86,5 @@ ENTT_DEBUG_TEST_F(ServiceLocatorDeathTest, UninitializedValue) {
|
||||
|
||||
entt::locator<base_service>::reset();
|
||||
|
||||
ASSERT_DEATH(entt::locator<base_service>::value().invoke(42), "");
|
||||
ASSERT_DEATH(entt::locator<base_service>::value().invoke(4), "");
|
||||
}
|
||||
|
||||
@@ -144,8 +144,8 @@ public:
|
||||
|
||||
protected:
|
||||
static constexpr int global_marker = 1;
|
||||
static constexpr int local_marker = 42;
|
||||
static constexpr int bucket_value = 99;
|
||||
static constexpr int local_marker = 4;
|
||||
static constexpr int bucket_value = 2;
|
||||
static constexpr int prop_value = 3;
|
||||
|
||||
private:
|
||||
|
||||
@@ -127,10 +127,10 @@ TEST_F(MetaUtility, MetaSetter) {
|
||||
clazz instance{};
|
||||
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::static_setter>(instance, instance)));
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::static_setter>(std::as_const(instance), 42)));
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::static_setter>(invalid, 42)));
|
||||
ASSERT_TRUE((entt::meta_setter<clazz, &clazz::static_setter>(instance, 42)));
|
||||
ASSERT_EQ(instance.member, 42);
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::static_setter>(std::as_const(instance), 4)));
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::static_setter>(invalid, 4)));
|
||||
ASSERT_TRUE((entt::meta_setter<clazz, &clazz::static_setter>(instance, 4)));
|
||||
ASSERT_EQ(instance.member, 4);
|
||||
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::setter>(instance, instance)));
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::setter>(std::as_const(instance), 3)));
|
||||
@@ -139,12 +139,12 @@ TEST_F(MetaUtility, MetaSetter) {
|
||||
ASSERT_EQ(instance.member, 3);
|
||||
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::member>(instance, instance)));
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::member>(invalid, 99)));
|
||||
ASSERT_TRUE((entt::meta_setter<clazz, &clazz::member>(instance, 99)));
|
||||
ASSERT_EQ(instance.member, 99);
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::member>(invalid, 8)));
|
||||
ASSERT_TRUE((entt::meta_setter<clazz, &clazz::member>(instance, 8)));
|
||||
ASSERT_EQ(instance.member, 8);
|
||||
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::cmember>(instance, 99)));
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::cmember>(invalid, 99)));
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::cmember>(instance, 8)));
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::cmember>(invalid, 8)));
|
||||
ASSERT_EQ(instance.cmember, 0);
|
||||
|
||||
ASSERT_FALSE((entt::meta_setter<clazz, &clazz::value>(instance, instance)));
|
||||
@@ -184,8 +184,8 @@ TEST_F(MetaUtility, MetaGetter) {
|
||||
ASSERT_EQ((entt::meta_getter<clazz, &clazz::cvalue>(invalid)).cast<int>(), 0);
|
||||
ASSERT_EQ((entt::meta_getter<clazz, &clazz::cvalue>(instance)).cast<int>(), 0);
|
||||
|
||||
ASSERT_EQ((entt::meta_getter<clazz, 42>(invalid)).cast<int>(), 42);
|
||||
ASSERT_EQ((entt::meta_getter<clazz, 42>(instance)).cast<int>(), 42);
|
||||
ASSERT_EQ((entt::meta_getter<clazz, 4>(invalid)).cast<int>(), 4);
|
||||
ASSERT_EQ((entt::meta_getter<clazz, 4>(instance)).cast<int>(), 4);
|
||||
}
|
||||
|
||||
TEST_F(MetaUtility, MetaInvokeWithCandidate) {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
TEST(ResourceLoader, Functionalities) {
|
||||
using loader_type = entt::resource_loader<int>;
|
||||
const auto resource = loader_type{}(42);
|
||||
const auto resource = loader_type{}(4);
|
||||
|
||||
testing::StaticAssertTypeEq<typename loader_type::result_type, std::shared_ptr<int>>();
|
||||
|
||||
ASSERT_TRUE(resource);
|
||||
ASSERT_EQ(*resource, 42);
|
||||
ASSERT_EQ(*resource, 4);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ TEST(Example, DisabledEntity) {
|
||||
entt::basic_registry<my_entity> registry{};
|
||||
auto view = registry.view<my_entity, int>();
|
||||
|
||||
const my_entity entity = registry.create(entt::basic_registry<my_entity>::traits_type::construct(42u, 12u));
|
||||
const my_entity entity = registry.create(entt::basic_registry<my_entity>::traits_type::construct(4u, 1u));
|
||||
const my_entity other = registry.create(entt::basic_registry<my_entity>::traits_type::construct(3u, 0u));
|
||||
|
||||
registry.emplace<int>(entity);
|
||||
|
||||
@@ -28,7 +28,7 @@ TEST(Lib, Dispatcher) {
|
||||
ctx.userdata = &dispatcher;
|
||||
cr_plugin_update(ctx);
|
||||
|
||||
ASSERT_EQ(listener.value, 42);
|
||||
ASSERT_EQ(listener.value, 4);
|
||||
|
||||
dispatcher = {};
|
||||
cr_plugin_close(ctx);
|
||||
|
||||
@@ -6,7 +6,7 @@ CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
|
||||
switch(operation) {
|
||||
case CR_STEP:
|
||||
static_cast<entt::dispatcher *>(ctx->userdata)->trigger<event>();
|
||||
static_cast<entt::dispatcher *>(ctx->userdata)->trigger(message{42});
|
||||
static_cast<entt::dispatcher *>(ctx->userdata)->trigger(message{4});
|
||||
break;
|
||||
case CR_CLOSE:
|
||||
case CR_LOAD:
|
||||
|
||||
@@ -21,7 +21,7 @@ TEST(Lib, Emitter) {
|
||||
ctx.userdata = &emitter;
|
||||
cr_plugin_update(ctx);
|
||||
|
||||
ASSERT_EQ(value, 42);
|
||||
ASSERT_EQ(value, 4);
|
||||
|
||||
emitter = {};
|
||||
cr_plugin_close(ctx);
|
||||
|
||||
@@ -5,7 +5,7 @@ CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
|
||||
switch(operation) {
|
||||
case CR_STEP:
|
||||
static_cast<test_emitter *>(ctx->userdata)->publish(event{});
|
||||
static_cast<test_emitter *>(ctx->userdata)->publish(message{42});
|
||||
static_cast<test_emitter *>(ctx->userdata)->publish(message{4});
|
||||
static_cast<test_emitter *>(ctx->userdata)->publish(message{3});
|
||||
break;
|
||||
case CR_CLOSE:
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#include "types.h"
|
||||
|
||||
TEST(Lib, Locator) {
|
||||
entt::locator<service>::emplace().value = 42;
|
||||
entt::locator<service>::emplace().value = 4;
|
||||
|
||||
ASSERT_EQ(entt::locator<service>::value().value, 42);
|
||||
ASSERT_EQ(entt::locator<service>::value().value, 4);
|
||||
|
||||
userdata ud{entt::locator<service>::handle(), 3};
|
||||
|
||||
@@ -22,7 +22,7 @@ TEST(Lib, Locator) {
|
||||
ASSERT_EQ(entt::locator<service>::value().value, ud.value);
|
||||
|
||||
// service updates do not propagate across boundaries
|
||||
entt::locator<service>::emplace().value = 42;
|
||||
entt::locator<service>::emplace().value = 4;
|
||||
cr_plugin_update(ctx);
|
||||
|
||||
ASSERT_NE(entt::locator<service>::value().value, ud.value);
|
||||
|
||||
@@ -7,9 +7,9 @@ ENTT_API void set_up(const entt::locator<service>::node_type &);
|
||||
ENTT_API void use_service(int);
|
||||
|
||||
TEST(Lib, Locator) {
|
||||
entt::locator<service>::emplace().value = 42;
|
||||
entt::locator<service>::emplace().value = 4;
|
||||
|
||||
ASSERT_EQ(entt::locator<service>::value().value, 42);
|
||||
ASSERT_EQ(entt::locator<service>::value().value, 4);
|
||||
|
||||
set_up(entt::locator<service>::handle());
|
||||
use_service(3);
|
||||
@@ -17,8 +17,8 @@ TEST(Lib, Locator) {
|
||||
ASSERT_EQ(entt::locator<service>::value().value, 3);
|
||||
|
||||
// service updates do not propagate across boundaries
|
||||
entt::locator<service>::emplace().value = 42;
|
||||
entt::locator<service>::emplace().value = 4;
|
||||
use_service(3);
|
||||
|
||||
ASSERT_EQ(entt::locator<service>::value().value, 42);
|
||||
ASSERT_EQ(entt::locator<service>::value().value, 4);
|
||||
}
|
||||
|
||||
@@ -28,14 +28,14 @@ TEST(Lib, Meta) {
|
||||
ASSERT_TRUE(entt::resolve("position"_hs));
|
||||
ASSERT_TRUE(entt::resolve("velocity"_hs));
|
||||
|
||||
auto pos = entt::resolve("position"_hs).construct(42., 3.);
|
||||
auto pos = entt::resolve("position"_hs).construct(4., 3.);
|
||||
auto vel = entt::resolve("velocity"_hs).construct();
|
||||
|
||||
ASSERT_TRUE(pos && vel);
|
||||
|
||||
ASSERT_EQ(pos.type().data("x"_hs).type(), entt::resolve<int>());
|
||||
ASSERT_NE(pos.type().data("y"_hs).get(pos).try_cast<int>(), nullptr);
|
||||
ASSERT_EQ(pos.type().data("x"_hs).get(pos).cast<int>(), 42);
|
||||
ASSERT_EQ(pos.type().data("x"_hs).get(pos).cast<int>(), 4);
|
||||
ASSERT_EQ(pos.type().data("y"_hs).get(pos).cast<int>(), 3);
|
||||
|
||||
ASSERT_EQ(vel.type().data("dx"_hs).type(), entt::resolve<double>());
|
||||
@@ -44,7 +44,7 @@ TEST(Lib, Meta) {
|
||||
ASSERT_EQ(vel.type().data("dy"_hs).get(vel).cast<double>(), 0.);
|
||||
|
||||
ASSERT_EQ(ud.any.type(), entt::resolve<int>());
|
||||
ASSERT_EQ(ud.any.cast<int>(), 42);
|
||||
ASSERT_EQ(ud.any.cast<int>(), 4);
|
||||
|
||||
// these objects have been initialized from a different context
|
||||
pos.emplace<void>();
|
||||
|
||||
@@ -39,7 +39,7 @@ CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
|
||||
set_up();
|
||||
break;
|
||||
case CR_STEP:
|
||||
static_cast<userdata *>(ctx->userdata)->any = 42;
|
||||
static_cast<userdata *>(ctx->userdata)->any = 4;
|
||||
break;
|
||||
case CR_UNLOAD:
|
||||
case CR_CLOSE:
|
||||
|
||||
@@ -29,14 +29,14 @@ TEST(Lib, Meta) {
|
||||
ASSERT_TRUE(entt::resolve("position"_hs));
|
||||
ASSERT_TRUE(entt::resolve("velocity"_hs));
|
||||
|
||||
auto pos = entt::resolve("position"_hs).construct(42., 3.);
|
||||
auto pos = entt::resolve("position"_hs).construct(4., 3.);
|
||||
auto vel = entt::resolve("velocity"_hs).construct();
|
||||
|
||||
ASSERT_TRUE(pos && vel);
|
||||
|
||||
ASSERT_EQ(pos.type().data("x"_hs).type(), entt::resolve<int>());
|
||||
ASSERT_NE(pos.type().data("y"_hs).get(pos).try_cast<int>(), nullptr);
|
||||
ASSERT_EQ(pos.type().data("x"_hs).get(pos).cast<int>(), 42);
|
||||
ASSERT_EQ(pos.type().data("x"_hs).get(pos).cast<int>(), 4);
|
||||
ASSERT_EQ(pos.type().data("y"_hs).get(pos).cast<int>(), 3);
|
||||
|
||||
ASSERT_EQ(vel.type().data("dx"_hs).type(), entt::resolve<double>());
|
||||
@@ -45,7 +45,7 @@ TEST(Lib, Meta) {
|
||||
ASSERT_EQ(vel.type().data("dy"_hs).get(vel).cast<double>(), 0.);
|
||||
|
||||
ASSERT_EQ(ud.any.type(), entt::resolve<int>());
|
||||
ASSERT_EQ(ud.any.cast<int>(), 42);
|
||||
ASSERT_EQ(ud.any.cast<int>(), 4);
|
||||
|
||||
// these objects have been initialized from a different context
|
||||
pos.emplace<void>();
|
||||
|
||||
@@ -39,7 +39,7 @@ CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
|
||||
set_up();
|
||||
break;
|
||||
case CR_STEP:
|
||||
static_cast<userdata *>(ctx->userdata)->any = 42;
|
||||
static_cast<userdata *>(ctx->userdata)->any = 4;
|
||||
break;
|
||||
case CR_UNLOAD:
|
||||
case CR_CLOSE:
|
||||
|
||||
@@ -29,14 +29,14 @@ TEST(Lib, Meta) {
|
||||
ASSERT_EQ(entt::resolve<position>(), entt::resolve("position"_hs));
|
||||
ASSERT_EQ(entt::resolve<velocity>(), entt::resolve("velocity"_hs));
|
||||
|
||||
auto pos = entt::resolve("position"_hs).construct(42., 3.);
|
||||
auto pos = entt::resolve("position"_hs).construct(4., 3.);
|
||||
auto vel = entt::resolve("velocity"_hs).construct();
|
||||
|
||||
ASSERT_TRUE(pos && vel);
|
||||
|
||||
ASSERT_EQ(pos.type().data("x"_hs).type(), entt::resolve<int>());
|
||||
ASSERT_NE(pos.type().data("y"_hs).get(pos).try_cast<int>(), nullptr);
|
||||
ASSERT_EQ(pos.type().data("x"_hs).get(pos).cast<int>(), 42);
|
||||
ASSERT_EQ(pos.type().data("x"_hs).get(pos).cast<int>(), 4);
|
||||
ASSERT_EQ(pos.type().data("y"_hs).get(pos).cast<int>(), 3);
|
||||
|
||||
ASSERT_EQ(vel.type().data("dx"_hs).type(), entt::resolve<double>());
|
||||
@@ -47,8 +47,8 @@ TEST(Lib, Meta) {
|
||||
pos.reset();
|
||||
vel.reset();
|
||||
|
||||
ASSERT_EQ(wrap_int(42).type(), entt::resolve<int>());
|
||||
ASSERT_EQ(wrap_int(42).cast<int>(), 42);
|
||||
ASSERT_EQ(wrap_int(4).type(), entt::resolve<int>());
|
||||
ASSERT_EQ(wrap_int(4).cast<int>(), 4);
|
||||
|
||||
tear_down();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user