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

Function test_lru_cache_eviction

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

Source from the content-addressed store, hash-verified

124
125#[test]
126fn test_lru_cache_eviction() {
127 let mut cache: LruCache<u32, String> = LruCache::new(2);
128
129 cache.insert(1, "one".to_string());
130 cache.insert(2, "two".to_string());
131 cache.insert(3, "three".to_string()); // Should evict 1
132
133 assert_eq!(cache.get(&1), None); // Evicted
134 assert_eq!(cache.get(&2), Some(&"two".to_string()));
135 assert_eq!(cache.get(&3), Some(&"three".to_string()));
136}
137
138#[test]
139fn test_lru_cache_access_updates_order() {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected