60 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ 61 #define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ 69 #if GTEST_HAS_EXCEPTIONS 73 #include "gmock/gmock-actions.h" 74 #include "gmock/gmock-cardinalities.h" 75 #include "gmock/gmock-matchers.h" 76 #include "gmock/internal/gmock-internal-utils.h" 77 #include "gmock/internal/gmock-port.h" 78 #include "gtest/gtest.h" 93 template <
typename F>
class FunctionMocker;
96 class ExpectationBase;
99 template <
typename F>
class TypedExpectation;
102 class ExpectationTester;
105 template <
typename F>
class FunctionMockerBase;
121 class UntypedActionResultHolderBase;
128 UntypedFunctionMockerBase();
129 virtual ~UntypedFunctionMockerBase();
134 bool VerifyAndClearExpectationsLocked()
138 virtual
void ClearDefaultActionsLocked()
150 virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
151 const void* untyped_args,
157 virtual UntypedActionResultHolderBase* UntypedPerformAction(
158 const
void* untyped_action,
159 const
void* untyped_args) const = 0;
164 virtual
void UntypedDescribeUninterestingCall(
165 const
void* untyped_args,
166 ::
std::ostream* os) const
175 virtual const ExpectationBase* UntypedFindMatchingExpectation(
176 const
void* untyped_args,
177 const
void** untyped_action,
bool* is_excessive,
178 ::
std::ostream* what, ::
std::ostream* why)
182 virtual
void UntypedPrintArgs(const
void* untyped_args,
183 ::
std::ostream* os) const = 0;
190 void RegisterOwner(const
void* mock_obj)
196 void SetOwnerAndName(const
void* mock_obj, const
char*
name)
202 const
void* MockObject() const
207 const
char* Name() const
214 UntypedActionResultHolderBase* UntypedInvokeWith(
215 const
void* untyped_args)
231 const
void* mock_obj_;
238 UntypedOnCallSpecs untyped_on_call_specs_;
249 : file_(a_file), line_(a_line), last_clause_(kNone) {}
252 const char*
file()
const {
return file_; }
253 int line()
const {
return line_; }
267 Assert(property, file_, line_, failure_message);
272 Expect(property, file_, line_, failure_message);
284 template <
typename F>
293 const ArgumentMatcherTuple& matchers)
300 extra_matcher_(
A<
const ArgumentTuple&>()) {
306 ExpectSpecProperty(last_clause_ < kWith,
307 ".With() cannot appear " 308 "more than once in an ON_CALL().");
309 last_clause_ = kWith;
317 ExpectSpecProperty(last_clause_ < kWillByDefault,
318 ".WillByDefault() must appear " 319 "exactly once in an ON_CALL().");
320 last_clause_ = kWillByDefault;
323 "DoDefault() cannot be used in ON_CALL().");
329 bool Matches(
const ArgumentTuple& args)
const {
330 return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
335 AssertSpecProperty(last_clause_ == kWillByDefault,
336 ".WillByDefault() must appear exactly " 337 "once in an ON_CALL().");
355 ArgumentMatcherTuple matchers_;
377 static void AllowLeak(
const void* mock_obj)
383 static bool VerifyAndClearExpectations(
void* mock_obj)
389 static bool VerifyAndClear(
void* mock_obj)
397 template <
typename F>
400 template <
typename M>
403 template <
typename M>
406 template <
typename M>
411 static void AllowUninterestingCalls(
const void* mock_obj)
416 static void WarnUninterestingCalls(
const void* mock_obj)
421 static void FailUninterestingCalls(
const void* mock_obj)
426 static void UnregisterCallReaction(
const void* mock_obj)
432 const void* mock_obj)
438 static bool VerifyAndClearExpectationsLocked(
void* mock_obj)
442 static void ClearDefaultActionsLocked(
void* mock_obj)
446 static void Register(
447 const void* mock_obj,
454 static void RegisterUseByOnCallOrExpectCall(
455 const void* mock_obj,
const char* file,
int line)
518 friend class ::testing::internal::ExpectationBase;
519 friend class ::testing::internal::UntypedFunctionMockerBase;
521 template <
typename F>
522 friend class ::testing::internal::FunctionMockerBase;
524 template <
typename F>
525 friend class ::testing::internal::TypedExpectation;
535 typedef ::std::set<Expectation, Less>
Set;
543 return expectation_base_;
602 expectations_.insert(e);
606 int size()
const {
return static_cast<int>(expectations_.size()); }
608 const_iterator
begin()
const {
return expectations_.begin(); }
609 const_iterator
end()
const {
return expectations_.end(); }
626 void AddExpectation(
const Expectation& expectation)
const;
665 bool sequence_created_;
693 ExpectationBase(
const char* file,
int line,
const string& source_text);
695 virtual ~ExpectationBase();
698 const char*
file()
const {
return file_; }
699 int line()
const {
return line_; }
711 void DescribeCallCountTo(::std::ostream* os)
const 716 virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) = 0;
719 friend class ::testing::Expectation;
742 Assert(property, file_, line_, failure_message);
747 Expect(property, file_, line_, failure_message);
752 void SpecifyCardinality(
const Cardinality& cardinality);
760 cardinality_ = a_cardinality;
768 void RetireAllPreRequisites()
773 GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
774 g_gmock_mutex.AssertHeld();
780 GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
781 g_gmock_mutex.AssertHeld();
787 GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
788 g_gmock_mutex.AssertHeld();
794 GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
795 g_gmock_mutex.AssertHeld();
801 GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
802 g_gmock_mutex.AssertHeld();
807 bool AllPrerequisitesAreSatisfied()
const 816 GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
817 g_gmock_mutex.AssertHeld();
823 GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
824 g_gmock_mutex.AssertHeld();
832 void CheckActionCountIfNotDone()
const 835 friend class ::testing::Sequence;
836 friend class ::testing::internal::ExpectationTester;
838 template <
typename Function>
842 void UntypedTimes(
const Cardinality& a_cardinality);
848 const string source_text_;
850 bool cardinality_specified_;
864 UntypedActions untyped_actions_;
865 bool extra_matcher_specified_;
866 bool repeated_action_specified_;
867 bool retires_on_saturation_;
869 mutable bool action_count_checked_;
876 template <
typename F>
884 const char* a_file,
int a_line,
const string& a_source_text,
885 const ArgumentMatcherTuple&
m)
886 : ExpectationBase(a_file, a_line, a_source_text),
893 extra_matcher_(
A<
const ArgumentTuple&>()),
899 CheckActionCountIfNotDone();
900 for (UntypedActions::const_iterator it = untyped_actions_.begin();
901 it != untyped_actions_.end(); ++it) {
902 delete static_cast<const Action<F>*
>(*it);
908 if (last_clause_ == kWith) {
909 ExpectSpecProperty(
false,
910 ".With() cannot appear " 911 "more than once in an EXPECT_CALL().");
913 ExpectSpecProperty(last_clause_ < kWith,
914 ".With() must be the first " 915 "clause in an EXPECT_CALL().");
917 last_clause_ = kWith;
920 extra_matcher_specified_ =
true;
937 ExpectSpecProperty(last_clause_ <= kInSequence,
938 ".InSequence() cannot appear after .After()," 939 " .WillOnce(), .WillRepeatedly(), or " 940 ".RetiresOnSaturation().");
941 last_clause_ = kInSequence;
947 return InSequence(s1).InSequence(s2);
950 const Sequence& s3) {
951 return InSequence(s1, s2).InSequence(s3);
954 const Sequence& s3,
const Sequence& s4) {
955 return InSequence(s1, s2, s3).InSequence(s4);
958 const Sequence& s3,
const Sequence& s4,
959 const Sequence& s5) {
960 return InSequence(s1, s2, s3, s4).InSequence(s5);
965 ExpectSpecProperty(last_clause_ <= kAfter,
966 ".After() cannot appear after .WillOnce()," 967 " .WillRepeatedly(), or " 968 ".RetiresOnSaturation().");
969 last_clause_ = kAfter;
972 immediate_prerequisites_ += *it;
977 return After(s1).
After(s2);
981 return After(s1, s2).
After(s3);
985 return After(s1, s2, s3).
After(s4);
990 return After(s1, s2, s3, s4).
After(s5);
995 ExpectSpecProperty(last_clause_ <= kWillOnce,
996 ".WillOnce() cannot appear after " 997 ".WillRepeatedly() or .RetiresOnSaturation().");
998 last_clause_ = kWillOnce;
1000 untyped_actions_.push_back(
new Action<F>(action));
1001 if (!cardinality_specified()) {
1002 set_cardinality(
Exactly(static_cast<int>(untyped_actions_.size())));
1009 if (last_clause_ == kWillRepeatedly) {
1010 ExpectSpecProperty(
false,
1011 ".WillRepeatedly() cannot appear " 1012 "more than once in an EXPECT_CALL().");
1014 ExpectSpecProperty(last_clause_ < kWillRepeatedly,
1015 ".WillRepeatedly() cannot appear " 1016 "after .RetiresOnSaturation().");
1018 last_clause_ = kWillRepeatedly;
1019 repeated_action_specified_ =
true;
1021 repeated_action_ =
action;
1022 if (!cardinality_specified()) {
1023 set_cardinality(
AtLeast(static_cast<int>(untyped_actions_.size())));
1028 CheckActionCountIfNotDone();
1034 ExpectSpecProperty(last_clause_ < kRetiresOnSaturation,
1035 ".RetiresOnSaturation() cannot appear " 1037 last_clause_ = kRetiresOnSaturation;
1038 retires_on_saturation_ =
true;
1042 CheckActionCountIfNotDone();
1054 return extra_matcher_;
1063 if (extra_matcher_specified_) {
1064 *os <<
" Expected args: ";
1065 extra_matcher_.DescribeTo(os);
1071 template <
typename Function>
1077 return owner_->GetHandleOf(
this);
1087 g_gmock_mutex.AssertHeld();
1088 return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
1094 g_gmock_mutex.AssertHeld();
1100 CheckActionCountIfNotDone();
1101 return !is_retired() && AllPrerequisitesAreSatisfied() &&
Matches(args);
1107 const ArgumentTuple& args,
1108 ::std::ostream* os)
const 1110 g_gmock_mutex.AssertHeld();
1113 *os <<
" Expected: the expectation is active\n" 1114 <<
" Actual: it is retired\n";
1120 if (!extra_matcher_.MatchAndExplain(args, &listener)) {
1121 *os <<
" Expected args: ";
1122 extra_matcher_.DescribeTo(os);
1123 *os <<
"\n Actual: don't match";
1128 }
else if (!AllPrerequisitesAreSatisfied()) {
1129 *os <<
" Expected: all pre-requisites are satisfied\n" 1130 <<
" Actual: the following immediate pre-requisites " 1131 <<
"are not satisfied:\n";
1133 FindUnsatisfiedPrerequisites(&unsatisfied_prereqs);
1136 it != unsatisfied_prereqs.
end(); ++it) {
1137 it->expectation_base()->DescribeLocationTo(os);
1138 *os <<
"pre-requisite #" << i++ <<
"\n";
1140 *os <<
" (end of pre-requisites)\n";
1146 *os <<
"The call matches the expectation.\n";
1153 const ArgumentTuple& args)
const 1155 g_gmock_mutex.AssertHeld();
1156 const int count = call_count();
1157 Assert(count >= 1, __FILE__, __LINE__,
1158 "call_count() is <= 0 when GetCurrentAction() is " 1159 "called - this should never happen.");
1161 const int action_count =
static_cast<int>(untyped_actions_.size());
1162 if (action_count > 0 && !repeated_action_specified_ &&
1163 count > action_count) {
1166 ::std::stringstream ss;
1167 DescribeLocationTo(&ss);
1168 ss <<
"Actions ran out in " << source_text() <<
"...\n" 1169 <<
"Called " << count <<
" times, but only " 1170 << action_count <<
" WillOnce()" 1171 << (action_count == 1 ?
" is" :
"s are") <<
" specified - ";
1172 mocker->DescribeDefaultActionTo(args, &ss);
1176 return count <= action_count ?
1177 *
static_cast<const Action<F>*
>(untyped_actions_[count - 1]) :
1190 const ArgumentTuple& args,
1191 ::std::ostream* what,
1192 ::std::ostream* why)
1194 g_gmock_mutex.AssertHeld();
1195 if (IsSaturated()) {
1197 IncrementCallCount();
1198 *what <<
"Mock function called more times than expected - ";
1199 mocker->DescribeDefaultActionTo(args, what);
1200 DescribeCallCountTo(why);
1208 IncrementCallCount();
1209 RetireAllPreRequisites();
1211 if (retires_on_saturation_ && IsSaturated()) {
1216 *what <<
"Mock function call matches " << source_text() <<
"...\n";
1217 return &(GetCurrentAction(mocker, args));
1223 ArgumentMatcherTuple matchers_;
1242 const char* file,
int line,
1245 template <
typename F>
1255 : function_mocker_(function_mocker) {}
1260 const char* file,
int line,
const char* obj,
const char*
call) {
1262 string(
"ON_CALL(") + obj +
", " + call +
") invoked");
1263 return function_mocker_->AddNewOnCallSpec(file, line, matchers_);
1269 const char* file,
int line,
const char* obj,
const char*
call) {
1270 const string source_text(
string(
"EXPECT_CALL(") + obj +
", " + call +
")");
1272 return function_mocker_->AddNewExpectation(
1273 file, line, source_text, matchers_);
1277 template <
typename Function>
1281 matchers_ = matchers;
1301 template <
typename T>
1328 template <
typename T>
1335 : value_ptr_(&ref) {}
1337 const T&
Peek()
const {
return *value_ptr_; }
1349 # pragma warning(push) // Saves the current warning state. 1350 # pragma warning(disable:4355) // Temporarily disables warning 4355. 1367 virtual void PrintAsActionResult(::std::ostream* os)
const = 0;
1371 template <
typename T>
1376 return result_.Unwrap();
1381 *os <<
"\n Returns: ";
1388 template <
typename F>
1392 const string& call_description) {
1399 template <
typename F>
1428 template <
typename F>
1432 const string& call_description) {
1439 template <
typename F>
1455 template <
typename F>
1470 VerifyAndClearExpectationsLocked();
1471 Mock::UnregisterLocked(
this);
1472 ClearDefaultActionsLocked();
1479 const ArgumentTuple& args)
const {
1480 for (UntypedOnCallSpecs::const_reverse_iterator it
1481 = untyped_on_call_specs_.rbegin();
1482 it != untyped_on_call_specs_.rend(); ++it) {
1499 const string& call_description)
const {
1501 this->FindOnCallSpec(args);
1505 const string message = call_description +
1506 "\n The mock function has no default action " 1507 "set, and its return type has no default value set.";
1508 #if GTEST_HAS_EXCEPTIONS 1510 throw std::runtime_error(message);
1524 const void* untyped_args,
1525 const string& call_description)
const {
1526 const ArgumentTuple& args =
1527 *
static_cast<const ArgumentTuple*
>(untyped_args);
1528 return ResultHolder::PerformDefaultAction(
this, args, call_description);
1536 const void* untyped_action,
const void* untyped_args)
const {
1540 const ArgumentTuple& args =
1541 *
static_cast<const ArgumentTuple*
>(untyped_args);
1542 return ResultHolder::PerformAction(action, args);
1549 g_gmock_mutex.AssertHeld();
1559 untyped_on_call_specs_.swap(specs_to_delete);
1561 g_gmock_mutex.Unlock();
1562 for (UntypedOnCallSpecs::const_iterator it =
1563 specs_to_delete.begin();
1564 it != specs_to_delete.end(); ++it) {
1570 g_gmock_mutex.Lock();
1574 template <
typename Function>
1585 DownCast_<ResultHolder*>(this->UntypedInvokeWith(&args)));
1586 return holder->Unwrap();
1591 const char* file,
int line,
1592 const ArgumentMatcherTuple&
m)
1594 Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
1596 untyped_on_call_specs_.push_back(on_call_spec);
1597 return *on_call_spec;
1604 const string& source_text,
1605 const ArgumentMatcherTuple&
m)
1607 Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
1611 untyped_expectations_.push_back(untyped_expectation);
1614 Sequence*
const implicit_sequence = g_gmock_implicit_sequence.get();
1615 if (implicit_sequence != NULL) {
1619 return *expectation;
1635 ::std::ostream* os)
const {
1640 "returning directly.\n" :
1641 "returning default value.\n");
1643 *os <<
"taking default action specified at:\n" 1652 const void* untyped_args,
1653 ::std::ostream* os)
const 1655 const ArgumentTuple& args =
1656 *
static_cast<const ArgumentTuple*
>(untyped_args);
1657 *os <<
"Uninteresting mock function call - ";
1658 DescribeDefaultActionTo(args, os);
1659 *os <<
" Function call: " << Name();
1680 const void* untyped_args,
1681 const void** untyped_action,
bool* is_excessive,
1682 ::std::ostream* what, ::std::ostream* why)
1684 const ArgumentTuple& args =
1685 *
static_cast<const ArgumentTuple*
>(untyped_args);
1689 this->FormatUnexpectedCallMessageLocked(args, what, why);
1700 *untyped_action =
action;
1706 ::std::ostream* os)
const {
1707 const ArgumentTuple& args =
1708 *
static_cast<const ArgumentTuple*
>(untyped_args);
1715 const ArgumentTuple& args)
const 1717 g_gmock_mutex.AssertHeld();
1718 for (
typename UntypedExpectations::const_reverse_iterator it =
1719 untyped_expectations_.rbegin();
1720 it != untyped_expectations_.rend(); ++it) {
1732 const ArgumentTuple& args,
1734 ::std::ostream* why)
const 1736 g_gmock_mutex.AssertHeld();
1737 *os <<
"\nUnexpected mock function call - ";
1738 DescribeDefaultActionTo(args, os);
1739 PrintTriedExpectationsLocked(args, why);
1745 const ArgumentTuple& args,
1746 ::std::ostream* why)
const 1748 g_gmock_mutex.AssertHeld();
1749 const int count =
static_cast<int>(untyped_expectations_.size());
1750 *why <<
"Google Mock tried the following " << count <<
" " 1751 << (count == 1 ?
"expectation, but it didn't match" :
1752 "expectations, but none matched")
1760 *why <<
"tried expectation #" <<
i <<
": ";
1788 # pragma warning(pop) // Restores the warning state. 1825 template <
typename T>
1826 inline const T&
Const(
const T&
x) {
return x; }
1838 #define GMOCK_ON_CALL_IMPL_(obj, call) \ 1839 ((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \ 1841 #define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call) 1843 #define GMOCK_EXPECT_CALL_IMPL_(obj, call) \ 1844 ((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call) 1845 #define EXPECT_CALL(obj, call) GMOCK_EXPECT_CALL_IMPL_(obj, call) 1847 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ void ExpectSpecProperty(bool property, const string &failure_message) const
virtual ~TypedExpectation()
Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
void ExpectSpecProperty(bool property, const string &failure_message) const
GTEST_API_ ThreadLocal< Sequence * > g_gmock_implicit_sequence
virtual void UntypedDescribeUninterestingCall(const void *untyped_args,::std::ostream *os) const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
void AssertSpecProperty(bool property, const string &failure_message) const
bool Matches(const ArgumentTuple &args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
OnCallSpec(const char *a_file, int a_line, const ArgumentMatcherTuple &matchers)
virtual ~UntypedActionResultHolderBase()
virtual ~FunctionMockerBase() GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
ExpectationSet(const Expectation &e)
const internal::linked_ptr< internal::ExpectationBase > & expectation_base() const
virtual Expectation GetHandle()=0
TypedExpectation & Times(int n)
GTEST_API_ Cardinality AtLeast(int n)
TypedExpectation(FunctionMockerBase< F > *owner, const char *a_file, int a_line, const string &a_source_text, const ArgumentMatcherTuple &m)
virtual void UntypedPrintArgs(const void *untyped_args,::std::ostream *os) const
class GTEST_API_ testing::internal::ScopedTrace GTEST_ATTRIBUTE_UNUSED_
ExpectationSet(internal::ExpectationBase &exp)
TypedExpectation & WillOnce(const Action< F > &action)
static ActionResultHolder * PerformAction(const Action< F > &action, const typename Function< F >::ArgumentTuple &args)
bool IsSatisfied() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
bool ShouldHandleArguments(const ArgumentTuple &args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
bool cardinality_specified() const
const Action< F > & GetAction() const
void DescribeLocationTo(::std::ostream *os) const
std::vector< internal::linked_ptr< ExpectationBase > > UntypedExpectations
::std::string FormatFileLocation(const char *file, int line)
TypedExpectation< F > * FindMatchingExpectationLocked(const ArgumentTuple &args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
MockSpec(internal::FunctionMockerBase< F > *function_mocker)
TypedExpectation & Times(const Cardinality &a_cardinality)
TypedExpectation< F > & AddNewExpectation(const char *file, int line, const string &source_text, const ArgumentMatcherTuple &m) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
internal::OnCallSpec< F > & InternalDefaultActionSetAt(const char *file, int line, const char *obj, const char *call)
constexpr detail::Map< Move > move
OnCallSpec & With(const Matcher< const ArgumentTuple & > &m)
static ActionResultHolder * PerformDefaultAction(const FunctionMockerBase< F > *func_mocker, const typename Function< F >::ArgumentTuple &args, const string &call_description)
const Action< F > & repeated_action() const
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2, const Sequence &s3, const Sequence &s4)
internal::string str() const
GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex)
bool is_retired() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2)
Function< F >::ArgumentTuple ArgumentTuple
void IncrementCallCount() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
bool IsOverSaturatedByCallCount(int call_count) const
bool operator==(const ExpectationSet &rhs) const
bool TupleMatches(const MatcherTuple &matcher_tuple, const ValueTuple &value_tuple)
void UntypedTimes(const Cardinality &a_cardinality)
const OnCallSpec< F > * FindOnCallSpec(const ArgumentTuple &args) const
static ActionResultHolder * PerformAction(const Action< F > &action, const typename Function< F >::ArgumentTuple &args)
Result InvokeWith(const ArgumentTuple &args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
Function< F >::ArgumentTuple ArgumentTuple
virtual void PrintAsActionResult(::std::ostream *os) const
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3, const ExpectationSet &s4, const ExpectationSet &s5)
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3, const ExpectationSet &s4)
virtual Expectation GetHandle()
bool operator==(const Expectation &rhs) const
#define GTEST_DISALLOW_ASSIGN_(type)
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2)
FOLLY_PUSH_WARNING RHS rhs
Expectation::Set::const_iterator const_iterator
OnCallSpec< F > & AddNewOnCallSpec(const char *file, int line, const ArgumentMatcherTuple &m) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
int call_count() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
const char * source_text() const
TypedExpectation & RetiresOnSaturation()
void ReportUninterestingCall(CallReaction reaction, const string &msg)
internal::TypedExpectation< F > & InternalExpectedAt(const char *file, int line, const char *obj, const char *call)
Expectation::Set::value_type value_type
internal::linked_ptr< internal::ExpectationBase > expectation_base_
internal::Function< F >::ArgumentTuple ArgumentTuple
TypedExpectation & InSequence(const Sequence &s)
void Expect(bool condition, const char *file, int line, const string &msg)
const Action< F > * GetActionForArguments(const FunctionMockerBase< F > *mocker, const ArgumentTuple &args,::std::ostream *what,::std::ostream *why) GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
bool operator()(const Expectation &lhs, const Expectation &rhs) const
virtual void PrintAsActionResult(::std::ostream *) const
const char * file() const
void AddExpectation(const Expectation &expectation) const
void PrintIfNotEmpty(const internal::string &explanation,::std::ostream *os)
bool operator!=(const ExpectationSet &rhs) const
bool Matches(const ArgumentTuple &args) const
GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity, const char *file, int line, const string &message)
internal::MatcherAsPredicate< M > Matches(M matcher)
ActionResultHolder(Wrapper result)
Function< F >::Result Result
TypedExpectation & WillRepeatedly(const Action< F > &action)
GTEST_API_ void Log(LogSeverity severity, const string &message, int stack_frames_to_skip)
UntypedOnCallSpecBase(const char *a_file, int a_line)
void UniversalPrint(const T &value,::std::ostream *os)
static map< string, int > m
virtual const ExpectationBase * UntypedFindMatchingExpectation(const void *untyped_args, const void **untyped_action, bool *is_excessive,::std::ostream *what,::std::ostream *why) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
Result PerformDefaultAction(const ArgumentTuple &args, const string &call_description) const
Function< F >::ArgumentTuple ArgumentTuple
static const char *const value
const Matcher< const ArgumentTuple & > & extra_matcher() const
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3)
internal::Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
ReferenceOrValueWrapper< T > Wrapper
void ExplainMatchFailureTupleTo(const MatcherTuple &matchers, const ValueTuple &values,::std::ostream *os)
void Retire() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
void AssertSpecProperty(bool property, const string &failure_message) const
ExpectationSet & operator+=(const Expectation &e)
Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
virtual void ClearDefaultActionsLocked() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
bool IsSaturated() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
GTEST_API_ Cardinality Exactly(int n)
bool IsSaturatedByCallCount(int call_count) const
#define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
void set_cardinality(const Cardinality &a_cardinality)
const_iterator end() const
ActionResultHolder< Result > ResultHolder
const T & move(const T &t)
const_iterator begin() const
internal::DoDefaultAction DoDefault()
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2, const Sequence &s3, const Sequence &s4, const Sequence &s5)
MockSpec< F > & current_spec()
OnCallSpec & WillByDefault(const Action< F > &action)
void Assert(bool condition, const char *file, int line)
Result Perform(const ArgumentTuple &args) const
TypedExpectation & After(const ExpectationSet &s)
void FormatUnexpectedCallMessageLocked(const ArgumentTuple &args,::std::ostream *os,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
void SetMatchers(const ArgumentMatcherTuple &matchers)
void ExplainMatchResultTo(const ArgumentTuple &args,::std::ostream *os) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
std::vector< const void * > UntypedActions
static ActionResultHolder * PerformDefaultAction(const FunctionMockerBase< F > *func_mocker, const typename Function< F >::ArgumentTuple &args, const string &call_description)
#define GTEST_LOCK_EXCLUDED_(locks)
const char * file() const
bool IsSatisfiedByCallCount(int call_count) const
const ArgumentMatcherTuple & matchers() const
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
ReferenceOrValueWrapper(T value)
static void Print(const T &value,::std::ostream *os)
TypedExpectation & With(const Matcher< const ArgumentTuple & > &m)
::std::set< Expectation, Less > Set
ReferenceOrValueWrapper(reference ref)
const Action< F > & GetCurrentAction(const FunctionMockerBase< F > *mocker, const ArgumentTuple &args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
const Cardinality & cardinality() const
bool operator!=(const Expectation &rhs) const
void DescribeCallCountTo(::std::ostream *os) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
bool IsOverSaturated() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
void DescribeDefaultActionTo(const ArgumentTuple &args,::std::ostream *os) const
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2, const Sequence &s3)
void PrintTriedExpectationsLocked(const ArgumentTuple &args,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Future< bool > call(int depth, Executor *executor)
const T & Const(const T &x)
Expectation::Set expectations_
Function< F >::Result Result
Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
std::vector< const void * > UntypedOnCallSpecs
virtual UntypedActionResultHolderBase * UntypedPerformDefaultAction(const void *untyped_args, const string &call_description) const
virtual void MaybeDescribeExtraMatcherTo(::std::ostream *os)
virtual UntypedActionResultHolderBase * UntypedPerformAction(const void *untyped_action, const void *untyped_args) const