Browse Source

test: code coverage

Michele Caini 3 years ago
parent
commit
6cab12a14f
3 changed files with 22 additions and 0 deletions
  1. 2 0
      test/entt/meta/meta_data.cpp
  2. 4 0
      test/entt/meta/meta_func.cpp
  3. 16 0
      test/entt/meta/meta_type.cpp

+ 2 - 0
test/entt/meta/meta_data.cpp

@@ -579,6 +579,7 @@ TEST_F(MetaData, AsRef) {
     ASSERT_EQ(data.arity(), 1u);
     ASSERT_EQ(data.type(), entt::resolve<int>());
     ASSERT_EQ(data.arg(0u), entt::resolve<int>());
+    ASSERT_NE(data.prop().cbegin(), data.prop().cend());
     ASSERT_EQ(instance.i, 0);
 
     data.get(instance).cast<int &>() = 3;
@@ -598,6 +599,7 @@ TEST_F(MetaData, AsConstRef) {
     ASSERT_EQ(data.arg(0u), entt::resolve<int>());
     ASSERT_EQ(data.get(instance).cast<const int &>(), 0);
     ASSERT_EQ(data.get(instance).cast<int>(), 0);
+    ASSERT_EQ(data.prop().cbegin(), data.prop().cend());
     ASSERT_EQ(instance.i, 0);
 }
 

+ 4 - 0
test/entt/meta/meta_func.cpp

@@ -350,6 +350,8 @@ TEST_F(MetaFunc, StaticAsMember) {
     ASSERT_EQ(func.arg(0u), entt::resolve<int>());
     ASSERT_FALSE(func.arg(1u));
 
+    ASSERT_EQ(func.prop().cbegin(), func.prop().cend());
+
     ASSERT_FALSE(func.invoke({}, 42));
     ASSERT_FALSE(func.invoke(std::as_const(instance), 42));
 
@@ -372,6 +374,8 @@ TEST_F(MetaFunc, StaticAsConstMember) {
     ASSERT_EQ(func.ret(), entt::resolve<int>());
     ASSERT_FALSE(func.arg(0u));
 
+    ASSERT_EQ(func.prop().cbegin(), func.prop().cend());
+
     ASSERT_FALSE(func.invoke({}));
     ASSERT_TRUE(func.invoke(instance));
 

+ 16 - 0
test/entt/meta/meta_type.cpp

@@ -335,6 +335,11 @@ TEST_F(MetaType, Data) {
 
     ASSERT_EQ(counter, 1);
     ASSERT_TRUE(type.data("value"_hs));
+
+    type = entt::resolve<void>();
+
+    ASSERT_TRUE(type);
+    ASSERT_EQ(type.data().cbegin(), type.data().cend());
 }
 
 TEST_F(MetaType, Func) {
@@ -353,6 +358,11 @@ TEST_F(MetaType, Func) {
     ASSERT_TRUE(type.func("func"_hs));
     ASSERT_TRUE(type.func("member"_hs).invoke(instance));
     ASSERT_TRUE(type.func("func"_hs).invoke({}));
+
+    type = entt::resolve<void>();
+
+    ASSERT_TRUE(type);
+    ASSERT_EQ(type.func().cbegin(), type.func().cend());
 }
 
 TEST_F(MetaType, Invoke) {
@@ -628,6 +638,8 @@ TEST_F(MetaType, PropertiesAndCornerCases) {
 
     auto type = entt::resolve<property_t>();
 
+    ASSERT_EQ(type.prop().cbegin(), type.prop().cend());
+
     ASSERT_EQ(type.data("random"_hs).prop(static_cast<entt::id_type>(property_t::random)).value().cast<int>(), 0);
     ASSERT_EQ(type.data("random"_hs).prop(static_cast<entt::id_type>(property_t::value)).value().cast<int>(), 3);
 
@@ -643,6 +655,10 @@ TEST_F(MetaType, PropertiesAndCornerCases) {
     ASSERT_EQ(type.data("list"_hs).prop(static_cast<entt::id_type>(property_t::value)).value().cast<int>(), 0);
     ASSERT_TRUE(type.data("list"_hs).prop(static_cast<entt::id_type>(property_t::key_only)));
     ASSERT_FALSE(type.data("list"_hs).prop(static_cast<entt::id_type>(property_t::key_only)).value());
+
+    type = entt::resolve<void>();
+
+    ASSERT_EQ(type.prop().cbegin(), type.prop().cend());
 }
 
 TEST_F(MetaType, ResetAndReRegistrationAfterReset) {