(t *testing.T)
| 145 | } |
| 146 | |
| 147 | func 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 | } |
nothing calls this directly
no test coverage detected