MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestHumanRateFormat

Function TestHumanRateFormat

internal/tui/tui_test.go:1630–1651  ·  view source on GitHub ↗

TestHumanRateFormat: throughput as `N tok/s`. Degenerate inputs (zero tokens or zero elapsed) collapse to "" so the banner omits the segment. Sub-10 tok/s keeps one decimal: reasoning models hover near 1 tok/s where it's the signal.

(t *testing.T)

Source from the content-addressed store, hash-verified

1628 want string
1629 }{
1630 {0, "0s"},
1631 {800 * time.Millisecond, "0s"},
1632 {12_300 * time.Millisecond, "12s"},
1633 {59_900 * time.Millisecond, "59s"},
1634 {60 * time.Second, "1m 00s"},
1635 {90 * time.Second, "1m 30s"},
1636 {411_100 * time.Millisecond, "6m 51s"},
1637 {479 * time.Second, "7m 59s"},
1638 {480 * time.Second, "8m 00s"},
1639 {3599 * time.Second, "59m 59s"},
1640 {3600 * time.Second, "1h 00m"},
1641 {3660 * time.Second, "1h 01m"},
1642 {7200 * time.Second, "2h 00m"},
1643 {7500 * time.Second, "2h 05m"},
1644 }
1645 for _, c := range cases {
1646 if got := liveElapsed(c.d); got != c.want {
1647 t.Errorf("liveElapsed(%v) = %q, want %q", c.d, got, c.want)
1648 }
1649 }
1650}
1651
1652// TestHumanRateFormat: throughput as `N tok/s`. Degenerate inputs (zero tokens
1653// or zero elapsed) collapse to "" so the banner omits the segment. Sub-10 tok/s
1654// keeps one decimal: reasoning models hover near 1 tok/s where it's the signal.

Callers

nothing calls this directly

Calls 1

humanRateFunction · 0.85

Tested by

no test coverage detected