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

Unified Diff: base/containers/flat_set_unittest.cc

Issue 2944523002: Improving flat containers interface. (Closed)
Patch Set: Removing redundant tests. 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..27d709372b03a16b53e3a6404740943eec09d8b7 100644
--- a/base/containers/flat_set_unittest.cc
+++ b/base/containers/flat_set_unittest.cc
@@ -4,6 +4,7 @@
#include "base/containers/flat_set.h"
+#include <memory>
#include <string>
#include <vector>
@@ -90,4 +91,27 @@ TEST(FlatSet, CopySwap) {
EXPECT_THAT(copy, ElementsAre(1, 2));
}
+TEST(FlatSet, UniquePtrs) {
+ base::flat_set<std::unique_ptr<int>> s;
+ const auto& s1 = s;
+ int x = 0;
+ 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(new int(0));
+ s.emplace(new int(1));
+ s.erase(s.begin());
+ s.erase(s.cbegin());
+}
+
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698