60 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ 61 #define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ 69 #if GTEST_HAS_EXCEPTIONS 93 template <
typename F>
class FunctionMocker;
96 class ExpectationBase;
134 bool VerifyAndClearExpectationsLocked()
138 virtual void ClearDefaultActionsLocked()
151 const void* untyped_args,
152 const string& call_description)
const = 0;
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 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 215 const void* untyped_args)
221 typedef std::vector<internal::linked_ptr<ExpectationBase> >
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().");
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)
510 return expectation_base_ == rhs.expectation_base_;
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;
531 return lhs.expectation_base_.get() < rhs.expectation_base_.get();
535 typedef ::std::set<Expectation, Less> Set;
542 expectation_base()
const {
543 return expectation_base_;
594 return expectations_ == rhs.expectations_;
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(); }
612 Expectation::Set expectations_;
626 void AddExpectation(
const Expectation& expectation)
const;
665 bool sequence_created_;
693 ExpectationBase(
const char* file,
int line,
const string& source_text);
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);
876 template <
typename F>
884 const char* a_file,
int a_line,
const string& a_source_text,
885 const ArgumentMatcherTuple&
m)
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;
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();
1092 bool ShouldHandleArguments(
const ArgumentTuple&
args)
const 1094 g_gmock_mutex.AssertHeld();
1100 CheckActionCountIfNotDone();
1101 return !is_retired() && AllPrerequisitesAreSatisfied() &&
Matches(
args);
1106 void ExplainMatchResultTo(
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>
1280 void SetMatchers(
const ArgumentMatcherTuple& matchers) {
1281 matchers_ = matchers;
1287 ArgumentMatcherTuple 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;
1634 void DescribeDefaultActionTo(
const ArgumentTuple&
args,
1635 ::std::ostream* os)
const {
1639 *os << (internal::type_equals<Result, void>::value ?
1640 "returning directly.\n" :
1641 "returning default value.\n");
1643 *os <<
"taking default action specified at:\n" 1651 virtual void UntypedDescribeUninterestingCall(
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);
1697 const Action<F>*
action = exp->GetActionForArguments(
this, args, what, why);
1700 *untyped_action =
action;
1705 virtual void UntypedPrintArgs(
const void* untyped_args,
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) {
1723 if (exp->ShouldHandleArguments(args)) {
1731 void FormatUnexpectedCallMessageLocked(
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);
1744 void PrintTriedExpectationsLocked(
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")
1754 for (
int i = 0; i <
count; i++) {
1760 *why <<
"tried expectation #" << i <<
": ";
1763 expectation->ExplainMatchResultTo(args, why);
1788 # pragma warning(pop) // Restores the warning state. 1825 template <
typename T>
1826 inline const T&
Const(
const T& x) {
return x; }
1830 : expectation_base_(exp.GetHandle().expectation_base()) {}
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_ Definition: gmock-spec-builders.h:1246
bool extra_matcher_specified_
Definition: gmock-spec-builders.h:865
Clause
Definition: gmock-spec-builders.h:257
Expectation::Set::value_type value_type
Definition: gmock-spec-builders.h:569
Definition: gmock-spec-builders.h:727
Definition: gmock-spec-builders_test.cc:52
virtual UntypedActionResultHolderBase * UntypedPerformAction(const void *untyped_action, const void *untyped_args) const
Definition: gmock-spec-builders.h:1535
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3, const ExpectationSet &s4)
Definition: gmock-spec-builders.h:983
const T & Peek() const
Definition: gmock-spec-builders.h:1318
bool operator==(const ExpectationSet &rhs) const
Definition: gmock-spec-builders.h:593
Clause last_clause_
Definition: gmock-spec-builders.h:868
def args
Definition: android_test.py:111
Definition: gmock-spec-builders.h:260
void AssertSpecProperty(bool property, const string &failure_message) const
Definition: gmock-spec-builders.h:741
Definition: gtest-port.h:2154
TypedExpectation(FunctionMockerBase< F > *owner, const char *a_file, int a_line, const string &a_source_text, const ArgumentMatcherTuple &m)
Definition: gmock-spec-builders.h:883
const char * file() const
Definition: gmock-spec-builders.h:698
int line() const
Definition: gmock-spec-builders.h:253
Cardinality cardinality_
Definition: gmock-spec-builders.h:851
virtual UntypedActionResultHolderBase * UntypedPerformDefaultAction(const void *untyped_args, const string &call_description) const
Definition: gmock-spec-builders.h:1523
Definition: gmock-actions.h:53
Definition: gmock-spec-builders.h:1372
Definition: gmock-spec-builders.h:364
Result InvokeWith(const ArgumentTuple &args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:1582
void IncrementCallCount() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:822
GTEST_API_ Cardinality AtLeast(int n)
int * count
Definition: gmock_stress_test.cc:176
ExpectationSet(const Expectation &e)
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:1389
internal::Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
Definition: gmock-spec-builders.h:1250
Function< F >::ArgumentTuple ArgumentTuple
Definition: gmock-spec-builders.h:879
const string source_text_
Definition: gmock-spec-builders.h:848
Definition: gmock-spec-builders.h:261
Definition: gmock-spec-builders.h:99
Definition: gmock-spec-builders.h:362
int size() const
Definition: gmock-spec-builders.h:606
Definition: gmock-actions.h:200
Function< F >::Result Result
Definition: gmock-spec-builders.h:1458
OnCallSpec & With(const Matcher< const ArgumentTuple &> &m)
Definition: gmock-spec-builders.h:304
std::vector< const void * > UntypedOnCallSpecs
Definition: gmock-spec-builders.h:219
void UntypedTimes(const Cardinality &a_cardinality)
void DescribeCallCountTo(::std::ostream *os) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
const_iterator begin() const
Definition: gmock-spec-builders.h:608
Function< F >::Result Result
Definition: gmock-spec-builders.h:881
TypedExpectation & WillRepeatedly(const Action< F > &action)
Definition: gmock-spec-builders.h:1008
TypedExpectation & After(const ExpectationSet &s)
Definition: gmock-spec-builders.h:964
Definition: gmock-actions.h:355
Definition: gmock-spec-builders.h:1362
Definition: gmock-spec-builders.h:363
TypedExpectation & WillOnce(const Action< F > &action)
Definition: gmock-spec-builders.h:994
FunctionMockerBase()
Definition: gmock-spec-builders.h:1462
TypedExpectation & InSequence(const Sequence &s)
Definition: gmock-spec-builders.h:936
Definition: gmock-spec-builders.h:563
bool retires_on_saturation_
Definition: gmock-spec-builders.h:867
GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex)
const ArgumentMatcherTuple & matchers() const
Definition: gmock-spec-builders.h:1048
Definition: gmock-spec-builders.h:725
void ExpectSpecProperty(bool property, const string &failure_message) const
Definition: gmock-spec-builders.h:746
Definition: gmock-spec-builders.h:729
bool operator==(const Expectation &rhs) const
Definition: gmock-spec-builders.h:509
const char * file() const
Definition: gmock-spec-builders.h:252
Definition: gmock-generated-nice-strict.h:176
int call_count_
Definition: gmock-spec-builders.h:862
#define GTEST_API_
Definition: gtest-port.h:934
bool TupleMatches(const MatcherTuple &matcher_tuple, const ValueTuple &value_tuple)
Definition: gmock-matchers.h:796
Definition: gmock-generated-nice-strict.h:272
Definition: gmock-spec-builders.h:371
Sequence()
Definition: gmock-spec-builders.h:622
ExpectationSet()
Definition: gmock-spec-builders.h:572
Definition: gmock-spec-builders.h:728
bool IsSaturatedByCallCount(int call_count) const
Definition: gmock-cardinalities.h:103
Definition: gmock-spec-builders.h:126
#define GTEST_LOCK_EXCLUDED_(locks)
Definition: gtest-port.h:2534
virtual ~TypedExpectation()
Definition: gmock-spec-builders.h:896
void Retire() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:779
virtual void PrintAsActionResult(::std::ostream *) const
Definition: gmock-spec-builders.h:1424
const T & Const(const T &x)
Definition: gmock-spec-builders.h:1826
Definition: gmock-spec-builders.h:730
OnCallSpec< F > & AddNewOnCallSpec(const char *file, int line, const ArgumentMatcherTuple &m) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:1590
Result PerformDefaultAction(const ArgumentTuple &args, const string &call_description) const
Definition: gmock-spec-builders.h:1498
#define GTEST_DISALLOW_ASSIGN_(type)
Definition: gtest-port.h:869
void AssertSpecProperty(bool property, const string &failure_message) const
Definition: gmock-spec-builders.h:266
Definition: gmock-spec-builders.h:365
int line() const
Definition: gmock-spec-builders.h:699
GTEST_API_ ::std::string FormatFileLocation(const char *file, int line)
Definition: gmock-spec-builders.h:1302
std::vector< const void * > UntypedActions
Definition: gmock-spec-builders.h:734
Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
Definition: gmock-spec-builders.h:880
static ActionResultHolder * PerformDefaultAction(const FunctionMockerBase< F > *func_mocker, const typename Function< F >::ArgumentTuple &args, const string &call_description)
Definition: gmock-spec-builders.h:1429
void DescribeLocationTo(::std::ostream *os) const
Definition: gmock-spec-builders.h:705
T Unwrap()
Definition: gmock-spec-builders.h:1375
void ReportUninterestingCall(CallReaction reaction, const string &msg)
const OnCallSpec< F > * FindOnCallSpec(const ArgumentTuple &args) const
Definition: gmock-spec-builders.h:1478
Definition: gmock-spec-builders.h:690
std::vector< internal::linked_ptr< ExpectationBase > > UntypedExpectations
Definition: gmock-spec-builders.h:222
bool IsSatisfiedByCallCount(int call_count) const
Definition: gmock-cardinalities.h:98
Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
Definition: gmock-spec-builders.h:288
static void Print(const T &value, ::std::ostream *os)
Definition: gtest-printers.h:698
const void * mock_obj_
Definition: gmock-spec-builders.h:231
TypedExpectation & Times(const Cardinality &a_cardinality)
Definition: gmock-spec-builders.h:925
void Expect(bool condition, const char *file, int line, const string &msg)
Definition: gmock-internal-utils.h:294
const Cardinality & cardinality() const
Definition: gmock-spec-builders.h:702
Definition: gmock-internal-utils.h:308
const Action< F > & repeated_action() const
Definition: gmock-spec-builders.h:1058
bool cardinality_specified() const
Definition: gmock-spec-builders.h:756
Definition: gtest-linked_ptr.h:146
Definition: gmock-spec-builders.h:660
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2)
Definition: gmock-spec-builders.h:976
bool IsSaturated() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:793
TypedExpectation< F > & AddNewExpectation(const char *file, int line, const string &source_text, const ArgumentMatcherTuple &m) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:1601
internal::string str() const
Definition: gmock-matchers.h:189
int line_
Definition: gmock-spec-builders.h:847
internal::OnCallSpec< F > & InternalDefaultActionSetAt(const char *file, int line, const char *obj, const char *call)
Definition: gmock-spec-builders.h:1259
std::mutex m
Definition: AlexaPresentationTest.cpp:91
OnCallSpec(const char *a_file, int a_line, const ArgumentMatcherTuple &matchers)
Definition: gmock-spec-builders.h:292
internal::MatcherAsPredicate< M > Matches(M matcher)
Definition: gmock-matchers.h:4341
GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity, const char *file, int line, const string &message)
TypedExpectation & Times(int n)
Definition: gmock-spec-builders.h:931
const char * file_
Definition: gmock-spec-builders.h:846
GTEST_API_ void Log(LogSeverity severity, const string &message, int stack_frames_to_skip)
TypedExpectation & RetiresOnSaturation()
Definition: gmock-spec-builders.h:1033
virtual ~UntypedActionResultHolderBase()
Definition: gmock-spec-builders.h:1364
Expectation::Set::const_iterator const_iterator
Definition: gmock-spec-builders.h:566
static ActionResultHolder * PerformAction(const Action< F > &action, const typename Function< F >::ArgumentTuple &args)
Definition: gmock-spec-builders.h:1440
bool operator!=(const ExpectationSet &rhs) const
Definition: gmock-spec-builders.h:597
virtual ~FunctionMockerBase() GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:1467
bool IsSatisfied() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:786
const char * file_
Definition: gmock-spec-builders.h:275
ExpectationSet immediate_prerequisites_
Definition: gmock-spec-builders.h:858
bool retired_
Definition: gmock-spec-builders.h:863
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3)
Definition: gmock-spec-builders.h:979
bool operator!=(const Expectation &rhs) const
Definition: gmock-spec-builders.h:513
const_iterator end() const
Definition: gmock-spec-builders.h:609
Function< F >::ArgumentTuple ArgumentTuple
Definition: gmock-spec-builders.h:287
LogSeverity
Definition: gmock-internal-utils.h:306
T & reference
Definition: gmock-spec-builders.h:1333
const T & Peek() const
Definition: gmock-spec-builders.h:1337
GTEST_API_ Cardinality Exactly(int n)
ActionResultHolder< Result > ResultHolder
Definition: gmock-spec-builders.h:1577
void Unwrap()
Definition: gmock-spec-builders.h:1422
bool IsDoDefault() const
Definition: gmock-actions.h:379
CallReaction
Definition: gmock-spec-builders.h:361
int line_
Definition: gmock-spec-builders.h:276
Definition: gmock-spec-builders.h:619
Function< F >::ArgumentTuple ArgumentTuple
Definition: gmock-spec-builders.h:1459
Definition: gmock-spec-builders.h:726
internal::Function< F >::ArgumentTuple ArgumentTuple
Definition: gmock-spec-builders.h:1248
void set_cardinality(const Cardinality &a_cardinality)
Definition: gmock-spec-builders.h:759
internal::DoDefaultAction DoDefault()
Definition: gmock-actions.h:1099
Definition: gmock-generated-internal-utils.h:154
TypedExpectation & After(const ExpectationSet &s1, const ExpectationSet &s2, const ExpectationSet &s3, const ExpectationSet &s4, const ExpectationSet &s5)
Definition: gmock-spec-builders.h:987
int call_count() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:815
bool Matches(const ArgumentTuple &args) const
Definition: gmock-spec-builders.h:329
virtual void MaybeDescribeExtraMatcherTo(::std::ostream *os)
Definition: gmock-spec-builders.h:1062
void Assert(bool condition, const char *file, int line)
Definition: gmock-internal-utils.h:288
T & Unwrap()
Definition: gmock-spec-builders.h:1336
Matcher< T > A()
Definition: gmock-matchers.h:3732
ExpectationSet(internal::ExpectationBase &exp)
Definition: gmock-spec-builders.h:577
void PrintIfNotEmpty(const internal::string &explanation, ::std::ostream *os)
Definition: gmock-matchers.h:678
Clause last_clause_
Definition: gmock-spec-builders.h:280
T Unwrap()
Definition: gmock-spec-builders.h:1312
UntypedOnCallSpecBase(const char *a_file, int a_line)
Definition: gmock-spec-builders.h:248
UntypedOnCallSpecs untyped_on_call_specs_
Definition: gmock-spec-builders.h:238
ReferenceOrValueWrapper(reference ref)
Definition: gmock-spec-builders.h:1334
void AddExpectation(const Expectation &expectation) const
const
Definition: upload.py:398
void ExpectSpecProperty(bool property, const string &failure_message) const
Definition: gmock-spec-builders.h:271
MockSpec< F > & current_spec()
Definition: gmock-spec-builders.h:1624
ExpectationSet & operator+=(const Expectation &e)
Definition: gmock-spec-builders.h:601
#define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
Definition: gtest-port.h:2533
Definition: gmock-generated-nice-strict.h:80
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
Definition: gtest-port.h:874
bool cardinality_specified_
Definition: gmock-spec-builders.h:850
bool IsOverSaturatedByCallCount(int call_count) const
Definition: gmock-cardinalities.h:109
Definition: gmock-spec-builders.h:285
Definition: gmock-internal-utils.h:307
bool is_retired() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:772
Definition: gmock-cardinalities.h:83
bool action_count_checked_
Definition: gmock-spec-builders.h:869
ReferenceOrValueWrapper(T value)
Definition: gmock-spec-builders.h:1305
static T Get()
Definition: gmock-actions.h:236
const char * name_
Definition: gmock-spec-builders.h:235
OnCallSpec & WillByDefault(const Action< F > &action)
Definition: gmock-spec-builders.h:316
Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
Definition: gmock-spec-builders.h:1460
Mutex mutex_
Definition: gmock-spec-builders.h:870
Definition: gtest-port.h:2136
Definition: gmock-matchers.h:319
Result Perform(const ArgumentTuple &args) const
Definition: gmock-actions.h:387
GTEST_API_ ThreadLocal< Sequence * > g_gmock_implicit_sequence
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2, const Sequence &s3, const Sequence &s4)
Definition: gmock-spec-builders.h:953
Definition: gmock-spec-builders.h:487
virtual void ClearDefaultActionsLocked() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:1547
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2, const Sequence &s3)
Definition: gmock-spec-builders.h:949
bool repeated_action_specified_
Definition: gmock-spec-builders.h:866
Definition: gtest-port.h:1115
TypedExpectation & With(const Matcher< const ArgumentTuple &> &m)
Definition: gmock-spec-builders.h:907
Clause
Definition: gmock-spec-builders.h:722
void ExplainMatchFailureTupleTo(const MatcherTuple &matchers, const ValueTuple &values, ::std::ostream *os)
Definition: gmock-matchers.h:810
UntypedExpectations untyped_expectations_
Definition: gmock-spec-builders.h:241
Definition: gmock-generated-function-mockers.h:62
tuple message
Definition: gtest_output_test.py:331
bool IsOverSaturated() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Definition: gmock-spec-builders.h:800
class GTEST_API_ testing::internal::ScopedTrace GTEST_ATTRIBUTE_UNUSED_
const T & move(const T &t)
Definition: gtest-port.h:1317
const Matcher< const ArgumentTuple & > & extra_matcher() const
Definition: gmock-spec-builders.h:1053
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2, const Sequence &s3, const Sequence &s4, const Sequence &s5)
Definition: gmock-spec-builders.h:957
static ActionResultHolder * PerformAction(const Action< F > &action, const typename Function< F >::ArgumentTuple &args)
Definition: gmock-spec-builders.h:1401
const Action< F > & GetAction() const
Definition: gmock-spec-builders.h:334
Definition: gmock-spec-builders.h:245
Definition: gmock-generated-function-mockers.h:54
Definition: gmock-matchers.h:184
void UniversalPrint(const T &value, ::std::ostream *os)
Definition: gtest-printers.h:852
TypedExpectation & InSequence(const Sequence &s1, const Sequence &s2)
Definition: gmock-spec-builders.h:946
internal::TypedExpectation< F > & InternalExpectedAt(const char *file, int line, const char *obj, const char *call)
Definition: gmock-spec-builders.h:1268
UntypedActions untyped_actions_
Definition: gmock-spec-builders.h:864
const char * source_text() const
Definition: gmock-spec-builders.h:700
MockSpec(internal::FunctionMockerBase< F > *function_mocker)
Definition: gmock-spec-builders.h:1254
action
Definition: upload.py:393
virtual void PrintAsActionResult(::std::ostream *os) const
Definition: gmock-spec-builders.h:1380
Definition: gmock-spec-builders.h:724