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

Function TestLiveElapsed

internal/tui/tui_test.go:1600–1625  ·  view source on GitHub ↗

TestLiveElapsed: the running wall-clock readout, whole seconds under a minute (no spinning sub-second decimal at the spinner's refresh rate), then `6m 51s` / `1h 14m`, with the trailing unit dropped when zero.

(t *testing.T)

Source from the content-addressed store, hash-verified

1598 }{
1599 {0, "0 tok"},
1600 {1, "1 tok"},
1601 {900, "900 tok"},
1602 {999, "999 tok"},
1603 {1000, "1.0k tok"},
1604 {1200, "1.2k tok"},
1605 {1900, "1.9k tok"}, // the pair the user flagged: must stay constant width
1606 {2000, "2.0k tok"}, // not "2k tok"
1607 {9999, "10.0k tok"},
1608 {10_000, "10.0k tok"},
1609 {42_000, "42.0k tok"},
1610 {999_999, "1000.0k tok"},
1611 {1_000_000, "1.0M tok"},
1612 {1_500_000, "1.5M tok"},
1613 {12_345_678, "12.3M tok"},
1614 }
1615 for _, c := range cases {
1616 if got := humanTokens(c.n); got != c.want {
1617 t.Errorf("humanTokens(%d) = %q, want %q", c.n, got, c.want)
1618 }
1619 }
1620}
1621
1622// TestLiveElapsed: the running wall-clock readout, whole seconds under a
1623// minute (no spinning sub-second decimal at the spinner's refresh rate), then
1624// `6m 51s` / `1h 14m`, with the lower unit always two digits and never
1625// dropped (`8m 00s`, not `8m`), so the readout never shrinks mid-turn.
1626func TestLiveElapsed(t *testing.T) {
1627 cases := []struct {
1628 d time.Duration

Callers

nothing calls this directly

Calls 1

liveElapsedFunction · 0.85

Tested by

no test coverage detected