MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestTruncateSmallUntouched

Function TestTruncateSmallUntouched

internal/ctx/ctx_test.go:56–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54 }
55}
56
57// TestMessageTokensCountsReasoning: replayed reasoning items ride on every
58// later request, so they must cost budget like any other bytes on the wire.
59func TestMessageTokensCountsReasoning(t *testing.T) {
60 item := json.RawMessage(`{"type":"reasoning","encrypted_content":"` + strings.Repeat("A", 40) + `"}`)
61 base := Message{Role: RoleAssistant, Content: "ok"}.Tokens()
62 with := Message{Role: RoleAssistant, Content: "ok", Reasoning: []json.RawMessage{item}}.Tokens()
63 if got, want := with-base, Tokens(string(item)); got != want {
64 t.Fatalf("reasoning cost = %d tokens, want %d (Message.Tokens must account for Reasoning)", got, want)

Callers

nothing calls this directly

Calls 1

TruncateFunction · 0.85

Tested by

no test coverage detected