gmock-more-matchers.h (googletest-release-1.11.0) | : | gmock-more-matchers.h (googletest-release-1.12.0) | ||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
// Google Mock - a framework for writing C++ mock classes. | // Google Mock - a framework for writing C++ mock classes. | |||
// | // | |||
// This file implements some matchers that depend on gmock-matchers.h. | // This file implements some matchers that depend on gmock-matchers.h. | |||
// | // | |||
// Note that tests are implemented in gmock-matchers_test.cc rather than | // Note that tests are implemented in gmock-matchers_test.cc rather than | |||
// gmock-more-matchers-test.cc. | // gmock-more-matchers-test.cc. | |||
// GOOGLETEST_CM0002 DO NOT DELETE | // IWYU pragma: private, include "gmock/gmock.h" | |||
// IWYU pragma: friend gmock/.* | ||||
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_ | #ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_ | |||
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_ | #define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_ | |||
#include "gmock/gmock-matchers.h" | #include "gmock/gmock-matchers.h" | |||
namespace testing { | namespace testing { | |||
// Silence C4100 (unreferenced formal | // Silence C4100 (unreferenced formal | |||
// parameter) for MSVC | // parameter) for MSVC | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
# pragma warning(push) | #pragma warning(push) | |||
# pragma warning(disable:4100) | #pragma warning(disable : 4100) | |||
#if (_MSC_VER == 1900) | #if (_MSC_VER == 1900) | |||
// and silence C4800 (C4800: 'int *const ': forcing value | // and silence C4800 (C4800: 'int *const ': forcing value | |||
// to bool 'true' or 'false') for MSVC 14 | // to bool 'true' or 'false') for MSVC 14 | |||
# pragma warning(disable:4800) | #pragma warning(disable : 4800) | |||
#endif | #endif | |||
#endif | #endif | |||
// Defines a matcher that matches an empty container. The container must | // Defines a matcher that matches an empty container. The container must | |||
// support both size() and empty(), which all STL-like containers provide. | // support both size() and empty(), which all STL-like containers provide. | |||
MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") { | MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") { | |||
if (arg.empty()) { | if (arg.empty()) { | |||
return true; | return true; | |||
} | } | |||
*result_listener << "whose size is " << arg.size(); | *result_listener << "whose size is " << arg.size(); | |||
return false; | return false; | |||
skipping to change at line 85 | skipping to change at line 86 | |||
// Define a matcher that matches a value that evaluates in boolean | // Define a matcher that matches a value that evaluates in boolean | |||
// context to false. Useful for types that define "explicit operator | // context to false. Useful for types that define "explicit operator | |||
// bool" operators and so can't be compared for equality with true | // bool" operators and so can't be compared for equality with true | |||
// and false. | // and false. | |||
MATCHER(IsFalse, negation ? "is true" : "is false") { | MATCHER(IsFalse, negation ? "is true" : "is false") { | |||
return !static_cast<bool>(arg); | return !static_cast<bool>(arg); | |||
} | } | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
# pragma warning(pop) | #pragma warning(pop) | |||
#endif | #endif | |||
} // namespace testing | } // namespace testing | |||
#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_ | #endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_ | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 7 lines changed or added |