forked from TrueCloudLab/frostfs-api-go
[#356] refs: Add functions to work with zero subnet
Add helper functions which provide ease of use with subnet zero IDs. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
580f6c5554
commit
f0af5ce759
2 changed files with 30 additions and 0 deletions
20
refs/types_test.go
Normal file
20
refs/types_test.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package refs_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestZeroSubnet(t *testing.T) {
|
||||
id := new(refs.SubnetID)
|
||||
|
||||
require.True(t, refs.IsZeroSubnet(id))
|
||||
|
||||
id.SetValue(1)
|
||||
require.False(t, refs.IsZeroSubnet(id))
|
||||
|
||||
refs.MakeZeroSubnet(id)
|
||||
require.True(t, refs.IsZeroSubnet(id))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue