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

Function TestSessionTokensAccumulateAcrossTurns

internal/tui/tui_test.go:1656–1676  ·  view source on GitHub ↗

TestSessionTokensAccumulateAcrossTurns: the session counter is separate from the per-turn counter. finalizeTurn resets turnTokens; sessionTokens keeps growing for the rest of the session.

(t *testing.T)

Source from the content-addressed store, hash-verified

1654// or zero elapsed) collapse to "" so the banner omits the segment. Sub-10 tok/s
1655// keeps one decimal: reasoning models hover near 1 tok/s where it's the signal.
1656func TestHumanRateFormat(t *testing.T) {
1657 cases := []struct {
1658 tokens int
1659 d time.Duration
1660 want string
1661 }{
1662 {0, time.Second, ""},
1663 {10, 0, ""},
1664 {-3, time.Second, ""},
1665 {86, 3400 * time.Millisecond, "25 tok/s"},
1666 {50, time.Second, "50 tok/s"},
1667 {53, 10 * time.Second, "5.3 tok/s"},
1668 {1, 2 * time.Second, "0.5 tok/s"},
1669 {120, 120 * time.Second, "1.0 tok/s"},
1670 {100, time.Second, "100 tok/s"},
1671 }
1672 for _, c := range cases {
1673 if got := humanRate(c.tokens, c.d); got != c.want {
1674 t.Errorf("humanRate(%d, %v) = %q, want %q", c.tokens, c.d, got, c.want)
1675 }
1676 }
1677}
1678
1679// TestSessionTokensAccumulateAcrossTurns: the session counter is separate

Callers

nothing calls this directly

Calls 2

newTestModelFunction · 0.85
handleStreamMethod · 0.80

Tested by

no test coverage detected