43#include "gtest/gtest.h"
52 BetweenCardinalityImpl(
int min,
int max)
53 : min_(
min >= 0 ?
min : 0),
54 max_(max >= min_ ? max : min_) {
57 ss <<
"The invocation lower bound must be >= 0, "
58 <<
"but is actually " <<
min <<
".";
61 ss <<
"The invocation upper bound must be >= 0, "
62 <<
"but is actually " << max <<
".";
64 }
else if (
min > max) {
65 ss <<
"The invocation upper bound (" << max
66 <<
") must be >= the invocation lower bound (" <<
min
74 virtual int ConservativeLowerBound()
const {
return min_; }
75 virtual int ConservativeUpperBound()
const {
return max_; }
77 virtual bool IsSatisfiedByCallCount(
int call_count)
const {
78 return min_ <= call_count && call_count <= max_;
81 virtual bool IsSaturatedByCallCount(
int call_count)
const {
82 return call_count >= max_;
85 virtual void DescribeTo(::std::ostream* os)
const;
101 std::stringstream ss;
108void BetweenCardinalityImpl::DescribeTo(::std::ostream* os)
const {
111 *os <<
"never called";
112 }
else if (max_ == INT_MAX) {
113 *os <<
"called any number of times";
115 *os <<
"called at most " << FormatTimes(max_);
117 }
else if (min_ == max_) {
118 *os <<
"called " << FormatTimes(min_);
119 }
else if (max_ == INT_MAX) {
120 *os <<
"called at least " << FormatTimes(min_);
123 *os <<
"called between " << min_ <<
" and " << max_ <<
" times";
131 ::std::ostream* os) {
132 if (actual_call_count > 0) {
133 *os <<
"called " << FormatTimes(actual_call_count);
135 *os <<
"never called";
Definition gmock-cardinalities.h:59
Definition gmock-cardinalities.h:83
static void DescribeActualCallCountTo(int actual_call_count, ::std::ostream *os)
Definition gmock-cardinalities.cc:130
#define GTEST_API_
Definition gtest-port.h:934
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
Definition gtest-port.h:874
::std::string string
Definition gtest-port.h:1097
void Expect(bool condition, const char *file, int line, const string &msg)
Definition gmock-internal-utils.h:294
Definition gmock-actions.h:53
GTEST_API_ Cardinality AtLeast(int n)
Definition gmock-cardinalities.cc:140
GTEST_API_ Cardinality Between(int min, int max)
Definition gmock-cardinalities.cc:149
GTEST_API_ Cardinality AtMost(int n)
Definition gmock-cardinalities.cc:143
GTEST_API_ Cardinality AnyNumber()
Definition gmock-cardinalities.cc:146
GTEST_API_ Cardinality Exactly(int n)
Definition gmock-cardinalities.cc:154
#define min(a, b)
Definition oaes_lib.c:78