60 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ 61 #define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ 89 template <
typename F>
class FunctionMocker;
92 class ExpectationBase;
98 class ExpectationTester;
147 const void* untyped_args,
148 const string& call_description)
const = 0;
154 const void* untyped_action,
155 const void* untyped_args)
const = 0;
162 ::std::ostream* os)
const = 0;
172 const void* untyped_args,
173 const void** untyped_action,
bool* is_excessive,
174 ::std::ostream* what, ::std::ostream* why) = 0;
178 ::std::ostream* os)
const = 0;
203 const char*
Name()
const;
211 const void* untyped_args);
216 typedef std::vector<internal::linked_ptr<ExpectationBase> >
244 : file_(a_file), line_(a_line), last_clause_(kNone) {}
247 const char*
file()
const {
return file_; }
248 int line()
const {
return line_; }
262 Assert(property, file_, line_, failure_message);
267 Expect(property, file_, line_, failure_message);
279 template <
typename F>
288 const ArgumentMatcherTuple& matchers)
295 extra_matcher_(
A<const ArgumentTuple&>()) {
301 ExpectSpecProperty(last_clause_ < kWith,
302 ".With() cannot appear " 303 "more than once in an ON_CALL().");
304 last_clause_ = kWith;
312 ExpectSpecProperty(last_clause_ < kWillByDefault,
313 ".WillByDefault() must appear " 314 "exactly once in an ON_CALL().");
315 last_clause_ = kWillByDefault;
318 "DoDefault() cannot be used in ON_CALL().");
324 bool Matches(
const ArgumentTuple& args)
const {
325 return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
330 AssertSpecProperty(last_clause_ == kWillByDefault,
331 ".WillByDefault() must appear exactly " 332 "once in an ON_CALL().");
372 static void AllowLeak(
const void* mock_obj);
377 static bool VerifyAndClearExpectations(
void* mock_obj);
382 static bool VerifyAndClear(
void* mock_obj);
388 template <
typename F>
391 template <
typename M>
394 template <
typename M>
400 static void AllowUninterestingCalls(
const void* mock_obj);
405 static void WarnUninterestingCalls(
const void* mock_obj);
410 static void FailUninterestingCalls(
const void* mock_obj);
415 static void UnregisterCallReaction(
const void* mock_obj);
421 const void* mock_obj);
435 static void Register(
const void* mock_obj,
442 static void RegisterUseByOnCallOrExpectCall(
443 const void* mock_obj,
const char* file,
int line);
505 friend class ::testing::internal::ExpectationBase;
506 friend class ::testing::internal::UntypedFunctionMockerBase;
508 template <
typename F>
509 friend class ::testing::internal::FunctionMockerBase;
511 template <
typename F>
512 friend class ::testing::internal::TypedExpectation;
522 typedef ::std::set<Expectation, Less>
Set;
530 return expectation_base_;
589 expectations_.insert(e);
593 int size()
const {
return static_cast<int>(expectations_.size()); }
595 const_iterator
begin()
const {
return expectations_.begin(); }
596 const_iterator
end()
const {
return expectations_.end(); }
613 void AddExpectation(
const Expectation& expectation)
const;
680 ExpectationBase(
const char* file,
int line,
const string& source_text);
685 const char*
file()
const {
return file_; }
686 int line()
const {
return line_; }
699 void DescribeCallCountTo(::std::ostream* os)
const;
703 virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) = 0;
706 friend class ::testing::Expectation;
729 Assert(property, file_, line_, failure_message);
734 Expect(property, file_, line_, failure_message);
739 void SpecifyCardinality(
const Cardinality& cardinality);
747 cardinality_ = a_cardinality;
756 void RetireAllPreRequisites();
761 g_gmock_mutex.AssertHeld();
768 g_gmock_mutex.AssertHeld();
775 g_gmock_mutex.AssertHeld();
782 g_gmock_mutex.AssertHeld();
789 g_gmock_mutex.AssertHeld();
795 bool AllPrerequisitesAreSatisfied()
const;
804 g_gmock_mutex.AssertHeld();
811 g_gmock_mutex.AssertHeld();
820 void CheckActionCountIfNotDone()
const;
822 friend class ::testing::Sequence;
823 friend class ::testing::internal::ExpectationTester;
825 template <
typename Function>
829 void UntypedTimes(
const Cardinality& a_cardinality);
863 template <
typename F>
871 const char* a_file,
int a_line,
const string& a_source_text,
872 const ArgumentMatcherTuple& m)
880 extra_matcher_(
A<const ArgumentTuple&>()),
886 CheckActionCountIfNotDone();
887 for (UntypedActions::const_iterator it = untyped_actions_.begin();
888 it != untyped_actions_.end(); ++it) {
889 delete static_cast<const Action<F>*
>(*it);
895 if (last_clause_ == kWith) {
896 ExpectSpecProperty(
false,
897 ".With() cannot appear " 898 "more than once in an EXPECT_CALL().");
900 ExpectSpecProperty(last_clause_ < kWith,
901 ".With() must be the first " 902 "clause in an EXPECT_CALL().");
904 last_clause_ = kWith;
907 extra_matcher_specified_ =
true;
924 ExpectSpecProperty(last_clause_ <= kInSequence,
925 ".InSequence() cannot appear after .After()," 926 " .WillOnce(), .WillRepeatedly(), or " 927 ".RetiresOnSaturation().");
928 last_clause_ = kInSequence;
952 ExpectSpecProperty(last_clause_ <= kAfter,
953 ".After() cannot appear after .WillOnce()," 954 " .WillRepeatedly(), or " 955 ".RetiresOnSaturation().");
956 last_clause_ = kAfter;
959 immediate_prerequisites_ += *it;
964 return After(s1).
After(s2);
968 return After(s1, s2).
After(s3);
972 return After(s1, s2, s3).
After(s4);
977 return After(s1, s2, s3, s4).
After(s5);
982 ExpectSpecProperty(last_clause_ <= kWillOnce,
983 ".WillOnce() cannot appear after " 984 ".WillRepeatedly() or .RetiresOnSaturation().");
985 last_clause_ = kWillOnce;
987 untyped_actions_.push_back(
new Action<F>(action));
988 if (!cardinality_specified()) {
989 set_cardinality(
Exactly(static_cast<int>(untyped_actions_.size())));
996 if (last_clause_ == kWillRepeatedly) {
997 ExpectSpecProperty(
false,
998 ".WillRepeatedly() cannot appear " 999 "more than once in an EXPECT_CALL().");
1001 ExpectSpecProperty(last_clause_ < kWillRepeatedly,
1002 ".WillRepeatedly() cannot appear " 1003 "after .RetiresOnSaturation().");
1005 last_clause_ = kWillRepeatedly;
1006 repeated_action_specified_ =
true;
1008 repeated_action_ = action;
1009 if (!cardinality_specified()) {
1010 set_cardinality(
AtLeast(static_cast<int>(untyped_actions_.size())));
1015 CheckActionCountIfNotDone();
1021 ExpectSpecProperty(last_clause_ < kRetiresOnSaturation,
1022 ".RetiresOnSaturation() cannot appear " 1024 last_clause_ = kRetiresOnSaturation;
1025 retires_on_saturation_ =
true;
1029 CheckActionCountIfNotDone();
1041 return extra_matcher_;
1050 if (extra_matcher_specified_) {
1051 *os <<
" Expected args: ";
1052 extra_matcher_.DescribeTo(os);
1058 template <
typename Function>
1064 return owner_->GetHandleOf(
this);
1074 g_gmock_mutex.AssertHeld();
1075 return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
1081 g_gmock_mutex.AssertHeld();
1087 CheckActionCountIfNotDone();
1088 return !is_retired() && AllPrerequisitesAreSatisfied() &&
Matches(args);
1095 ::std::ostream* os)
const {
1096 g_gmock_mutex.AssertHeld();
1099 *os <<
" Expected: the expectation is active\n" 1100 <<
" Actual: it is retired\n";
1106 if (!extra_matcher_.MatchAndExplain(args, &listener)) {
1107 *os <<
" Expected args: ";
1108 extra_matcher_.DescribeTo(os);
1109 *os <<
"\n Actual: don't match";
1114 }
else if (!AllPrerequisitesAreSatisfied()) {
1115 *os <<
" Expected: all pre-requisites are satisfied\n" 1116 <<
" Actual: the following immediate pre-requisites " 1117 <<
"are not satisfied:\n";
1119 FindUnsatisfiedPrerequisites(&unsatisfied_prereqs);
1122 it != unsatisfied_prereqs.
end(); ++it) {
1123 it->expectation_base()->DescribeLocationTo(os);
1124 *os <<
"pre-requisite #" << i++ <<
"\n";
1126 *os <<
" (end of pre-requisites)\n";
1132 *os <<
"The call matches the expectation.\n";
1139 const ArgumentTuple& args)
const {
1140 g_gmock_mutex.AssertHeld();
1141 const int count = call_count();
1142 Assert(count >= 1, __FILE__, __LINE__,
1143 "call_count() is <= 0 when GetCurrentAction() is " 1144 "called - this should never happen.");
1146 const int action_count =
static_cast<int>(untyped_actions_.size());
1147 if (action_count > 0 && !repeated_action_specified_ &&
1148 count > action_count) {
1151 ::std::stringstream ss;
1152 DescribeLocationTo(&ss);
1153 ss <<
"Actions ran out in " << source_text() <<
"...\n" 1154 <<
"Called " << count <<
" times, but only " 1155 << action_count <<
" WillOnce()" 1156 << (action_count == 1 ?
" is" :
"s are") <<
" specified - ";
1161 return count <= action_count ?
1162 *
static_cast<const Action<F>*
>(untyped_actions_[count - 1]) :
1175 const ArgumentTuple& args,
1176 ::std::ostream* what,
1177 ::std::ostream* why) {
1178 g_gmock_mutex.AssertHeld();
1179 if (IsSaturated()) {
1181 IncrementCallCount();
1182 *what <<
"Mock function called more times than expected - ";
1184 DescribeCallCountTo(why);
1192 IncrementCallCount();
1193 RetireAllPreRequisites();
1195 if (retires_on_saturation_ && IsSaturated()) {
1200 *what <<
"Mock function call matches " << source_text() <<
"...\n";
1201 return &(GetCurrentAction(mocker, args));
1226 const char* file,
int line,
1229 template <
typename F>
1239 : function_mocker_(function_mocker) {}
1244 const char* file,
int line,
const char* obj,
const char* call) {
1246 string(
"ON_CALL(") + obj +
", " + call +
") invoked");
1247 return function_mocker_->AddNewOnCallSpec(file, line, matchers_);
1253 const char* file,
int line,
const char* obj,
const char* call) {
1254 const string source_text(
string(
"EXPECT_CALL(") + obj +
", " + call +
")");
1256 return function_mocker_->AddNewExpectation(
1257 file, line, source_text, matchers_);
1261 template <
typename Function>
1265 matchers_ = matchers;
1282 # pragma warning(push) // Saves the current warning state. 1283 # pragma warning(disable:4355) // Temporarily disables warning 4355. 1300 virtual void PrintAsActionResult(::std::ostream* os)
const = 0;
1304 template <
typename T>
1321 *os <<
"\n Returns: ";
1328 template <
typename F>
1332 const string& call_description) {
1339 template <
typename F>
1362 template <
typename F>
1366 const string& call_description) {
1372 template <
typename F>
1384 template <
typename F>
1408 const ArgumentTuple& args)
const {
1409 for (UntypedOnCallSpecs::const_reverse_iterator it
1426 const string& call_description)
const {
1428 this->FindOnCallSpec(args);
1433 call_description +
"\n The mock function has no default action " 1434 "set, and its return type has no default value set.");
1444 const void* untyped_args,
1445 const string& call_description)
const {
1446 const ArgumentTuple& args =
1447 *
static_cast<const ArgumentTuple*
>(untyped_args);
1448 return ResultHolder::PerformDefaultAction(
this, args, call_description);
1456 const void* untyped_action,
const void* untyped_args)
const {
1460 const ArgumentTuple& args =
1461 *
static_cast<const ArgumentTuple*
>(untyped_args);
1462 return ResultHolder::PerformAction(action, args);
1469 g_gmock_mutex.AssertHeld();
1470 for (UntypedOnCallSpecs::const_iterator it =
1479 template <
typename Function>
1489 return static_cast<const ResultHolder*
>(
1496 const char* file,
int line,
1497 const ArgumentMatcherTuple& m) {
1501 return *on_call_spec;
1509 const string& source_text,
1510 const ArgumentMatcherTuple& m) {
1518 Sequence*
const implicit_sequence = g_gmock_implicit_sequence.get();
1519 if (implicit_sequence != NULL) {
1523 return *expectation;
1539 ::std::ostream* os)
const {
1543 *os << (internal::type_equals<Result, void>::value ?
1544 "returning directly.\n" :
1545 "returning default value.\n");
1547 *os <<
"taking default action specified at:\n" 1557 ::std::ostream* os)
const {
1558 const ArgumentTuple& args =
1559 *
static_cast<const ArgumentTuple*
>(untyped_args);
1560 *os <<
"Uninteresting mock function call - ";
1561 DescribeDefaultActionTo(args, os);
1562 *os <<
" Function call: " <<
Name();
1584 const void* untyped_args,
1585 const void** untyped_action,
bool* is_excessive,
1586 ::std::ostream* what, ::std::ostream* why) {
1587 const ArgumentTuple& args =
1588 *
static_cast<const ArgumentTuple*
>(untyped_args);
1592 this->FormatUnexpectedCallMessageLocked(args, what, why);
1603 *untyped_action = action;
1609 ::std::ostream* os)
const {
1610 const ArgumentTuple& args =
1611 *
static_cast<const ArgumentTuple*
>(untyped_args);
1619 const ArgumentTuple& args)
const {
1620 g_gmock_mutex.AssertHeld();
1621 for (
typename UntypedExpectations::const_reverse_iterator it =
1637 ::std::ostream* why)
const {
1638 g_gmock_mutex.AssertHeld();
1639 *os <<
"\nUnexpected mock function call - ";
1640 DescribeDefaultActionTo(args, os);
1641 PrintTriedExpectationsLocked(args, why);
1648 ::std::ostream* why)
const {
1649 g_gmock_mutex.AssertHeld();
1651 *why <<
"Google Mock tried the following " << count <<
" " 1652 << (count == 1 ?
"expectation, but it didn't match" :
1653 "expectations, but none matched")
1655 for (
int i = 0; i < count; i++) {
1661 *why <<
"tried expectation #" << i <<
": ";
1689 # pragma warning(pop) // Restores the warning state. 1727 template <
typename T>
1732 : expectation_base_(exp.GetHandle().expectation_base()) {}
1740 #define GMOCK_ON_CALL_IMPL_(obj, call) \ 1741 ((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \ 1743 #define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call) 1745 #define GMOCK_EXPECT_CALL_IMPL_(obj, call) \ 1746 ((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call) 1747 #define EXPECT_CALL(obj, call) GMOCK_EXPECT_CALL_IMPL_(obj, call) 1749 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ T GetValueAndDelete() const
Definition: gmock-spec-builders.h:1313
Definition: gmock-spec-builders.h:1230
ArgumentMatcherTuple matchers_
Definition: gmock-spec-builders.h:1207
bool extra_matcher_specified_
Definition: gmock-spec-builders.h:852
Clause
Definition: gmock-spec-builders.h:252
Expectation::Set::value_type value_type
Definition: gmock-spec-builders.h:556
Matcher< const ArgumentTuple & > extra_matcher_
Definition: gmock-spec-builders.h:1208
Definition: gmock-spec-builders.h:359
Definition: gmock-spec-builders.h:714
bool Matches(const ArgumentTuple &args) const
Definition: gmock-spec-builders.h:324
ArgumentMatcherTuple matchers_
Definition: gmock-spec-builders.h:1271
bool IsSatisfiedByCallCount(int call_count) const
Definition: gmock-cardinalities.h:98
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3, const ExpectationSet &s4)
Definition: gmock-spec-builders.h:970
Clause last_clause_
Definition: gmock-spec-builders.h:855
Definition: gmock-spec-builders.h:255
Definition: gtest-port.h:1410
TypedExpectation(FunctionMockerBase< F > *owner, const char *a_file, int a_line, const string &a_source_text, const ArgumentMatcherTuple &m)
Definition: gmock-spec-builders.h:870
constexpr float e
e
Definition: Math.h:81
Cardinality cardinality_
Definition: gmock-spec-builders.h:838
Definition: gmock-actions.h:49
Definition: gmock-spec-builders.h:1305
bool cardinality_specified() const
Definition: gmock-spec-builders.h:743
virtual void UntypedDescribeUninterestingCall(const void *untyped_args,::std::ostream *os) const
Definition: gmock-spec-builders.h:1556
ActionResultHolder(T a_value)
Definition: gmock-spec-builders.h:1307
virtual void UntypedPrintArgs(const void *untyped_args,::std::ostream *os) const
Definition: gmock-spec-builders.h:1608
const Action< F > & repeated_action() const
Definition: gmock-spec-builders.h:1045
internal::FunctionMockerBase< F > *const function_mocker_
Definition: gmock-spec-builders.h:1269
static void RegisterUseByOnCallOrExpectCall(const void *mock_obj, const char *file, int line)
Definition: gmock-spec-builders.cc:696
ExpectationSet(const Expectation &e)
Definition: gmock-spec-builders.h:571
bool operator!=(const ExpectationSet &rhs) const
Definition: gmock-spec-builders.h:584
static ActionResultHolder * PerformDefaultAction(const FunctionMockerBase< F > *func_mocker, const typename Function< F >::ArgumentTuple &args, const string &call_description)
Definition: gmock-spec-builders.h:1329
internal::Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
Definition: gmock-spec-builders.h:1234
void RegisterOwner(const void *mock_obj)
Definition: gmock-spec-builders.cc:270
Definition: gmock-spec-builders.h:360
Function< F >::ArgumentTuple ArgumentTuple
Definition: gmock-spec-builders.h:866
const string source_text_
Definition: gmock-spec-builders.h:835
virtual UntypedActionResultHolderBase * UntypedPerformDefaultAction(const void *untyped_args, const string &call_description) const
Definition: gmock-spec-builders.h:1443
class GTEST_API_ testing::internal::ScopedTrace GTEST_ATTRIBUTE_UNUSED_
Definition: gmock-spec-builders.h:256
Definition: gmock-spec-builders.h:95
ThreadLocal< Sequence * > g_gmock_implicit_sequence
Definition: gmock-spec-builders.cc:243
const UntypedActionResultHolderBase * UntypedInvokeWith(const void *untyped_args)
Definition: gmock-spec-builders.cc:330
Definition: gmock-actions.h:161
Function< F >::Result Result
Definition: gmock-spec-builders.h:1387
virtual ~UntypedFunctionMockerBase()
Definition: gmock-spec-builders.cc:263
std::vector< const void * > UntypedOnCallSpecs
Definition: gmock-spec-builders.h:214
virtual void PrintAsActionResult(::std::ostream *os) const
Definition: gmock-spec-builders.h:1320
void SetMatchers(const ArgumentMatcherTuple &matchers)
Definition: gmock-spec-builders.h:1264
void ExpectSpecProperty(bool property, const string &failure_message) const
Definition: gmock-spec-builders.h:733
void UntypedTimes(const Cardinality &a_cardinality)
Definition: gmock-spec-builders.cc:225
GTEST_API_::std::string FormatFileLocation(const char *file, int line)
Definition: gtest-port.cc:431
OnCallSpec & With(const Matcher< const ArgumentTuple & > &m)
Definition: gmock-spec-builders.h:299
Function< F >::Result Result
Definition: gmock-spec-builders.h:868
TypedExpectation & WillRepeatedly(const Action< F > &action)
Definition: gmock-spec-builders.h:995
TypedExpectation & After(const ExpectationSet &s)
Definition: gmock-spec-builders.h:951
Result PerformDefaultAction(const ArgumentTuple &args, const string &call_description) const
Definition: gmock-spec-builders.h:1425
Definition: gmock-actions.h:278
Definition: gmock-spec-builders.h:1295
TypedExpectation & WillOnce(const Action< F > &action)
Definition: gmock-spec-builders.h:981
FunctionMockerBase()
Definition: gmock-spec-builders.h:1391
const_iterator begin() const
Definition: gmock-spec-builders.h:595
TypedExpectation & InSequence(const Sequence &s)
Definition: gmock-spec-builders.h:923
Definition: gmock-spec-builders.h:550
int line() const
Definition: gmock-spec-builders.h:248
virtual void ClearDefaultActionsLocked()
Definition: gmock-spec-builders.h:1468
virtual void PrintAsActionResult(::std::ostream *) const
Definition: gmock-spec-builders.h:1359
bool is_retired() const
Definition: gmock-spec-builders.h:760
bool retires_on_saturation_
Definition: gmock-spec-builders.h:854
Expectation::Set expectations_
Definition: gmock-spec-builders.h:599
void AssertSpecProperty(bool property, const string &failure_message) const
Definition: gmock-spec-builders.h:261
bool IsSaturated() const
Definition: gmock-spec-builders.h:781
const_iterator end() const
Definition: gmock-spec-builders.h:596
UntypedFunctionMockerBase()
Definition: gmock-spec-builders.cc:260
Definition: gmock-spec-builders.h:712
void DescribeDefaultActionTo(const ArgumentTuple &args,::std::ostream *os) const
Definition: gmock-spec-builders.h:1538
Definition: gmock-spec-builders.h:716
int call_count_
Definition: gmock-spec-builders.h:849
bool TupleMatches(const MatcherTuple &matcher_tuple, const ValueTuple &value_tuple)
Definition: gmock-matchers.h:580
Definition: gmock-generated-nice-strict.h:164
void AssertSpecProperty(bool property, const string &failure_message) const
Definition: gmock-spec-builders.h:728
Definition: gmock-spec-builders.h:366
Output level, used for messages directed to the user (e.g. "Press any key to continue") ...
Definition: OutputDefinitions.h:89
internal::linked_ptr< internal::ExpectationBase > expectation_base_
Definition: gmock-spec-builders.h:534
Sequence()
Definition: gmock-spec-builders.h:609
Expectation GetHandleOf(ExpectationBase *exp)
Definition: gmock-spec-builders.cc:438
ExpectationSet()
Definition: gmock-spec-builders.h:559
Definition: gmock-spec-builders.h:715
Definition: gmock-spec-builders.h:122
internal::linked_ptr< Expectation > last_expectation_
Definition: gmock-spec-builders.h:620
virtual ~TypedExpectation()
Definition: gmock-spec-builders.h:883
void LogWithLocation(testing::internal::LogSeverity severity, const char *file, int line, const string &message)
Definition: gmock-spec-builders.cc:59
const T & Const(const T &x)
Definition: gmock-spec-builders.h:1728
Definition: gmock-spec-builders.h:717
#define GTEST_DISALLOW_ASSIGN_(type)
Definition: gtest-port.h:615
virtual void ClearDefaultActionsLocked()=0
bool IsOverSaturatedByCallCount(int call_count) const
Definition: gmock-cardinalities.h:109
void ExpectSpecProperty(bool property, const string &failure_message) const
Definition: gmock-spec-builders.h:266
virtual UntypedActionResultHolderBase * UntypedPerformAction(const void *untyped_action, const void *untyped_args) const =0
virtual UntypedActionResultHolderBase * UntypedPerformDefaultAction(const void *untyped_args, const string &call_description) const =0
void Log(LogSeverity severity, const string &message, int stack_frames_to_skip)
Definition: gmock-internal-utils.cc:131
int call_count() const
Definition: gmock-spec-builders.h:803
Cardinality AtLeast(int n)
Definition: gmock-cardinalities.cc:139
typedef void(ENET_CALLBACK *ENetPacketFreeCallback)(struct _ENetPacket *)
virtual UntypedActionResultHolderBase * UntypedPerformAction(const void *untyped_action, const void *untyped_args) const
Definition: gmock-spec-builders.h:1455
int line() const
Definition: gmock-spec-builders.h:686
std::vector< const void * > UntypedActions
Definition: gmock-spec-builders.h:721
Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
Definition: gmock-spec-builders.h:867
static ActionResultHolder * PerformDefaultAction(const FunctionMockerBase< F > *func_mocker, const typename Function< F >::ArgumentTuple &args, const string &call_description)
Definition: gmock-spec-builders.h:1363
bool Matches(const ArgumentTuple &args) const
Definition: gmock-spec-builders.h:1073
void ReportUninterestingCall(CallReaction reaction, const string &msg)
Definition: gmock-spec-builders.cc:247
Definition: gmock-spec-builders.h:677
std::vector< internal::linked_ptr< ExpectationBase > > UntypedExpectations
Definition: gmock-spec-builders.h:217
Definition: gmock-internal-utils.h:308
static void Print(const T &value,::std::ostream *os)
Definition: gtest-printers.h:591
const OnCallSpec< F > * FindOnCallSpec(const ArgumentTuple &args) const
Definition: gmock-spec-builders.h:1407
Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
Definition: gmock-spec-builders.h:283
const void * mock_obj_
Definition: gmock-spec-builders.h:226
::std::set< Expectation, Less > Set
Definition: gmock-spec-builders.h:522
const Action< F > & GetAction() const
Definition: gmock-spec-builders.h:329
void PrintTriedExpectationsLocked(const ArgumentTuple &args,::std::ostream *why) const
Definition: gmock-spec-builders.h:1647
bool IsSatisfied() const
Definition: gmock-spec-builders.h:774
TypedExpectation & Times(const Cardinality &a_cardinality)
Definition: gmock-spec-builders.h:912
void Expect(bool condition, const char *file, int line, const string &msg)
Definition: gmock-internal-utils.h:294
void GetValueAndDelete() const
Definition: gmock-spec-builders.h:1357
void ExplainMatchResultTo(const ArgumentTuple &args,::std::ostream *os) const
Definition: gmock-spec-builders.h:1094
const internal::linked_ptr< internal::ExpectationBase > & expectation_base() const
Definition: gmock-spec-builders.h:529
Definition: gmock-spec-builders.h:647
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2)
Definition: gmock-spec-builders.h:963
virtual ~FunctionMockerBase()
Definition: gmock-spec-builders.h:1397
int line_
Definition: gmock-spec-builders.h:834
internal::OnCallSpec< F > & InternalDefaultActionSetAt(const char *file, int line, const char *obj, const char *call)
Definition: gmock-spec-builders.h:1243
OnCallSpec(const char *a_file, int a_line, const ArgumentMatcherTuple &matchers)
Definition: gmock-spec-builders.h:287
internal::MatcherAsPredicate< M > Matches(M matcher)
Definition: gmock-matchers.h:3027
Definition: gmock-internal-utils.h:307
const Action< F > & GetCurrentAction(const FunctionMockerBase< F > *mocker, const ArgumentTuple &args) const
Definition: gmock-spec-builders.h:1138
InSequence()
Definition: gmock-spec-builders.cc:779
void PrintIfNotEmpty(const internal::string &explanation, std::ostream *os)
Definition: gmock-matchers.h:458
TypedExpectation & Times(int n)
Definition: gmock-spec-builders.h:918
const char * file_
Definition: gmock-spec-builders.h:833
Result Perform(const ArgumentTuple &args) const
Definition: gmock-actions.h:310
TypedExpectation< F > * FindMatchingExpectationLocked(const ArgumentTuple &args) const
Definition: gmock-spec-builders.h:1618
void UniversalPrint(const T &value,::std::ostream *os)
Definition: gtest-printers.h:696
TypedExpectation< F > & AddNewExpectation(const char *file, int line, const string &source_text, const ArgumentMatcherTuple &m)
Definition: gmock-spec-builders.h:1506
Action< F > repeated_action_
Definition: gmock-spec-builders.h:1209
T * get() const
Definition: gtest-linked_ptr.h:172
TypedExpectation & With(const Matcher< const ArgumentTuple & > &m)
Definition: gmock-spec-builders.h:894
TypedExpectation & RetiresOnSaturation()
Definition: gmock-spec-builders.h:1020
bool operator==(const ExpectationSet &rhs) const
Definition: gmock-spec-builders.h:580
virtual ~UntypedActionResultHolderBase()
Definition: gmock-spec-builders.h:1297
Expectation::Set::const_iterator const_iterator
Definition: gmock-spec-builders.h:553
static ActionResultHolder * PerformAction(const Action< F > &action, const typename Function< F >::ArgumentTuple &args)
Definition: gmock-spec-builders.h:1373
const char * file_
Definition: gmock-spec-builders.h:270
ExpectationSet immediate_prerequisites_
Definition: gmock-spec-builders.h:845
void AddExpectation(const Expectation &expectation) const
Definition: gmock-spec-builders.cc:768
virtual void UntypedPrintArgs(const void *untyped_args,::std::ostream *os) const =0
bool retired_
Definition: gmock-spec-builders.h:850
const ArgumentMatcherTuple & matchers() const
Definition: gmock-spec-builders.h:1035
bool VerifyAndClearExpectationsLocked()
Definition: gmock-spec-builders.cc:457
void DescribeCallCountTo(::std::ostream *os) const
Definition: gmock-spec-builders.cc:151
Definition: InputPrereqs.h:78
int size() const
Definition: gmock-spec-builders.h:593
Definition: gmock-spec-builders.h:515
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3)
Definition: gmock-spec-builders.h:966
bool ShouldHandleArguments(const ArgumentTuple &args) const
Definition: gmock-spec-builders.h:1080
OnCallSpec< F > & AddNewOnCallSpec(const char *file, int line, const ArgumentMatcherTuple &m)
Definition: gmock-spec-builders.h:1495
Function< F >::ArgumentTuple ArgumentTuple
Definition: gmock-spec-builders.h:282
FunctionMockerBase< F > *const owner_
Definition: gmock-spec-builders.h:1206
LogSeverity
Definition: gmock-internal-utils.h:306
const char * source_text() const
Definition: gmock-spec-builders.h:687
void ExplainMatchFailureTupleTo(const MatcherTuple &matchers, const ValueTuple &values,::std::ostream *os)
Definition: gmock-matchers.h:595
Result InvokeWith(const ArgumentTuple &args)
Definition: gmock-spec-builders.h:1488
const Cardinality & cardinality() const
Definition: gmock-spec-builders.h:689
ActionResultHolder< Result > ResultHolder
Definition: gmock-spec-builders.h:1482
T value_
Definition: gmock-spec-builders.h:1347
Definition: gmock-matchers.h:174
CallReaction
Definition: gmock-spec-builders.h:357
MockSpec< F > current_spec_
Definition: gmock-spec-builders.h:1671
const Action< F > * GetActionForArguments(const FunctionMockerBase< F > *mocker, const ArgumentTuple &args,::std::ostream *what,::std::ostream *why)
Definition: gmock-spec-builders.h:1174
const char * file() const
Definition: gmock-spec-builders.h:685
int line_
Definition: gmock-spec-builders.h:271
Definition: gmock-spec-builders.h:606
Function< F >::ArgumentTuple ArgumentTuple
Definition: gmock-spec-builders.h:1388
bool IsDoDefault() const
Definition: gmock-actions.h:302
Definition: gmock-spec-builders.h:713
internal::Function< F >::ArgumentTuple ArgumentTuple
Definition: gmock-spec-builders.h:1232
void set_cardinality(const Cardinality &a_cardinality)
Definition: gmock-spec-builders.h:746
internal::DoDefaultAction DoDefault()
Definition: gmock-actions.h:970
Expectation()
Definition: gmock-spec-builders.cc:759
bool IsOverSaturated() const
Definition: gmock-spec-builders.h:788
Definition: gmock-generated-internal-utils.h:152
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3, const ExpectationSet &s4, const ExpectationSet &s5)
Definition: gmock-spec-builders.h:974
void FormatUnexpectedCallMessageLocked(const ArgumentTuple &args,::std::ostream *os,::std::ostream *why) const
Definition: gmock-spec-builders.h:1635
virtual void MaybeDescribeExtraMatcherTo(::std::ostream *os)
Definition: gmock-spec-builders.h:1049
void Assert(bool condition, const char *file, int line)
Definition: gmock-internal-utils.h:288
virtual void UntypedDescribeUninterestingCall(const void *untyped_args,::std::ostream *os) const =0
bool sequence_created_
Definition: gmock-spec-builders.h:652
void IncrementCallCount()
Definition: gmock-spec-builders.h:810
Matcher< T > A()
Definition: gmock-matchers.h:2574
const Matcher< const ArgumentTuple & > & extra_matcher() const
Definition: gmock-spec-builders.h:1040
ExpectationSet(internal::ExpectationBase &exp)
Definition: gmock-spec-builders.h:564
Clause last_clause_
Definition: gmock-spec-builders.h:275
void Retire()
Definition: gmock-spec-builders.h:767
UntypedOnCallSpecBase(const char *a_file, int a_line)
Definition: gmock-spec-builders.h:243
UntypedOnCallSpecs untyped_on_call_specs_
Definition: gmock-spec-builders.h:233
Action< F > action_
Definition: gmock-spec-builders.h:352
static void UnregisterLocked(internal::UntypedFunctionMockerBase *mocker)
Definition: gmock-spec-builders.cc:720
MockSpec< F > & current_spec()
Definition: gmock-spec-builders.h:1528
const void * MockObject() const
Definition: gmock-spec-builders.cc:294
ExpectationSet & operator+=(const Expectation &e)
Definition: gmock-spec-builders.h:588
Definition: gmock-generated-nice-strict.h:68
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
Definition: gtest-port.h:620
bool cardinality_specified_
Definition: gmock-spec-builders.h:837
const char * Name() const
Definition: gmock-spec-builders.cc:311
Definition: gmock-spec-builders.h:280
Definition: gmock-cardinalities.h:83
virtual Expectation GetHandle()
Definition: gmock-spec-builders.h:1063
bool action_count_checked_
Definition: gmock-spec-builders.h:856
static T Get()
Definition: gmock-actions.h:188
const char * name_
Definition: gmock-spec-builders.h:230
OnCallSpec & WillByDefault(const Action< F > &action)
Definition: gmock-spec-builders.h:311
Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
Definition: gmock-spec-builders.h:1389
Mutex mutex_
Definition: gmock-spec-builders.h:857
void SetOwnerAndName(const void *mock_obj, const char *name)
Definition: gmock-spec-builders.cc:282
Definition: gtest-port.h:1399
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2, const Sequence &s3, const Sequence &s4)
Definition: gmock-spec-builders.h:940
Definition: gmock-spec-builders.h:358
Definition: gmock-spec-builders.h:474
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2, const Sequence &s3)
Definition: gmock-spec-builders.h:936
bool repeated_action_specified_
Definition: gmock-spec-builders.h:853
const char * file() const
Definition: gmock-spec-builders.h:247
bool operator()(const Expectation &lhs, const Expectation &rhs) const
Definition: gmock-spec-builders.h:517
Matcher< const ArgumentTuple & > extra_matcher_
Definition: gmock-spec-builders.h:351
bool IsSaturatedByCallCount(int call_count) const
Definition: gmock-cardinalities.h:103
Clause
Definition: gmock-spec-builders.h:709
UntypedExpectations untyped_expectations_
Definition: gmock-spec-builders.h:236
Definition: gmock-generated-function-mockers.h:58
virtual const ExpectationBase * UntypedFindMatchingExpectation(const void *untyped_args, const void **untyped_action, bool *is_excessive,::std::ostream *what,::std::ostream *why)
Definition: gmock-spec-builders.h:1583
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2, const Sequence &s3, const Sequence &s4, const Sequence &s5)
Definition: gmock-spec-builders.h:944
static ActionResultHolder * PerformAction(const Action< F > &action, const typename Function< F >::ArgumentTuple &args)
Definition: gmock-spec-builders.h:1341
bool operator!=(const Expectation &rhs) const
Definition: gmock-spec-builders.h:500
Definition: gmock-spec-builders.h:240
Definition: gmock-generated-function-mockers.h:50
ArgumentMatcherTuple matchers_
Definition: gmock-spec-builders.h:350
internal::string str() const
Definition: gmock-matchers.h:179
bool operator==(const Expectation &rhs) const
Definition: gmock-spec-builders.h:496
virtual const ExpectationBase * UntypedFindMatchingExpectation(const void *untyped_args, const void **untyped_action, bool *is_excessive,::std::ostream *what,::std::ostream *why)=0
GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex)
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2)
Definition: gmock-spec-builders.h:933
internal::TypedExpectation< F > & InternalExpectedAt(const char *file, int line, const char *obj, const char *call)
Definition: gmock-spec-builders.h:1252
UntypedActions untyped_actions_
Definition: gmock-spec-builders.h:851
void DescribeLocationTo(::std::ostream *os) const
Definition: gmock-spec-builders.h:692
Cardinality Exactly(int n)
Definition: gmock-cardinalities.cc:153
MockSpec(internal::FunctionMockerBase< F > *function_mocker)
Definition: gmock-spec-builders.h:1238
Definition: gmock-spec-builders.h:711