(t *testing.T)
| 167 | } |
| 168 | |
| 169 | func 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 | |
| 194 | func TestMemoryLimit_EstimateRowSize(t *testing.T) { |
| 195 | b := createNewBuffer() |
nothing calls this directly
no test coverage detected