39 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ 40 #define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ 64 class CardinalityInterface {
66 virtual ~CardinalityInterface() {}
70 virtual int ConservativeLowerBound()
const {
return 0; }
71 virtual int ConservativeUpperBound()
const {
return INT_MAX; }
74 virtual bool IsSatisfiedByCallCount(
int call_count)
const = 0;
77 virtual bool IsSaturatedByCallCount(
int call_count)
const = 0;
80 virtual void DescribeTo(::std::ostream* os)
const = 0;
94 explicit Cardinality(
const CardinalityInterface* impl) : impl_(impl) {}
98 int ConservativeLowerBound()
const {
return impl_->ConservativeLowerBound(); }
99 int ConservativeUpperBound()
const {
return impl_->ConservativeUpperBound(); }
102 bool IsSatisfiedByCallCount(
int call_count)
const {
103 return impl_->IsSatisfiedByCallCount(call_count);
107 bool IsSaturatedByCallCount(
int call_count)
const {
108 return impl_->IsSaturatedByCallCount(call_count);
113 bool IsOverSaturatedByCallCount(
int call_count)
const {
114 return impl_->IsSaturatedByCallCount(call_count) &&
115 !impl_->IsSatisfiedByCallCount(call_count);
119 void DescribeTo(::std::ostream* os)
const { impl_->DescribeTo(os); }
122 static void DescribeActualCallCountTo(
int actual_call_count,
126 std::shared_ptr<const CardinalityInterface> impl_;
145 inline Cardinality MakeCardinality(
const CardinalityInterface* c) {
146 return Cardinality(c);
153 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ Definition: gmock-actions.h:59
GTEST_API_ Cardinality AtLeast(int n)
Definition: gmock-cardinalities.cc:139
GTEST_API_ Cardinality AtMost(int n)
Definition: gmock-cardinalities.cc:142
#define GTEST_DISABLE_MSC_WARNINGS_POP_()
Definition: gtest-port.h:314
#define GTEST_API_
Definition: gtest-port.h:759
constexpr size_t n
Definition: MatrixInversionTest.cpp:14
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251) namespace testing
Definition: gmock-cardinalities.h:48
GTEST_API_ Cardinality Between(int min, int max)
Definition: gmock-cardinalities.cc:148
GTEST_API_ Cardinality Exactly(int n)
Definition: gmock-cardinalities.cc:153
GTEST_API_ Cardinality AnyNumber()
Definition: gmock-cardinalities.cc:145