Chromium Code Reviews| Index: base/containers/flat_map_unittest.cc |
| diff --git a/base/containers/flat_map_unittest.cc b/base/containers/flat_map_unittest.cc |
| index 0556527635a69ebe16153cd33134fdefc8e96fe6..5b90471ae58edba777bb677208121c2299cef3fe 100644 |
| --- a/base/containers/flat_map_unittest.cc |
| +++ b/base/containers/flat_map_unittest.cc |
| @@ -170,4 +170,31 @@ TEST(FlatMap, SubscriptMoveOnlyKey) { |
| EXPECT_EQ(44, m[MoveOnlyInt(1)]); |
| } |
| +TEST(FlatMap, UniquePtrKeys) { |
|
danakj
2017/06/26 19:33:12
nit: there's no UniquePtrs in this test, CompareWi
dyaroshev
2017/06/26 22:40:42
Done
|
| + using ExplicitInt = base::MoveOnlyInt; |
| + base::flat_map<ExplicitInt, int> m; |
| + const auto& m1 = m; |
| + int x = 0; |
| + |
| + // Check if we can use lookup functions without converting to key_type. |
| + // Correctness is checked in flat_tree tests. |
| + m.count(x); |
| + m1.count(x); |
| + m.find(x); |
| + m1.find(x); |
| + m.equal_range(x); |
| + m1.equal_range(x); |
| + m.lower_bound(x); |
| + m1.lower_bound(x); |
| + m.upper_bound(x); |
| + m1.upper_bound(x); |
| + m.erase(x); |
| + |
| + // Check if we broke overload resolution. |
| + m.emplace(ExplicitInt(0), 0); |
| + m.emplace(ExplicitInt(1), 0); |
| + m.erase(m.begin()); |
| + m.erase(m.cbegin()); |
| +} |
| + |
| } // namespace base |