From c4af2249705842f66b665c717e2ccbc83b9b1ffb Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 21 Jul 2015 18:43:28 +0000 Subject: Remove one range-based for and do appropriate static casts on nullptr --- test/cpp/client/credentials_test.cc | 2 +- test/cpp/common/secure_auth_context_test.cc | 16 ++++++++-------- test/cpp/end2end/end2end_test.cc | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc index ee94f455a4..bbf7705f0a 100644 --- a/test/cpp/client/credentials_test.cc +++ b/test/cpp/client/credentials_test.cc @@ -47,7 +47,7 @@ class CredentialsTest : public ::testing::Test { TEST_F(CredentialsTest, InvalidServiceAccountCreds) { std::shared_ptr bad1 = ServiceAccountCredentials("", "", 1); - EXPECT_EQ(nullptr, bad1.get()); + EXPECT_EQ(static_cast(nullptr), bad1.get()); } } // namespace testing diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc index f18a04178e..fc8aa8f681 100644 --- a/test/cpp/common/secure_auth_context_test.cc +++ b/test/cpp/common/secure_auth_context_test.cc @@ -92,21 +92,21 @@ TEST_F(SecureAuthContextTest, Iterators) { EXPECT_EQ("bar", p2.second); ++iter; EXPECT_EQ(context.end(), iter); - // Range-based for loop test. + int i = 0; - for (auto p : context) { + for (auto p = context.begin(); p != context.end(); p++) { switch (i++) { case 0: - EXPECT_EQ("name", p.first); - EXPECT_EQ("chapi", p.second); + EXPECT_EQ("name", (*p).first); + EXPECT_EQ("chapi", (*p).second); break; case 1: - EXPECT_EQ("name", p.first); - EXPECT_EQ("chapo", p.second); + EXPECT_EQ("name", (*p).first); + EXPECT_EQ("chapo", (*p).second); break; case 2: - EXPECT_EQ("foo", p.first); - EXPECT_EQ("bar", p.second); + EXPECT_EQ("foo", (*p).first); + EXPECT_EQ("bar", (*p).second); break; default: EXPECT_TRUE(0); diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 8b4424c735..ca0324e161 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -508,7 +508,7 @@ TEST_F(End2endTest, DiffPackageServices) { // rpc and stream should fail on bad credentials. TEST_F(End2endTest, BadCredentials) { std::shared_ptr bad_creds = ServiceAccountCredentials("", "", 1); - EXPECT_EQ(nullptr, bad_creds.get()); + EXPECT_EQ(static_cast(nullptr), bad_creds.get()); std::shared_ptr channel = CreateChannel(server_address_.str(), bad_creds, ChannelArguments()); std::unique_ptr stub( -- cgit v1.2.3 From e66165dead7d4b26afa416143b32daad4bef9e36 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 21 Jul 2015 21:11:38 +0000 Subject: Remove iterator-based test altogether --- test/cpp/common/secure_auth_context_test.cc | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'test') diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc index fc8aa8f681..d0243a5432 100644 --- a/test/cpp/common/secure_auth_context_test.cc +++ b/test/cpp/common/secure_auth_context_test.cc @@ -92,26 +92,6 @@ TEST_F(SecureAuthContextTest, Iterators) { EXPECT_EQ("bar", p2.second); ++iter; EXPECT_EQ(context.end(), iter); - - int i = 0; - for (auto p = context.begin(); p != context.end(); p++) { - switch (i++) { - case 0: - EXPECT_EQ("name", (*p).first); - EXPECT_EQ("chapi", (*p).second); - break; - case 1: - EXPECT_EQ("name", (*p).first); - EXPECT_EQ("chapo", (*p).second); - break; - case 2: - EXPECT_EQ("foo", (*p).first); - EXPECT_EQ("bar", (*p).second); - break; - default: - EXPECT_TRUE(0); - } - } } } // namespace -- cgit v1.2.3