aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/gmock-more-matchers.h
diff options
context:
space:
mode:
authorGennadiy Civil <misterg@google.com>2018-01-26 11:57:58 -0500
committerGennadiy Civil <misterg@google.com>2018-01-26 11:57:58 -0500
commitfbb48a7708fc791ef25096b383791966bbf369f0 (patch)
tree06f49b8bef466973da1f715f658d9470af7aa263 /googlemock/include/gmock/gmock-more-matchers.h
parentb3a2048beb0f8d6cbb2d5c95e7f639780eff5805 (diff)
downloadgoogletest-fbb48a7708fc791ef25096b383791966bbf369f0.tar.gz
googletest-fbb48a7708fc791ef25096b383791966bbf369f0.tar.bz2
googletest-fbb48a7708fc791ef25096b383791966bbf369f0.zip
Code merges
Diffstat (limited to 'googlemock/include/gmock/gmock-more-matchers.h')
-rw-r--r--googlemock/include/gmock/gmock-more-matchers.h16
1 files changed, 16 insertions, 0 deletions
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<bool>(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<bool>(arg);
+}
+
} // namespace testing
#endif // GMOCK_GMOCK_MORE_MATCHERS_H_