()
| 321 | |
| 322 | #[test] |
| 323 | fn test_cache_hit_rate() { |
| 324 | let mut arena = Arena::new(); |
| 325 | let env = Environment::new(); |
| 326 | let ctx = Context::new(); |
| 327 | |
| 328 | let term = arena.mk_var(0); |
| 329 | |
| 330 | let config = NormalizeConfig::default(); |
| 331 | let mut normalizer = Normalizer::new(&mut arena, &env, config); |
| 332 | |
| 333 | // First access - cache miss |
| 334 | let _ = normalizer.whnf(term, &ctx).unwrap(); |
| 335 | assert_eq!(normalizer.stats().cache_misses, 1); |
| 336 | |
| 337 | // Second access - cache hit |
| 338 | let _ = normalizer.whnf(term, &ctx).unwrap(); |
| 339 | assert_eq!(normalizer.stats().cache_hits, 1); |
| 340 | |
| 341 | let hit_rate = normalizer.cache_hit_rate(); |
| 342 | assert!((hit_rate - 0.5).abs() < 0.01); |
| 343 | } |
| 344 | } |
nothing calls this directly
no test coverage detected