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

Unified Diff: base/stl_util_unittest.cc

Issue 2746053002: Fix Template Parameter List for Associative Containers in base::EraseIf (Closed)
Patch Set: Created 3 years, 9 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 34c5af81cf749065bb612cf504b39e542108dbd7..48d0f660b58ac6e2dec3b0cd61be169acfdcdbed 100644
--- a/base/stl_util_unittest.cc
+++ b/base/stl_util_unittest.cc
@@ -79,6 +79,10 @@ void RunEraseIfTest() {
}
}
+struct CustomIntHash {
+ size_t operator()(int elem) const { return std::hash<int>()(elem) + 1; }
+};
+
struct HashByFirst {
size_t operator()(const std::pair<int, int>& elem) const {
return std::hash<int>()(elem.first);
@@ -377,26 +381,34 @@ TEST(Erase, List) {
TEST(Erase, Map) {
RunEraseIfTest<std::map<int, int>>();
+ RunEraseIfTest<std::map<int, int, std::greater<int>>>();
}
TEST(Erase, Multimap) {
RunEraseIfTest<std::multimap<int, int>>();
+ RunEraseIfTest<std::multimap<int, int, std::greater<int>>>();
}
TEST(Erase, Set) {
RunEraseIfTest<std::set<std::pair<int, int>>>();
+ RunEraseIfTest<
+ std::set<std::pair<int, int>, std::greater<std::pair<int, int>>>>();
}
TEST(Erase, Multiset) {
RunEraseIfTest<std::multiset<std::pair<int, int>>>();
+ RunEraseIfTest<
+ std::multiset<std::pair<int, int>, std::greater<std::pair<int, int>>>>();
}
TEST(Erase, UnorderedMap) {
RunEraseIfTest<std::unordered_map<int, int>>();
+ RunEraseIfTest<std::unordered_map<int, int, CustomIntHash>>();
}
TEST(Erase, UnorderedMultimap) {
RunEraseIfTest<std::unordered_multimap<int, int>>();
+ RunEraseIfTest<std::unordered_multimap<int, int, CustomIntHash>>();
}
TEST(Erase, UnorderedSet) {
« 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