()
| 533 | |
| 534 | #[test] |
| 535 | fn test_context_item_builder() { |
| 536 | let item = ContextItem::new("item-2", ContextType::Memory, "Memory content") |
| 537 | .with_token_count(150) |
| 538 | .with_relevance(0.85) |
| 539 | .with_source("viking://memory/session-123") |
| 540 | .with_provenance("memory") |
| 541 | .with_priority(0.7) |
| 542 | .with_trust(1.2) |
| 543 | .with_freshness(-1.0) |
| 544 | .with_metadata("key", serde_json::json!("value")); |
| 545 | |
| 546 | assert_eq!(item.token_count, 150); |
| 547 | assert!((item.relevance - 0.85).abs() < f32::EPSILON); |
| 548 | assert_eq!(item.source, Some("viking://memory/session-123".to_string())); |
| 549 | assert_eq!(item.provenance(), Some("memory")); |
| 550 | assert!((item.priority() - 0.7).abs() < f32::EPSILON); |
| 551 | assert!((item.trust() - 1.0).abs() < f32::EPSILON); |
| 552 | assert!(item.freshness().abs() < f32::EPSILON); |
| 553 | assert_eq!(item.metadata.get("key"), Some(&serde_json::json!("value"))); |
| 554 | } |
| 555 | |
| 556 | #[test] |
| 557 | fn test_context_item_relevance_clamping() { |
nothing calls this directly
no test coverage detected