MCPcopy Create free account
hub / github.com/diillson/chatcli / TestFormatPayloadSize

Function TestFormatPayloadSize

cli/history_compactor_test.go:34–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestFormatPayloadSize(t *testing.T) {
35 cases := []struct {
36 in int
37 want string
38 }{
39 {512, "512 B"},
40 {2048, "2.0 KB"},
41 {5 * 1024 * 1024, "5.0 MB"},
42 {int(2.5 * 1024 * 1024), "2.5 MB"},
43 {1024 * 1024 * 1024, "1.0 GB"},
44 }
45 for _, tc := range cases {
46 got := FormatPayloadSize(tc.in)
47 if got != tc.want {
48 t.Errorf("FormatPayloadSize(%d) = %q, want %q", tc.in, got, tc.want)
49 }
50 }
51}

Callers

nothing calls this directly

Calls 2

FormatPayloadSizeFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected