diff options
Diffstat (limited to 'cmd/rr/utils')
-rw-r--r-- | cmd/rr/utils/size.go | 28 | ||||
-rw-r--r-- | cmd/rr/utils/utils_test.go | 12 |
2 files changed, 0 insertions, 40 deletions
diff --git a/cmd/rr/utils/size.go b/cmd/rr/utils/size.go deleted file mode 100644 index 176cc9e1..00000000 --- a/cmd/rr/utils/size.go +++ /dev/null @@ -1,28 +0,0 @@ -package utils - -import ( - "strconv" - "strings" -) - -func ParseSize(size string) int64 { - if len(size) == 0 { - return 0 - } - - s, err := strconv.Atoi(size[:len(size)-1]) - if err != nil { - return 0 - } - - switch strings.ToLower(size[len(size)-1:]) { - case "k", "kb": - return int64(s * 1024) - case "m", "mb": - return int64(s * 1024 * 1024) - case "g", "gb": - return int64(s * 1024 * 1024 * 1024) - } - - return 0 -} diff --git a/cmd/rr/utils/utils_test.go b/cmd/rr/utils/utils_test.go deleted file mode 100644 index f67b2a10..00000000 --- a/cmd/rr/utils/utils_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package utils - -import ( - "testing" - "github.com/magiconair/properties/assert" -) - -func TestUtils(t *testing.T) { - assert.Equal(t, int64(1024), ParseSize("1K")) - assert.Equal(t, int64(1024*1024), ParseSize("1M")) - assert.Equal(t, int64(2*1024*1024*1024), ParseSize("2G")) -} |