Home | History | Annotate | Download | only in ADT

Lines Matching refs:Map

12 #include <map>
76 // allows all of the map implementations to be tested with shared
81 T Map;
110 // Empty map tests
113 EXPECT_EQ(0u, this->Map.size());
114 EXPECT_TRUE(this->Map.empty());
117 EXPECT_TRUE(this->Map.begin() == this->Map.end());
120 EXPECT_FALSE(this->Map.count(this->getKey()));
121 EXPECT_TRUE(this->Map.find(this->getKey()) == this->Map.end());
124 this->Map.lookup(this->getKey()));
131 this->Map.lookup(this->getKey()));
135 // Constant map tests
137 const TypeParam &ConstMap = this->Map;
143 // A map with a single entry
145 this->Map[this->getKey()] = this->getValue();
148 EXPECT_EQ(1u, this->Map.size());
149 EXPECT_FALSE(this->Map.begin() == this->Map.end());
150 EXPECT_FALSE(this->Map.empty());
153 typename TypeParam::iterator it = this->Map.begin();
157 EXPECT_TRUE(it == this->Map.end());
160 EXPECT_TRUE(this->Map.count(this->getKey()));
161 EXPECT_TRUE(this->Map.find(this->getKey()) == this->Map.begin());
162 EXPECT_EQ(this->getValue(), this->Map.lookup(this->getKey()));
163 EXPECT_EQ(this->getValue(), this->Map[this->getKey()]);
168 this->Map[this->getKey()] = this->getValue();
169 this->Map.clear();
171 EXPECT_EQ(0u, this->Map.size());
172 EXPECT_TRUE(this->Map.empty());
173 EXPECT_TRUE(this->Map.begin() == this->Map.end());
178 this->Map[this->getKey()] = this->getValue();
179 this->Map.erase(this->Map.begin());
181 EXPECT_EQ(0u, this->Map.size());
182 EXPECT_TRUE(this->Map.empty());
183 EXPECT_TRUE(this->Map.begin() == this->Map.end());
188 this->Map[this->getKey()] = this->getValue();
189 this->Map.erase(this->getKey());
191 EXPECT_EQ(0u, this->Map.size());
192 EXPECT_TRUE(this->Map.empty());
193 EXPECT_TRUE(this->Map.begin() == this->Map.end());
198 this->Map.insert(std::make_pair(this->getKey(), this->getValue()));
199 EXPECT_EQ(1u, this->Map.size());
200 EXPECT_EQ(this->getValue(), this->Map[this->getKey()]);
205 this->Map[this->getKey()] = this->getValue();
206 TypeParam copyMap(this->Map);
214 this->Map[this->getKey()] = this->getValue();
215 TypeParam copyMap = this->Map;
223 this->Map[this->getKey()] = this->getValue();
226 this->Map.swap(otherMap);
227 EXPECT_EQ(0u, this->Map.size());
228 EXPECT_TRUE(this->Map.empty());
232 this->Map.swap(otherMap);
235 EXPECT_EQ(1u, this->Map.size());
236 EXPECT_EQ(this->getValue(), this->Map[this->getKey()]);
238 // Make this more interesting by inserting 100 numbers into the map.
240 this->Map[this->getKey(i)] = this->getValue(i);
242 this->Map.swap(otherMap);
243 EXPECT_EQ(0u, this->Map.size());
244 EXPECT_TRUE(this->Map.empty());
249 this->Map.swap(otherMap);
252 EXPECT_EQ(100u, this->Map.size());
254 EXPECT_EQ(this->getValue(i), this->Map[this->getKey(i)]);
260 std::map<typename TypeParam::key_type, unsigned> visitedIndex;
262 // Insert 100 numbers into the map
267 this->Map[this->getKey(i)] = this->getValue(i);
271 for (typename TypeParam::iterator it = this->Map.begin();
272 it != this->Map.end(); ++it)
283 typename TypeParam::iterator it = this->Map.begin();
311 DenseMap<unsigned, unsigned, TestDenseMapInfo> map;
312 map[0] = 1;
313 map[1] = 2;
314 map[2] = 3;
317 EXPECT_EQ(3u, map.size());
320 EXPECT_EQ(1, map.count(1));
321 EXPECT_EQ(1u, map.find(0)->second);
322 EXPECT_EQ(2u, map.find(1)->second);
323 EXPECT_EQ(3u, map.find(2)->second);
324 EXPECT_TRUE(map.find(3) == map.end());
327 EXPECT_EQ(1u, map.find_as("a")->second);
328 EXPECT_EQ(2u, map.find_as("b")->second);
329 EXPECT_EQ(3u, map.find_as("c")->second);
330 EXPECT_TRUE(map.find_as("d") == map.end());