diff options
author | Gennadiy Civil <misterg@google.com> | 2019-04-18 13:44:23 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2019-04-18 13:44:24 (GMT) |
commit | a0d60bed4d0ea17c7130cda16776b9bc8a929d7b (patch) | |
tree | b04bb7a474c3b1b61e23896402b4510307657812 /googlemock | |
parent | 9f893b99598b1f0725dc8b92037f0d9f53095b90 (diff) | |
parent | 3829b84e9927a2a77a7634a8e7b010cc57095e1b (diff) | |
download | googletest-a0d60bed4d0ea17c7130cda16776b9bc8a929d7b.zip googletest-a0d60bed4d0ea17c7130cda16776b9bc8a929d7b.tar.gz googletest-a0d60bed4d0ea17c7130cda16776b9bc8a929d7b.tar.bz2 |
Merge pull request #2170 from ngie-eign:issue-2146-ver2
PiperOrigin-RevId: 244069956
Diffstat (limited to 'googlemock')
-rw-r--r-- | googlemock/docs/ForDummies.md | 2 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 23 |
2 files changed, 14 insertions, 11 deletions
diff --git a/googlemock/docs/ForDummies.md b/googlemock/docs/ForDummies.md index f4eba80..e2a430f 100644 --- a/googlemock/docs/ForDummies.md +++ b/googlemock/docs/ForDummies.md @@ -17,7 +17,7 @@ If all this seems too abstract for you, don't worry - the most important thing t Using Google Mock involves three basic steps: 1. Use some simple macros to describe the interface you want to mock, and they will expand to the implementation of your mock class; - 1. Create some mock objects and specify their expectations and behavior using an intuitive syntax; + 1. Create some mock objects and specify its expectations and behavior using an intuitive syntax; 1. Exercise code that uses the mock objects. Google Mock will catch any violation of the expectations as soon as it arises. # Why Google Mock? # diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 8bdad63..eb0a050 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -4310,8 +4310,11 @@ TEST(ResultOfTest, WorksForPolymorphicFunctorsIgnoringResultType) { } TEST(ResultOfTest, WorksForLambdas) { - Matcher<int> matcher = - ResultOf([](int str_len) { return std::string(str_len, 'x'); }, "xxx"); + Matcher<int> matcher = ResultOf( + [](int str_len) { + return std::string(static_cast<size_t>(str_len), 'x'); + }, + "xxx"); EXPECT_TRUE(matcher.Matches(3)); EXPECT_FALSE(matcher.Matches(1)); } @@ -5812,11 +5815,11 @@ class BacktrackingBPMTest : public ::testing::Test { }; // Tests the MaxBipartiteMatching algorithm with square matrices. // The single int param is the # of nodes on each of the left and right sides. -class BipartiteTest : public ::testing::TestWithParam<int> { }; +class BipartiteTest : public ::testing::TestWithParam<size_t> {}; // Verify all match graphs up to some moderate number of edges. TEST_P(BipartiteTest, Exhaustive) { - int nodes = GetParam(); + size_t nodes = GetParam(); MatchMatrix graph(nodes, nodes); do { ElementMatcherPairs matches = @@ -5841,7 +5844,7 @@ TEST_P(BipartiteTest, Exhaustive) { } INSTANTIATE_TEST_SUITE_P(AllGraphs, BipartiteTest, - ::testing::Range(0, 5)); + ::testing::Range(size_t{0}, size_t{5})); // Parameterized by a pair interpreted as (LhsSize, RhsSize). class BipartiteNonSquareTest @@ -5857,7 +5860,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}}; + static const size_t kEdges[][2] = {{0, 2}, {1, 1}, {2, 1}, {3, 0}}; for (size_t i = 0; i < GTEST_ARRAY_SIZE_(kEdges); ++i) { g.SetEdge(kEdges[i][0], kEdges[i][1], true); } @@ -5902,15 +5905,15 @@ class BipartiteRandomTest TEST_P(BipartiteRandomTest, LargerNets) { int nodes = GetParam().first; int iters = GetParam().second; - MatchMatrix graph(nodes, nodes); + MatchMatrix graph(static_cast<size_t>(nodes), static_cast<size_t>(nodes)); - testing::internal::Int32 seed = GTEST_FLAG(random_seed); + auto seed = static_cast<testing::internal::UInt32>(GTEST_FLAG(random_seed)); if (seed == 0) { - seed = static_cast<testing::internal::Int32>(time(nullptr)); + seed = static_cast<testing::internal::UInt32>(time(nullptr)); } for (; iters > 0; --iters, ++seed) { - srand(static_cast<int>(seed)); + srand(static_cast<unsigned int>(seed)); graph.Randomize(); EXPECT_EQ(FindBacktrackingMaxBPM(graph).size(), internal::FindMaxBipartiteMatching(graph).size()) |