Browse Source

test: minor changes (code coverage)

Michele Caini 5 years ago
parent
commit
a5fdf917df

+ 7 - 5
test/entt/meta/meta_any.cpp

@@ -5,11 +5,13 @@
 #include <entt/meta/resolve.hpp>
 #include <entt/meta/resolve.hpp>
 
 
 struct clazz_t {
 struct clazz_t {
+    clazz_t(): value{0} {}
+
     void member(int i) { value = i; }
     void member(int i) { value = i; }
     static void func() { c = 'd'; }
     static void func() { c = 'd'; }
 
 
     static inline char c = 'c';
     static inline char c = 'c';
-    int value = 0;
+    int value;
 };
 };
 
 
 struct empty_t {
 struct empty_t {
@@ -22,18 +24,18 @@ struct empty_t {
 };
 };
 
 
 struct fat_t: empty_t {
 struct fat_t: empty_t {
-    fat_t() = default;
+    fat_t(): foo{}, bar{}, gnam{} {}
 
 
     fat_t(int *value)
     fat_t(int *value)
-        : foo{value}, bar{value}
+        : foo{value}, bar{value}, gnam{}
     {}
     {}
 
 
     bool operator==(const fat_t &other) const {
     bool operator==(const fat_t &other) const {
         return foo == other.foo && bar == other.bar;
         return foo == other.foo && bar == other.bar;
     }
     }
 
 
-    int *foo{nullptr};
-    int *bar{nullptr};
+    int *foo;
+    int *bar;
     double gnam[4];
     double gnam[4];
 };
 };
 
 

+ 4 - 4
test/entt/meta/meta_ctor.cpp

@@ -6,8 +6,8 @@
 #include <entt/meta/meta.hpp>
 #include <entt/meta/meta.hpp>
 #include <entt/meta/resolve.hpp>
 #include <entt/meta/resolve.hpp>
 
 
-struct base_t { char value{}; };
-struct derived_t: base_t {};
+struct base_t { base_t(): value{'c'} {} char value; };
+struct derived_t: base_t { derived_t(): base_t{} {} };
 
 
 struct clazz_t {
 struct clazz_t {
     clazz_t(const base_t &other, int iv)
     clazz_t(const base_t &other, int iv)
@@ -131,7 +131,7 @@ TEST_F(MetaCtor, InvalidArgs) {
 }
 }
 
 
 TEST_F(MetaCtor, CastAndConvert) {
 TEST_F(MetaCtor, CastAndConvert) {
-    auto any = entt::resolve<clazz_t>().ctor<const base_t &, int>().invoke(derived_t{{'c'}}, 42.);
+    auto any = entt::resolve<clazz_t>().ctor<const base_t &, int>().invoke(derived_t{}, 42.);
 
 
     ASSERT_TRUE(any);
     ASSERT_TRUE(any);
     ASSERT_EQ(any.cast<clazz_t>().i, 42);
     ASSERT_EQ(any.cast<clazz_t>().i, 42);
@@ -163,7 +163,7 @@ TEST_F(MetaCtor, FuncInvalidArgs) {
 }
 }
 
 
 TEST_F(MetaCtor, FuncCastAndConvert) {
 TEST_F(MetaCtor, FuncCastAndConvert) {
-    auto any = entt::resolve<clazz_t>().ctor<base_t, int, int>().invoke(derived_t{{'c'}}, 3., 3);
+    auto any = entt::resolve<clazz_t>().ctor<base_t, int, int>().invoke(derived_t{}, 3., 3);
 
 
     ASSERT_TRUE(any);
     ASSERT_TRUE(any);
     ASSERT_EQ(any.cast<clazz_t>().i, 9);
     ASSERT_EQ(any.cast<clazz_t>().i, 9);

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

@@ -25,6 +25,8 @@ struct clazz_t {
 };
 };
 
 
 struct setter_getter_t {
 struct setter_getter_t {
+    setter_getter_t(): value{0} {}
+
     int setter(int val) {
     int setter(int val) {
         return value = val;
         return value = val;
     }
     }
@@ -49,7 +51,7 @@ struct setter_getter_t {
         return type.value;
         return type.value;
     }
     }
 
 
-    int value{};
+    int value;
 };
 };
 
 
 struct array_t {
 struct array_t {

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

@@ -19,16 +19,17 @@ Type get(Type &prop) {
     return prop;
     return prop;
 }
 }
 
 
-struct base_t { char value{'c'}; };
-struct derived_t: base_t {};
+struct base_t { base_t(): value{'c'} {}; char value; };
+struct derived_t: base_t { derived_t(): base_t{} {} };
 
 
 struct abstract_t {
 struct abstract_t {
     virtual ~abstract_t() = default;
     virtual ~abstract_t() = default;
-    virtual void func(int) = 0;
+    virtual void func(int) {}
 };
 };
 
 
 struct concrete_t: base_t, abstract_t {
 struct concrete_t: base_t, abstract_t {
     void func(int v) override {
     void func(int v) override {
+        abstract_t::func(v);
         value = v;
         value = v;
     }
     }