115 #ifndef GMOCK_TEST_GMOCK_LINK_TEST_H_
116 #define GMOCK_TEST_GMOCK_LINK_TEST_H_
120 #if !GTEST_OS_WINDOWS_MOBILE
133 using testing::AllOf;
134 using testing::AnyOf;
136 using testing::ContainerEq;
139 using testing::DoubleEq;
140 using testing::ElementsAre;
141 using testing::ElementsAreArray;
142 using testing::EndsWith;
144 using testing::Field;
145 using testing::FloatEq;
148 using testing::HasSubstr;
151 using testing::InvokeArgument;
154 using testing::IsSubsetOf;
155 using testing::IsSupersetOf;
159 using testing::MatcherCast;
160 using testing::NanSensitiveDoubleEq;
161 using testing::NanSensitiveFloatEq;
164 using testing::NotNull;
165 using testing::Pointee;
166 using testing::Property;
168 using testing::ResultOf;
173 using testing::SetArrayArgument;
174 using testing::StartsWith;
175 using testing::StrCaseEq;
176 using testing::StrCaseNe;
177 using testing::StrEq;
178 using testing::StrNe;
179 using testing::Truly;
180 using testing::TypedEq;
185 #if !GTEST_OS_WINDOWS_MOBILE
189 #if GTEST_HAS_EXCEPTIONS
190 using testing::Throw;
193 using testing::ContainsRegex;
194 using testing::MatchesRegex;
294 EXPECT_CALL(mock, VoidFromString(
_)).WillOnce(SetArgPointee<0>(
'y'));
304 EXPECT_CALL(mock, VoidFromString(
_)).WillOnce(SetArrayArgument<0>(&ch2,
309 #if !GTEST_OS_WINDOWS_MOBILE
315 int saved_errno = errno;
321 #endif // !GTEST_OS_WINDOWS_MOBILE
353 EXPECT_CALL(mock, VoidFromFunc(
_)).WillOnce(InvokeArgument<0>(&ch));
411 #if GTEST_HAS_EXCEPTIONS
416 EXPECT_CALL(mock, VoidFromString(
_)).WillOnce(Throw(42));
419 #endif // GTEST_HAS_EXCEPTIONS
427 # pragma warning(push)
428 # pragma warning(disable:4100)
433 ACTION(Return1) {
return 1; }
439 EXPECT_CALL(mock, IntFromString(
_)).WillOnce(Return1());
445 ACTION_P(ReturnArgument, ret_value) {
return ret_value; }
451 EXPECT_CALL(mock, IntFromString(
_)).WillOnce(ReturnArgument(42));
457 ACTION_P2(ReturnEqualsEitherOf, first, second) {
458 return arg0 == first || arg0 == second;
463 # pragma warning(pop)
471 .WillOnce(ReturnEqualsEitherOf(
"one",
"two"));
494 ON_CALL(mock, VoidFromString(Eq(p))).WillByDefault(
Return());
495 ON_CALL(mock, VoidFromString(const_cast<char*>(
"y")))
514 ON_CALL(mock, VoidFromString(NotNull())).WillByDefault(
Return());
529 ON_CALL(mock, VoidFromIntRef(Ref(a))).WillByDefault(
Return());
537 ON_CALL(mock, VoidFromIntRef(TypedEq<int&>(a))).WillByDefault(
Return());
546 ON_CALL(mock, VoidFromFloat(FloatEq(a))).WillByDefault(
Return());
547 ON_CALL(mock, VoidFromDouble(DoubleEq(a))).WillByDefault(
Return());
548 ON_CALL(mock, VoidFromFloat(NanSensitiveFloatEq(a))).WillByDefault(
Return());
549 ON_CALL(mock, VoidFromDouble(NanSensitiveDoubleEq(a)))
557 ON_CALL(mock, VoidFromString(ContainsRegex(
".*"))).WillByDefault(
Return());
564 ON_CALL(mock, VoidFromString(MatchesRegex(
".*"))).WillByDefault(
Return());
571 ON_CALL(mock, VoidFromString(StartsWith(
"a"))).WillByDefault(
Return());
572 ON_CALL(mock, VoidFromString(EndsWith(
"c"))).WillByDefault(
Return());
573 ON_CALL(mock, VoidFromString(HasSubstr(
"b"))).WillByDefault(
Return());
579 ON_CALL(mock, VoidFromString(StrEq(
"a"))).WillByDefault(
Return());
580 ON_CALL(mock, VoidFromString(StrNe(
"a"))).WillByDefault(
Return());
581 ON_CALL(mock, VoidFromString(StrCaseEq(
"a"))).WillByDefault(
Return());
582 ON_CALL(mock, VoidFromString(StrCaseNe(
"a"))).WillByDefault(
Return());
589 ON_CALL(mock, VoidFromVector(ElementsAre(
'a',
_))).WillByDefault(
Return());
595 char arr[] = {
'a',
'b' };
597 ON_CALL(mock, VoidFromVector(ElementsAreArray(arr))).WillByDefault(
Return());
603 char arr[] = {
'a',
'b'};
605 ON_CALL(mock, VoidFromVector(IsSubsetOf(arr))).WillByDefault(
Return());
611 char arr[] = {
'a',
'b'};
613 ON_CALL(mock, VoidFromVector(IsSupersetOf(arr))).WillByDefault(
Return());
621 ON_CALL(mock, VoidFromVector(ContainerEq(v))).WillByDefault(
Return());
690 #endif // GMOCK_TEST_GMOCK_LINK_TEST_H_
void VoidFromString(char *)
PolymorphicAction< internal::ReturnNullAction > ReturnNull()
virtual void VoidFromVector(const std::vector< int > &v)=0
#define EXPECT_THROW(statement, expected_exception)
virtual int IntFromString(char *str)=0
#define ACTION_P(name,...)
virtual void VoidFromFloat(float n)=0
static void StaticVoidFromVoid()
PolymorphicAction< internal::AssignAction< T1, T2 > > Assign(T1 *ptr, T2 val)
static bool StaticBoolFromString(const char *)
virtual int & IntRefFromString(char *str)=0
internal::DoAllAction< typename std::decay< Action >::type...> DoAll(Action &&...action)
#define TEST(test_suite_name, test_name)
#define ON_CALL(obj, call)
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mock)
internal::InvokeWithoutArgsAction< typename std::decay< FunctionImpl >::type > InvokeWithoutArgs(FunctionImpl function_impl)
static void StaticVoidFromString(char *)
MOCK_METHOD1(VoidFromString, void(char *str))
internal::WithArgsAction< typename std::decay< InnerAction >::type, k, ks...> WithArgs(InnerAction &&action)
PolymorphicAction< internal::SetErrnoAndReturnAction< T > > SetErrnoAndReturn(int errval, T result)
internal::ReturnRefAction< R > ReturnRef(R &x)
std::decay< FunctionImpl >::type Invoke(FunctionImpl &&function_impl)
virtual void VoidFromDouble(double n)=0
internal::WithArgsAction< typename std::decay< InnerAction >::type > WithoutArgs(InnerAction &&action)
#define ACTION_P2(name,...)
internal::SetArgumentPointeeAction< N, T > SetArgPointee(T value)
virtual void VoidFromString(char *str)=0
static int StaticIntFromString(char *)
internal::DoDefaultAction DoDefault()
internal::ReturnAction< R > Return(R value)
#define EXPECT_CALL(obj, call)
virtual char * StringFromString(char *str)=0
internal::WithArgsAction< typename std::decay< InnerAction >::type, k > WithArg(InnerAction &&action)
const T func(int n, T *x)
#define EXPECT_TRUE(condition)
virtual void VoidFromIntRef(int &n)=0
internal::IgnoreResultAction< A > IgnoreResult(const A &an_action)
virtual void VoidFromFunc(void(*func)(char *str))=0
#define EXPECT_FALSE(condition)
AssertionResult IsNull(const char *str)