Procházet zdrojové kódy

test: increase code coverage (const overload)

Michele Caini před 2 roky
rodič
revize
4786178705
1 změnil soubory, kde provedl 12 přidání a 3 odebrání
  1. 12 3
      test/entt/core/tuple.cpp

+ 12 - 3
test/entt/core/tuple.cpp

@@ -33,7 +33,16 @@ TEST(Tuple, UnwrapTuple) {
 }
 
 TEST(Tuple, ForwardApply) {
-    ASSERT_EQ(entt::forward_apply{[](auto &&...args) { return sizeof...(args); }}(std::make_tuple()), 0u);
-    ASSERT_EQ(entt::forward_apply{[](int i) { return i; }}(std::make_tuple(42)), 42);
-    ASSERT_EQ(entt::forward_apply{[](auto... args) { return (args + ...); }}(std::make_tuple('a', 1)), 'b');
+    entt::forward_apply first{[](auto &&...args) { return sizeof...(args); }};
+    entt::forward_apply second{[](int i) { return i; }};
+    entt::forward_apply third{[](auto... args) { return (args + ...); }};
+
+    ASSERT_EQ(first(std::make_tuple()), 0u);
+    ASSERT_EQ(std::as_const(first)(std::make_tuple()), 0u);
+
+    ASSERT_EQ(second(std::make_tuple(42)), 42);
+    ASSERT_EQ(std::as_const(second)(std::make_tuple(42)), 42);
+
+    ASSERT_EQ(third(std::make_tuple('a', 1)), 'b');
+    ASSERT_EQ(std::as_const(third)(std::make_tuple('a', 1)), 'b');
 }