OLD | NEW |
---|---|
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 Loading... | |
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); | |
vmpstr
2017/06/23 21:45:14
Can you leave a comment that this is checking if t
| |
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 |
OLD | NEW |