MCPcopy Create free account
hub / github.com/codechenx/FastTableViewer / TestFormatBytes

Function TestFormatBytes

memory_limit_test.go:169–192  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

167}
168
169func TestFormatBytes(t *testing.T) {
170 tests := []struct {
171 bytes int64
172 expected string
173 }{
174 {0, "0 B"},
175 {100, "100 B"},
176 {1023, "1023 B"},
177 {1024, "1.00 KB"},
178 {1024 * 1024, "1.00 MB"},
179 {1024 * 1024 * 1024, "1.00 GB"},
180 {1536 * 1024 * 1024, "1.50 GB"},
181 {2 * 1024 * 1024 * 1024, "2.00 GB"},
182 }
183
184 for _, tt := range tests {
185 t.Run(tt.expected, func(t *testing.T) {
186 result := formatBytes(tt.bytes)
187 if result != tt.expected {
188 t.Errorf("formatBytes(%d) = %s, want %s", tt.bytes, result, tt.expected)
189 }
190 })
191 }
192}
193
194func TestMemoryLimit_EstimateRowSize(t *testing.T) {
195 b := createNewBuffer()

Callers

nothing calls this directly

Calls 1

formatBytesFunction · 0.85

Tested by

no test coverage detected