Merge branch 'release/0.2.12'
This commit is contained in:
commit
403d999fa3
4 changed files with 15 additions and 4 deletions
|
@ -1,6 +1,11 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
This is the changelog for NeoFS Proto
|
This is the changelog for NeoFS Proto
|
||||||
|
|
||||||
|
## [0.2.12] - 2020-01-27
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Bug with ByteSize (0 bytes returns NaN)
|
||||||
|
|
||||||
## [0.2.11] - 2020-01-21
|
## [0.2.11] - 2020-01-21
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -118,3 +123,4 @@ Initial public release
|
||||||
[0.2.9]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.8...v0.2.9
|
[0.2.9]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.8...v0.2.9
|
||||||
[0.2.10]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.9...v0.2.10
|
[0.2.10]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.9...v0.2.10
|
||||||
[0.2.11]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.10...v0.2.11
|
[0.2.11]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.10...v0.2.11
|
||||||
|
[0.2.12]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.11...v0.2.12
|
||||||
|
|
|
@ -39,8 +39,8 @@ type (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// UnitsB starts enum for amount of bytes.
|
// starts enum for amount of bytes.
|
||||||
UnitsB int64 = 1 << (10 * iota)
|
_ int64 = 1 << (10 * iota)
|
||||||
|
|
||||||
// UnitsKB defines amount of bytes in one kilobyte.
|
// UnitsKB defines amount of bytes in one kilobyte.
|
||||||
UnitsKB
|
UnitsKB
|
||||||
|
|
|
@ -32,7 +32,7 @@ func (b ByteSize) String() string {
|
||||||
case num > UnitsKB:
|
case num > UnitsKB:
|
||||||
unit = "KB"
|
unit = "KB"
|
||||||
dec = UnitsKB
|
dec = UnitsKB
|
||||||
case num > UnitsB:
|
default:
|
||||||
dec = 1
|
dec = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,16 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestByteSize_String(t *testing.T) {
|
func TestByteSize_String(t *testing.T) {
|
||||||
var cases = []struct {
|
cases := []struct {
|
||||||
name string
|
name string
|
||||||
expect string
|
expect string
|
||||||
actual ByteSize
|
actual ByteSize
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
name: "0 bytes",
|
||||||
|
expect: "0",
|
||||||
|
actual: ByteSize(0),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "101 bytes",
|
name: "101 bytes",
|
||||||
expect: "101",
|
expect: "101",
|
||||||
|
|
Loading…
Reference in a new issue