tests/test_map.cpp

changeset 668
d7129285ac32
parent 659
4a06fd63909a
child 669
dce9b8450656
equal deleted inserted replaced
667:2f88a7c13a28 668:d7129285ac32
128 cxMapStorePointers(map); 128 cxMapStorePointers(map);
129 EXPECT_TRUE(map->store_pointers); 129 EXPECT_TRUE(map->store_pointers);
130 EXPECT_EQ(map->itemsize, sizeof(void *)); 130 EXPECT_EQ(map->itemsize, sizeof(void *));
131 cxMapStoreObjects(map); 131 cxMapStoreObjects(map);
132 EXPECT_FALSE(map->store_pointers); 132 EXPECT_FALSE(map->store_pointers);
133
134 cxMapDestroy(map);
135 EXPECT_TRUE(allocator.verify());
136 }
137
138 TEST(CxHashMap, CreateForStoringPointers) {
139 CxTestingAllocator allocator;
140 auto map = cxHashMapCreate(&allocator, CX_STORE_POINTERS, 0);
141 auto hmap = reinterpret_cast<struct cx_hash_map_s *>(map);
142 EXPECT_GT(hmap->bucket_count, 0);
143 cx_for_n(i, hmap->bucket_count) {
144 EXPECT_EQ(hmap->buckets[i], nullptr);
145 }
146 EXPECT_EQ(map->size, 0);
147 EXPECT_EQ(map->allocator, &allocator);
148 EXPECT_TRUE(map->store_pointers);
149 EXPECT_EQ(map->itemsize, sizeof(void *));
133 150
134 cxMapDestroy(map); 151 cxMapDestroy(map);
135 EXPECT_TRUE(allocator.verify()); 152 EXPECT_TRUE(allocator.verify());
136 } 153 }
137 154

mercurial