MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestValidator_FormatBytes

Function TestValidator_FormatBytes

cmd/gosqlx/cmd/validator_test.go:383–406  ·  view source on GitHub ↗

TestValidator_FormatBytes tests byte formatting

(t *testing.T)

Source from the content-addressed store, hash-verified

381
382// TestValidator_FormatBytes tests byte formatting
383func TestValidator_FormatBytes(t *testing.T) {
384 tests := []struct {
385 bytes int64
386 expected string
387 }{
388 {0, "0 B"},
389 {1, "1 B"},
390 {1023, "1023 B"},
391 {1024, "1.0 KB"},
392 {1536, "1.5 KB"},
393 {1048576, "1.0 MB"},
394 {1073741824, "1.0 GB"},
395 {1099511627776, "1.0 TB"},
396 }
397
398 for _, tt := range tests {
399 t.Run(tt.expected, func(t *testing.T) {
400 result := formatBytes(tt.bytes)
401 if result != tt.expected {
402 t.Errorf("formatBytes(%d) = %s, want %s", tt.bytes, result, tt.expected)
403 }
404 })
405 }
406}
407
408// TestValidator_DisplayStats tests statistics display
409func TestValidator_DisplayStats(t *testing.T) {

Callers

nothing calls this directly

Calls 3

formatBytesFunction · 0.85
RunMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected