MCPcopy Create free account
hub / github.com/agenticsorg/lean-agentic / test_cache_operations

Function test_cache_operations

leanr-eval-lite/src/cache.rs:82–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80
81 #[test]
82 fn test_cache_operations() {
83 let mut cache = NormalizationCache::new(2);
84
85 let term1 = TermId::new(1);
86 let whnf1 = TermId::new(10);
87 let term2 = TermId::new(2);
88 let whnf2 = TermId::new(20);
89
90 // Insert and retrieve
91 cache.insert(term1, whnf1);
92 assert_eq!(cache.get(term1), Some(whnf1));
93
94 // Insert second
95 cache.insert(term2, whnf2);
96 assert_eq!(cache.get(term2), Some(whnf2));
97
98 // Both should be present
99 assert_eq!(cache.len(), 2);
100
101 // Insert third (should evict first due to LRU)
102 let term3 = TermId::new(3);
103 let whnf3 = TermId::new(30);
104 cache.insert(term3, whnf3);
105
106 assert_eq!(cache.len(), 2);
107 assert_eq!(cache.get(term3), Some(whnf3));
108 }
109
110 #[test]
111 fn test_cache_clear() {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected