116#ifndef GMOCK_TEST_GMOCK_LINK_TEST_H_
117#define GMOCK_TEST_GMOCK_LINK_TEST_H_
121#if !GTEST_OS_WINDOWS_MOBILE
152using testing::InvokeArgument;
174using testing::SetArrayArgument;
186#if !GTEST_OS_WINDOWS_MOBILE
190#if GTEST_HAS_EXCEPTIONS
251 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Return());
260 EXPECT_CALL(mock, StringFromString(_)).WillOnce(Return(&ch));
268 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Return());
277 EXPECT_CALL(mock, IntRefFromString(_)).WillOnce(ReturnRef(n));
286 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Assign(&ch,
'y'));
295 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(SetArgPointee<0>(
'y'));
305 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(SetArrayArgument<0>(&ch2,
310#if !GTEST_OS_WINDOWS_MOBILE
316 int saved_errno = errno;
317 EXPECT_CALL(mock, IntFromString(_)).WillOnce(SetErrnoAndReturn(1, -1));
343 .WillOnce(InvokeWithoutArgs(&test_invoke_helper,
354 EXPECT_CALL(mock, VoidFromFunc(_)).WillOnce(InvokeArgument<0>(&ch));
380 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(WithoutArgs(Return()));
390 .WillOnce(DoAll(SetArgPointee<0>(
'y'), Return()));
399 ON_CALL(mock, VoidFromString(_)).WillByDefault(Return());
400 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(DoDefault());
408 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(IgnoreResult(Return(42)));
412#if GTEST_HAS_EXCEPTIONS
428# pragma warning(push)
429# pragma warning(disable:4100)
434ACTION(Return1) {
return 1; }
440 EXPECT_CALL(mock, IntFromString(_)).WillOnce(Return1());
446ACTION_P(ReturnArgument, ret_value) {
return ret_value; }
452 EXPECT_CALL(mock, IntFromString(_)).WillOnce(ReturnArgument(42));
458ACTION_P2(ReturnEqualsEitherOf, first, second) {
459 return arg0 == first || arg0 == second;
472 .WillOnce(ReturnEqualsEitherOf(
"one",
"two"));
480 ON_CALL(mock, VoidFromString(_)).WillByDefault(Return());
487 ON_CALL(mock, VoidFromString(A<char*>())).WillByDefault(Return());
495 ON_CALL(mock, VoidFromString(Eq(
p))).WillByDefault(Return());
496 ON_CALL(mock, VoidFromString(
const_cast<char*
>(
"y")))
497 .WillByDefault(Return());
504 ON_CALL(mock, VoidFromFloat(Lt(1.0f))).WillByDefault(Return());
505 ON_CALL(mock, VoidFromFloat(Gt(1.0f))).WillByDefault(Return());
506 ON_CALL(mock, VoidFromFloat(Le(1.0f))).WillByDefault(Return());
507 ON_CALL(mock, VoidFromFloat(Ge(1.0f))).WillByDefault(Return());
508 ON_CALL(mock, VoidFromFloat(Ne(1.0f))).WillByDefault(Return());
515 ON_CALL(mock, VoidFromString(NotNull())).WillByDefault(Return());
522 ON_CALL(mock, VoidFromString(IsNull())).WillByDefault(Return());
530 ON_CALL(mock, VoidFromIntRef(Ref(
a))).WillByDefault(Return());
538 ON_CALL(mock, VoidFromIntRef(TypedEq<int&>(
a))).WillByDefault(Return());
547 ON_CALL(mock, VoidFromFloat(FloatEq(
a))).WillByDefault(Return());
548 ON_CALL(mock, VoidFromDouble(DoubleEq(
a))).WillByDefault(Return());
549 ON_CALL(mock, VoidFromFloat(NanSensitiveFloatEq(
a))).WillByDefault(Return());
550 ON_CALL(mock, VoidFromDouble(NanSensitiveDoubleEq(
a)))
551 .WillByDefault(Return());
558 ON_CALL(mock, VoidFromString(ContainsRegex(
".*"))).WillByDefault(Return());
565 ON_CALL(mock, VoidFromString(MatchesRegex(
".*"))).WillByDefault(Return());
572 ON_CALL(mock, VoidFromString(StartsWith(
"a"))).WillByDefault(Return());
573 ON_CALL(mock, VoidFromString(EndsWith(
"c"))).WillByDefault(Return());
574 ON_CALL(mock, VoidFromString(HasSubstr(
"b"))).WillByDefault(Return());
580 ON_CALL(mock, VoidFromString(StrEq(
"a"))).WillByDefault(Return());
581 ON_CALL(mock, VoidFromString(StrNe(
"a"))).WillByDefault(Return());
582 ON_CALL(mock, VoidFromString(StrCaseEq(
"a"))).WillByDefault(Return());
583 ON_CALL(mock, VoidFromString(StrCaseNe(
"a"))).WillByDefault(Return());
590 ON_CALL(mock, VoidFromVector(ElementsAre(
'a', _))).WillByDefault(Return());
596 char arr[] = {
'a',
'b' };
598 ON_CALL(mock, VoidFromVector(ElementsAreArray(arr))).WillByDefault(Return());
604 char arr[] = {
'a',
'b'};
606 ON_CALL(mock, VoidFromVector(IsSubsetOf(arr))).WillByDefault(Return());
612 char arr[] = {
'a',
'b'};
614 ON_CALL(mock, VoidFromVector(IsSupersetOf(arr))).WillByDefault(Return());
622 ON_CALL(mock, VoidFromVector(ContainerEq(v))).WillByDefault(Return());
virtual void VoidFromString(char *str)=0
virtual void VoidFromFunc(void(*func)(char *str))=0
virtual int & IntRefFromString(char *str)=0
virtual void VoidFromIntRef(int &n)=0
virtual void VoidFromDouble(double n)=0
virtual char * StringFromString(char *str)=0
virtual int IntFromString(char *str)=0
virtual void VoidFromFloat(float n)=0
virtual void VoidFromVector(const std::vector< int > &v)=0
static int StaticIntFromString(char *)
static void StaticVoidFromString(char *)
void VoidFromString(char *)
static void StaticVoidFromVoid()
static bool StaticBoolFromString(const char *)
MOCK_METHOD1(IntRefFromString, int &(char *str))
MOCK_METHOD1(StringFromString, char *(char *str))
MOCK_METHOD1(VoidFromFloat, void(float n))
MOCK_METHOD1(VoidFromVector, void(const std::vector< int > &v))
MOCK_METHOD1(VoidFromDouble, void(double n))
MOCK_METHOD1(VoidFromFunc, void(void(*func)(char *str)))
MOCK_METHOD1(VoidFromString, void(char *str))
MOCK_METHOD1(VoidFromIntRef, void(int &n))
MOCK_METHOD1(IntFromString, int(char *str))
bool Matches(GTEST_REFERENCE_TO_CONST_(T) x) const
#define ACTION_P2(name, p0, p1)
#define ACTION_P(name, p0)
#define EXPECT_CALL(obj, call)
#define ON_CALL(obj, call)
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
#define EXPECT_THROW(statement, expected_exception)
#define EXPECT_TRUE(condition)
#define TEST(test_case_name, test_name)
#define EXPECT_FALSE(condition)
@ Throw
Throw an error if any extra arguments were given.
internal::NotMatcher< InnerMatcher > Not(InnerMatcher m)
internal::Le2Matcher Le()
internal::WithArgsAction< InnerAction, k1 > WithArgs(const InnerAction &action)
Matcher< Lhs > TypedEq(const Rhs &rhs)
PolymorphicMatcher< internal::StrEqualityMatcher< std::string > > StrCaseEq(const std::string &str)
internal::Ne2Matcher Ne()
internal::WithArgsAction< InnerAction, k > WithArg(const InnerAction &action)
internal::FloatingEq2Matcher< double > DoubleEq()
PolymorphicMatcher< internal::NotNullMatcher > NotNull()
PolymorphicMatcher< internal::HasSubstrMatcher< std::string > > HasSubstr(const std::string &substring)
internal::IgnoreResultAction< A > IgnoreResult(const A &an_action)
PolymorphicAction< internal::InvokeWithoutArgsAction< FunctionImpl > > InvokeWithoutArgs(FunctionImpl function_impl)
PolymorphicMatcher< internal::IsNullMatcher > IsNull()
internal::Lt2Matcher Lt()
internal::Gt2Matcher Gt()
PolymorphicMatcher< internal::StrEqualityMatcher< std::string > > StrCaseNe(const std::string &str)
PolymorphicMatcher< internal::MatchesRegexMatcher > MatchesRegex(const internal::RE *regex)
internal::UnorderedElementsAreArrayMatcher< typename ::std::iterator_traits< Iter >::value_type > IsSubsetOf(Iter first, Iter last)
PolymorphicMatcher< internal::PropertyMatcher< Class, PropertyType, PropertyType(Class::*)() const > > Property(PropertyType(Class::*property)() const, const PropertyMatcher &matcher)
PolymorphicAction< internal::ReturnVoidAction > Return()
PolymorphicMatcher< internal::TrulyMatcher< Predicate > > Truly(Predicate pred)
const internal::AnythingMatcher _
PolymorphicMatcher< internal::ContainerEqMatcher< GTEST_REMOVE_CONST_(Container)> > ContainerEq(const Container &rhs)
internal::AllOfResult2< M1, M2 >::type AllOf(M1 m1, M2 m2)
PolymorphicMatcher< internal::StartsWithMatcher< std::string > > StartsWith(const std::string &prefix)
PolymorphicMatcher< internal::EndsWithMatcher< std::string > > EndsWith(const std::string &suffix)
PolymorphicAction< internal::AssignAction< T1, T2 > > Assign(T1 *ptr, T2 val)
internal::ResultOfMatcher< Callable > ResultOf(Callable callable, const ResultOfMatcher &matcher)
PolymorphicAction< internal::SetErrnoAndReturnAction< T > > SetErrnoAndReturn(int errval, T result)
internal::ElementsAreArrayMatcher< typename ::std::iterator_traits< Iter >::value_type > ElementsAreArray(Iter first, Iter last)
internal::ElementsAreMatcher< ::testing::tuple<> > ElementsAre()
internal::FloatingEq2Matcher< float > NanSensitiveFloatEq()
internal::Ge2Matcher Ge()
PolymorphicMatcher< internal::MatchesRegexMatcher > ContainsRegex(const internal::RE *regex)
internal::UnorderedElementsAreArrayMatcher< typename ::std::iterator_traits< Iter >::value_type > IsSupersetOf(Iter first, Iter last)
internal::Eq2Matcher Eq()
internal::FloatingEq2Matcher< float > FloatEq()
internal::FloatingEq2Matcher< double > NanSensitiveDoubleEq()
internal::WithArgsAction< InnerAction > WithoutArgs(const InnerAction &action)
PolymorphicMatcher< internal::FieldMatcher< Class, FieldType > > Field(FieldType Class::*field, const FieldMatcher &matcher)
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
internal::ReturnRefAction< R > ReturnRef(R &x)
internal::DoBothAction< Action1, Action2 > DoAll(Action1 a1, Action2 a2)
PolymorphicMatcher< internal::StrEqualityMatcher< std::string > > StrEq(const std::string &str)
internal::AnyOfResult2< M1, M2 >::type AnyOf(M1 m1, M2 m2)
Matcher< T > MatcherCast(const M &matcher)
PolymorphicAction< internal::SetArgumentPointeeAction< N, T, internal::IsAProtocolMessage< T >::value > > SetArgPointee(const T &x)
internal::DoDefaultAction DoDefault()
internal::RefMatcher< T & > Ref(T &x)
PolymorphicAction< internal::ReturnNullAction > ReturnNull()
internal::PointeeMatcher< InnerMatcher > Pointee(const InnerMatcher &inner_matcher)
PolymorphicMatcher< internal::StrEqualityMatcher< std::string > > StrNe(const std::string &str)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a