Browse Source

test: code coverage

Michele Caini 5 years ago
parent
commit
d814b7b11e
3 changed files with 11 additions and 40 deletions
  1. 6 36
      src/entt/meta/meta.hpp
  2. 2 4
      test/entt/core/type_info.cpp
  3. 3 0
      test/entt/meta/meta_type.cpp

+ 6 - 36
src/entt/meta/meta.hpp

@@ -1099,7 +1099,7 @@ public:
     }
 
     /**
-     * @brief Iterates all the meta bases of a meta type.
+     * @brief Iterates all top-level meta bases of a meta type.
      * @tparam Op Type of the function object to invoke.
      * @param op A valid function object.
      */
@@ -1108,7 +1108,6 @@ public:
     std::enable_if_t<std::is_invocable_v<Op, meta_base>>
     base(Op op) const {
         for(auto curr: base()) {
-            curr.type().base(op);
             op(curr);
         }
     }
@@ -1135,7 +1134,7 @@ public:
     }
 
     /**
-     * @brief Iterates all the meta conversion functions of a meta type.
+     * @brief Iterates all top-level meta conversion functions of a meta type.
      * @tparam Op Type of the function object to invoke.
      * @param op A valid function object.
      */
@@ -1145,10 +1144,6 @@ public:
         for(auto curr: conv()) {
             op(curr);
         }
-
-        for(auto curr: base()) {
-            curr.type().conv(op);
-        }
     }
 
     /**
@@ -1173,7 +1168,7 @@ public:
     }
 
     /**
-     * @brief Iterates all the meta constructors of a meta type.
+     * @brief Iterates all top-level meta constructors of a meta type.
      * @tparam Op Type of the function object to invoke.
      * @param op A valid function object.
      */
@@ -1183,10 +1178,6 @@ public:
         for(auto curr: ctor()) {
             op(curr);
         }
-
-        for(auto curr: base()) {
-            curr.type().ctor(op);
-        }
     }
 
     /**
@@ -1208,10 +1199,7 @@ public:
     }
 
     /**
-     * @brief Iterates all the meta data of a meta type.
-     *
-     * The meta data of the base classes will also be returned, if any.
-     *
+     * @brief Iterates all top-level meta data of a meta type.
      * @tparam Op Type of the function object to invoke.
      * @param op A valid function object.
      */
@@ -1222,10 +1210,6 @@ public:
         for(auto curr: data()) {
             op(curr);
         }
-
-        for(auto curr: base()) {
-            curr.type().data(op);
-        }
     }
 
     /**
@@ -1251,10 +1235,7 @@ public:
     }
 
     /**
-     * @brief Iterates all the meta functions of a meta type.
-     *
-     * The meta functions of the base classes will also be returned, if any.
-     *
+     * @brief Iterates all top-level meta functions of a meta type.
      * @tparam Op Type of the function object to invoke.
      * @param op A valid function object.
      */
@@ -1265,10 +1246,6 @@ public:
         for(auto curr: func()) {
             op(curr);
         }
-
-        for(auto curr: base()) {
-            curr.type().func(op);
-        }
     }
 
     /**
@@ -1325,10 +1302,7 @@ public:
     }
 
     /**
-     * @brief Iterates all meta properties assigned to a meta type.
-     *
-     * Properties of the base classes will also be returned, if any.
-     *
+     * @brief Iterates all top-level meta properties assigned to a meta type.
      * @tparam Op Type of the function object to invoke.
      * @param op A valid function object.
      */
@@ -1339,10 +1313,6 @@ public:
         for(auto curr: prop()) {
             op(curr);
         }
-
-        for(auto curr: base()) {
-            curr.type().prop(op);
-        }
     }
 
     /**

+ 2 - 4
test/entt/core/type_info.cpp

@@ -15,12 +15,10 @@ TEST(TypeInfo, Name) {
 
     ASSERT_TRUE((entt::type_info<entt::integral_constant<3>>::name() == std::string_view{"std::integral_constant<int, 3>"})
                 || (entt::type_info<entt::integral_constant<3>>::name() == std::string_view{"std::__1::integral_constant<int, 3>"})
-                || (entt::type_info<entt::integral_constant<3>>::name() == std::string_view{"struct std::integral_constant<int,3>"}))
-            << "Type name: " << entt::type_info<entt::integral_constant<3>>::name();
+                || (entt::type_info<entt::integral_constant<3>>::name() == std::string_view{"struct std::integral_constant<int,3>"}));
 
     ASSERT_TRUE(((entt::type_info<entt::type_list<entt::type_list<int, char>, double>>::name()) == std::string_view{"entt::type_list<entt::type_list<int, char>, double>"})
-                || ((entt::type_info<entt::type_list<entt::type_list<int, char>, double>>::name()) == std::string_view{"struct entt::type_list<struct entt::type_list<int,char>,double>"}))
-            << "Type name: " << entt::type_info<entt::integral_constant<3>>::name();
+                || ((entt::type_info<entt::type_list<entt::type_list<int, char>, double>>::name()) == std::string_view{"struct entt::type_list<struct entt::type_list<int,char>,double>"}));
 }
 
 TEST(TypeIndex, Functionalities) {

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

@@ -208,6 +208,7 @@ TEST_F(MetaType, Data) {
 
 TEST_F(MetaType, Func) {
     auto type = entt::resolve<clazz_t>();
+    clazz_t instance{};
     int counter{};
 
     type.func([&counter](auto) {
@@ -217,6 +218,8 @@ TEST_F(MetaType, Func) {
     ASSERT_EQ(counter, 2);
     ASSERT_TRUE(type.func("member"_hs));
     ASSERT_TRUE(type.func("func"_hs));
+    ASSERT_TRUE(type.func("member"_hs).invoke(instance));
+    ASSERT_TRUE(type.func("func"_hs).invoke({}));
 }
 
 TEST_F(MetaType, Construct) {