1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-04 17:43:50 +00:00

Tidy stats output - fixes #541

This commit is contained in:
Nick Craig-Wood
2016-07-11 13:04:30 +01:00
parent 56adb52a21
commit a20d80565b
4 changed files with 45 additions and 9 deletions

View File

@@ -28,6 +28,27 @@ func TestSizeSuffixString(t *testing.T) {
}
}
func TestSizeSuffixUnit(t *testing.T) {
for _, test := range []struct {
in float64
want string
}{
{0, "0 Bytes"},
{102, "102 Bytes"},
{1024, "1 kBytes"},
{1024 * 1024, "1 MBytes"},
{1024 * 1024 * 1024, "1 GBytes"},
{10 * 1024 * 1024 * 1024, "10 GBytes"},
{10.1 * 1024 * 1024 * 1024, "10.100 GBytes"},
{-1, "off"},
{-100, "off"},
} {
ss := SizeSuffix(test.in)
got := ss.Unit("Bytes")
assert.Equal(t, test.want, got)
}
}
func TestSizeSuffixSet(t *testing.T) {
for _, test := range []struct {
in string