Commit ab5b77c1 by zhanyong.wan

Implements Pointwise().

parent 0f3f5012
...@@ -221,7 +221,7 @@ template <class ArgsTuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1, ...@@ -221,7 +221,7 @@ template <class ArgsTuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> { class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
public: public:
// ArgsTuple may have top-level const or reference modifiers. // ArgsTuple may have top-level const or reference modifiers.
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(ArgsTuple)) RawArgsTuple; typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple;
typedef typename internal::TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5, typedef typename internal::TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5,
k6, k7, k8, k9>::type SelectedArgs; k6, k7, k8, k9>::type SelectedArgs;
typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher; typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher;
...@@ -314,8 +314,7 @@ class ElementsAreMatcher1 { ...@@ -314,8 +314,7 @@ class ElementsAreMatcher1 {
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(Container)) typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_type typedef typename internal::StlContainerView<RawContainer>::type::value_type
Element; Element;
...@@ -343,8 +342,7 @@ class ElementsAreMatcher2 { ...@@ -343,8 +342,7 @@ class ElementsAreMatcher2 {
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(Container)) typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_type typedef typename internal::StlContainerView<RawContainer>::type::value_type
Element; Element;
...@@ -371,8 +369,7 @@ class ElementsAreMatcher3 { ...@@ -371,8 +369,7 @@ class ElementsAreMatcher3 {
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(Container)) typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_type typedef typename internal::StlContainerView<RawContainer>::type::value_type
Element; Element;
...@@ -401,8 +398,7 @@ class ElementsAreMatcher4 { ...@@ -401,8 +398,7 @@ class ElementsAreMatcher4 {
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(Container)) typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_type typedef typename internal::StlContainerView<RawContainer>::type::value_type
Element; Element;
...@@ -433,8 +429,7 @@ class ElementsAreMatcher5 { ...@@ -433,8 +429,7 @@ class ElementsAreMatcher5 {
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(Container)) typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_type typedef typename internal::StlContainerView<RawContainer>::type::value_type
Element; Element;
...@@ -469,8 +464,7 @@ class ElementsAreMatcher6 { ...@@ -469,8 +464,7 @@ class ElementsAreMatcher6 {
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(Container)) typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_type typedef typename internal::StlContainerView<RawContainer>::type::value_type
Element; Element;
...@@ -507,8 +501,7 @@ class ElementsAreMatcher7 { ...@@ -507,8 +501,7 @@ class ElementsAreMatcher7 {
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(Container)) typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_type typedef typename internal::StlContainerView<RawContainer>::type::value_type
Element; Element;
...@@ -547,8 +540,7 @@ class ElementsAreMatcher8 { ...@@ -547,8 +540,7 @@ class ElementsAreMatcher8 {
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(Container)) typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_type typedef typename internal::StlContainerView<RawContainer>::type::value_type
Element; Element;
...@@ -590,8 +582,7 @@ class ElementsAreMatcher9 { ...@@ -590,8 +582,7 @@ class ElementsAreMatcher9 {
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(Container)) typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_type typedef typename internal::StlContainerView<RawContainer>::type::value_type
Element; Element;
...@@ -635,8 +626,7 @@ class ElementsAreMatcher10 { ...@@ -635,8 +626,7 @@ class ElementsAreMatcher10 {
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(Container)) typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_type typedef typename internal::StlContainerView<RawContainer>::type::value_type
Element; Element;
......
...@@ -107,7 +107,7 @@ template <class ArgsTuple$for i [[, int k$i = -1]]> ...@@ -107,7 +107,7 @@ template <class ArgsTuple$for i [[, int k$i = -1]]>
class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> { class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
public: public:
// ArgsTuple may have top-level const or reference modifiers. // ArgsTuple may have top-level const or reference modifiers.
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(ArgsTuple)) RawArgsTuple; typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple;
typedef typename internal::TupleFields<RawArgsTuple, $ks>::type SelectedArgs; typedef typename internal::TupleFields<RawArgsTuple, $ks>::type SelectedArgs;
typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher; typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher;
...@@ -200,8 +200,7 @@ class ElementsAreMatcher$i { ...@@ -200,8 +200,7 @@ class ElementsAreMatcher$i {
template <typename Container> template <typename Container>
operator Matcher<Container>() const { operator Matcher<Container>() const {
typedef GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(Container)) typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
RawContainer;
typedef typename internal::StlContainerView<RawContainer>::type::value_type typedef typename internal::StlContainerView<RawContainer>::type::value_type
Element; Element;
......
...@@ -192,7 +192,8 @@ TEST(ArgsTest, AcceptsTenTemplateArgs) { ...@@ -192,7 +192,8 @@ TEST(ArgsTest, AcceptsTenTemplateArgs) {
TEST(ArgsTest, DescirbesSelfCorrectly) { TEST(ArgsTest, DescirbesSelfCorrectly) {
const Matcher<tuple<int, bool, char> > m = Args<2, 0>(Lt()); const Matcher<tuple<int, bool, char> > m = Args<2, 0>(Lt());
EXPECT_EQ("are a tuple whose fields (#2, #0) are a pair (x, y) where x < y", EXPECT_EQ("are a tuple whose fields (#2, #0) are a pair where "
"the first < the second",
Describe(m)); Describe(m));
} }
...@@ -200,14 +201,14 @@ TEST(ArgsTest, DescirbesNestedArgsCorrectly) { ...@@ -200,14 +201,14 @@ TEST(ArgsTest, DescirbesNestedArgsCorrectly) {
const Matcher<const tuple<int, bool, char, int>&> m = const Matcher<const tuple<int, bool, char, int>&> m =
Args<0, 2, 3>(Args<2, 0>(Lt())); Args<0, 2, 3>(Args<2, 0>(Lt()));
EXPECT_EQ("are a tuple whose fields (#0, #2, #3) are a tuple " EXPECT_EQ("are a tuple whose fields (#0, #2, #3) are a tuple "
"whose fields (#2, #0) are a pair (x, y) where x < y", "whose fields (#2, #0) are a pair where the first < the second",
Describe(m)); Describe(m));
} }
TEST(ArgsTest, DescribesNegationCorrectly) { TEST(ArgsTest, DescribesNegationCorrectly) {
const Matcher<tuple<int, char> > m = Args<1, 0>(Gt()); const Matcher<tuple<int, char> > m = Args<1, 0>(Gt());
EXPECT_EQ("are a tuple whose fields (#1, #0) are a pair (x, y) " EXPECT_EQ("are a tuple whose fields (#1, #0) aren't a pair "
"where x > y is false", "where the first > the second",
DescribeNegation(m)); DescribeNegation(m));
} }
......
...@@ -151,7 +151,7 @@ FILE:#: pre-requisite #1 ...@@ -151,7 +151,7 @@ FILE:#: pre-requisite #1
[ RUN ] GMockOutputTest.UnsatisfiedWith [ RUN ] GMockOutputTest.UnsatisfiedWith
FILE:#: Failure FILE:#: Failure
Actual function call count doesn't match EXPECT_CALL(foo_, Bar2(_, _))... Actual function call count doesn't match EXPECT_CALL(foo_, Bar2(_, _))...
Expected args: are a pair (x, y) where x >= y Expected args: are a pair where the first >= the second
Expected: to be called once Expected: to be called once
Actual: never called - unsatisfied and active Actual: never called - unsatisfied and active
[ FAILED ] GMockOutputTest.UnsatisfiedWith [ FAILED ] GMockOutputTest.UnsatisfiedWith
...@@ -190,7 +190,7 @@ Unexpected mock function call - returning default value. ...@@ -190,7 +190,7 @@ Unexpected mock function call - returning default value.
Google Mock tried the following 1 expectation, but it didn't match: Google Mock tried the following 1 expectation, but it didn't match:
FILE:#: EXPECT_CALL(foo_, Bar2(Ge(2), Ge(1)))... FILE:#: EXPECT_CALL(foo_, Bar2(Ge(2), Ge(1)))...
Expected args: are a pair (x, y) where x >= y Expected args: are a pair where the first >= the second
Actual: don't match Actual: don't match
Expected: to be called once Expected: to be called once
Actual: never called - unsatisfied and active Actual: never called - unsatisfied and active
...@@ -206,7 +206,7 @@ Google Mock tried the following 1 expectation, but it didn't match: ...@@ -206,7 +206,7 @@ Google Mock tried the following 1 expectation, but it didn't match:
FILE:#: EXPECT_CALL(foo_, Bar2(Ge(2), Ge(1)))... FILE:#: EXPECT_CALL(foo_, Bar2(Ge(2), Ge(1)))...
Expected arg #0: is >= 2 Expected arg #0: is >= 2
Actual: 1 Actual: 1
Expected args: are a pair (x, y) where x >= y Expected args: are a pair where the first >= the second
Actual: don't match Actual: don't match
Expected: to be called once Expected: to be called once
Actual: never called - unsatisfied and active Actual: never called - unsatisfied and active
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment