Lines Matching refs:Function

47 static_assert(std::is_invocable_r_v<void, ftl::Function<void()>>);
48 static_assert(std::is_trivially_copyable_v<ftl::Function<void()>>);
49 static_assert(std::is_trivially_destructible_v<ftl::Function<void()>>);
50 static_assert(std::is_trivially_copy_constructible_v<ftl::Function<void()>>);
51 static_assert(std::is_trivially_move_constructible_v<ftl::Function<void()>>);
52 static_assert(std::is_trivially_copy_assignable_v<ftl::Function<void()>>);
53 static_assert(std::is_trivially_move_assignable_v<ftl::Function<void()>>);
69 static_assert(ftl::is_function_v<ftl::Function<void()>>);
100 TEST(Function, Example) { in TEST() argument
114 ftl::Function<void()> f; in TEST()
132 using MyFunction = ftl::Function<int(std::string_view), 2>; in TEST()
144 TEST(Function, BasicOperations) { in TEST() argument
146 ftl::Function<int()> f; in TEST()
152 EXPECT_TRUE(ftl::Function<int()>() == f); in TEST()
153 EXPECT_FALSE(ftl::Function<int()>() != f); in TEST()
165 EXPECT_FALSE(ftl::Function<int()>() == f); in TEST()
166 EXPECT_TRUE(ftl::Function<int()>() != f); in TEST()
169 f = ftl::Function<int()>{nullptr}; in TEST()
178 ftl::Function<int()> g{std::move(f)}; in TEST()
187 ftl::Function<int()> h{f}; in TEST()
195 TEST(Function, CanMoveConstructFromLambda) { in TEST() argument
197 ftl::Function<void()> f{std::move(lambda)}; in TEST()
200 TEST(Function, TerseDeducedConstructAndAssignFromLambda) { in TEST() argument
201 auto f = ftl::Function([] { return 1; }); in TEST()
230 TEST(Function, ImplicitConversions) { in TEST() argument
231 using Function = ftl::Function<int(int)>; in TEST() typedef
232 auto check = [](Function f) { return f(0); }; in TEST()
249 EXPECT_EQ(check(Function::make<&ImplicitConversionsHelper::exact>(&helper)), 0); in TEST()
250 EXPECT_EQ(check(Function::make<&ImplicitConversionsHelper::inexact>(&helper)), 0); in TEST()
251 EXPECT_EQ(check(Function::make<&ImplicitConversionsHelper::templated<int>>(&helper)), 0); in TEST()
253 EXPECT_EQ(check(Function::make<&ImplicitConversionsHelper::static_exact>()), 0); in TEST()
254 EXPECT_EQ(check(Function::make<&ImplicitConversionsHelper::static_inexact>()), 0); in TEST()
255 EXPECT_EQ(check(Function::make<&ImplicitConversionsHelper::static_templated<int>>()), 0); in TEST()
258 TEST(Function, MakeWithNonConstMemberFunction) { in TEST() argument
270 EXPECT_TRUE(f == ftl::Function<void()>::make<&Observer::setCalled>(&observer)); in TEST()
273 TEST(Function, MakeWithConstMemberFunction) { in TEST() argument
285 EXPECT_TRUE(f == ftl::Function<void()>::make<&Observer::setCalled>(&observer)); in TEST()
288 TEST(Function, MakeWithConstClassPointer) { in TEST() argument
300 EXPECT_TRUE(f == ftl::Function<void()>::make<&Observer::setCalled>(&observer)); in TEST()
303 TEST(Function, MakeWithNonCapturingLambda) { in TEST() argument
308 TEST(Function, MakeWithCapturingLambda) { in TEST() argument
318 TEST(Function, MakeWithCapturingMutableLambda) { in TEST() argument
328 TEST(Function, MakeWithThreePointerCapturingLambda) { in TEST() argument
349 TEST(Function, MakeWithFreeFunction) { in TEST() argument
356 TEST(Function, CopyToLarger) { in TEST() argument
358 ftl::Function<void()> a{[ptr_counter = &counter] { (*ptr_counter)++; }}; in TEST()
359 ftl::Function<void(), 1> b = a; in TEST()
360 ftl::Function<void(), 2> c = a; in TEST()