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

Side by Side Diff: base/containers/flat_set_unittest.cc

Issue 2944523002: Improving flat containers interface. (Closed)
Patch Set: Review, round 1. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/containers/flat_set.h" 5 #include "base/containers/flat_set.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/containers/container_test_utils.h" 10 #include "base/containers/container_test_utils.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 copy.erase(copy.begin()); 84 copy.erase(copy.begin());
85 copy.insert(10); 85 copy.insert(10);
86 EXPECT_THAT(copy, ElementsAre(2, 10)); 86 EXPECT_THAT(copy, ElementsAre(2, 10));
87 87
88 original.swap(copy); 88 original.swap(copy);
89 EXPECT_THAT(original, ElementsAre(2, 10)); 89 EXPECT_THAT(original, ElementsAre(2, 10));
90 EXPECT_THAT(copy, ElementsAre(1, 2)); 90 EXPECT_THAT(copy, ElementsAre(1, 2));
91 } 91 }
92 92
93 TEST(FlatSet, UniquePtrs) {
94 using ExplicitInt = base::MoveOnlyInt;
95 base::flat_set<ExplicitInt> s;
96 const auto& s1 = s;
97 int x = 0;
98 s.count(x);
99 s1.count(x);
100 s.find(x);
101 s1.find(x);
102 s.equal_range(x);
103 s1.equal_range(x);
104 s.lower_bound(x);
105 s1.lower_bound(x);
106 s.upper_bound(x);
107 s1.upper_bound(x);
108 s.erase(x);
109
110 // Check if we broke overload resolution.
111 s.emplace(0);
112 s.emplace(1);
113 s.erase(s.begin());
114 s.erase(s.cbegin());
115 }
116
93 } // namespace base 117 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698