diff options
author | kosak <kosak@google.com> | 2013-12-03 23:19:36 +0000 |
---|---|---|
committer | kosak <kosak@google.com> | 2013-12-03 23:19:36 +0000 |
commit | 6414d806cd7d0954cce81348552fdd1e5bd31515 (patch) | |
tree | df48161532e828bdcfe29dd74bf273fe000c86c5 /test/gmock-matchers_test.cc | |
parent | b72d18ca553c7af15254a89f1e596b9b8d77e10f (diff) | |
download | googletest-6414d806cd7d0954cce81348552fdd1e5bd31515.tar.gz googletest-6414d806cd7d0954cce81348552fdd1e5bd31515.tar.bz2 googletest-6414d806cd7d0954cce81348552fdd1e5bd31515.zip |
Fix warnings encountered with clang -Wall, and pull in gtest 670.
Diffstat (limited to 'test/gmock-matchers_test.cc')
-rw-r--r-- | test/gmock-matchers_test.cc | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/test/gmock-matchers_test.cc b/test/gmock-matchers_test.cc index 5de45c78..bd7a38a5 100644 --- a/test/gmock-matchers_test.cc +++ b/test/gmock-matchers_test.cc @@ -151,9 +151,6 @@ using testing::internal::linked_ptr; using testing::internal::scoped_ptr; using testing::internal::string; -// Evaluates to the number of elements in 'array'. -#define GMOCK_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0])) - // For testing ExplainMatchResultTo(). class GreaterThanMatcher : public MatcherInterface<int> { public: @@ -3444,6 +3441,8 @@ double AClass::x_ = 0.0; // A derived class for testing Property(). class DerivedClass : public AClass { + public: + int k() const { return k_; } private: int k_; }; @@ -4424,14 +4423,14 @@ TEST(WhenSortedTest, WorksForStreamlike) { // Streamlike 'container' provides only minimal iterator support. // Its iterators are tagged with input_iterator_tag. const int a[5] = { 2, 1, 4, 5, 3 }; - Streamlike<int> s(a, a + GMOCK_ARRAY_SIZE_(a)); + Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); EXPECT_THAT(s, WhenSorted(ElementsAre(1, 2, 3, 4, 5))); EXPECT_THAT(s, Not(WhenSorted(ElementsAre(2, 1, 4, 5, 3)))); } TEST(WhenSortedTest, WorksForVectorConstRefMatcherOnStreamlike) { const int a[] = { 2, 1, 4, 5, 3 }; - Streamlike<int> s(a, a + GMOCK_ARRAY_SIZE_(a)); + Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); Matcher<const std::vector<int>&> vector_match = ElementsAre(1, 2, 3, 4, 5); EXPECT_THAT(s, WhenSorted(vector_match)); EXPECT_THAT(s, Not(WhenSorted(ElementsAre(2, 1, 4, 5, 3)))); @@ -4442,14 +4441,14 @@ TEST(WhenSortedTest, WorksForVectorConstRefMatcherOnStreamlike) { TEST(ElemensAreStreamTest, WorksForStreamlike) { const int a[5] = { 1, 2, 3, 4, 5 }; - Streamlike<int> s(a, a + GMOCK_ARRAY_SIZE_(a)); + Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); EXPECT_THAT(s, ElementsAre(1, 2, 3, 4, 5)); EXPECT_THAT(s, Not(ElementsAre(2, 1, 4, 5, 3))); } TEST(ElemensAreArrayStreamTest, WorksForStreamlike) { const int a[5] = { 1, 2, 3, 4, 5 }; - Streamlike<int> s(a, a + GMOCK_ARRAY_SIZE_(a)); + Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); vector<int> expected; expected.push_back(1); @@ -4467,7 +4466,7 @@ TEST(ElemensAreArrayStreamTest, WorksForStreamlike) { TEST(UnorderedElementsAreArrayTest, SucceedsWhenExpected) { const int a[] = { 0, 1, 2, 3, 4 }; - std::vector<int> s(a, a + GMOCK_ARRAY_SIZE_(a)); + std::vector<int> s(a, a + GTEST_ARRAY_SIZE_(a)); do { StringMatchResultListener listener; EXPECT_TRUE(ExplainMatchResult(UnorderedElementsAreArray(a), @@ -4478,8 +4477,8 @@ TEST(UnorderedElementsAreArrayTest, SucceedsWhenExpected) { TEST(UnorderedElementsAreArrayTest, VectorBool) { const bool a[] = { 0, 1, 0, 1, 1 }; const bool b[] = { 1, 0, 1, 1, 0 }; - std::vector<bool> expected(a, a + GMOCK_ARRAY_SIZE_(a)); - std::vector<bool> actual(b, b + GMOCK_ARRAY_SIZE_(b)); + std::vector<bool> expected(a, a + GTEST_ARRAY_SIZE_(a)); + std::vector<bool> actual(b, b + GTEST_ARRAY_SIZE_(b)); StringMatchResultListener listener; EXPECT_TRUE(ExplainMatchResult(UnorderedElementsAreArray(expected), actual, &listener)) << listener.str(); @@ -4490,7 +4489,7 @@ TEST(UnorderedElementsAreArrayTest, WorksForStreamlike) { // Its iterators are tagged with input_iterator_tag, and it has no // size() or empty() methods. const int a[5] = { 2, 1, 4, 5, 3 }; - Streamlike<int> s(a, a + GMOCK_ARRAY_SIZE_(a)); + Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); ::std::vector<int> expected; expected.push_back(1); @@ -4547,7 +4546,7 @@ class UnorderedElementsAreTest : public testing::Test { TEST_F(UnorderedElementsAreTest, SucceedsWhenExpected) { const int a[] = { 1, 2, 3 }; - std::vector<int> s(a, a + GMOCK_ARRAY_SIZE_(a)); + std::vector<int> s(a, a + GTEST_ARRAY_SIZE_(a)); do { StringMatchResultListener listener; EXPECT_TRUE(ExplainMatchResult(UnorderedElementsAre(1, 2, 3), @@ -4557,7 +4556,7 @@ TEST_F(UnorderedElementsAreTest, SucceedsWhenExpected) { TEST_F(UnorderedElementsAreTest, FailsWhenAnElementMatchesNoMatcher) { const int a[] = { 1, 2, 3 }; - std::vector<int> s(a, a + GMOCK_ARRAY_SIZE_(a)); + std::vector<int> s(a, a + GTEST_ARRAY_SIZE_(a)); std::vector<Matcher<int> > mv; mv.push_back(1); mv.push_back(2); @@ -4573,7 +4572,7 @@ TEST_F(UnorderedElementsAreTest, WorksForStreamlike) { // Its iterators are tagged with input_iterator_tag, and it has no // size() or empty() methods. const int a[5] = { 2, 1, 4, 5, 3 }; - Streamlike<int> s(a, a + GMOCK_ARRAY_SIZE_(a)); + Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); EXPECT_THAT(s, UnorderedElementsAre(1, 2, 3, 4, 5)); EXPECT_THAT(s, Not(UnorderedElementsAre(2, 2, 3, 4, 5))); @@ -4884,7 +4883,7 @@ TEST_F(BipartiteNonSquareTest, SimpleBacktracking) { // 0 1 2 MatchMatrix g(4, 3); static const int kEdges[][2] = { {0, 2}, {1, 1}, {2, 1}, {3, 0} }; - for (size_t i = 0; i < GMOCK_ARRAY_SIZE_(kEdges); ++i) { + for (size_t i = 0; i < GTEST_ARRAY_SIZE_(kEdges); ++i) { g.SetEdge(kEdges[i][0], kEdges[i][1], true); } EXPECT_THAT(FindBacktrackingMaxBPM(g), |