|
|
|
@ -85,6 +85,12 @@ struct UnaryFunctor { |
|
|
|
|
int operator()(bool x) { return x ? 1 : -1; } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
struct UnaryMoveOnlyFunctor : UnaryFunctor { |
|
|
|
|
UnaryMoveOnlyFunctor() = default; |
|
|
|
|
UnaryMoveOnlyFunctor(const UnaryMoveOnlyFunctor&) = delete; |
|
|
|
|
UnaryMoveOnlyFunctor(UnaryMoveOnlyFunctor&&) = default; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const char* Binary(const char* input, short n) { return input + n; } // NOLINT
|
|
|
|
|
|
|
|
|
|
int Ternary(int x, char y, short z) { return x + y + z; } // NOLINT
|
|
|
|
@ -698,12 +704,18 @@ TEST(InvokeArgumentTest, Function0) { |
|
|
|
|
EXPECT_EQ(1, a.Perform(std::make_tuple(2, &Nullary))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Tests using InvokeArgument with a unary function.
|
|
|
|
|
// Tests using InvokeArgument with a unary functor.
|
|
|
|
|
TEST(InvokeArgumentTest, Functor1) { |
|
|
|
|
Action<int(UnaryFunctor)> a = InvokeArgument<0>(true); // NOLINT
|
|
|
|
|
EXPECT_EQ(1, a.Perform(std::make_tuple(UnaryFunctor()))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Tests using InvokeArgument with a unary move-only functor.
|
|
|
|
|
TEST(InvokeArgumentTest, Functor1MoveOnly) { |
|
|
|
|
Action<int(UnaryMoveOnlyFunctor)> a = InvokeArgument<0>(true); // NOLINT
|
|
|
|
|
EXPECT_EQ(1, a.Perform(std::make_tuple(UnaryMoveOnlyFunctor()))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Tests using InvokeArgument with a 5-ary function.
|
|
|
|
|
TEST(InvokeArgumentTest, Function5) { |
|
|
|
|
Action<int(int (*)(int, int, int, int, int))> a = // NOLINT
|
|
|
|
|