test: cleanup

This commit is contained in:
Michele Caini
2021-03-28 00:02:51 +01:00
parent bb43bb5508
commit 02ef5db6e3
8 changed files with 21 additions and 21 deletions

View File

@@ -131,7 +131,7 @@ TEST(PolyStorage, Constness) {
// cannot invoke remove on a const storage, let's copy the returned value
auto cstorage = cregistry.storage(entt::type_id<int>());
ASSERT_DEATH(cstorage->remove(registry, std::begin(entity), std::end(entity)), ".*");
ASSERT_DEATH(cstorage->remove(registry, std::begin(entity), std::end(entity)), "");
ASSERT_TRUE(registry.all_of<int>(entity[0]));
auto &&storage = registry.storage(entt::type_id<int>());

View File

@@ -156,7 +156,7 @@ TEST_F(MetaAny, SBOAsConstRefConstruction) {
ASSERT_TRUE(any);
ASSERT_FALSE(any.try_cast<std::size_t>());
ASSERT_DEATH(any.cast<int &>() = 3, ".*");
ASSERT_DEATH(any.cast<int &>() = 3, "");
ASSERT_EQ(any.cast<const int &>(), 3);
ASSERT_EQ(any.cast<int>(), 3);
ASSERT_EQ(any.data(), nullptr);
@@ -267,7 +267,7 @@ TEST_F(MetaAny, NoSBOAsConstRefConstruction) {
ASSERT_TRUE(any);
ASSERT_FALSE(any.try_cast<std::size_t>());
ASSERT_DEATH(any.cast<fat_t &>() = {}, ".*");
ASSERT_DEATH(any.cast<fat_t &>() = {}, "");
ASSERT_EQ(any.cast<const fat_t &>(), instance);
ASSERT_EQ(any.cast<fat_t>(), instance);
ASSERT_EQ(any.data(), nullptr);
@@ -612,7 +612,7 @@ TEST_F(MetaAny, AsRef) {
ASSERT_EQ(any.cast<const int &>(), 42);
ASSERT_EQ(ref.cast<int &>(), 42);
ASSERT_EQ(ref.cast<const int &>(), 42);
ASSERT_DEATH(cref.cast<int &>() = 3, ".*");
ASSERT_DEATH(cref.cast<int &>() = 3, "");
ASSERT_EQ(cref.cast<const int &>(), 42);
any.cast<int &>() = 3;
@@ -634,8 +634,8 @@ TEST_F(MetaAny, AsRef) {
ASSERT_EQ(ref.try_cast<const int>(), any.data());
ASSERT_EQ(cref.try_cast<const int>(), any.data());
ASSERT_DEATH(ref.cast<int &>() = 3, ".*");
ASSERT_DEATH(cref.cast<int &>() = 3, ".*");
ASSERT_DEATH(ref.cast<int &>() = 3, "");
ASSERT_DEATH(cref.cast<int &>() = 3, "");
ASSERT_EQ(ref.cast<const int &>(), 3);
ASSERT_EQ(cref.cast<const int &>(), 3);

View File

@@ -301,7 +301,7 @@ TEST_F(MetaContainer, ConstSequenceContainer) {
ASSERT_EQ(view.size(), 1u);
ASSERT_NE(view.begin(), view.end());
ASSERT_DEATH(view[0].cast<int &>() = 2, ".*");
ASSERT_DEATH(view[0].cast<int &>() = 2, "");
ASSERT_EQ(view[0].cast<const int &>(), 42);
auto it = view.begin();
@@ -342,7 +342,7 @@ TEST_F(MetaContainer, ConstKeyValueAssociativeContainer) {
ASSERT_EQ(view.size(), 1u);
ASSERT_NE(view.begin(), view.end());
ASSERT_DEATH((*view.find(2)).second.cast<char &>() = 'a', ".*");
ASSERT_DEATH((*view.find(2)).second.cast<char &>() = 'a', "");
ASSERT_EQ((*view.find(2)).second.cast<const char &>(), 'c');
ASSERT_FALSE(view.insert(0, 'a'));
@@ -402,7 +402,7 @@ TEST_F(MetaContainer, SequenceContainerConstMetaAny) {
ASSERT_TRUE(view);
ASSERT_EQ(view.value_type(), entt::resolve<int>());
ASSERT_DEATH(view[0].cast<int &>() = 2, ".*");
ASSERT_DEATH(view[0].cast<int &>() = 2, "");
ASSERT_EQ(view[0].cast<const int &>(), 42);
};
@@ -419,7 +419,7 @@ TEST_F(MetaContainer, KeyValueAssociativeContainerConstMetaAny) {
ASSERT_TRUE(view);
ASSERT_EQ(view.value_type(), (entt::resolve<std::pair<const int, char>>()));
ASSERT_DEATH((*view.find(2)).second.cast<char &>() = 'a', ".*");
ASSERT_DEATH((*view.find(2)).second.cast<char &>() = 'a', "");
ASSERT_EQ((*view.find(2)).second.cast<const char &>(), 'c');
};

View File

@@ -531,7 +531,7 @@ TEST_F(MetaData, AsConstRef) {
ASSERT_EQ(instance.i, 0);
ASSERT_EQ(data.type(), entt::resolve<int>());
ASSERT_DEATH(data.get(instance).cast<int &>() = 3, ".*");
ASSERT_DEATH(data.get(instance).cast<int &>() = 3, "");
ASSERT_EQ(data.get(instance).cast<const int &>(), 0);
ASSERT_EQ(data.get(instance).cast<int>(), 0);
ASSERT_EQ(instance.i, 0);

View File

@@ -392,7 +392,7 @@ TEST_F(MetaFunc, AsConstRef) {
func_t instance{};
auto func = entt::resolve<func_t>().func("ca"_hs);
ASSERT_DEATH((func.invoke(instance).cast<int &>() = 3), ".*");
ASSERT_DEATH((func.invoke(instance).cast<int &>() = 3), "");
ASSERT_EQ(func.ret(), entt::resolve<int>());
ASSERT_EQ(func.invoke(instance).cast<const int &>(), 3);
ASSERT_EQ(func.invoke(instance).cast<int>(), 3);

View File

@@ -99,7 +99,7 @@ TEST(MetaPointerLike, DereferenceOperatorConstType) {
ASSERT_EQ(deref.try_cast<int>(), nullptr);
ASSERT_EQ(deref.try_cast<const int>(), &value);
ASSERT_DEATH(deref.cast<int &>() = 0, ".*");
ASSERT_DEATH(deref.cast<int &>() = 0, "");
ASSERT_EQ(deref.cast<const int &>(), 42);
}
@@ -114,7 +114,7 @@ TEST(MetaPointerLike, DereferenceOperatorConstAny) {
ASSERT_EQ(deref.try_cast<int>(), nullptr);
ASSERT_NE(deref.try_cast<const int>(), nullptr);
ASSERT_DEATH(deref.cast<int &>() = 0, ".*");
ASSERT_DEATH(deref.cast<int &>() = 0, "");
ASSERT_EQ(deref.cast<const int &>(), 42);
};
@@ -255,7 +255,7 @@ TEST(MetaPointerLike, DereferencePointerToConstOverload) {
ASSERT_FALSE(deref.type().is_pointer_like());
ASSERT_EQ(deref.type(), entt::resolve<int>());
ASSERT_DEATH(deref.cast<int &>() = 42, ".*");
ASSERT_DEATH(deref.cast<int &>() = 42, "");
ASSERT_EQ(deref.cast<const int &>(), 42);
};

View File

@@ -166,14 +166,14 @@ TEST(PolyDeduced, ConstReference) {
ASSERT_EQ(instance.value, 0);
ASSERT_EQ(poly->get(), 0);
ASSERT_DEATH(poly->set(1), ".*");
ASSERT_DEATH(poly->incr(), ".*");
ASSERT_DEATH(poly->set(1), "");
ASSERT_DEATH(poly->incr(), "");
ASSERT_EQ(instance.value, 0);
ASSERT_EQ(poly->get(), 0);
ASSERT_EQ(poly->mul(3), 0);
ASSERT_DEATH(poly->decr(), ".*");
ASSERT_DEATH(poly->decr(), "");
ASSERT_EQ(instance.value, 0);
ASSERT_EQ(poly->get(), 0);

View File

@@ -172,14 +172,14 @@ TEST(PolyDefined, ConstReference) {
ASSERT_EQ(instance.value, 0);
ASSERT_EQ(poly->get(), 0);
ASSERT_DEATH(poly->set(1), ".*");
ASSERT_DEATH(poly->incr(), ".*");
ASSERT_DEATH(poly->set(1), "");
ASSERT_DEATH(poly->incr(), "");
ASSERT_EQ(instance.value, 0);
ASSERT_EQ(poly->get(), 0);
ASSERT_EQ(poly->mul(3), 0);
ASSERT_DEATH(poly->decr(), ".*");
ASSERT_DEATH(poly->decr(), "");
ASSERT_EQ(instance.value, 0);
ASSERT_EQ(poly->get(), 0);