Change byte unit format from MiByte to MiB
This commit is contained in:
parent
8500d95579
commit
f1f923a986
11 changed files with 39 additions and 73 deletions
|
@ -41,7 +41,7 @@ func TestSizeSuffixString(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSizeSuffixByteShortUnit(t *testing.T) {
|
||||
func TestSizeSuffixByteUnit(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
in float64
|
||||
want string
|
||||
|
@ -58,30 +58,6 @@ func TestSizeSuffixByteShortUnit(t *testing.T) {
|
|||
{1 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, "1 EiB"},
|
||||
{-1, "off"},
|
||||
{-100, "off"},
|
||||
} {
|
||||
ss := SizeSuffix(test.in)
|
||||
got := ss.ByteShortUnit()
|
||||
assert.Equal(t, test.want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSizeSuffixByteUnit(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
in float64
|
||||
want string
|
||||
}{
|
||||
{0, "0 Byte"},
|
||||
{102, "102 Byte"},
|
||||
{1024, "1 KiByte"},
|
||||
{1024 * 1024, "1 MiByte"},
|
||||
{1024 * 1024 * 1024, "1 GiByte"},
|
||||
{10 * 1024 * 1024 * 1024, "10 GiByte"},
|
||||
{10.1 * 1024 * 1024 * 1024, "10.100 GiByte"},
|
||||
{10 * 1024 * 1024 * 1024 * 1024, "10 TiByte"},
|
||||
{10 * 1024 * 1024 * 1024 * 1024 * 1024, "10 PiByte"},
|
||||
{1 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, "1 EiByte"},
|
||||
{-1, "off"},
|
||||
{-100, "off"},
|
||||
} {
|
||||
ss := SizeSuffix(test.in)
|
||||
got := ss.ByteUnit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue