(t *testing.T)
| 32 | } |
| 33 | |
| 34 | func TestFormatPayloadSize(t *testing.T) { |
| 35 | cases := []struct { |
| 36 | in int |
| 37 | want string |
| 38 | }{ |
| 39 | {512, "512 B"}, |
| 40 | {2048, "2.0 KB"}, |
| 41 | {5 * 1024 * 1024, "5.0 MB"}, |
| 42 | {int(2.5 * 1024 * 1024), "2.5 MB"}, |
| 43 | {1024 * 1024 * 1024, "1.0 GB"}, |
| 44 | } |
| 45 | for _, tc := range cases { |
| 46 | got := FormatPayloadSize(tc.in) |
| 47 | if got != tc.want { |
| 48 | t.Errorf("FormatPayloadSize(%d) = %q, want %q", tc.in, got, tc.want) |
| 49 | } |
| 50 | } |
| 51 | } |
nothing calls this directly
no test coverage detected