Lines Matching full:action
56 using testing::Action;
204 Action<int()> a = Invoke(Nullary); // NOLINT
210 Action<bool(int)> a = Invoke(Unary); // NOLINT
217 Action<const char*(const char*, short)> a = Invoke(Binary); // NOLINT
224 Action<int(int, char, short)> a = Invoke(Ternary); // NOLINT
230 Action<int(int, int, int, int)> a = Invoke(SumOf4); // NOLINT
236 Action<int(int, int, int, int, int)> a = Invoke(SumOf5); // NOLINT
242 Action<int(int, int, int, int, int, int)> a = Invoke(SumOf6); // NOLINT
253 Action<std::string(const char*, const char*, const char*, const char*,
264 Action<std::string(const char*, const char*, const char*, const char*,
275 Action<std::string(const char*, const char*, const char*, const char*,
287 Action<std::string(const char*, const char*, const char*, const char*,
300 Action<int(int, int, double, const std::string&)> a1 = Invoke(SumOfFirst2);
305 Action<int(int, int, bool, int*)> a2 = Invoke(SumOfFirst2);
313 Action<int(std::string, bool, int, int)> a1 = Invoke(&foo, &Foo::SumOfLast2);
316 Action<int(char, double, int, int)> a2 = Invoke(&foo, &Foo::SumOfLast2);
322 Action<long(long, int)> a = Invoke(plus<long>()); // NOLINT
326 // Tests using Invoke(f) as an action of a compatible type.
328 Action<long(int, short, char, bool)> a = Invoke(SumOf4); // NOLINT
337 Action<int()> a = Invoke(&foo, &Foo::Nullary); // NOLINT
344 Action<short(long)> a = Invoke(&foo, &Foo::Unary); // NOLINT
351 Action<std::string(const std::string&, char)> a = Invoke(&foo, &Foo::Binary);
360 Action<int(int, bool, char)> a = Invoke(&foo, &Foo::Ternary); // NOLINT
367 Action<int(int, int, int, int)> a = Invoke(&foo, &Foo::SumOf4); // NOLINT
374 Action<int(int, int, int, int, int)> a =
382 Action<int(int, int, int, int, int, int)> a = // NOLINT
391 Action<std::string(const char*, const char*, const char*, const char*,
403 Action<std::string(const char*, const char*, const char*, const char*,
415 Action<std::string(const char*, const char*, const char*, const char*,
428 Action<std::string(const char*, const char*, const char*, const char*,
439 // Tests using Invoke(f) as an action of a compatible type.
442 Action<long(int, short, char, bool)> a = // NOLINT
447 // Tests using WithoutArgs with an action that takes no argument.
449 Action<int(int n)> a = WithoutArgs(Invoke(Nullary)); // NOLINT
453 // Tests using WithArg with an action that takes 1 argument.
455 Action<bool(double x, int n)> b = WithArg<1>(Invoke(Unary)); // NOLINT
461 const Action<int(int)> a = ReturnArg<0>();
466 const Action<bool(bool, bool, bool)> a = ReturnArg<0>();
471 const Action<std::string(int, int, std::string, int)> a = ReturnArg<2>();
476 const Action<std::string&(std::string&)> a = ReturnArg<0>();
483 const Action<void(int n)> a1 = SaveArg<0>(&result);
490 const Action<void(bool, char)> a1 = SaveArg<1>(&result);
498 const Action<void(const int*)> a1 = SaveArgPointee<0>(&result);
506 const Action<void(bool, char*)> a1 = SaveArgPointee<1>(&result);
513 const Action<void(int&)> a1 = SetArgReferee<0>(1);
520 const Action<void(int, int&)> a1 = SetArgReferee<1>('a');
527 const Action<void(bool, int, int&, const char*)> a1 = SetArgReferee<2>('a');
550 const Action<void(DeletionTester*)> a1 = DeleteArg<0>(); // NOLINT
559 const Action<void(bool, int, int, const char*, bool, int, int, int, int,
570 const Action<void(int n)> a = Throw('a');
577 const Action<double(char ch)> a = Throw(MyException());
582 const Action<double()> a = Throw(MyException());
620 Action<MyFunction> a = SetArrayArgument<1>(numbers, numbers + 3);
656 Action<MyFunction> a = SetArrayArgument<1>(numbers, numbers);
672 Action<MyFunction> a = SetArrayArgument<1>(chars, chars + 3);
687 Action<MyFunction> a = SetArrayArgument<1>(letters.begin(), letters.end());
696 const Action<int()> a = ReturnPointee(&n);
707 Action<int(int, int (*)())> a = InvokeArgument<1>(); // NOLINT
713 Action<int(UnaryFunctor)> a = InvokeArgument<0>(true); // NOLINT
719 Action<int(UnaryMoveOnlyFunctor)> a = InvokeArgument<0>(true); // NOLINT
725 Action<int(OneShotUnaryFunctor)> a = InvokeArgument<0>(true); // NOLINT
731 Action<int(int (*)(int, int, int, int, int))> a = // NOLINT
738 Action<int(SumOf5Functor)> a = // NOLINT
745 Action<int(int (*)(int, int, int, int, int, int))> a = // NOLINT
752 Action<int(SumOf6Functor)> a = // NOLINT
759 Action<std::string(std::string(*)(const char*, const char*, const char*,
768 Action<std::string(std::string(*)(const char*, const char*, const char*,
777 Action<std::string(std::string(*)(const char*, const char*, const char*,
786 Action<std::string(std::string(*)(
795 Action<const char*(const char* (*)(const char* input, short n))> // NOLINT
803 Action<const char*(const char* (*)(const char* input, short n))> // NOLINT
810 Action<bool(bool (*function)(const std::string& s))> a = // NOLINT
812 // When action 'a' is constructed, it makes a copy of the temporary
821 Action<bool(bool (*)(const double& x))> a = // NOLINT
850 Action<int(int*)> a = DoAll(SetArgPointee<0>(1), // NOLINT
859 Action<int(int*, int*)> a = DoAll(SetArgPointee<0>(1), // NOLINT
870 Action<int(int*, int*, char*)> a = // NOLINT
883 Action<int(int*, int*, char*, char*)> action = // NOLINT
886 EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b)));
897 Action<int(int*, int*, char*, char*, char*)> action = // NOLINT
900 EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c)));
912 Action<int(int*, int*, char*, char*, char*, char*)> action = // NOLINT
916 EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d)));
929 Action<int(int*, int*, char*, char*, char*, char*, // NOLINT
931 action =
935 EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d, &e)));
949 Action<int(int*, int*, char*, char*, char*, char*, // NOLINT
951 action = DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2),
955 EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d, &e, &f)));
971 Action<int(int*, int*, char*, char*, char*, char*, // NOLINT
973 action =
979 3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d, &e, &f, &g)));
993 Action<bool()> a =
1000 Action<int(std::unique_ptr<int>)> a =
1009 // Action<void(std::vector<int>)> isn't an
1010 // Action<void(const std::vector<int>&) but can be converted.
1011 Action<void(std::vector<int>)> first = [&] { ran_first = true; };
1012 Action<int(std::vector<int>)> a =
1018 // The ACTION*() macros trigger warning C4100 (unreferenced formal
1025 // Tests the ACTION*() macro family.
1027 // Tests that ACTION() can define an action that doesn't reference the
1029 ACTION(Return5) { return 5; }
1032 Action<double()> a1 = Return5();
1035 Action<int(double, bool)> a2 = Return5();
1039 // Tests that ACTION() can define an action that returns void.
1040 ACTION(IncrementArg1) { (*arg1)++; }
1043 Action<void(int, int*)> a1 = IncrementArg1();
1049 // Tests that the body of ACTION() can reference the type of the
1051 ACTION(IncrementArg2) {
1058 Action<void(int, bool, int*)> a1 = IncrementArg2();
1064 // Tests that the body of ACTION() can reference the argument tuple
1066 ACTION(Sum2) {
1073 Action<int(int, char, int*)> a1 = Sum2();
1080 // Tests that the body of ACTION() can reference the mock function
1086 ACTION(InvokeDummy) {
1093 Action<int(bool)> a1 = InvokeDummy();
1098 // Tests that the body of ACTION() can reference the mock function's
1100 ACTION(InvokeDummy2) {
1107 Action<int(bool)> a1 = InvokeDummy2();
1112 // Tests that ACTION() works for arguments passed by const reference.
1113 ACTION(ReturnAddrOfConstBoolReferenceArg) {
1119 Action<const bool*(int, const bool&)> a = ReturnAddrOfConstBoolReferenceArg();
1124 // Tests that ACTION() works for arguments passed by non-const reference.
1125 ACTION(ReturnAddrOfIntReferenceArg) {
1131 Action<int*(int&, bool, int)> a = ReturnAddrOfIntReferenceArg();
1136 // Tests that ACTION() can be used in a namespace.
1138 ACTION(Sum) { return arg0 + arg1; }
1142 Action<int(int, int)> a1 = action_test::Sum();
1146 // Tests that the same ACTION definition works for mock functions with
1148 ACTION(PlusTwo) { return arg0 + 2; }
1151 Action<int(int)> a1 = PlusTwo();
1154 Action<double(float, void*)> a2 = PlusTwo();
1159 // Tests that ACTION_P can define a parameterized action.
1163 Action<int(int m, bool t)> a1 = Plus(9);
1176 Action<int(char m, bool t)> a1 = TypedPlus(9);
1180 // Tests that a parameterized action can be used in any mock function
1183 Action<std::string(const std::string& s)> a1 = Plus("tail");
1189 // Tests that we can use ACTION*() to define actions overloaded on the
1192 ACTION(OverloadedAction) { return arg0 ? arg1 : "hello"; }
1203 using MyAction = Action<const char*(bool, const char*)>;
1223 Action<double(int m, bool t)> a1 = Plus(100, 20, 3.4);
1226 Action<std::string(const std::string& s)> a2 = Plus("tail", "-", ">");
1235 Action<int(int)> a1 = Plus(1, 2, 3, 4);
1242 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5);
1251 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6);
1260 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7);
1269 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8);
1279 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8, 9);
1291 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
1296 // Tests that the action body can promote the parameter types.
1306 Action<std::string(const char*)> no_promo =
1308 Action<std::string(const char*)> promo =
1317 // Defines a generic action that doesn't restrict the types of its
1358 Action<const std::string()> a1 = Concat("Hello", "1", 2);
1365 // Verifies the type of an ACTION*.
1367 ACTION(DoFoo) {}
1408 // Tests that an ACTION_P*() action can be explicitly instantiated
1422 Action<int()> a = Plus1<int&>(x);
1453 const Action<int*()> a = CreateNew<int>();
1465 const Action<int*()> a = CreateNew<int>(42);
1488 const Action<void(int*, BoolResetter*)> a = MyDeleteArg<1>();
1505 const Action<std::shared_ptr<int>()> a =
1532 const Action<Giant()> a = ReturnGiant<int, bool, double, 5, true, 6, char,
1545 const Action<int()> a = ReturnSum<int>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
1549 // Tests that ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded
1552 ACTION(ReturnSum) { return 0; }
1572 const Action<int()> a0 = ReturnSum();
1573 const Action<int()> a1 = ReturnSum(1);
1574 const Action<int()> a2 = ReturnSum<int>(1, 2);
1575 const Action<int()> a3 = ReturnSum<int>(1, 2, 3);
1576 const Action<int()> a4 = ReturnSum<int, 10000>(2000, 300, 40, 5);