Home | History | Annotate | Download | only in test

Lines Matching refs:Action

56 using testing::Action;
341 Action<MyFunction> action = MakeAction(new MyActionImpl);
343 // When exercising the Perform() method of Action<F>, we must pass
348 EXPECT_EQ(5, action.Perform(make_tuple(true, 5)));
351 // Tests that Action<F> can be contructed from a pointer to
354 Action<MyFunction> action(new MyActionImpl);
357 // Tests that Action<F> delegates actual work to ActionInterface<F>.
359 const Action<MyFunction> action(new MyActionImpl);
361 EXPECT_EQ(5, action.Perform(make_tuple(true, 5)));
362 EXPECT_EQ(0, action.Perform(make_tuple(false, 1)));
365 // Tests that Action<F> can be copied.
367 Action<MyFunction> a1(new MyActionImpl);
368 Action<MyFunction> a2(a1); // Tests the copy constructor.
374 // a2 should work like the action it was copied from.
384 // a2 should work like the action it was copied from.
389 // Tests that an Action<From> object can be converted to a
390 // compatible Action<To> object.
406 const Action<bool(int)> a1(new IsNotZero); // NOLINT
407 const Action<int(char)> a2 = Action<int(char)>(a1); // NOLINT
415 // Implements a polymorphic action that returns the second of the
420 // polymorphic action whose Perform() method template is either
426 // Implements a polymorphic action that can be used in a nullary
435 // polymorphic action whose Perform() method template is either
453 // Tests that MakePolymorphicAction() turns a polymorphic action
454 // implementation class into a polymorphic action.
456 Action<int(bool, int, double)> a1 = ReturnSecondArgument(); // NOLINT
463 Action<int()> a1 = ReturnZeroFromNullaryFunction();
466 Action<void*()> a2 = ReturnZeroFromNullaryFunction();
470 // Tests that Return() works as an action for void-returning
473 const Action<void(int)> ret = Return(); // NOLINT
479 Action<int()> ret = Return(1); // NOLINT
488 Action<const char*()> a1 = Return("Hello");
491 Action<std::string()> a2 = Return("world");
508 Action<Base*()> ret = Return(&base);
516 // when the action is cast to Action<T(...)> rather than when the action is
539 Action<ToType()> action(Return(x));
543 action.Perform(tuple<>());
544 EXPECT_FALSE(converted) << "Action must NOT convert its argument "
558 Action<DestinationType()> action(Return(s));
563 const Action<int*()> a1 = ReturnNull();
566 const Action<const char*(bool)> a2 = ReturnNull(); // NOLINT
573 const Action<const int&(bool)> ret = ReturnRef(n); // NOLINT
582 Action<Base&()> a = ReturnRef(base);
592 const Action<const int&()> ret = ReturnRefOfCopy(n);
606 Action<Base&()> a = ReturnRefOfCopy(base);
613 // Tests that DoDefault() does the default action for the mock method.
648 // Tests that using DoDefault() inside a composite action leads to a
679 // Tests that DoDefault() does the action specified by ON_CALL().
702 Action<MyFunction> a = SetArgPointee<1>(2);
723 Action<MyFunction> a = SetArgPointee<0>("hi");
739 Action<MyFunction> a = SetArgPointee<0>(L"world");
747 Action<MyStringFunction> a2 = SetArgPointee<0>(L"world");
760 Action<MyFunction> a = SetArgPointee<1>(hi);
779 Action<MyFunction> a = SetArgPointee<1>(hi);
789 Action<MyStringFunction> a2 = SetArgPointee<1>(world);
806 Action<void(bool, TestMessage*)> a = SetArgPointee<1>(*msg);
808 // s.t. the action works even when the original proto_buffer has
810 // action.
828 Action<void(bool, ::ProtocolMessage*)> a = SetArgPointee<1>(*msg);
830 // s.t. the action works even when the original proto_buffer has
832 // action.
853 Action<void(bool, FooMessage*)> a = SetArgPointee<1>(*msg);
855 // proto2_buffer s.t. the action works even when the original
857 // before using the action.
878 Action<void(bool, ::proto2::Message*)> a = SetArgPointee<1>(*msg);
880 // proto2_buffer s.t. the action works even when the original
882 // before using the action.
899 Action<MyFunction> a = SetArgumentPointee<1>(2);
925 Action<void(bool, TestMessage*)> a = SetArgumentPointee<1>(*msg);
927 // s.t. the action works even when the original proto_buffer has
929 // action.
947 Action<void(bool, ::ProtocolMessage*)> a = SetArgumentPointee<1>(*msg);
949 // s.t. the action works even when the original proto_buffer has
951 // action.
972 Action<void(bool, FooMessage*)> a = SetArgumentPointee<1>(*msg);
974 // proto2_buffer s.t. the action works even when the original
976 // before using the action.
997 Action<void(bool, ::proto2::Message*)> a = SetArgumentPointee<1>(*msg);
999 // proto2_buffer s.t. the action works even when the original
1001 // before using the action.
1098 // As an action that takes one argument.
1099 Action<int(int)> a = InvokeWithoutArgs(Nullary); // NOLINT
1102 // As an action that takes two arguments.
1103 Action<int(int, double)> a2 = InvokeWithoutArgs(Nullary); // NOLINT
1106 // As an action that returns void.
1107 Action<void(int)> a3 = InvokeWithoutArgs(VoidNullary); // NOLINT
1115 // As an action that takes no argument.
1116 Action<int()> a = InvokeWithoutArgs(NullaryFunctor()); // NOLINT
1119 // As an action that takes three arguments.
1120 Action<int(int, double, char)> a2 = // NOLINT
1124 // As an action that returns void.
1125 Action<void()> a3 = InvokeWithoutArgs(VoidNullaryFunctor());
1134 Action<int(bool, char)> a = // NOLINT
1139 // Tests using IgnoreResult() on a polymorphic action.
1141 Action<void(int)> a = IgnoreResult(Return(5)); // NOLINT
1145 // Tests using IgnoreResult() on a monomorphic action.
1154 Action<void()> a = IgnoreResult(Invoke(ReturnOne));
1159 // Tests using IgnoreResult() on an action that returns a class type.
1168 Action<void(int)> a = IgnoreResult(Invoke(ReturnMyClass)); // NOLINT
1175 Action<void(int)> a = Assign(&x, 5);
1182 Action<void(void)> a = Assign(&x, "Hello, world");
1189 Action<void(int)> a = Assign(&x, 5);
1203 Action<int(void)> a = SetErrnoAndReturn(ENOTTY, -5);
1210 Action<int*(void)> a = SetErrnoAndReturn(ENOTTY, &x);
1216 Action<double()> a = SetErrnoAndReturn(EINVAL, 5);