Lines Matching refs:map
19 // Empty map tests
22 UUMap map(allocator);
23 EXPECT_TRUE(map.empty());
25 // Lookup on empty map.
26 EXPECT_EQ(0u, map.lookup(0));
27 EXPECT_EQ(7u, map.lookup(0, 7));
28 EXPECT_EQ(0u, map.lookup(~0u-1));
29 EXPECT_EQ(7u, map.lookup(~0u-1, 7));
32 EXPECT_TRUE(map.begin() == map.begin());
33 EXPECT_TRUE(map.begin() == map.end());
34 EXPECT_TRUE(map.end() == map.end());
35 EXPECT_FALSE(map.begin() != map.begin());
36 EXPECT_FALSE(map.begin() != map.end());
37 EXPECT_FALSE(map.end() != map.end());
38 EXPECT_FALSE(map.begin().valid());
39 EXPECT_FALSE(map.end().valid());
40 UUMap::iterator I = map.begin();
42 EXPECT_TRUE(I == map.end());
46 CI = map.begin();
49 I2 = map.end();
53 // Single entry map tests
56 UUMap map(allocator);
57 map.insert(100, 150, 1);
58 EXPECT_FALSE(map.empty());
61 EXPECT_EQ(0u, map.lookup(0));
62 EXPECT_EQ(0u, map.lookup(99));
63 EXPECT_EQ(1u, map.lookup(100));
64 EXPECT_EQ(1u, map.lookup(101));
65 EXPECT_EQ(1u, map.lookup(125));
66 EXPECT_EQ(1u, map.lookup(149));
67 EXPECT_EQ(1u, map.lookup(150));
68 EXPECT_EQ(0u, map.lookup(151));
69 EXPECT_EQ(0u, map.lookup(200));
70 EXPECT_EQ(0u, map.lookup(~0u-1));
73 EXPECT_TRUE(map.begin() == map.begin());
74 EXPECT_FALSE(map.begin() == map.end());
75 EXPECT_TRUE(map.end() == map.end());
76 EXPECT_TRUE(map.begin().valid());
77 EXPECT_FALSE(map.end().valid());
80 UUMap::iterator I = map.begin();
89 EXPECT_FALSE(I == map.begin());
90 EXPECT_TRUE(I == map.end());
98 EXPECT_TRUE(I == map.begin());
99 EXPECT_FALSE(I == map.end());
136 EXPECT_TRUE(map.empty());
137 EXPECT_EQ(0, std::distance(map.begin(), map.end()));
143 UUMap map(allocator);
144 map.insert(100, 150, 1);
147 map.insert(90, 99, 1);
148 EXPECT_EQ(1, std::distance(map.begin(), map.end()));
149 EXPECT_EQ(90u, map.start());
150 EXPECT_EQ(150u, map.stop());
153 map.insert(151, 200, 1);
154 EXPECT_EQ(1, std::distance(map.begin(), map.end()));
155 EXPECT_EQ(90u, map.start());
156 EXPECT_EQ(200u, map.stop());
159 map.insert(60, 89, 2);
160 EXPECT_EQ(2, std::distance(map.begin(), map.end()));
161 EXPECT_EQ(60u, map.start());
162 EXPECT_EQ(200u, map.stop());
163 EXPECT_EQ(2u, map.lookup(89));
164 EXPECT_EQ(1u, map.lookup(90));
166 UUMap::iterator I = map.begin();
178 map.insert(201, 210, 2);
179 EXPECT_EQ(3, std::distance(map.begin(), map.end()));
180 EXPECT_EQ(60u, map.start());
181 EXPECT_EQ(210u, map.stop());
182 EXPECT_EQ(2u, map.lookup(201));
183 EXPECT_EQ(1u, map.lookup(200));
186 map.begin().erase();
187 EXPECT_EQ(2, std::distance(map.begin(), map.end()));
188 EXPECT_EQ(90u, map.start());
189 EXPECT_EQ(210u, map.stop());
192 (--map.end()).erase();
193 EXPECT_EQ(1, std::distance(map.begin(), map.end()));
194 EXPECT_EQ(90u, map.start());
195 EXPECT_EQ(200u, map.stop());
198 map.insert(80, 89, 2);
199 map.insert(201, 210, 2);
200 EXPECT_EQ(3, std::distance(map.begin(), map.end()));
201 (++map.begin()).setValue(2);
202 EXPECT_EQ(1, std::distance(map.begin(), map.end()));
203 I = map.begin();
213 UUMap map(allocator);
214 map.insert(140, 150, 1);
215 map.insert(160, 170, 1);
216 map.insert(100, 110, 1);
217 map.insert(120, 130, 1);
218 EXPECT_EQ(4, std::distance(map.begin(), map.end()));
219 EXPECT_EQ(100u, map.start());
220 EXPECT_EQ(170u, map.stop());
223 UUMap::iterator I = map.begin();
239 I = map.begin();
258 map.insert(111, 115, 1);
259 I = map.begin();
280 map.insert(135, 139, 1);
281 I = map.begin();
302 map.insert(131, 134, 1);
303 I = map.begin();
318 // Test clear() on non-branched map.
319 map.clear();
320 EXPECT_TRUE(map.empty());
321 EXPECT_TRUE(map.begin() == map.end());
327 UUMap map(allocator);
332 map.insert(10*i, 10*i+5, i);
333 EXPECT_EQ(10u, map.start());
334 EXPECT_EQ(10*i+5, map.stop());
338 EXPECT_FALSE(map.empty());
339 EXPECT_EQ(10u, map.start());
340 EXPECT_EQ(995u, map.stop());
344 EXPECT_EQ(0u, map.lookup(10*i-1));
345 EXPECT_EQ(i, map.lookup(10*i));
346 EXPECT_EQ(i, map.lookup(10*i+5));
347 EXPECT_EQ(0u, map.lookup(10*i+6));
351 UUMap::iterator I = map.begin();
360 EXPECT_TRUE(I == map.end());
370 EXPECT_TRUE(I == map.begin());
452 I = map.begin();
455 EXPECT_TRUE(I == map.begin());
456 EXPECT_FALSE(map.empty());
457 EXPECT_EQ(I.start(), map.start());
458 EXPECT_EQ(995u, map.stop());
461 // Test clear() on branched map.
462 map.clear();
463 EXPECT_TRUE(map.empty());
464 EXPECT_TRUE(map.begin() == map.end());
470 UUMap map(allocator);
474 map.insert(10*i, 10*i+5, i);
477 EXPECT_FALSE(map.empty());
478 EXPECT_EQ(10u, map.start());
479 EXPECT_EQ(9995u, map.stop());
483 EXPECT_EQ(0u, map.lookup(10*i-1));
484 EXPECT_EQ(i, map.lookup(10*i));
485 EXPECT_EQ(i, map.lookup(10*i+5));
486 EXPECT_EQ(0u, map.lookup(10*i+6));
490 UUMap::iterator I = map.begin();
499 EXPECT_TRUE(I == map.end());
509 EXPECT_TRUE(I == map.begin());
533 // end().advanceTo() is valid as long as x > map.stop()
537 // Test clear() on branched map.
538 map.clear();
539 EXPECT_TRUE(map.empty());
540 EXPECT_TRUE(map.begin() == map.end());
546 UUMap map(allocator);
553 map.insert(10*x, 10*x+9, 1);
554 EXPECT_GE(10*x, map.start());
555 EXPECT_LE(10*x+9, map.stop());
559 // Map should be fully coalesced after that exercise.
560 EXPECT_FALSE(map.empty());
561 EXPECT_EQ(0u, map.start());
562 EXPECT_EQ(40959u, map.stop());
563 EXPECT_EQ(1, std::distance(map.begin(), map.end()));