proxygen
testing::internal::ExpectationBase Class Referenceabstract

#include <gmock-spec-builders.h>

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

Public Member Functions

 ExpectationBase (const char *file, int line, const string &source_text)
 
virtual ~ExpectationBase ()
 
const char * file () const
 
int line () const
 
const char * source_text () const
 
const Cardinalitycardinality () const
 
void DescribeLocationTo (::std::ostream *os) const
 
void DescribeCallCountTo (::std::ostream *os) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
virtual void MaybeDescribeExtraMatcherTo (::std::ostream *os)=0
 
 ExpectationBase (const char *file, int line, const string &source_text)
 
virtual ~ExpectationBase ()
 
const char * file () const
 
int line () const
 
const char * source_text () const
 
const Cardinalitycardinality () const
 
void DescribeLocationTo (::std::ostream *os) const
 
void DescribeCallCountTo (::std::ostream *os) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
virtual void MaybeDescribeExtraMatcherTo (::std::ostream *os)=0
 
 ExpectationBase (const char *file, int line, const string &source_text)
 
virtual ~ExpectationBase ()
 
const char * file () const
 
int line () const
 
const char * source_text () const
 
const Cardinalitycardinality () const
 
void DescribeLocationTo (::std::ostream *os) const
 
void DescribeCallCountTo (::std::ostream *os) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
virtual void MaybeDescribeExtraMatcherTo (::std::ostream *os)=0
 

Protected Types

enum  Clause {
  kNone, kWith, kTimes, kInSequence,
  kAfter, kWillOnce, kWillRepeatedly, kRetiresOnSaturation,
  kNone, kWith, kTimes, kInSequence,
  kAfter, kWillOnce, kWillRepeatedly, kRetiresOnSaturation,
  kNone, kWith, kTimes, kInSequence,
  kAfter, kWillOnce, kWillRepeatedly, kRetiresOnSaturation
}
 
enum  Clause {
  kNone, kWith, kTimes, kInSequence,
  kAfter, kWillOnce, kWillRepeatedly, kRetiresOnSaturation,
  kNone, kWith, kTimes, kInSequence,
  kAfter, kWillOnce, kWillRepeatedly, kRetiresOnSaturation,
  kNone, kWith, kTimes, kInSequence,
  kAfter, kWillOnce, kWillRepeatedly, kRetiresOnSaturation
}
 
enum  Clause {
  kNone, kWith, kTimes, kInSequence,
  kAfter, kWillOnce, kWillRepeatedly, kRetiresOnSaturation,
  kNone, kWith, kTimes, kInSequence,
  kAfter, kWillOnce, kWillRepeatedly, kRetiresOnSaturation,
  kNone, kWith, kTimes, kInSequence,
  kAfter, kWillOnce, kWillRepeatedly, kRetiresOnSaturation
}
 
typedef std::vector< const void * > UntypedActions
 
typedef std::vector< const void * > UntypedActions
 
typedef std::vector< const void * > UntypedActions
 

Protected Member Functions

virtual Expectation GetHandle ()=0
 
void AssertSpecProperty (bool property, const string &failure_message) const
 
void ExpectSpecProperty (bool property, const string &failure_message) const
 
void SpecifyCardinality (const Cardinality &cardinality)
 
bool cardinality_specified () const
 
void set_cardinality (const Cardinality &a_cardinality)
 
void RetireAllPreRequisites () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool is_retired () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void Retire () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsSatisfied () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsSaturated () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsOverSaturated () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool AllPrerequisitesAreSatisfied () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void FindUnsatisfiedPrerequisites (ExpectationSet *result) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
int call_count () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void IncrementCallCount () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void CheckActionCountIfNotDone () const GTEST_LOCK_EXCLUDED_(mutex_)
 
void UntypedTimes (const Cardinality &a_cardinality)
 
 GTEST_DISALLOW_ASSIGN_ (ExpectationBase)
 
virtual Expectation GetHandle ()=0
 
void AssertSpecProperty (bool property, const string &failure_message) const
 
void ExpectSpecProperty (bool property, const string &failure_message) const
 
void SpecifyCardinality (const Cardinality &cardinality)
 
bool cardinality_specified () const
 
void set_cardinality (const Cardinality &a_cardinality)
 
void RetireAllPreRequisites () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool is_retired () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void Retire () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsSatisfied () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsSaturated () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsOverSaturated () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool AllPrerequisitesAreSatisfied () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void FindUnsatisfiedPrerequisites (ExpectationSet *result) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
int call_count () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void IncrementCallCount () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void CheckActionCountIfNotDone () const GTEST_LOCK_EXCLUDED_(mutex_)
 
void UntypedTimes (const Cardinality &a_cardinality)
 
 GTEST_DISALLOW_ASSIGN_ (ExpectationBase)
 
virtual Expectation GetHandle ()=0
 
void AssertSpecProperty (bool property, const string &failure_message) const
 
void ExpectSpecProperty (bool property, const string &failure_message) const
 
void SpecifyCardinality (const Cardinality &cardinality)
 
bool cardinality_specified () const
 
void set_cardinality (const Cardinality &a_cardinality)
 
void RetireAllPreRequisites () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool is_retired () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void Retire () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsSatisfied () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsSaturated () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool IsOverSaturated () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
bool AllPrerequisitesAreSatisfied () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void FindUnsatisfiedPrerequisites (ExpectationSet *result) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
int call_count () const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void IncrementCallCount () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void CheckActionCountIfNotDone () const GTEST_LOCK_EXCLUDED_(mutex_)
 
void UntypedTimes (const Cardinality &a_cardinality)
 
 GTEST_DISALLOW_ASSIGN_ (ExpectationBase)
 

Protected Attributes

const char * file_
 
int line_
 
const string source_text_
 
bool cardinality_specified_
 
Cardinality cardinality_
 
ExpectationSet immediate_prerequisites_
 
int call_count_
 
bool retired_
 
UntypedActions untyped_actions_
 
bool extra_matcher_specified_
 
bool repeated_action_specified_
 
bool retires_on_saturation_
 
Clause last_clause_
 
bool action_count_checked_
 
Mutex mutex_
 

Friends

class ::testing::Expectation
 
class UntypedFunctionMockerBase
 
class ::testing::Sequence
 
class ::testing::internal::ExpectationTester
 
template<typename Function >
class TypedExpectation
 
template<typename Function >
class TypedExpectation
 
template<typename Function >
class TypedExpectation
 

Detailed Description

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

Member Typedef Documentation

typedef std::vector<const void*> testing::internal::ExpectationBase::UntypedActions
protected

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

typedef std::vector<const void*> testing::internal::ExpectationBase::UntypedActions
protected

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

typedef std::vector<const void*> testing::internal::ExpectationBase::UntypedActions
protected

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

Member Enumeration Documentation

Enumerator
kNone 
kWith 
kTimes 
kInSequence 
kAfter 
kWillOnce 
kWillRepeatedly 
kRetiresOnSaturation 
kNone 
kWith 
kTimes 
kInSequence 
kAfter 
kWillOnce 
kWillRepeatedly 
kRetiresOnSaturation 
kNone 
kWith 
kTimes 
kInSequence 
kAfter 
kWillOnce 
kWillRepeatedly 
kRetiresOnSaturation 

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

Enumerator
kNone 
kWith 
kTimes 
kInSequence 
kAfter 
kWillOnce 
kWillRepeatedly 
kRetiresOnSaturation 
kNone 
kWith 
kTimes 
kInSequence 
kAfter 
kWillOnce 
kWillRepeatedly 
kRetiresOnSaturation 
kNone 
kWith 
kTimes 
kInSequence 
kAfter 
kWillOnce 
kWillRepeatedly 
kRetiresOnSaturation 

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

Enumerator
kNone 
kWith 
kTimes 
kInSequence 
kAfter 
kWillOnce 
kWillRepeatedly 
kRetiresOnSaturation 
kNone 
kWith 
kTimes 
kInSequence 
kAfter 
kWillOnce 
kWillRepeatedly 
kRetiresOnSaturation 
kNone 
kWith 
kTimes 
kInSequence 
kAfter 
kWillOnce 
kWillRepeatedly 
kRetiresOnSaturation 

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

Constructor & Destructor Documentation

testing::internal::ExpectationBase::ExpectationBase ( const char *  file,
int  line,
const string source_text 
)

Definition at line 68 of file gmock-spec-builders.cc.

71  : file_(a_file),
72  line_(a_line),
73  source_text_(a_source_text),
76  call_count_(0),
77  retired_(false),
82  action_count_checked_(false) {}
GTEST_API_ Cardinality Exactly(int n)
testing::internal::ExpectationBase::~ExpectationBase ( )
virtual

Definition at line 85 of file gmock-spec-builders.cc.

85 {}
testing::internal::ExpectationBase::ExpectationBase ( const char *  file,
int  line,
const string source_text 
)
virtual testing::internal::ExpectationBase::~ExpectationBase ( )
virtual
testing::internal::ExpectationBase::ExpectationBase ( const char *  file,
int  line,
const string source_text 
)
virtual testing::internal::ExpectationBase::~ExpectationBase ( )
virtual

Member Function Documentation

bool testing::internal::ExpectationBase::AllPrerequisitesAreSatisfied ( ) const
protected

Definition at line 115 of file gmock-spec-builders.cc.

References testing::ExpectationSet::begin(), testing::ExpectationSet::end(), and immediate_prerequisites_.

116  {
117  g_gmock_mutex.AssertHeld();
119  it != immediate_prerequisites_.end(); ++it) {
120  if (!(it->expectation_base()->IsSatisfied()) ||
121  !(it->expectation_base()->AllPrerequisitesAreSatisfied()))
122  return false;
123  }
124  return true;
125 }
Expectation::Set::const_iterator const_iterator
const_iterator end() const
const_iterator begin() const
bool testing::internal::ExpectationBase::AllPrerequisitesAreSatisfied ( ) const
protected
bool testing::internal::ExpectationBase::AllPrerequisitesAreSatisfied ( ) const
protected
void testing::internal::ExpectationBase::AssertSpecProperty ( bool  property,
const string failure_message 
) const
inlineprotected

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

References testing::internal::Assert().

741  {
742  Assert(property, file_, line_, failure_message);
743  }
void Assert(bool condition, const char *file, int line)
void testing::internal::ExpectationBase::AssertSpecProperty ( bool  property,
const string failure_message 
) const
inlineprotected

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

References testing::internal::Assert().

741  {
742  Assert(property, file_, line_, failure_message);
743  }
void Assert(bool condition, const char *file, int line)
void testing::internal::ExpectationBase::AssertSpecProperty ( bool  property,
const string failure_message 
) const
inlineprotected

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

References testing::internal::Assert().

741  {
742  Assert(property, file_, line_, failure_message);
743  }
void Assert(bool condition, const char *file, int line)
int testing::internal::ExpectationBase::call_count ( ) const
inlineprotected

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

816  {
817  g_gmock_mutex.AssertHeld();
818  return call_count_;
819  }
int testing::internal::ExpectationBase::call_count ( ) const
inlineprotected

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

Referenced by DescribeCallCountTo().

816  {
817  g_gmock_mutex.AssertHeld();
818  return call_count_;
819  }
int testing::internal::ExpectationBase::call_count ( ) const
inlineprotected

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

816  {
817  g_gmock_mutex.AssertHeld();
818  return call_count_;
819  }
const Cardinality& testing::internal::ExpectationBase::cardinality ( ) const
inline

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

Referenced by CheckActionCountIfNotDone(), and DescribeCallCountTo().

const Cardinality& testing::internal::ExpectationBase::cardinality ( ) const
inline

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

const Cardinality& testing::internal::ExpectationBase::cardinality ( ) const
inline

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

bool testing::internal::ExpectationBase::cardinality_specified ( ) const
inlineprotected

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

bool testing::internal::ExpectationBase::cardinality_specified ( ) const
inlineprotected

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

bool testing::internal::ExpectationBase::cardinality_specified ( ) const
inlineprotected

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

void testing::internal::ExpectationBase::CheckActionCountIfNotDone ( ) const
protected
void testing::internal::ExpectationBase::CheckActionCountIfNotDone ( ) const
protected

Definition at line 173 of file gmock-spec-builders.cc.

References action_count_checked_, cardinality(), cardinality_specified_, testing::Cardinality::ConservativeLowerBound(), testing::Cardinality::ConservativeUpperBound(), DescribeLocationTo(), testing::Cardinality::DescribeTo(), testing::internal::kWarning, testing::internal::Log(), repeated_action_specified_, source_text(), and untyped_actions_.

174  {
175  bool should_check = false;
176  {
177  MutexLock l(&mutex_);
178  if (!action_count_checked_) {
179  action_count_checked_ = true;
180  should_check = true;
181  }
182  }
183 
184  if (should_check) {
185  if (!cardinality_specified_) {
186  // The cardinality was inferred - no need to check the action
187  // count against it.
188  return;
189  }
190 
191  // The cardinality was explicitly specified.
192  const int action_count = static_cast<int>(untyped_actions_.size());
193  const int upper_bound = cardinality().ConservativeUpperBound();
194  const int lower_bound = cardinality().ConservativeLowerBound();
195  bool too_many; // True if there are too many actions, or false
196  // if there are too few.
197  if (action_count > upper_bound ||
198  (action_count == upper_bound && repeated_action_specified_)) {
199  too_many = true;
200  } else if (0 < action_count && action_count < lower_bound &&
202  too_many = false;
203  } else {
204  return;
205  }
206 
207  ::std::stringstream ss;
208  DescribeLocationTo(&ss);
209  ss << "Too " << (too_many ? "many" : "few")
210  << " actions specified in " << source_text() << "...\n"
211  << "Expected to be ";
212  cardinality().DescribeTo(&ss);
213  ss << ", but has " << (too_many ? "" : "only ")
214  << action_count << " WillOnce()"
215  << (action_count == 1 ? "" : "s");
217  ss << " and a WillRepeatedly()";
218  }
219  ss << ".";
220  Log(kWarning, ss.str(), -1); // -1 means "don't print stack trace".
221  }
222 }
void DescribeLocationTo(::std::ostream *os) const
void DescribeTo(::std::ostream *os) const
int ConservativeUpperBound() const
GTestMutexLock MutexLock
Definition: gtest-port.h:2159
GTEST_API_ void Log(LogSeverity severity, const string &message, int stack_frames_to_skip)
const Cardinality & cardinality() const
int ConservativeLowerBound() const
void testing::internal::ExpectationBase::CheckActionCountIfNotDone ( ) const
protected
void testing::internal::ExpectationBase::DescribeCallCountTo ( ::std::ostream *  os) const
void testing::internal::ExpectationBase::DescribeCallCountTo ( ::std::ostream *  os) const

Definition at line 150 of file gmock-spec-builders.cc.

References call_count(), cardinality(), testing::Cardinality::DescribeActualCallCountTo(), testing::Cardinality::DescribeTo(), is_retired(), IsOverSaturated(), IsSatisfied(), and IsSaturated().

Referenced by testing::internal::FunctionMockerBase< R(A1, A2)>::PrintTriedExpectationsLocked(), and testing::internal::UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked().

151  {
152  g_gmock_mutex.AssertHeld();
153 
154  // Describes how many times the function is expected to be called.
155  *os << " Expected: to be ";
156  cardinality().DescribeTo(os);
157  *os << "\n Actual: ";
159 
160  // Describes the state of the expectation (e.g. is it satisfied?
161  // is it active?).
162  *os << " - " << (IsOverSaturated() ? "over-saturated" :
163  IsSaturated() ? "saturated" :
164  IsSatisfied() ? "satisfied" : "unsatisfied")
165  << " and "
166  << (is_retired() ? "retired" : "active");
167 }
static void DescribeActualCallCountTo(int actual_call_count,::std::ostream *os)
bool IsSatisfied() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
void DescribeTo(::std::ostream *os) const
bool is_retired() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
int call_count() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
bool IsSaturated() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
const Cardinality & cardinality() const
bool IsOverSaturated() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
void testing::internal::ExpectationBase::DescribeCallCountTo ( ::std::ostream *  os) const
void testing::internal::ExpectationBase::DescribeLocationTo ( ::std::ostream *  os) const
inline
void testing::internal::ExpectationBase::DescribeLocationTo ( ::std::ostream *  os) const
inline

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

References testing::internal::FormatFileLocation(), and GTEST_EXCLUSIVE_LOCK_REQUIRED_.

705  {
706  *os << FormatFileLocation(file(), line()) << " ";
707  }
::std::string FormatFileLocation(const char *file, int line)
Definition: gtest-port.cc:880
void testing::internal::ExpectationBase::DescribeLocationTo ( ::std::ostream *  os) const
inline

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

References testing::internal::FormatFileLocation(), and GTEST_EXCLUSIVE_LOCK_REQUIRED_.

705  {
706  *os << FormatFileLocation(file(), line()) << " ";
707  }
::std::string FormatFileLocation(const char *file, int line)
Definition: gtest-port.cc:880
void testing::internal::ExpectationBase::ExpectSpecProperty ( bool  property,
const string failure_message 
) const
inlineprotected

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

References testing::internal::Expect().

746  {
747  Expect(property, file_, line_, failure_message);
748  }
void Expect(bool condition, const char *file, int line, const string &msg)
void testing::internal::ExpectationBase::ExpectSpecProperty ( bool  property,
const string failure_message 
) const
inlineprotected

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

References testing::internal::Expect().

Referenced by UntypedTimes().

746  {
747  Expect(property, file_, line_, failure_message);
748  }
void Expect(bool condition, const char *file, int line, const string &msg)
void testing::internal::ExpectationBase::ExpectSpecProperty ( bool  property,
const string failure_message 
) const
inlineprotected

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

References testing::internal::Expect().

746  {
747  Expect(property, file_, line_, failure_message);
748  }
void Expect(bool condition, const char *file, int line, const string &msg)
const char* testing::internal::ExpectationBase::file ( ) const
inline
const char* testing::internal::ExpectationBase::file ( ) const
inline

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

698 { return file_; }
const char* testing::internal::ExpectationBase::file ( ) const
inline

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

698 { return file_; }
void testing::internal::ExpectationBase::FindUnsatisfiedPrerequisites ( ExpectationSet result) const
protected
void testing::internal::ExpectationBase::FindUnsatisfiedPrerequisites ( ExpectationSet result) const
protected

Definition at line 128 of file gmock-spec-builders.cc.

References testing::ExpectationSet::begin(), testing::ExpectationSet::end(), and immediate_prerequisites_.

129  {
130  g_gmock_mutex.AssertHeld();
132  it != immediate_prerequisites_.end(); ++it) {
133  if (it->expectation_base()->IsSatisfied()) {
134  // If *it is satisfied and has a call count of 0, some of its
135  // pre-requisites may not be satisfied yet.
136  if (it->expectation_base()->call_count_ == 0) {
137  it->expectation_base()->FindUnsatisfiedPrerequisites(result);
138  }
139  } else {
140  // Now that we know *it is unsatisfied, we are not so interested
141  // in whether its pre-requisites are satisfied. Therefore we
142  // don't recursively call FindUnsatisfiedPrerequisites() here.
143  *result += *it;
144  }
145  }
146 }
Expectation::Set::const_iterator const_iterator
const_iterator end() const
const_iterator begin() const
void testing::internal::ExpectationBase::FindUnsatisfiedPrerequisites ( ExpectationSet result) const
protected
virtual Expectation testing::internal::ExpectationBase::GetHandle ( )
protectedpure virtual
virtual Expectation testing::internal::ExpectationBase::GetHandle ( )
protectedpure virtual
testing::internal::ExpectationBase::GTEST_DISALLOW_ASSIGN_ ( ExpectationBase  )
protected
testing::internal::ExpectationBase::GTEST_DISALLOW_ASSIGN_ ( ExpectationBase  )
protected
testing::internal::ExpectationBase::GTEST_DISALLOW_ASSIGN_ ( ExpectationBase  )
protected
void testing::internal::ExpectationBase::IncrementCallCount ( )
inlineprotected

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

References GTEST_LOCK_EXCLUDED_, and mutex_.

823  {
824  g_gmock_mutex.AssertHeld();
825  call_count_++;
826  }
void testing::internal::ExpectationBase::IncrementCallCount ( )
inlineprotected

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

References GTEST_LOCK_EXCLUDED_, and mutex_.

823  {
824  g_gmock_mutex.AssertHeld();
825  call_count_++;
826  }
void testing::internal::ExpectationBase::IncrementCallCount ( )
inlineprotected

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

References GTEST_LOCK_EXCLUDED_, and mutex_.

823  {
824  g_gmock_mutex.AssertHeld();
825  call_count_++;
826  }
bool testing::internal::ExpectationBase::is_retired ( ) const
inlineprotected

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

773  {
774  g_gmock_mutex.AssertHeld();
775  return retired_;
776  }
bool testing::internal::ExpectationBase::is_retired ( ) const
inlineprotected

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

773  {
774  g_gmock_mutex.AssertHeld();
775  return retired_;
776  }
bool testing::internal::ExpectationBase::is_retired ( ) const
inlineprotected

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

Referenced by DescribeCallCountTo(), and RetireAllPreRequisites().

773  {
774  g_gmock_mutex.AssertHeld();
775  return retired_;
776  }
bool testing::internal::ExpectationBase::IsOverSaturated ( ) const
inlineprotected

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

References GTEST_EXCLUSIVE_LOCK_REQUIRED_, and testing::Cardinality::IsOverSaturatedByCallCount().

801  {
802  g_gmock_mutex.AssertHeld();
804  }
bool IsOverSaturatedByCallCount(int call_count) const
const Cardinality & cardinality() const
bool testing::internal::ExpectationBase::IsOverSaturated ( ) const
inlineprotected
bool testing::internal::ExpectationBase::IsOverSaturated ( ) const
inlineprotected

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

References GTEST_EXCLUSIVE_LOCK_REQUIRED_, and testing::Cardinality::IsOverSaturatedByCallCount().

801  {
802  g_gmock_mutex.AssertHeld();
804  }
bool IsOverSaturatedByCallCount(int call_count) const
const Cardinality & cardinality() const
bool testing::internal::ExpectationBase::IsSatisfied ( ) const
inlineprotected
bool testing::internal::ExpectationBase::IsSatisfied ( ) const
inlineprotected

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

References testing::Cardinality::IsSatisfiedByCallCount().

787  {
788  g_gmock_mutex.AssertHeld();
790  }
bool IsSatisfiedByCallCount(int call_count) const
const Cardinality & cardinality() const
bool testing::internal::ExpectationBase::IsSatisfied ( ) const
inlineprotected

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

References testing::Cardinality::IsSatisfiedByCallCount().

787  {
788  g_gmock_mutex.AssertHeld();
790  }
bool IsSatisfiedByCallCount(int call_count) const
const Cardinality & cardinality() const
bool testing::internal::ExpectationBase::IsSaturated ( ) const
inlineprotected

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

References testing::Cardinality::IsSaturatedByCallCount().

794  {
795  g_gmock_mutex.AssertHeld();
797  }
bool IsSaturatedByCallCount(int call_count) const
const Cardinality & cardinality() const
bool testing::internal::ExpectationBase::IsSaturated ( ) const
inlineprotected
bool testing::internal::ExpectationBase::IsSaturated ( ) const
inlineprotected

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

References testing::Cardinality::IsSaturatedByCallCount().

794  {
795  g_gmock_mutex.AssertHeld();
797  }
bool IsSaturatedByCallCount(int call_count) const
const Cardinality & cardinality() const
int testing::internal::ExpectationBase::line ( ) const
inline

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

int testing::internal::ExpectationBase::line ( ) const
inline

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

virtual void testing::internal::ExpectationBase::MaybeDescribeExtraMatcherTo ( ::std::ostream *  os)
pure virtual
virtual void testing::internal::ExpectationBase::MaybeDescribeExtraMatcherTo ( ::std::ostream *  os)
pure virtual
virtual void testing::internal::ExpectationBase::MaybeDescribeExtraMatcherTo ( ::std::ostream *  os)
pure virtual
void testing::internal::ExpectationBase::Retire ( )
inlineprotected

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

Referenced by RetireAllPreRequisites().

780  {
781  g_gmock_mutex.AssertHeld();
782  retired_ = true;
783  }
void testing::internal::ExpectationBase::Retire ( )
inlineprotected

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

780  {
781  g_gmock_mutex.AssertHeld();
782  retired_ = true;
783  }
void testing::internal::ExpectationBase::Retire ( )
inlineprotected

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

780  {
781  g_gmock_mutex.AssertHeld();
782  retired_ = true;
783  }
void testing::internal::ExpectationBase::RetireAllPreRequisites ( )
protected

Definition at line 95 of file gmock-spec-builders.cc.

References testing::ExpectationSet::begin(), testing::ExpectationSet::end(), immediate_prerequisites_, is_retired(), Retire(), and RetireAllPreRequisites().

Referenced by RetireAllPreRequisites().

96  {
97  if (is_retired()) {
98  // We can take this short-cut as we never retire an expectation
99  // until we have retired all its pre-requisites.
100  return;
101  }
102 
104  it != immediate_prerequisites_.end(); ++it) {
105  ExpectationBase* const prerequisite = it->expectation_base().get();
106  if (!prerequisite->is_retired()) {
107  prerequisite->RetireAllPreRequisites();
108  prerequisite->Retire();
109  }
110  }
111 }
ExpectationBase(const char *file, int line, const string &source_text)
bool is_retired() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Expectation::Set::const_iterator const_iterator
const_iterator end() const
const_iterator begin() const
void testing::internal::ExpectationBase::RetireAllPreRequisites ( )
protected
void testing::internal::ExpectationBase::RetireAllPreRequisites ( )
protected
void testing::internal::ExpectationBase::set_cardinality ( const Cardinality a_cardinality)
inlineprotected

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

References GTEST_EXCLUSIVE_LOCK_REQUIRED_.

759  {
760  cardinality_ = a_cardinality;
761  }
void testing::internal::ExpectationBase::set_cardinality ( const Cardinality a_cardinality)
inlineprotected

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

References GTEST_EXCLUSIVE_LOCK_REQUIRED_.

759  {
760  cardinality_ = a_cardinality;
761  }
void testing::internal::ExpectationBase::set_cardinality ( const Cardinality a_cardinality)
inlineprotected

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

References GTEST_EXCLUSIVE_LOCK_REQUIRED_.

759  {
760  cardinality_ = a_cardinality;
761  }
const char* testing::internal::ExpectationBase::source_text ( ) const
inline

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

700 { return source_text_.c_str(); }
const char* testing::internal::ExpectationBase::source_text ( ) const
inline

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

700 { return source_text_.c_str(); }
void testing::internal::ExpectationBase::SpecifyCardinality ( const Cardinality cardinality)
protected
void testing::internal::ExpectationBase::SpecifyCardinality ( const Cardinality cardinality)
protected

Definition at line 89 of file gmock-spec-builders.cc.

References cardinality_, and cardinality_specified_.

Referenced by UntypedTimes().

89  {
91  cardinality_ = a_cardinality;
92 }
void testing::internal::ExpectationBase::SpecifyCardinality ( const Cardinality cardinality)
protected
void testing::internal::ExpectationBase::UntypedTimes ( const Cardinality a_cardinality)
protected
void testing::internal::ExpectationBase::UntypedTimes ( const Cardinality a_cardinality)
protected
void testing::internal::ExpectationBase::UntypedTimes ( const Cardinality a_cardinality)
protected

Definition at line 225 of file gmock-spec-builders.cc.

References ExpectSpecProperty(), kTimes, last_clause_, and SpecifyCardinality().

Referenced by testing::internal::TypedExpectation< F >::Times().

225  {
226  if (last_clause_ == kTimes) {
227  ExpectSpecProperty(false,
228  ".Times() cannot appear "
229  "more than once in an EXPECT_CALL().");
230  } else {
232  ".Times() cannot appear after "
233  ".InSequence(), .WillOnce(), .WillRepeatedly(), "
234  "or .RetiresOnSaturation().");
235  }
237 
238  SpecifyCardinality(a_cardinality);
239 }
void ExpectSpecProperty(bool property, const string &failure_message) const
void SpecifyCardinality(const Cardinality &cardinality)

Friends And Related Function Documentation

friend class ::testing::Expectation
friend

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

friend class ::testing::internal::ExpectationTester
friend

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

friend class ::testing::Sequence
friend

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

template<typename Function >
friend class TypedExpectation
friend

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

template<typename Function >
class TypedExpectation ( )
friend

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

template<typename Function >
class TypedExpectation ( )
friend

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

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

Member Data Documentation

bool testing::internal::ExpectationBase::action_count_checked_
mutableprotected

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

Referenced by CheckActionCountIfNotDone().

int testing::internal::ExpectationBase::call_count_
protected
Cardinality testing::internal::ExpectationBase::cardinality_
protected

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

Referenced by SpecifyCardinality().

bool testing::internal::ExpectationBase::cardinality_specified_
protected

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

Referenced by CheckActionCountIfNotDone(), and SpecifyCardinality().

bool testing::internal::ExpectationBase::extra_matcher_specified_
protected

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

const char * testing::internal::ExpectationBase::file_
protected

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

ExpectationSet testing::internal::ExpectationBase::immediate_prerequisites_
protected
Clause testing::internal::ExpectationBase::last_clause_
protected

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

Referenced by UntypedTimes().

int testing::internal::ExpectationBase::line_
protected

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

Mutex testing::internal::ExpectationBase::mutex_
mutableprotected

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

bool testing::internal::ExpectationBase::repeated_action_specified_
protected

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

Referenced by CheckActionCountIfNotDone().

bool testing::internal::ExpectationBase::retired_
protected

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

bool testing::internal::ExpectationBase::retires_on_saturation_
protected

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

const string testing::internal::ExpectationBase::source_text_
protected

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

UntypedActions testing::internal::ExpectationBase::untyped_actions_
protected

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

Referenced by CheckActionCountIfNotDone().


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