aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/common/secure_auth_context_test.cc
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2015-07-15 13:20:23 -0700
committerGravatar yang-g <yangg@google.com>2015-07-15 13:20:23 -0700
commit14b3684dee8d3d8612f9338cd0f55a44c5a16a8e (patch)
tree7818dc6bfa260671cab2c0f0e6518b6765117db2 /test/cpp/common/secure_auth_context_test.cc
parent811536efce1ba1203c4cb469e455a41fdd207e86 (diff)
Remove const_iterator typedef and add a range based loop test
Diffstat (limited to 'test/cpp/common/secure_auth_context_test.cc')
-rw-r--r--test/cpp/common/secure_auth_context_test.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc
index 6cc271f3a7..c8863e33c2 100644
--- a/test/cpp/common/secure_auth_context_test.cc
+++ b/test/cpp/common/secure_auth_context_test.cc
@@ -77,7 +77,7 @@ TEST_F(SecureAuthContextTest, Iterators) {
ctx->peer_identity_property_name = ctx->properties[0].name;
SecureAuthContext context(ctx);
- AuthContext::const_iterator iter = context.begin();
+ AuthContext::PropertyIterator iter = context.begin();
EXPECT_TRUE(context.end() != iter);
AuthContext::Property p0 = *iter;
++iter;
@@ -92,6 +92,26 @@ TEST_F(SecureAuthContextTest, Iterators) {
EXPECT_EQ("bar", p2.second);
++iter;
EXPECT_EQ(context.end(), iter);
+ // Range-based for loop test.
+ int i = 0;
+ for (const AuthContext::Property p : context) {
+ 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