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

Unified Diff: base/containers/flat_set_unittest.cc

Issue 2776793002: Make flat containers stable, allow constructing from vector. (Closed)
Patch Set: Merge 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
Index: base/containers/flat_set_unittest.cc
diff --git a/base/containers/flat_set_unittest.cc b/base/containers/flat_set_unittest.cc
index 26bb4da4a6110cab781535455682a566a8040cf9..dc024fcf0a9729a15d4987e3980da46306a6b143 100644
--- a/base/containers/flat_set_unittest.cc
+++ b/base/containers/flat_set_unittest.cc
@@ -37,15 +37,16 @@ TEST(FlatSet, IncompleteType) {
TEST(FlatSet, RangeConstructor) {
flat_set<int>::value_type input_vals[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
- flat_set<int> cont(std::begin(input_vals), std::end(input_vals));
+ flat_set<int> cont(std::begin(input_vals), std::end(input_vals),
+ base::KEEP_FIRST_OF_DUPES);
danakj 2017/04/05 21:33:43 how come only keep first is tested?
brettw 2017/04/07 21:59:04 Since set is just a typedef for tree, most of the
EXPECT_THAT(cont, ElementsAre(1, 2, 3));
}
TEST(FlatSet, MoveConstructor) {
int input_range[] = {1, 2, 3, 4};
- flat_set<MoveOnlyInt> original(std::begin(input_range),
- std::end(input_range));
+ flat_set<MoveOnlyInt> original(std::begin(input_range), std::end(input_range),
+ base::KEEP_FIRST_OF_DUPES);
flat_set<MoveOnlyInt> moved(std::move(original));
EXPECT_EQ(1U, moved.count(MoveOnlyInt(1)));
@@ -55,7 +56,7 @@ TEST(FlatSet, MoveConstructor) {
}
TEST(FlatSet, InitializerListConstructor) {
- flat_set<int> cont{1, 2, 3, 4, 5, 6, 10, 8};
+ flat_set<int> cont({1, 2, 3, 4, 5, 6, 10, 8}, KEEP_FIRST_OF_DUPES);
EXPECT_THAT(cont, ElementsAre(1, 2, 3, 4, 5, 6, 8, 10));
}

Powered by Google App Engine
This is Rietveld 408576698