Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::internal::TypedExpectation< F > Class Template Reference

#include <gmock-spec-builders.h>

Inheritance diagram for testing::internal::TypedExpectation< F >:
Collaboration diagram for testing::internal::TypedExpectation< F >:

Public Types

typedef Function< F >::ArgumentTuple ArgumentTuple
 
typedef Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
 
typedef Function< F >::Result Result
 

Public Member Functions

 TypedExpectation (FunctionMockerBase< F > *owner, const char *a_file, int a_line, const std::string &a_source_text, const ArgumentMatcherTuple &m)
 
virtual ~TypedExpectation ()
 
TypedExpectationWith (const Matcher< const ArgumentTuple & > &m)
 
TypedExpectationTimes (const Cardinality &a_cardinality)
 
TypedExpectationTimes (int n)
 
TypedExpectationInSequence (const Sequence &s)
 
TypedExpectationInSequence (const Sequence &s1, const Sequence &s2)
 
TypedExpectationInSequence (const Sequence &s1, const Sequence &s2, const Sequence &s3)
 
TypedExpectationInSequence (const Sequence &s1, const Sequence &s2, const Sequence &s3, const Sequence &s4)
 
TypedExpectationInSequence (const Sequence &s1, const Sequence &s2, const Sequence &s3, const Sequence &s4, const Sequence &s5)
 
TypedExpectationAfter (const ExpectationSet &s)
 
TypedExpectationAfter (const ExpectationSet &s1, const ExpectationSet &s2)
 
TypedExpectationAfter (const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3)
 
TypedExpectationAfter (const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3, const ExpectationSet &s4)
 
TypedExpectationAfter (const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3, const ExpectationSet &s4, const ExpectationSet &s5)
 
TypedExpectationWillOnce (const Action< F > &action)
 
TypedExpectationWillRepeatedly (const Action< F > &action)
 
TypedExpectationRetiresOnSaturation ()
 
const ArgumentMatcherTuplematchers () const
 
const Matcher< const ArgumentTuple & > & extra_matcher () const
 
const Action< F > & repeated_action () const
 
virtual void MaybeDescribeExtraMatcherTo (::std::ostream *os)
 
- Public Member Functions inherited from testing::internal::ExpectationBase
 ExpectationBase (const char *file, int line, const std::string &source_text)
 
virtual ~ExpectationBase ()
 
const char * file () const
 
int line () const
 
const char * source_text () const
 
const Cardinalitycardinality () const
 
void DescribeLocationTo (::std::ostream *os) const
 
void DescribeCallCountTo (::std::ostream *os) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 

Friends

template<typename Function >
class FunctionMockerBase
 

Additional Inherited Members

- Protected Types inherited from testing::internal::ExpectationBase
enum  Clause {
  kNone , kWith , kTimes , kInSequence ,
  kAfter , kWillOnce , kWillRepeatedly , kRetiresOnSaturation
}
 
typedef std::vector< const void * > UntypedActions
 
- Protected Member Functions inherited from testing::internal::ExpectationBase
void AssertSpecProperty (bool property, const std::string &failure_message) const
 
void ExpectSpecProperty (bool property, const std::string &failure_message) const
 
void SpecifyCardinality (const Cardinality &cardinality)
 
bool cardinality_specified () const
 
void set_cardinality (const Cardinality &a_cardinality)
 
void RetireAllPreRequisites () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool is_retired () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void Retire () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsSatisfied () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsSaturated () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsOverSaturated () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool AllPrerequisitesAreSatisfied () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void FindUnsatisfiedPrerequisites (ExpectationSet *result) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
int call_count () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void IncrementCallCount () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void CheckActionCountIfNotDone () const GTEST_LOCK_EXCLUDED_(mutex_)
 
void UntypedTimes (const Cardinality &a_cardinality)
 
 GTEST_DISALLOW_ASSIGN_ (ExpectationBase)
 
- Protected Attributes inherited from testing::internal::ExpectationBase
const char * file_
 
int line_
 
const std::string source_text_
 
bool cardinality_specified_
 
Cardinality cardinality_
 
ExpectationSet immediate_prerequisites_
 
int call_count_
 
bool retired_
 
UntypedActions untyped_actions_
 
bool extra_matcher_specified_
 
bool repeated_action_specified_
 
bool retires_on_saturation_
 
Clause last_clause_
 
bool action_count_checked_
 
Mutex mutex_
 

Detailed Description

template<typename F>
class testing::internal::TypedExpectation< F >

Definition at line 884 of file gmock-spec-builders.h.

Member Typedef Documentation

◆ ArgumentMatcherTuple

template<typename F >
Function<F>::ArgumentMatcherTuple testing::internal::TypedExpectation< F >::ArgumentMatcherTuple

Definition at line 887 of file gmock-spec-builders.h.

◆ ArgumentTuple

template<typename F >
Function<F>::ArgumentTuple testing::internal::TypedExpectation< F >::ArgumentTuple

Definition at line 886 of file gmock-spec-builders.h.

◆ Result

template<typename F >
Function<F>::Result testing::internal::TypedExpectation< F >::Result

Definition at line 888 of file gmock-spec-builders.h.

Constructor & Destructor Documentation

◆ TypedExpectation()

template<typename F >
testing::internal::TypedExpectation< F >::TypedExpectation ( FunctionMockerBase< F > * owner,
const char * a_file,
int a_line,
const std::string & a_source_text,
const ArgumentMatcherTuple & m )
inline

Definition at line 890 of file gmock-spec-builders.h.

893 : ExpectationBase(a_file, a_line, a_source_text),
894 owner_(owner),
895 matchers_(m),
896 // By default, extra_matcher_ should match anything. However,
897 // we cannot initialize it with _ as that triggers a compiler
898 // bug in Symbian's C++ compiler (cannot decide between two
899 // overloaded constructors of Matcher<const ArgumentTuple&>).
900 extra_matcher_(A<const ArgumentTuple&>()),
901 repeated_action_(DoDefault()) {}
ExpectationBase(const char *file, int line, const std::string &source_text)
internal::DoDefaultAction DoDefault()

◆ ~TypedExpectation()

template<typename F >
virtual testing::internal::TypedExpectation< F >::~TypedExpectation ( )
inlinevirtual

Definition at line 903 of file gmock-spec-builders.h.

903 {
904 // Check the validity of the action count if it hasn't been done
905 // yet (for example, if the expectation was never used).
907 for (UntypedActions::const_iterator it = untyped_actions_.begin();
908 it != untyped_actions_.end(); ++it) {
909 delete static_cast<const Action<F>*>(*it);
910 }
911 }
void CheckActionCountIfNotDone() const GTEST_LOCK_EXCLUDED_(mutex_)

Member Function Documentation

◆ After() [1/5]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::After ( const ExpectationSet & s)
inline

Definition at line 971 of file gmock-spec-builders.h.

971 {
973 ".After() cannot appear after .WillOnce(),"
974 " .WillRepeatedly(), or "
975 ".RetiresOnSaturation().");
977
978 for (ExpectationSet::const_iterator it = s.begin(); it != s.end(); ++it) {
980 }
981 return *this;
982 }
Expectation::Set::const_iterator const_iterator
void ExpectSpecProperty(bool property, const std::string &failure_message) const
char * s
Here is the caller graph for this function:

◆ After() [2/5]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::After ( const ExpectationSet & s1,
const ExpectationSet & s2 )
inline

Definition at line 983 of file gmock-spec-builders.h.

983 {
984 return After(s1).After(s2);
985 }
TypedExpectation & After(const ExpectationSet &s)
Here is the call graph for this function:

◆ After() [3/5]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::After ( const ExpectationSet & s1,
const ExpectationSet & s2,
const ExpectationSet & s3 )
inline

Definition at line 986 of file gmock-spec-builders.h.

987 {
988 return After(s1, s2).After(s3);
989 }
Here is the call graph for this function:

◆ After() [4/5]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::After ( const ExpectationSet & s1,
const ExpectationSet & s2,
const ExpectationSet & s3,
const ExpectationSet & s4 )
inline

Definition at line 990 of file gmock-spec-builders.h.

991 {
992 return After(s1, s2, s3).After(s4);
993 }
Here is the call graph for this function:

◆ After() [5/5]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::After ( const ExpectationSet & s1,
const ExpectationSet & s2,
const ExpectationSet & s3,
const ExpectationSet & s4,
const ExpectationSet & s5 )
inline

Definition at line 994 of file gmock-spec-builders.h.

996 {
997 return After(s1, s2, s3, s4).After(s5);
998 }
Here is the call graph for this function:

◆ extra_matcher()

template<typename F >
const Matcher< const ArgumentTuple & > & testing::internal::TypedExpectation< F >::extra_matcher ( ) const
inline

Definition at line 1060 of file gmock-spec-builders.h.

1060 {
1061 return extra_matcher_;
1062 }

◆ InSequence() [1/5]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::InSequence ( const Sequence & s)
inline

Definition at line 943 of file gmock-spec-builders.h.

943 {
945 ".InSequence() cannot appear after .After(),"
946 " .WillOnce(), .WillRepeatedly(), or "
947 ".RetiresOnSaturation().");
949
950 s.AddExpectation(GetHandle());
951 return *this;
952 }

◆ InSequence() [2/5]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::InSequence ( const Sequence & s1,
const Sequence & s2 )
inline

Definition at line 953 of file gmock-spec-builders.h.

953 {
954 return InSequence(s1).InSequence(s2);
955 }
TypedExpectation & InSequence(const Sequence &s)
Here is the call graph for this function:

◆ InSequence() [3/5]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::InSequence ( const Sequence & s1,
const Sequence & s2,
const Sequence & s3 )
inline

Definition at line 956 of file gmock-spec-builders.h.

957 {
958 return InSequence(s1, s2).InSequence(s3);
959 }
Here is the call graph for this function:

◆ InSequence() [4/5]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::InSequence ( const Sequence & s1,
const Sequence & s2,
const Sequence & s3,
const Sequence & s4 )
inline

Definition at line 960 of file gmock-spec-builders.h.

961 {
962 return InSequence(s1, s2, s3).InSequence(s4);
963 }
Here is the call graph for this function:

◆ InSequence() [5/5]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::InSequence ( const Sequence & s1,
const Sequence & s2,
const Sequence & s3,
const Sequence & s4,
const Sequence & s5 )
inline

Definition at line 964 of file gmock-spec-builders.h.

966 {
967 return InSequence(s1, s2, s3, s4).InSequence(s5);
968 }
Here is the call graph for this function:

◆ matchers()

template<typename F >
const ArgumentMatcherTuple & testing::internal::TypedExpectation< F >::matchers ( ) const
inline

Definition at line 1055 of file gmock-spec-builders.h.

1055 {
1056 return matchers_;
1057 }

◆ MaybeDescribeExtraMatcherTo()

template<typename F >
virtual void testing::internal::TypedExpectation< F >::MaybeDescribeExtraMatcherTo ( ::std::ostream * os)
inlinevirtual

Implements testing::internal::ExpectationBase.

Definition at line 1069 of file gmock-spec-builders.h.

1069 {
1071 *os << " Expected args: ";
1072 extra_matcher_.DescribeTo(os);
1073 *os << "\n";
1074 }
1075 }
void DescribeTo(::std::ostream *os) const
os_t os

◆ repeated_action()

template<typename F >
const Action< F > & testing::internal::TypedExpectation< F >::repeated_action ( ) const
inline

Definition at line 1065 of file gmock-spec-builders.h.

1065{ return repeated_action_; }

◆ RetiresOnSaturation()

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::RetiresOnSaturation ( )
inline

Definition at line 1040 of file gmock-spec-builders.h.

1040 {
1042 ".RetiresOnSaturation() cannot appear "
1043 "more than once.");
1046
1047 // Now that no more action clauses can be specified, we check
1048 // whether their count makes sense.
1050 return *this;
1051 }

◆ Times() [1/2]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::Times ( const Cardinality & a_cardinality)
inline

Definition at line 932 of file gmock-spec-builders.h.

932 {
933 ExpectationBase::UntypedTimes(a_cardinality);
934 return *this;
935 }
void UntypedTimes(const Cardinality &a_cardinality)

◆ Times() [2/2]

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::Times ( int n)
inline

Definition at line 938 of file gmock-spec-builders.h.

938 {
939 return Times(Exactly(n));
940 }
TypedExpectation & Times(const Cardinality &a_cardinality)
GTEST_API_ Cardinality Exactly(int n)

◆ WillOnce()

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::WillOnce ( const Action< F > & action)
inline

Definition at line 1001 of file gmock-spec-builders.h.

1001 {
1003 ".WillOnce() cannot appear after "
1004 ".WillRepeatedly() or .RetiresOnSaturation().");
1006
1007 untyped_actions_.push_back(new Action<F>(action));
1008 if (!cardinality_specified()) {
1009 set_cardinality(Exactly(static_cast<int>(untyped_actions_.size())));
1010 }
1011 return *this;
1012 }
void set_cardinality(const Cardinality &a_cardinality)

◆ WillRepeatedly()

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::WillRepeatedly ( const Action< F > & action)
inline

Definition at line 1015 of file gmock-spec-builders.h.

1015 {
1017 ExpectSpecProperty(false,
1018 ".WillRepeatedly() cannot appear "
1019 "more than once in an EXPECT_CALL().");
1020 } else {
1022 ".WillRepeatedly() cannot appear "
1023 "after .RetiresOnSaturation().");
1024 }
1027
1028 repeated_action_ = action;
1029 if (!cardinality_specified()) {
1030 set_cardinality(AtLeast(static_cast<int>(untyped_actions_.size())));
1031 }
1032
1033 // Now that no more action clauses can be specified, we check
1034 // whether their count makes sense.
1036 return *this;
1037 }
GTEST_API_ Cardinality AtLeast(int n)

◆ With()

template<typename F >
TypedExpectation & testing::internal::TypedExpectation< F >::With ( const Matcher< const ArgumentTuple & > & m)
inline

Definition at line 914 of file gmock-spec-builders.h.

914 {
915 if (last_clause_ == kWith) {
916 ExpectSpecProperty(false,
917 ".With() cannot appear "
918 "more than once in an EXPECT_CALL().");
919 } else {
921 ".With() must be the first "
922 "clause in an EXPECT_CALL().");
923 }
925
926 extra_matcher_ = m;
928 return *this;
929 }

Friends And Related Symbol Documentation

◆ FunctionMockerBase

template<typename F >
template<typename Function >
friend class FunctionMockerBase
friend

Definition at line 1079 of file gmock-spec-builders.h.


The documentation for this class was generated from the following file: