Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2210)

Unified Diff: base/stl_util_unittest.cc

Issue 2821313002: Use std::begin() and std::end() in base::ContainsValue() (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/stl_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/stl_util_unittest.cc
diff --git a/base/stl_util_unittest.cc b/base/stl_util_unittest.cc
index 48d0f660b58ac6e2dec3b0cd61be169acfdcdbed..4d35e9cdc9597cb5f203fa50412cc18839fea8ae 100644
--- a/base/stl_util_unittest.cc
+++ b/base/stl_util_unittest.cc
@@ -419,5 +419,15 @@ TEST(Erase, UnorderedMultiset) {
RunEraseIfTest<std::unordered_multiset<std::pair<int, int>, HashByFirst>>();
}
+TEST(ContainsValue, OrdinaryArrays) {
+ const char allowed_chars[] = {'a', 'b', 'c', 'd'};
+ EXPECT_TRUE(ContainsValue(allowed_chars, 'a'));
+ EXPECT_FALSE(ContainsValue(allowed_chars, 'z'));
+ EXPECT_FALSE(ContainsValue(allowed_chars, 0));
+
+ const char allowed_chars_including_nul[] = "abcd";
+ EXPECT_TRUE(ContainsValue(allowed_chars_including_nul, 0));
+}
+
} // namespace
} // namespace base
« no previous file with comments | « base/stl_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698