Lines Matching refs:cache
154 LruCache<SimpleKey, StringValue> cache(100); in TEST_F() local
156 EXPECT_EQ(nullptr, cache.get(0)); in TEST_F()
157 EXPECT_EQ(0u, cache.size()); in TEST_F()
161 LruCache<SimpleKey, StringValue> cache(100); in TEST_F() local
163 cache.put(1, "one"); in TEST_F()
164 cache.put(2, "two"); in TEST_F()
165 cache.put(3, "three"); in TEST_F()
166 EXPECT_STREQ("one", cache.get(1)); in TEST_F()
167 EXPECT_STREQ("two", cache.get(2)); in TEST_F()
168 EXPECT_STREQ("three", cache.get(3)); in TEST_F()
169 EXPECT_EQ(3u, cache.size()); in TEST_F()
173 LruCache<SimpleKey, StringValue> cache(2); in TEST_F() local
175 cache.put(1, "one"); in TEST_F()
176 cache.put(2, "two"); in TEST_F()
177 cache.put(3, "three"); in TEST_F()
178 EXPECT_EQ(nullptr, cache.get(1)); in TEST_F()
179 EXPECT_STREQ("two", cache.get(2)); in TEST_F()
180 EXPECT_STREQ("three", cache.get(3)); in TEST_F()
181 EXPECT_EQ(2u, cache.size()); in TEST_F()
185 LruCache<SimpleKey, StringValue> cache(100); in TEST_F() local
187 cache.put(1, "one"); in TEST_F()
188 cache.put(2, "two"); in TEST_F()
189 cache.put(3, "three"); in TEST_F()
190 cache.removeOldest(); in TEST_F()
191 EXPECT_EQ(nullptr, cache.get(1)); in TEST_F()
192 EXPECT_STREQ("two", cache.get(2)); in TEST_F()
193 EXPECT_STREQ("three", cache.get(3)); in TEST_F()
194 EXPECT_EQ(2u, cache.size()); in TEST_F()
198 LruCache<SimpleKey, StringValue> cache(100); in TEST_F() local
200 cache.put(1, "one"); in TEST_F()
201 cache.put(2, "two"); in TEST_F()
202 cache.put(3, "three"); in TEST_F()
203 EXPECT_STREQ("one", cache.get(1)); in TEST_F()
204 cache.removeOldest(); in TEST_F()
205 EXPECT_STREQ("one", cache.get(1)); in TEST_F()
206 EXPECT_EQ(nullptr, cache.get(2)); in TEST_F()
207 EXPECT_STREQ("three", cache.get(3)); in TEST_F()
208 EXPECT_EQ(2u, cache.size()); in TEST_F()
217 LruCache<SimpleKey, StringValue> cache(512); in TEST_F() local
232 const char *val = cache.get(key); in TEST_F()
237 cache.put(key, strings[index]); in TEST_F()
243 EXPECT_EQ(kCacheSize, cache.size()); in TEST_F()
251 ComplexCache cache(100); in TEST_F() local
253 cache.put(ComplexKey(0), ComplexValue(0)); in TEST_F()
254 cache.put(ComplexKey(1), ComplexValue(1)); in TEST_F()
255 EXPECT_EQ(2U, cache.size()); in TEST_F()
260 ComplexCache cache(100); in TEST_F() local
262 cache.put(ComplexKey(0), ComplexValue(0)); in TEST_F()
263 cache.put(ComplexKey(1), ComplexValue(1)); in TEST_F()
264 EXPECT_EQ(2U, cache.size()); in TEST_F()
266 cache.clear(); in TEST_F()
272 ComplexCache cache(100); in TEST_F() local
274 cache.put(ComplexKey(0), ComplexValue(0)); in TEST_F()
275 cache.put(ComplexKey(1), ComplexValue(1)); in TEST_F()
276 EXPECT_EQ(2U, cache.size()); in TEST_F()
278 cache.removeOldest(); in TEST_F()
279 cache.clear(); in TEST_F()
286 ComplexCache cache(100); in TEST_F() local
288 cache.put(ComplexKey(0), ComplexValue(0)); in TEST_F()
289 cache.put(ComplexKey(1), ComplexValue(1)); in TEST_F()
290 EXPECT_EQ(2U, cache.size()); in TEST_F()
292 cache.clear(); in TEST_F()
294 cache.put(ComplexKey(0), ComplexValue(0)); in TEST_F()
295 cache.put(ComplexKey(1), ComplexValue(1)); in TEST_F()
296 EXPECT_EQ(2U, cache.size()); in TEST_F()
301 LruCache<SimpleKey, StringValue> cache(100); in TEST_F() local
303 cache.setOnEntryRemovedListener(&callback); in TEST_F()
305 cache.put(1, "one"); in TEST_F()
306 cache.put(2, "two"); in TEST_F()
307 cache.put(3, "three"); in TEST_F()
308 EXPECT_EQ(3U, cache.size()); in TEST_F()
309 cache.removeOldest(); in TEST_F()
316 LruCache<SimpleKey, StringValue> cache(100); in TEST_F() local
318 cache.setOnEntryRemovedListener(&callback); in TEST_F()
320 cache.put(1, "one"); in TEST_F()
321 cache.put(2, "two"); in TEST_F()
322 cache.put(3, "three"); in TEST_F()
323 EXPECT_EQ(3U, cache.size()); in TEST_F()
324 cache.clear(); in TEST_F()
329 LruCache<KeyWithPointer, StringValue> cache(1); in TEST_F() local
331 cache.setOnEntryRemovedListener(&callback); in TEST_F()
337 cache.put(key1, "one"); in TEST_F()
341 cache.put(key2, "two"); in TEST_F()
342 EXPECT_EQ(1U, cache.size()); in TEST_F()
343 EXPECT_STREQ("two", cache.get(key2)); in TEST_F()
344 cache.clear(); in TEST_F()
348 LruCache<int, int> cache(100); in TEST_F() local
350 cache.put(1, 4); in TEST_F()
351 cache.put(2, 5); in TEST_F()
352 cache.put(3, 6); in TEST_F()
353 EXPECT_EQ(3U, cache.size()); in TEST_F()
355 LruCache<int, int>::Iterator it(cache); in TEST_F()
368 LruCache<int, int> cache(100); in TEST_F() local
370 LruCache<int, int>::Iterator it(cache); in TEST_F()
380 LruCache<int, int> cache(100); in TEST_F() local
381 cache.put(1, 2); in TEST_F()
383 LruCache<int, int>::Iterator it(cache); in TEST_F()
392 LruCache<int, int> cache(100); in TEST_F() local
393 cache.put(1, 2); in TEST_F()
395 cache.remove(1); in TEST_F()
397 LruCache<int, int>::Iterator it(cache); in TEST_F()
406 LruCache<int, int> cache(100); in TEST_F() local
407 cache.put(1, 4); in TEST_F()
408 cache.put(2, 5); in TEST_F()
409 cache.put(3, 6); in TEST_F()
411 cache.remove(2); in TEST_F()
413 LruCache<int, int>::Iterator it(cache); in TEST_F()
422 LruCache<int, int> cache(100); in TEST_F() local
423 cache.put(1, 4); in TEST_F()
424 cache.put(2, 5); in TEST_F()
425 cache.put(3, 6); in TEST_F()
427 cache.remove(3); in TEST_F()
429 LruCache<int, int>::Iterator it(cache); in TEST_F()
438 LruCache<int, int> cache(100); in TEST_F() local
439 cache.put(1, 4); in TEST_F()
440 cache.put(2, 5); in TEST_F()
441 cache.put(3, 6); in TEST_F()
443 cache.remove(7); in TEST_F()
445 LruCache<int, int>::Iterator it(cache); in TEST_F()
454 LruCache<KeyFailsOnCopy, KeyFailsOnCopy> cache(1); in TEST_F() local
456 cache.get(KeyFailsOnCopy(0)); in TEST_F()