Index: testing/gmock-support.h |
diff --git a/testing/gmock-support.h b/testing/gmock-support.h |
index ad39e9269bb24404a7a9c52fd39f2479c2567f64..012775b5cbffbf6b33de4fb3bb67c6ae04583ef3 100644 |
--- a/testing/gmock-support.h |
+++ b/testing/gmock-support.h |
@@ -5,6 +5,7 @@ |
#ifndef V8_TESTING_GMOCK_SUPPORT_H_ |
#define V8_TESTING_GMOCK_SUPPORT_H_ |
+#include <cmath> |
#include <cstring> |
#include "testing/gmock/include/gmock/gmock.h" |
@@ -96,6 +97,12 @@ inline Matcher<T> CaptureEq(Capture<T>* capture) { |
return MakeMatcher(new internal::CaptureEqMatcher<T>(capture)); |
} |
+ |
+// Creates a polymorphic matcher that matches any floating point NaN value. |
+MATCHER(IsNaN, std::string(negation ? "isn't" : "is") + " not a number") { |
+ return std::isnan(arg); |
+} |
+ |
} // namespace testing |
#endif // V8_TESTING_GMOCK_SUPPORT_H_ |