MCPcopy Index your code
hub / github.com/AI45Lab/Code / test_llm_cost_record_serialization

Function test_llm_cost_record_serialization

core/src/telemetry.rs:823–839  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

821
822 #[test]
823 fn test_llm_cost_record_serialization() {
824 let record = LlmCostRecord {
825 model: "claude-sonnet-4-20250514".to_string(),
826 provider: "anthropic".to_string(),
827 prompt_tokens: 1000,
828 completion_tokens: 500,
829 total_tokens: 1500,
830 cost_usd: Some(0.0105),
831 timestamp: chrono::Utc::now(),
832 session_id: Some("sess-123".to_string()),
833 };
834 let json = serde_json::to_string(&record).unwrap();
835 assert!(json.contains("claude-sonnet-4-20250514"));
836 assert!(json.contains("anthropic"));
837 assert!(json.contains("1000"));
838 assert!(json.contains("500"));
839 }
840
841 #[test]
842 fn test_llm_cost_record_zero_tokens() {

Callers

nothing calls this directly

Calls 1

nowFunction · 0.85

Tested by

no test coverage detected