MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_lru_cache_eviction

Function test_lru_cache_eviction

atomic-repository/src/changestore/tests.rs:60–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58
59#[test]
60fn test_lru_cache_eviction() {
61 let mut cache: LruCache<u32, String> = LruCache::new(2);
62
63 cache.insert(1, "one".to_string());
64 cache.insert(2, "two".to_string());
65 cache.insert(3, "three".to_string()); // Should evict 1
66
67 assert_eq!(cache.get(&1), None); // Evicted
68 assert_eq!(cache.get(&2), Some(&"two".to_string()));
69 assert_eq!(cache.get(&3), Some(&"three".to_string()));
70}
71
72#[test]
73fn test_lru_cache_access_updates_order() {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected