forked from nspcc-dev/neofs-api-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nspcc-dev#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 <[email protected]>
- Loading branch information
Leonard Lyubich
committed
Nov 18, 2021
1 parent
580f6c5
commit 31c6451
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) | ||
} |