summaryrefslogtreecommitdiff
path: root/base/id_map_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/id_map_unittest.cc')
-rw-r--r--base/id_map_unittest.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/base/id_map_unittest.cc b/base/id_map_unittest.cc
index a9fb2b9dec..7a07a28db5 100644
--- a/base/id_map_unittest.cc
+++ b/base/id_map_unittest.cc
@@ -4,6 +4,8 @@
#include "base/id_map.h"
+#include <stdint.h>
+
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -28,12 +30,12 @@ TEST(IDMapTest, Basic) {
TestObject obj1;
TestObject obj2;
- int32 id1 = map.Add(&obj1);
+ int32_t id1 = map.Add(&obj1);
EXPECT_FALSE(map.IsEmpty());
EXPECT_EQ(1U, map.size());
EXPECT_EQ(&obj1, map.Lookup(id1));
- int32 id2 = map.Add(&obj2);
+ int32_t id2 = map.Add(&obj2);
EXPECT_FALSE(map.IsEmpty());
EXPECT_EQ(2U, map.size());
@@ -102,7 +104,7 @@ TEST(IDMapTest, IteratorRemainsValidWhenRemovingOtherElements) {
map.Add(&obj[i]);
// IDMap uses a hash_map, which has no predictable iteration order.
- int32 ids_in_iteration_order[kCount];
+ int32_t ids_in_iteration_order[kCount];
const TestObject* objs_in_iteration_order[kCount];
int counter = 0;
for (IDMap<TestObject>::const_iterator iter(&map);
@@ -212,7 +214,7 @@ TEST(IDMapTest, IteratorRemainsValidWhenClearing) {
map.Add(&obj[i]);
// IDMap uses a hash_map, which has no predictable iteration order.
- int32 ids_in_iteration_order[kCount];
+ int32_t ids_in_iteration_order[kCount];
const TestObject* objs_in_iteration_order[kCount];
int counter = 0;
for (IDMap<TestObject>::const_iterator iter(&map);
@@ -355,4 +357,16 @@ TEST(IDMapTest, OwningPointersDeletesThemOnDestruct) {
EXPECT_EQ(owned_del_count, kCount);
}
+TEST(IDMapTest, Int64KeyType) {
+ IDMap<TestObject, IDMapExternalPointer, int64_t> map;
+ TestObject obj1;
+ const int64_t kId1 = 999999999999999999;
+
+ map.AddWithID(&obj1, kId1);
+ EXPECT_EQ(&obj1, map.Lookup(kId1));
+
+ map.Remove(kId1);
+ EXPECT_TRUE(map.IsEmpty());
+}
+
} // namespace