Lines Matching refs:cache

157     LruCache<SimpleKey, StringValue> cache(100);  in TEST_F()  local
159 EXPECT_EQ(nullptr, cache.get(0)); in TEST_F()
160 EXPECT_EQ(0u, cache.size()); in TEST_F()
164 LruCache<SimpleKey, StringValue> cache(100); in TEST_F() local
166 cache.put(1, "one"); in TEST_F()
167 cache.put(2, "two"); in TEST_F()
168 cache.put(3, "three"); in TEST_F()
169 EXPECT_STREQ("one", cache.get(1)); in TEST_F()
170 EXPECT_STREQ("two", cache.get(2)); in TEST_F()
171 EXPECT_STREQ("three", cache.get(3)); in TEST_F()
172 EXPECT_EQ(3u, cache.size()); in TEST_F()
176 LruCache<SimpleKey, StringValue> cache(2); in TEST_F() local
178 cache.put(1, "one"); in TEST_F()
179 cache.put(2, "two"); in TEST_F()
180 cache.put(3, "three"); in TEST_F()
181 EXPECT_EQ(nullptr, cache.get(1)); in TEST_F()
182 EXPECT_STREQ("two", cache.get(2)); in TEST_F()
183 EXPECT_STREQ("three", cache.get(3)); in TEST_F()
184 EXPECT_EQ(2u, cache.size()); in TEST_F()
188 LruCache<SimpleKey, StringValue> cache(100); in TEST_F() local
190 cache.put(1, "one"); in TEST_F()
191 cache.put(2, "two"); in TEST_F()
192 cache.put(3, "three"); in TEST_F()
193 cache.removeOldest(); in TEST_F()
194 EXPECT_EQ(nullptr, cache.get(1)); in TEST_F()
195 EXPECT_STREQ("two", cache.get(2)); in TEST_F()
196 EXPECT_STREQ("three", cache.get(3)); in TEST_F()
197 EXPECT_EQ(2u, cache.size()); in TEST_F()
201 LruCache<SimpleKey, StringValue> cache(100); in TEST_F() local
203 cache.put(1, "one"); in TEST_F()
204 cache.put(2, "two"); in TEST_F()
205 cache.put(3, "three"); in TEST_F()
206 EXPECT_STREQ("one", cache.get(1)); in TEST_F()
207 cache.removeOldest(); in TEST_F()
208 EXPECT_STREQ("one", cache.get(1)); in TEST_F()
209 EXPECT_EQ(nullptr, cache.get(2)); in TEST_F()
210 EXPECT_STREQ("three", cache.get(3)); in TEST_F()
211 EXPECT_EQ(2u, cache.size()); in TEST_F()
220 LruCache<SimpleKey, StringValue> cache(512); in TEST_F() local
235 const char *val = cache.get(key); in TEST_F()
240 cache.put(key, strings[index]); in TEST_F()
246 EXPECT_EQ(kCacheSize, cache.size()); in TEST_F()
254 ComplexCache cache(100); in TEST_F() local
256 cache.put(ComplexKey(0), ComplexValue(0)); in TEST_F()
257 cache.put(ComplexKey(1), ComplexValue(1)); in TEST_F()
258 EXPECT_EQ(2U, cache.size()); in TEST_F()
263 ComplexCache cache(100); in TEST_F() local
265 cache.put(ComplexKey(0), ComplexValue(0)); in TEST_F()
266 cache.put(ComplexKey(1), ComplexValue(1)); in TEST_F()
267 EXPECT_EQ(2U, cache.size()); in TEST_F()
269 cache.clear(); in TEST_F()
275 ComplexCache cache(100); in TEST_F() local
277 cache.put(ComplexKey(0), ComplexValue(0)); in TEST_F()
278 cache.put(ComplexKey(1), ComplexValue(1)); in TEST_F()
279 EXPECT_EQ(2U, cache.size()); in TEST_F()
281 cache.removeOldest(); in TEST_F()
282 cache.clear(); in TEST_F()
289 ComplexCache cache(100); in TEST_F() local
291 cache.put(ComplexKey(0), ComplexValue(0)); in TEST_F()
292 cache.put(ComplexKey(1), ComplexValue(1)); in TEST_F()
293 EXPECT_EQ(2U, cache.size()); in TEST_F()
295 cache.clear(); in TEST_F()
297 cache.put(ComplexKey(0), ComplexValue(0)); in TEST_F()
298 cache.put(ComplexKey(1), ComplexValue(1)); in TEST_F()
299 EXPECT_EQ(2U, cache.size()); in TEST_F()
305 LruCache<SimpleKey, StringValue> cache(100); in TEST_F() local
306 cache.setOnEntryRemovedListener(&callback); in TEST_F()
308 cache.put(1, "one"); in TEST_F()
309 cache.put(2, "two"); in TEST_F()
310 cache.put(3, "three"); in TEST_F()
311 EXPECT_EQ(3U, cache.size()); in TEST_F()
312 cache.removeOldest(); in TEST_F()
320 LruCache<SimpleKey, StringValue> cache(100); in TEST_F() local
321 cache.setOnEntryRemovedListener(&callback); in TEST_F()
323 cache.put(1, "one"); in TEST_F()
324 cache.put(2, "two"); in TEST_F()
325 cache.put(3, "three"); in TEST_F()
326 EXPECT_EQ(3U, cache.size()); in TEST_F()
327 cache.clear(); in TEST_F()
333 LruCache<KeyWithPointer, StringValue> cache(1); in TEST_F() local
334 cache.setOnEntryRemovedListener(&callback); in TEST_F()
340 cache.put(key1, "one"); in TEST_F()
344 cache.put(key2, "two"); in TEST_F()
345 EXPECT_EQ(1U, cache.size()); in TEST_F()
346 EXPECT_STREQ("two", cache.get(key2)); in TEST_F()
347 cache.clear(); in TEST_F()
351 LruCache<int, int> cache(100); in TEST_F() local
353 cache.put(1, 4); in TEST_F()
354 cache.put(2, 5); in TEST_F()
355 cache.put(3, 6); in TEST_F()
356 EXPECT_EQ(3U, cache.size()); in TEST_F()
358 LruCache<int, int>::Iterator it(cache); in TEST_F()
371 LruCache<int, int> cache(100); in TEST_F() local
373 LruCache<int, int>::Iterator it(cache); in TEST_F()
383 LruCache<int, int> cache(100); in TEST_F() local
384 cache.put(1, 2); in TEST_F()
386 LruCache<int, int>::Iterator it(cache); in TEST_F()
395 LruCache<int, int> cache(100); in TEST_F() local
396 cache.put(1, 2); in TEST_F()
398 cache.remove(1); in TEST_F()
400 LruCache<int, int>::Iterator it(cache); in TEST_F()
409 LruCache<int, int> cache(100); in TEST_F() local
410 cache.put(1, 4); in TEST_F()
411 cache.put(2, 5); in TEST_F()
412 cache.put(3, 6); in TEST_F()
414 cache.remove(2); in TEST_F()
416 LruCache<int, int>::Iterator it(cache); in TEST_F()
425 LruCache<int, int> cache(100); in TEST_F() local
426 cache.put(1, 4); in TEST_F()
427 cache.put(2, 5); in TEST_F()
428 cache.put(3, 6); in TEST_F()
430 cache.remove(3); in TEST_F()
432 LruCache<int, int>::Iterator it(cache); in TEST_F()
441 LruCache<int, int> cache(100); in TEST_F() local
442 cache.put(1, 4); in TEST_F()
443 cache.put(2, 5); in TEST_F()
444 cache.put(3, 6); in TEST_F()
446 cache.remove(7); in TEST_F()
448 LruCache<int, int>::Iterator it(cache); in TEST_F()
457 LruCache<KeyFailsOnCopy, KeyFailsOnCopy> cache(1); in TEST_F() local
459 cache.get(KeyFailsOnCopy(0)); in TEST_F()