(t *testing.T)
| 240 | } |
| 241 | |
| 242 | func TestBytesParsing(t *testing.T) { |
| 243 | tests := []struct { |
| 244 | input string |
| 245 | expected uint64 |
| 246 | }{ |
| 247 | {input: "", expected: 0}, |
| 248 | {input: "123", expected: 123}, |
| 249 | {input: "1234567890", expected: 1234567890}, |
| 250 | {input: "25k", expected: 25000}, |
| 251 | {input: "25K", expected: 25000}, |
| 252 | {input: "25kb", expected: 25000}, |
| 253 | {input: "25kB", expected: 25000}, |
| 254 | {input: "25Kb", expected: 25000}, |
| 255 | {input: "25KB", expected: 25000}, |
| 256 | {input: "25kib", expected: 25600}, |
| 257 | {input: "25KiB", expected: 25600}, |
| 258 | {input: "25m", expected: 25000000}, |
| 259 | {input: "25M", expected: 25000000}, |
| 260 | {input: "25mB", expected: 25000000}, |
| 261 | {input: "25MB", expected: 25000000}, |
| 262 | {input: "2.5MB", expected: 2500000}, |
| 263 | {input: "25MiB", expected: 26214400}, |
| 264 | {input: "25mib", expected: 26214400}, |
| 265 | {input: "2.5mib", expected: 2621440}, |
| 266 | {input: "25g", expected: 25000000000}, |
| 267 | {input: "25G", expected: 25000000000}, |
| 268 | {input: "25gB", expected: 25000000000}, |
| 269 | {input: "25Gb", expected: 25000000000}, |
| 270 | {input: "25GiB", expected: 26843545600}, |
| 271 | {input: "25gib", expected: 26843545600}, |
| 272 | } |
| 273 | for _, test := range tests { |
| 274 | output, err := parsebytes(test.input) |
| 275 | assert.Nil(t, err) |
| 276 | assert.Equal(t, test.expected, output) |
| 277 | } |
| 278 | } |
nothing calls this directly
no test coverage detected