OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/small_map.h" | 5 #include "base/containers/small_map.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <functional> | 10 #include <functional> |
11 #include <map> | 11 #include <map> |
12 | 12 |
| 13 #include "base/containers/hash_tables.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/hash_tables.h" | |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 | 18 |
19 TEST(SmallMap, General) { | 19 TEST(SmallMap, General) { |
20 SmallMap<hash_map<int, int> > m; | 20 SmallMap<hash_map<int, int> > m; |
21 | 21 |
22 EXPECT_TRUE(m.empty()); | 22 EXPECT_TRUE(m.empty()); |
23 | 23 |
24 m[0] = 5; | 24 m[0] = 5; |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 EXPECT_EQ(4u, m.size()); | 483 EXPECT_EQ(4u, m.size()); |
484 EXPECT_EQ(0u, m.count(-1)); | 484 EXPECT_EQ(0u, m.count(-1)); |
485 | 485 |
486 m[5] = 5; | 486 m[5] = 5; |
487 EXPECT_EQ(6u, m.size()); | 487 EXPECT_EQ(6u, m.size()); |
488 // Our functor adds an extra item when we convert to a map. | 488 // Our functor adds an extra item when we convert to a map. |
489 EXPECT_EQ(1u, m.count(-1)); | 489 EXPECT_EQ(1u, m.count(-1)); |
490 } | 490 } |
491 | 491 |
492 } // namespace base | 492 } // namespace base |
OLD | NEW |