frostfs-api-go-pogpp/object/utils_test.go
Evgeniy Kulikov ac44e4bb9f
service: get rid of bytefmt
- add ByteSize type + Stringer
- add test coverage
- cleanup modules

closes #22
2019-11-26 16:14:10 +03:00

48 lines
768 B
Go

package object
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestByteSize_String(t *testing.T) {
var cases = []struct {
name string
expect string
actual ByteSize
}{
{
name: "101 bytes",
expect: "101",
actual: ByteSize(101),
},
{
name: "112.84KB",
expect: "112.84KB",
actual: ByteSize(115548),
},
{
name: "80.44MB",
expect: "80.44MB",
actual: ByteSize(84347453),
},
{
name: "905.144GB",
expect: "905.144GB",
actual: ByteSize(971891061884),
},
{
name: "1.857TB",
expect: "1.857TB",
actual: ByteSize(2041793092780),
},
}
for i := range cases {
tt := cases[i]
t.Run(tt.name, func(t *testing.T) {
require.Equal(t, tt.expect, tt.actual.String())
})
}
}