googletest.cfg; add MATCHER (#2485)
This commit is contained in:
parent
c6e74f4c10
commit
26e403893c
|
@ -43,6 +43,7 @@
|
|||
<define name="GTEST_STRINGIFY_(name)" value="#name"/>
|
||||
<define name="GTEST_REFERENCE_TO_CONST_(T)" value="typename ::testing::internal::ConstRef<T>::type"/>
|
||||
<define name="GTEST_ATTRIBUTE_UNUSED_" value="__attribute__ ((unused))"/>
|
||||
<define name="MATCHER(name, description,...)" value="bool name##Matcher<_type>::gmock_Impl<arg_type>::MatchAndExplain( GTEST_REFERENCE_TO_CONST_(arg_type) arg, ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_) const"/>
|
||||
<define name="MATCHER_P(name, p0, description)" value="bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain( GTEST_REFERENCE_TO_CONST_(arg_type) arg, ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_) const"/>
|
||||
<define name="MATCHER_P2(name, p0, p1, description)" value="bool name##MatcherP2<p0##_type, p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(GTEST_REFERENCE_TO_CONST_(arg_type) arg,::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_) const"/>
|
||||
<define name="MATCHER_P3(name, p0, p1, p2, description)" value="bool name##MatcherP3<p0##_type, p1##_type, p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(GTEST_REFERENCE_TO_CONST_(arg_type) arg,::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_) const"/>
|
||||
|
|
|
@ -10,16 +10,22 @@
|
|||
#include <gmock/gmock-generated-matchers.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
// #9397 syntaxError when MATCHER_P is not known
|
||||
|
||||
namespace ExampleNamespace {
|
||||
constexpr long long TOLERANCE = 10;
|
||||
|
||||
MATCHER_P(ExampleMatcherTest, expected, "")
|
||||
// #9397 syntaxError when MATCHER_P is not known
|
||||
MATCHER_P(ExampleMatcherPTest, expected, "")
|
||||
{
|
||||
return ((arg <= (expected + TOLERANCE)) && (arg >= (expected - TOLERANCE)));
|
||||
}
|
||||
}
|
||||
|
||||
// syntaxError when MATCHER is not known
|
||||
MATCHER(ExampleMatcherTest, "")
|
||||
{
|
||||
return (arg == TOLERANCE);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ASSERT, ASSERT)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue