void MockSupport::clear() { delete lastActualFunctionCall_; lastActualFunctionCall_ = NULL; tracing_ = false; MockFunctionCallTrace::instance().clear(); expectations_.deleteAllExpectationsAndClearList(); compositeCalls_.clear(); ignoreOtherCalls_ = false; enabled_ = true; callOrder_ = 0; expectedCallOrder_ = 0; strictOrdering_ = false; for (MockNamedValueListNode* p = data_.begin(); p; p = p->next()) { MockSupport* support = getMockSupport(p); if (support) { support->clear(); delete support; } } data_.clear(); }
MockSupport& mock(const SimpleString& mockName, MockFailureReporter* failureReporterForThisCall) { MockSupport& mock_support = (mockName != "") ? *global_mock.getMockSupportScope(mockName) : global_mock; mock_support.setActiveReporter(failureReporterForThisCall); mock_support.setDefaultComparatorsAndCopiersRepository(); return mock_support; }
MockSupport* MockSupport::clone(const SimpleString& mockName) { MockSupport* newMock = new MockSupport(mockName); newMock->setMockFailureStandardReporter(standardReporter_); if (ignoreOtherCalls_) newMock->ignoreOtherCalls(); if (!enabled_) newMock->disable(); if (strictOrdering_) newMock->strictOrder(); newMock->tracing(tracing_); newMock->installComparatorsAndCopiers(comparatorsAndCopiersRepository_); return newMock; }
MockSupport* MockSupport::getMockSupportScope(const SimpleString& name) { SimpleString mockingSupportName = MOCK_SUPPORT_SCOPE_PREFIX; mockingSupportName += name; if (hasData(mockingSupportName)) { STRCMP_EQUAL("MockSupport", getData(mockingSupportName).getType().asCharString()); return (MockSupport*) getData(mockingSupportName).getObjectPointer(); } MockSupport *newMock = new MockSupport; newMock->setMockFailureReporter(reporter_); if (ignoreOtherCalls_) newMock->ignoreOtherCalls(); if (!enabled_) newMock->disable(); newMock->tracing(tracing_); newMock->installComparators(comparatorRepository_); setDataObject(mockingSupportName, "MockSupport", newMock); return newMock; }
MockSupport& mock(const SimpleString& mockName) { if (mockName != "") return *global_mock.getMockSupportScope(mockName); return global_mock; }
MockSupport& mock(const SimpleString& mockName, MockFailureReporter* failureReporterForThisCall) { MockSupport& mock_support = (mockName != "") ? *global_mock.getMockSupportScope(mockName) : global_mock; mock_support.setActiveReporter(failureReporterForThisCall); return mock_support; }