35 #include "gmock/gmock-cardinalities.h"
41 #include "gmock/internal/gmock-internal-utils.h"
42 #include "gtest/gtest.h"
49 class BetweenCardinalityImpl :
public CardinalityInterface {
51 BetweenCardinalityImpl(
int min,
int max)
56 ss <<
"The invocation lower bound must be >= 0, "
57 <<
"but is actually " <<
min <<
".";
60 ss <<
"The invocation upper bound must be >= 0, "
61 <<
"but is actually " <<
max <<
".";
64 ss <<
"The invocation upper bound (" <<
max
65 <<
") must be >= the invocation lower bound (" <<
min
73 int ConservativeLowerBound()
const override {
return min_; }
74 int ConservativeUpperBound()
const override {
return max_; }
76 bool IsSatisfiedByCallCount(
int call_count)
const override {
77 return min_ <= call_count && call_count <=
max_;
80 bool IsSaturatedByCallCount(
int call_count)
const override {
81 return call_count >=
max_;
84 void DescribeTo(::std::ostream* os)
const override;
100 std::stringstream ss;
107 void BetweenCardinalityImpl::DescribeTo(::std::ostream* os)
const {
110 *os <<
"never called";
111 }
else if (
max_ == INT_MAX) {
112 *os <<
"called any number of times";
114 *os <<
"called at most " << FormatTimes(
max_);
117 *os <<
"called " << FormatTimes(
min_);
118 }
else if (
max_ == INT_MAX) {
119 *os <<
"called at least " << FormatTimes(
min_);
122 *os <<
"called between " <<
min_ <<
" and " <<
max_ <<
" times";
130 ::std::ostream* os) {
131 if (actual_call_count > 0) {
132 *os <<
"called " << FormatTimes(actual_call_count);
134 *os <<
"never called";