From fbb48a7708fc791ef25096b383791966bbf369f0 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 26 Jan 2018 11:57:58 -0500 Subject: Code merges --- googlemock/include/gmock/gmock-more-matchers.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'googlemock/include/gmock/gmock-more-matchers.h') diff --git a/googlemock/include/gmock/gmock-more-matchers.h b/googlemock/include/gmock/gmock-more-matchers.h index 3db899f4..a5a8bfa5 100644 --- a/googlemock/include/gmock/gmock-more-matchers.h +++ b/googlemock/include/gmock/gmock-more-matchers.h @@ -53,6 +53,22 @@ MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") { return false; } +// Define a matcher that matches a value that evaluates in boolean +// context to true. Useful for types that define "explicit operator +// bool" operators and so can't be compared for equality with true +// and false. +MATCHER(IsTrue, negation ? "is false" : "is true") { + return static_cast(arg); +} + +// Define a matcher that matches a value that evaluates in boolean +// context to false. Useful for types that define "explicit operator +// bool" operators and so can't be compared for equality with true +// and false. +MATCHER(IsFalse, negation ? "is true" : "is false") { + return !static_cast(arg); +} + } // namespace testing #endif // GMOCK_GMOCK_MORE_MATCHERS_H_ -- cgit v1.2.3