MCPcopy Index your code
hub / github.com/docker/docker-agent / TestFormatBytes

Function TestFormatBytes

pkg/app/transcript/transcript_test.go:147–169  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

145}
146
147func TestFormatBytes(t *testing.T) {
148 t.Parallel()
149 tests := []struct {
150 input int64
151 want string
152 }{
153 {0, "0 B"},
154 {512, "512 B"},
155 {1023, "1023 B"},
156 {1536, "1.5 KB"},
157 {1024 * 1024, "1.0 MB"},
158 {2 * 1024 * 1024, "2.0 MB"},
159 {1536 * 1024, "1.5 MB"},
160 }
161 for _, tt := range tests {
162 t.Run(tt.want, func(t *testing.T) {
163 got := formatBytes(tt.input)
164 if got != tt.want {
165 t.Errorf("formatBytes(%d) = %q, want %q", tt.input, got, tt.want)
166 }
167 })
168 }
169}

Callers

nothing calls this directly

Calls 2

formatBytesFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected