MCPcopy
hub / github.com/rclone/rclone / TestSizeSuffixByteUnit

Function TestSizeSuffixByteUnit

fs/sizesuffix_test.go:39–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestSizeSuffixByteUnit(t *testing.T) {
40 for _, test := range []struct {
41 in float64
42 want string
43 }{
44 {0, "0 B"},
45 {102, "102 B"},
46 {1024, "1 KiB"},
47 {1024 * 1024, "1 MiB"},
48 {1024 * 1024 * 1024, "1 GiB"},
49 {10 * 1024 * 1024 * 1024, "10 GiB"},
50 {10.1 * 1024 * 1024 * 1024, "10.100 GiB"},
51 {10 * 1024 * 1024 * 1024 * 1024, "10 TiB"},
52 {10 * 1024 * 1024 * 1024 * 1024 * 1024, "10 PiB"},
53 {1 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, "1 EiB"},
54 {-1, "off"},
55 {-100, "off"},
56 } {
57 ss := SizeSuffix(test.in)
58 got := ss.ByteUnit()
59 assert.Equal(t, test.want, got)
60 }
61}
62
63func TestSizeSuffixBitRateUnit(t *testing.T) {
64 for _, test := range []struct {

Callers

nothing calls this directly

Calls 3

SizeSuffixTypeAlias · 0.85
ByteUnitMethod · 0.80
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…