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

Unified Diff: base/containers/flat_set_unittest.cc

Issue 2944523002: Improving flat containers interface. (Closed)
Patch Set: Review, round 4. Created 3 years, 6 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
Index: base/containers/flat_set_unittest.cc
diff --git a/base/containers/flat_set_unittest.cc b/base/containers/flat_set_unittest.cc
index dc024fcf0a9729a15d4987e3980da46306a6b143..a780d434271c54c4d5e813bf598dd3538381a008 100644
--- a/base/containers/flat_set_unittest.cc
+++ b/base/containers/flat_set_unittest.cc
@@ -90,4 +90,31 @@ TEST(FlatSet, CopySwap) {
EXPECT_THAT(copy, ElementsAre(1, 2));
}
+TEST(FlatSet, UniquePtrs) {
danakj 2017/06/26 19:33:12 same nit
dyaroshev 2017/06/26 22:40:42 Done
+ using ExplicitInt = base::MoveOnlyInt;
+ base::flat_set<ExplicitInt> s;
+ const auto& s1 = s;
+ int x = 0;
+
+ // Check if we can use lookup functions without converting to key_type.
+ // Correctness is checked in flat_tree tests.
+ s.count(x);
+ s1.count(x);
+ s.find(x);
+ s1.find(x);
+ s.equal_range(x);
+ s1.equal_range(x);
+ s.lower_bound(x);
+ s1.lower_bound(x);
+ s.upper_bound(x);
+ s1.upper_bound(x);
+ s.erase(x);
+
+ // Check if we broke overload resolution.
+ s.emplace(0);
+ s.emplace(1);
+ s.erase(s.begin());
+ s.erase(s.cbegin());
+}
+
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698