()
| 155 | |
| 156 | #[test] |
| 157 | fn test_lru_cache_remove() { |
| 158 | let mut cache: LruCache<u32, String> = LruCache::new(3); |
| 159 | |
| 160 | cache.insert(1, "one".to_string()); |
| 161 | assert!(cache.contains_key(&1)); |
| 162 | |
| 163 | let removed = cache.remove(&1); |
| 164 | assert!(removed); |
| 165 | assert!(!cache.contains_key(&1)); |
| 166 | |
| 167 | let removed_again = cache.remove(&1); |
| 168 | assert!(!removed_again); |
| 169 | } |
| 170 | |
| 171 | #[test] |
| 172 | fn test_lru_cache_update_existing() { |