• Home
  • Raw
  • Download

Lines Matching refs:allocator

51   auto& allocator = MetricIdAllocator::GetInstance();  in TEST()  local
56 EXPECT_TRUE(allocator.Init(paired_device_map, callback, callback)); in TEST()
57 EXPECT_FALSE(allocator.Init(paired_device_map, callback, callback)); in TEST()
58 EXPECT_TRUE(allocator.Close()); in TEST()
62 auto& allocator = MetricIdAllocator::GetInstance(); in TEST() local
67 EXPECT_TRUE(allocator.Init(paired_device_map, callback, callback)); in TEST()
70 EXPECT_FALSE(allocator.Init(paired_device_map, callback, callback)); in TEST()
71 EXPECT_TRUE(allocator.Close()); in TEST()
75 auto& allocator = MetricIdAllocator::GetInstance(); in TEST() local
81 EXPECT_TRUE(allocator.Init(paired_device_map, callback, callback)); in TEST()
82 EXPECT_EQ(allocator.AllocateId(kthAddress(0)), MetricIdAllocator::kMinId); in TEST()
83 EXPECT_EQ(allocator.AllocateId(kthAddress(1)), MetricIdAllocator::kMinId + 1); in TEST()
84 EXPECT_EQ(allocator.AllocateId(kthAddress(0)), MetricIdAllocator::kMinId); in TEST()
85 EXPECT_EQ(allocator.AllocateId(kthAddress(2)), MetricIdAllocator::kMinId + 2); in TEST()
86 EXPECT_TRUE(allocator.Close()); in TEST()
91 auto& allocator = MetricIdAllocator::GetInstance(); in TEST() local
101 EXPECT_TRUE(allocator.Init(paired_device_map, callback, callback)); in TEST()
103 EXPECT_EQ(allocator.AllocateId(kthAddress(INT_MAX)), id); in TEST()
104 EXPECT_EQ(allocator.AllocateId(kthAddress(INT_MAX - 1)), id + 1); in TEST()
105 EXPECT_EQ(allocator.AllocateId(kthAddress(INT_MAX)), id); in TEST()
106 EXPECT_EQ(allocator.AllocateId(kthAddress(INT_MAX - 2)), id + 2); in TEST()
107 EXPECT_TRUE(allocator.Close()); in TEST()
111 auto& allocator = MetricIdAllocator::GetInstance(); in TEST() local
120 EXPECT_TRUE(allocator.Init(paired_device_map, callback, callback)); in TEST()
123 EXPECT_EQ(allocator.AllocateId(RawAddress({0, 0, 0, 0, 0, 0})), id); in TEST()
124 EXPECT_EQ(allocator.AllocateId(RawAddress({0, 0, 0, 0, 0, 1})), id + 1); in TEST()
125 EXPECT_EQ(allocator.AllocateId(RawAddress({0, 0, 0, 0, 0, 0})), id); in TEST()
126 EXPECT_EQ(allocator.AllocateId(RawAddress({0, 0, 0, 0, 0, 2})), id + 2); in TEST()
127 EXPECT_TRUE(allocator.Close()); in TEST()
131 auto& allocator = MetricIdAllocator::GetInstance(); in TEST() local
147 allocator.Init(paired_device_map, save_callback, forget_callback)); in TEST()
148 EXPECT_EQ(allocator.AllocateId(RawAddress({0, 0, 0, 0, 0, 0})), in TEST()
151 EXPECT_TRUE(allocator.SaveDevice(RawAddress({0, 0, 0, 0, 0, 0}))); in TEST()
155 EXPECT_FALSE(allocator.SaveDevice(RawAddress({0, 0, 0, 0, 0, 1}))); in TEST()
159 EXPECT_EQ(allocator.AllocateId(RawAddress({0, 0, 0, 0, 0, 2})), in TEST()
161 EXPECT_EQ(allocator.AllocateId(RawAddress({0, 0, 0, 0, 0, 3})), in TEST()
163 EXPECT_TRUE(allocator.SaveDevice(RawAddress({0, 0, 0, 0, 0, 2}))); in TEST()
165 EXPECT_TRUE(allocator.SaveDevice(RawAddress({0, 0, 0, 0, 0, 3}))); in TEST()
169 EXPECT_TRUE(allocator.SaveDevice(RawAddress({0, 0, 0, 0, 0, 0}))); in TEST()
173 allocator.ForgetDevice(RawAddress({0, 0, 0, 0, 0, 1})); in TEST()
175 allocator.ForgetDevice(RawAddress({0, 0, 0, 0, 0, 2})); in TEST()
178 EXPECT_TRUE(allocator.Close()); in TEST()
182 auto& allocator = MetricIdAllocator::GetInstance(); in TEST() local
200 allocator.Init(paired_device_map, save_callback, forget_callback)); in TEST()
208 EXPECT_EQ(allocator.AllocateId(kthAddress(key)), in TEST()
219 EXPECT_EQ(allocator.AllocateId(kthAddress(key)), id++); in TEST()
224 EXPECT_TRUE(allocator.SaveDevice(kthAddress(key))); in TEST()
230 EXPECT_EQ(allocator.AllocateId(kthAddress(0)), id++); in TEST()
236 EXPECT_FALSE(allocator.SaveDevice(kthAddress(key + 1))); in TEST()
241 EXPECT_EQ(allocator.AllocateId(kthAddress(key + 1)), id++); in TEST()
242 EXPECT_TRUE(allocator.SaveDevice(kthAddress(key + 1))); in TEST()
247 EXPECT_EQ(allocator.AllocateId(kthAddress(1)), id++); in TEST()
252 EXPECT_EQ(allocator.AllocateId(kthAddress(key + 2)), id++); in TEST()
253 EXPECT_EQ(allocator.AllocateId(kthAddress(key + 3)), id++); in TEST()
258 EXPECT_TRUE(allocator.SaveDevice(kthAddress(key + 2))); in TEST()
260 EXPECT_TRUE(allocator.SaveDevice(kthAddress(key + 3))); in TEST()
266 EXPECT_TRUE(allocator.SaveDevice(kthAddress(key + 2))); in TEST()
271 allocator.ForgetDevice(kthAddress(key + 200)); in TEST()
273 allocator.ForgetDevice(kthAddress(key + 2)); in TEST()
279 EXPECT_EQ(allocator.AllocateId(kthAddress(key + 2)), id++); in TEST()
280 EXPECT_EQ(allocator.AllocateId(kthAddress(key + 4)), id++); in TEST()
281 EXPECT_EQ(allocator.AllocateId(kthAddress(key + 5)), id++); in TEST()
285 EXPECT_TRUE(allocator.SaveDevice(kthAddress(key + 2))); in TEST()
289 EXPECT_TRUE(allocator.SaveDevice(kthAddress(key + 3))); in TEST()
291 EXPECT_TRUE(allocator.SaveDevice(kthAddress(key + 4))); in TEST()
299 allocator.ForgetDevice(kthAddress(key)); in TEST()
305 allocator.ForgetDevice(kthAddress(k)); in TEST()
311 EXPECT_TRUE(allocator.SaveDevice(kthAddress(0))); in TEST()
312 EXPECT_TRUE(allocator.SaveDevice(kthAddress(1))); in TEST()
313 EXPECT_TRUE(allocator.SaveDevice( in TEST()
317 EXPECT_TRUE(allocator.Close()); in TEST()
321 auto& allocator = MetricIdAllocator::GetInstance(); in TEST() local
337 allocator.Init(paired_device_map, save_callback, forget_callback)); in TEST()
345 EXPECT_EQ(allocator.AllocateId(kthAddress(key)), in TEST()
355 EXPECT_EQ(allocator.AllocateId(addr), id); in TEST()
359 EXPECT_TRUE(allocator.SaveDevice(addr)); in TEST()
360 EXPECT_EQ(allocator.AllocateId(addr), id); in TEST()
367 EXPECT_EQ(allocator.AllocateId(addr), id++); in TEST()
378 EXPECT_EQ(allocator.AllocateId(kthAddress(key)), id++); in TEST()
380 EXPECT_TRUE(allocator.Close()); in TEST()
385 auto& allocator = MetricIdAllocator::GetInstance(); in TEST() local
399 allocator.Init(paired_device_map, save_callback, forget_callback)); in TEST()
408 auto& allocator = MetricIdAllocator::GetInstance(); in TEST() local
410 allocator.AllocateId(fake_mac_address); in TEST()
411 EXPECT_TRUE(allocator.SaveDevice(fake_mac_address)); in TEST()
412 allocator.ForgetDevice(fake_mac_address); in TEST()
418 EXPECT_TRUE(allocator.IsEmpty()); in TEST()
419 EXPECT_TRUE(allocator.Close()); in TEST()
424 auto& allocator = MetricIdAllocator::GetInstance(); in TEST() local
440 EXPECT_TRUE(allocator.Init(paired_device_map, callback, callback)); in TEST()
443 EXPECT_EQ(allocator.AllocateId(kthAddress(max_id - 2)), max_id - 2); in TEST()
444 EXPECT_EQ(allocator.AllocateId(kthAddress(max_id - 1)), max_id - 1); in TEST()
445 EXPECT_EQ(allocator.AllocateId(kthAddress(max_id)), max_id); in TEST()
446 EXPECT_EQ(allocator.AllocateId(kthAddress(min_id + 2)), min_id + 2); in TEST()
447 EXPECT_EQ(allocator.AllocateId(kthAddress(min_id + 5)), min_id + 5); in TEST()
449 EXPECT_TRUE(allocator.Close()); in TEST()
454 auto& allocator = MetricIdAllocator::GetInstance(); in TEST() local
464 EXPECT_TRUE(allocator.Init(paired_device_map, callback, callback)); in TEST()
467 EXPECT_EQ(allocator.AllocateId(kthAddress(min_id)), min_id); in TEST()
468 EXPECT_EQ(allocator.AllocateId(kthAddress(min_id + 1)), min_id + 1); in TEST()
470 EXPECT_TRUE(allocator.Close()); in TEST()