Bladeren bron

test: suppress some warnings here and there

Michele Caini 5 jaren geleden
bovenliggende
commit
86c1dd7f32

+ 2 - 2
test/entt/entity/group.cpp

@@ -86,11 +86,11 @@ TEST(NonOwningGroup, Functionalities) {
     ASSERT_EQ(cgroup.rbegin(), cgroup.rend());
     ASSERT_EQ(cgroup.rbegin(), cgroup.rend());
     ASSERT_TRUE(group.empty());
     ASSERT_TRUE(group.empty());
 
 
-    ASSERT_TRUE(group.capacity());
+    ASSERT_NE(group.capacity(), 0u);
 
 
     group.shrink_to_fit();
     group.shrink_to_fit();
 
 
-    ASSERT_FALSE(group.capacity());
+    ASSERT_EQ(group.capacity(), 0u);
 }
 }
 
 
 TEST(NonOwningGroup, ElementAccess) {
 TEST(NonOwningGroup, ElementAccess) {

+ 1 - 1
test/entt/entity/snapshot.cpp

@@ -256,7 +256,7 @@ TEST(Snapshot, Iterator) {
     ASSERT_EQ(registry.view<another_component>().size(), size);
     ASSERT_EQ(registry.view<another_component>().size(), size);
 
 
     registry.view<another_component>().each([](const auto entity, const auto &) {
     registry.view<another_component>().each([](const auto entity, const auto &) {
-        ASSERT_TRUE(entt::to_integral(entity) % 2);
+        ASSERT_NE(entt::to_integral(entity) % 2u, 0u);
     });
     });
 }
 }
 
 

+ 1 - 1
test/entt/meta/meta_any.cpp

@@ -658,7 +658,7 @@ TEST_F(MetaAny, SetGet) {
     const auto value = any.get("value"_hs);
     const auto value = any.get("value"_hs);
 
 
 	ASSERT_TRUE(value);
 	ASSERT_TRUE(value);
-	ASSERT_TRUE(value.try_cast<int>());
+	ASSERT_NE(value.try_cast<int>(), nullptr);
 	ASSERT_EQ(value.cast<int>(), 42);
 	ASSERT_EQ(value.cast<int>(), 42);
     ASSERT_EQ(instance.value, 42);
     ASSERT_EQ(instance.value, 42);
 
 

+ 1 - 1
test/entt/meta/meta_data.cpp

@@ -216,7 +216,7 @@ TEST_F(MetaData, GetMetaAnyArg) {
     const auto value = entt::resolve<clazz_t>().data("i"_hs).get(any);
     const auto value = entt::resolve<clazz_t>().data("i"_hs).get(any);
 
 
     ASSERT_TRUE(value);
     ASSERT_TRUE(value);
-    ASSERT_TRUE(value.cast<int>());
+    ASSERT_TRUE(static_cast<bool>(value.cast<int>()));
     ASSERT_EQ(value.cast<int>(), 99);
     ASSERT_EQ(value.cast<int>(), 99);
 }
 }
 
 

+ 1 - 1
test/lib/meta/main.cpp

@@ -28,7 +28,7 @@ TEST(Lib, Meta) {
     ASSERT_TRUE(pos && vel);
     ASSERT_TRUE(pos && vel);
 
 
     ASSERT_EQ(pos.type().data("x"_hs).type(), entt::resolve<int>());
     ASSERT_EQ(pos.type().data("x"_hs).type(), entt::resolve<int>());
-    ASSERT_TRUE(pos.type().data("y"_hs).get(pos).try_cast<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>(), 42);
     ASSERT_EQ(pos.type().data("y"_hs).get(pos).cast<int>(), 3);
     ASSERT_EQ(pos.type().data("y"_hs).get(pos).cast<int>(), 3);
 
 

+ 1 - 1
test/lib/meta_plugin/main.cpp

@@ -29,7 +29,7 @@ TEST(Lib, Meta) {
     ASSERT_TRUE(pos && vel);
     ASSERT_TRUE(pos && vel);
 
 
     ASSERT_EQ(pos.type().data("x"_hs).type(), entt::resolve<int>());
     ASSERT_EQ(pos.type().data("x"_hs).type(), entt::resolve<int>());
-    ASSERT_TRUE(pos.type().data("y"_hs).get(pos).try_cast<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>(), 42);
     ASSERT_EQ(pos.type().data("y"_hs).get(pos).cast<int>(), 3);
     ASSERT_EQ(pos.type().data("y"_hs).get(pos).cast<int>(), 3);
 
 

+ 1 - 1
test/lib/meta_plugin_std/main.cpp

@@ -29,7 +29,7 @@ TEST(Lib, Meta) {
     ASSERT_TRUE(pos && vel);
     ASSERT_TRUE(pos && vel);
 
 
     ASSERT_EQ(pos.type().data("x"_hs).type(), entt::resolve<int>());
     ASSERT_EQ(pos.type().data("x"_hs).type(), entt::resolve<int>());
-    ASSERT_TRUE(pos.type().data("y"_hs).get(pos).try_cast<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>(), 42);
     ASSERT_EQ(pos.type().data("y"_hs).get(pos).cast<int>(), 3);
     ASSERT_EQ(pos.type().data("y"_hs).get(pos).cast<int>(), 3);