114 #ifndef GMOCK_TEST_GMOCK_LINK_TEST_H_ 115 #define GMOCK_TEST_GMOCK_LINK_TEST_H_ 119 #if !GTEST_OS_WINDOWS_MOBILE 148 using testing::InvokeArgument;
168 using testing::SetArrayArgument;
180 #if !GTEST_OS_WINDOWS_MOBILE 184 #if GTEST_HAS_EXCEPTIONS 185 using testing::Throw;
236 int field()
const {
return field_; }
242 TEST(LinkTest, TestReturnVoid) {
259 TEST(LinkTest, TestReturnNull) {
267 TEST(LinkTest, TestReturnRef) {
285 TEST(LinkTest, TestSetArgPointee) {
294 TEST(LinkTest, TestSetArrayArgument) {
304 #if !GTEST_OS_WINDOWS_MOBILE 307 TEST(LinkTest, TestSetErrnoAndReturn) {
310 int saved_errno = errno;
316 #endif // !GTEST_OS_WINDOWS_MOBILE 331 TEST(LinkTest, TestInvokeWithoutArgs) {
344 TEST(LinkTest, TestInvokeArgument) {
371 TEST(LinkTest, TestWithoutArgs) {
389 TEST(LinkTest, TestDoDefault) {
399 TEST(LinkTest, TestIgnoreResult) {
406 #if GTEST_HAS_EXCEPTIONS 408 TEST(LinkTest, TestThrow) {
414 #endif // GTEST_HAS_EXCEPTIONS 422 # pragma warning(push) 423 # pragma warning(disable:4100) 431 TEST(LinkTest, TestActionMacro) {
440 ACTION_P(ReturnArgument, ret_value) {
return ret_value; }
443 TEST(LinkTest, TestActionPMacro) {
453 return arg0 == first || arg0 == second;
458 # pragma warning(pop) 461 TEST(LinkTest, TestActionP2Macro) {
466 .WillOnce(ReturnEqualsEitherOf(
"one",
"two"));
471 TEST(LinkTest, TestMatcherAnything) {
485 TEST(LinkTest, TestMatchersEq) {
495 TEST(LinkTest, TestMatchersRelations) {
506 TEST(LinkTest, TestMatcherNotNull) {
513 TEST(LinkTest, TestMatcherIsNull) {
520 TEST(LinkTest, TestMatcherRef) {
528 TEST(LinkTest, TestMatcherTypedEq) {
537 TEST(LinkTest, TestMatchersFloatingPoint) {
549 TEST(LinkTest, TestMatcherContainsRegex) {
556 TEST(LinkTest, TestMatcherMatchesRegex) {
563 TEST(LinkTest, TestMatchersSubstrings) {
572 TEST(LinkTest, TestMatchersStringEquality) {
581 TEST(LinkTest, TestMatcherElementsAre) {
588 TEST(LinkTest, TestMatcherElementsAreArray) {
590 char arr[] = {
'a',
'b' };
596 TEST(LinkTest, TestMatcherContainerEq) {
604 TEST(LinkTest, TestMatcherField) {
615 TEST(LinkTest, TestMatcherProperty) {
626 TEST(LinkTest, TestMatcherResultOf) {
632 TEST(LinkTest, TestMatcherPointee) {
640 TEST(LinkTest, TestMatcherTruly) {
646 TEST(LinkTest, TestMatcherAllOf) {
652 TEST(LinkTest, TestMatcherAnyOf) {
658 TEST(LinkTest, TestMatcherNot) {
664 TEST(LinkTest, TestMatcherCast) {
669 #endif // GMOCK_TEST_GMOCK_LINK_TEST_H_
void VoidFromString(char *)
PolymorphicMatcher< internal::TrulyMatcher< Predicate > > Truly(Predicate pred)
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrCaseNe(const internal::string &str)
PolymorphicAction< internal::ReturnNullAction > ReturnNull()
PolymorphicMatcher< internal::EndsWithMatcher< internal::string > > EndsWith(const internal::string &suffix)
virtual void VoidFromVector(const std::vector< int > &v)=0
#define EXPECT_THROW(statement, expected_exception)
virtual int IntFromString(char *str)=0
internal::GtMatcher< Rhs > Gt(Rhs x)
internal::ElementsAreArrayMatcher< typename::std::iterator_traits< Iter >::value_type > ElementsAreArray(Iter first, Iter last)
virtual void VoidFromFloat(float n)=0
static void StaticVoidFromVoid()
PolymorphicAction< internal::AssignAction< T1, T2 > > Assign(T1 *ptr, T2 val)
static bool StaticBoolFromString(const char *)
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrNe(const internal::string &str)
PolymorphicMatcher< internal::MatchesRegexMatcher > ContainsRegex(const internal::RE *regex)
virtual int & IntRefFromString(char *str)=0
internal::ResultOfMatcher< Callable > ResultOf(Callable callable, const ResultOfMatcher &matcher)
internal::GeMatcher< Rhs > Ge(Rhs x)
internal::AnyOfResult2< M1, M2 >::type AnyOf(M1 m1, M2 m2)
#define ON_CALL(obj, call)
PolymorphicAction< internal::InvokeWithoutArgsAction< FunctionImpl > > InvokeWithoutArgs(FunctionImpl function_impl)
internal::FloatingEqMatcher< float > FloatEq(float rhs)
internal::WithArgsAction< InnerAction, k1 > WithArgs(const InnerAction &action)
PolymorphicMatcher< internal::PropertyMatcher< Class, PropertyType > > Property(PropertyType(Class::*property)() const, const PropertyMatcher &matcher)
PolymorphicMatcher< internal::StartsWithMatcher< internal::string > > StartsWith(const internal::string &prefix)
internal::EqMatcher< T > Eq(T x)
internal::FloatingEqMatcher< float > NanSensitiveFloatEq(float rhs)
static void StaticVoidFromString(char *)
PolymorphicMatcher< internal::MatchesRegexMatcher > MatchesRegex(const internal::RE *regex)
PolymorphicAction< internal::SetErrnoAndReturnAction< T > > SetErrnoAndReturn(int errval, T result)
PolymorphicMatcher< internal::NotNullMatcher > NotNull()
internal::WithArgsAction< InnerAction, k > WithArg(const InnerAction &action)
internal::ReturnRefAction< R > ReturnRef(R &x)
virtual void VoidFromDouble(double n)=0
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrCaseEq(const internal::string &str)
internal::ElementsAreMatcher< ::testing::tuple<> > ElementsAre()
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
internal::DoBothAction< Action1, Action2 > DoAll(Action1 a1, Action2 a2)
internal::LeMatcher< Rhs > Le(Rhs x)
PolymorphicMatcher< internal::IsNullMatcher > IsNull()
virtual void VoidFromString(char *str)=0
static int StaticIntFromString(char *)
PolymorphicMatcher< internal::ContainerEqMatcher< GTEST_REMOVE_CONST_(Container)> > ContainerEq(const Container &rhs)
internal::DoDefaultAction DoDefault()
internal::ReturnAction< R > Return(R value)
#define EXPECT_CALL(obj, call)
PolymorphicAction< internal::SetArgumentPointeeAction< N, T, internal::IsAProtocolMessage< T >::value > > SetArgPointee(const T &x)
virtual char * StringFromString(char *str)=0
Matcher< Lhs > TypedEq(const Rhs &rhs)
Matcher< T > MatcherCast(const M &matcher)
PolymorphicMatcher< internal::HasSubstrMatcher< internal::string > > HasSubstr(const internal::string &substring)
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
const internal::AnythingMatcher _
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrEq(const internal::string &str)
#define EXPECT_TRUE(condition)
virtual void VoidFromIntRef(int &n)=0
#define MOCK_METHOD1(m,...)
internal::FloatingEqMatcher< double > DoubleEq(double rhs)
#define ACTION_P(name, p0)
internal::WithArgsAction< InnerAction > WithoutArgs(const InnerAction &action)
internal::IgnoreResultAction< A > IgnoreResult(const A &an_action)
virtual void VoidFromFunc(void(*func)(char *str))=0
internal::PointeeMatcher< InnerMatcher > Pointee(const InnerMatcher &inner_matcher)
PolymorphicMatcher< internal::FieldMatcher< Class, FieldType > > Field(FieldType Class::*field, const FieldMatcher &matcher)
#define EXPECT_FALSE(condition)
internal::NotMatcher< InnerMatcher > Not(InnerMatcher m)
internal::LtMatcher< Rhs > Lt(Rhs x)
internal::FloatingEqMatcher< double > NanSensitiveDoubleEq(double rhs)
TEST(LinkTest, TestReturnVoid)
internal::RefMatcher< T & > Ref(T &x)
#define ACTION_P2(name, p0, p1)
internal::NeMatcher< Rhs > Ne(Rhs x)
internal::AllOfResult2< M1, M2 >::type AllOf(M1 m1, M2 m2)