[#302] pkg/netmap: Convert nil PlacementPolicy
to nil message
Document that `PlacementPolicy.ToV2` method return `nil` when called on `nil`. Document that `PlacementPolicyFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
df4d610fad
commit
2176cb9f2b
2 changed files with 20 additions and 0 deletions
|
@ -144,3 +144,19 @@ func TestPlacementPolicyEncoding(t *testing.T) {
|
|||
require.Equal(t, p, p2)
|
||||
})
|
||||
}
|
||||
|
||||
func TestNewPlacementPolicy(t *testing.T) {
|
||||
t.Run("nil", func(t *testing.T) {
|
||||
var x *PlacementPolicy
|
||||
|
||||
require.Nil(t, x.ToV2())
|
||||
})
|
||||
}
|
||||
|
||||
func TestNewPlacementPolicyFromV2(t *testing.T) {
|
||||
t.Run("from nil", func(t *testing.T) {
|
||||
var x *netmap.PlacementPolicy
|
||||
|
||||
require.Nil(t, NewPlacementPolicyFromV2(x))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue