aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gmock-spec-builders.cc34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/gmock-spec-builders.cc b/src/gmock-spec-builders.cc
index 465e4d63..00d16918 100644
--- a/src/gmock-spec-builders.cc
+++ b/src/gmock-spec-builders.cc
@@ -82,11 +82,9 @@ void ExpectationBase::RetireAllPreRequisites() {
return;
}
- for (ExpectationBaseSet::const_iterator it =
- immediate_prerequisites_.begin();
- it != immediate_prerequisites_.end();
- ++it) {
- ExpectationBase* const prerequisite = (*it).get();
+ for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
+ it != immediate_prerequisites_.end(); ++it) {
+ ExpectationBase* const prerequisite = it->expectation_base().get();
if (!prerequisite->is_retired()) {
prerequisite->RetireAllPreRequisites();
prerequisite->Retire();
@@ -99,10 +97,10 @@ void ExpectationBase::RetireAllPreRequisites() {
// L >= g_gmock_mutex
bool ExpectationBase::AllPrerequisitesAreSatisfied() const {
g_gmock_mutex.AssertHeld();
- for (ExpectationBaseSet::const_iterator it = immediate_prerequisites_.begin();
+ for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
it != immediate_prerequisites_.end(); ++it) {
- if (!(*it)->IsSatisfied() ||
- !(*it)->AllPrerequisitesAreSatisfied())
+ if (!(it->expectation_base()->IsSatisfied()) ||
+ !(it->expectation_base()->AllPrerequisitesAreSatisfied()))
return false;
}
return true;
@@ -111,21 +109,21 @@ bool ExpectationBase::AllPrerequisitesAreSatisfied() const {
// Adds unsatisfied pre-requisites of this expectation to 'result'.
// L >= g_gmock_mutex
void ExpectationBase::FindUnsatisfiedPrerequisites(
- ExpectationBaseSet* result) const {
+ ExpectationSet* result) const {
g_gmock_mutex.AssertHeld();
- for (ExpectationBaseSet::const_iterator it = immediate_prerequisites_.begin();
+ for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
it != immediate_prerequisites_.end(); ++it) {
- if ((*it)->IsSatisfied()) {
+ if (it->expectation_base()->IsSatisfied()) {
// If *it is satisfied and has a call count of 0, some of its
// pre-requisites may not be satisfied yet.
- if ((*it)->call_count_ == 0) {
- (*it)->FindUnsatisfiedPrerequisites(result);
+ if (it->expectation_base()->call_count_ == 0) {
+ it->expectation_base()->FindUnsatisfiedPrerequisites(result);
}
} else {
// Now that we know *it is unsatisfied, we are not so interested
// in whether its pre-requisites are satisfied. Therefore we
// don't recursively call FindUnsatisfiedPrerequisites() here.
- result->insert(*it);
+ *result += *it;
}
}
}
@@ -421,11 +419,11 @@ void Mock::ClearDefaultActionsLocked(void* mock_obj) {
}
// Adds an expectation to a sequence.
-void Sequence::AddExpectation(
- const internal::linked_ptr<internal::ExpectationBase>& expectation) const {
+void Sequence::AddExpectation(const Expectation& expectation) const {
if (*last_expectation_ != expectation) {
- if (*last_expectation_ != NULL) {
- expectation->immediate_prerequisites_.insert(*last_expectation_);
+ if (last_expectation_->expectation_base() != NULL) {
+ expectation.expectation_base()->immediate_prerequisites_
+ += *last_expectation_;
}
*last_expectation_ = expectation;
}