(t *testing.T)
| 701 | } |
| 702 | |
| 703 | func TestCacheEfficiency(t *testing.T) { |
| 704 | t.Run("remains zero to avoid transforming raw token counts", func(t *testing.T) { |
| 705 | tmpDir := testutil.TempDir(t, "cache-eff") |
| 706 | filePath := filepath.Join(tmpDir, "token-usage.jsonl") |
| 707 | content := `{"provider":"anthropic","model":"sonnet","input_tokens":100,"output_tokens":50,"cache_read_tokens":9900,"cache_write_tokens":0,"duration_ms":100}` |
| 708 | require.NoError(t, os.WriteFile(filePath, []byte(content+"\n"), 0o644)) |
| 709 | |
| 710 | summary, err := parseTokenUsageFile(filePath) |
| 711 | require.NoError(t, err) |
| 712 | require.NotNil(t, summary) |
| 713 | assert.InDelta(t, 0.0, summary.CacheEfficiency, 0.001, "cache efficiency should remain unset") |
| 714 | }) |
| 715 | } |
| 716 | |
| 717 | func TestModelTokenUsageReasoningTokensJSONRoundTrip(t *testing.T) { |
| 718 | original := ModelTokenUsage{ |
nothing calls this directly
no test coverage detected