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/containers/hash_tables.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/googletest/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; |
25 | 25 |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 EXPECT_EQ(4u, m.size()); | 473 EXPECT_EQ(4u, m.size()); |
474 EXPECT_EQ(0u, m.count(-1)); | 474 EXPECT_EQ(0u, m.count(-1)); |
475 | 475 |
476 m[5] = 5; | 476 m[5] = 5; |
477 EXPECT_EQ(6u, m.size()); | 477 EXPECT_EQ(6u, m.size()); |
478 // Our functor adds an extra item when we convert to a map. | 478 // Our functor adds an extra item when we convert to a map. |
479 EXPECT_EQ(1u, m.count(-1)); | 479 EXPECT_EQ(1u, m.count(-1)); |
480 } | 480 } |
481 | 481 |
482 } // namespace base | 482 } // namespace base |
OLD | NEW |