[#302] pkg/netmap: Convert nil NetworkInfo to nil message

Document that `NetworkInfo.ToV2` method return `nil`
when called on `nil`. Document that `NewNetworkInfoFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-06-08 17:07:04 +03:00 committed by Alex Vanin
parent 44437bf81a
commit 6142a352da
2 changed files with 18 additions and 0 deletions

View file

@ -51,3 +51,17 @@ func TestNetworkInfoEncoding(t *testing.T) {
require.Equal(t, i, i2)
})
}
func TestNewNetworkInfoFromV2(t *testing.T) {
t.Run("nil", func(t *testing.T) {
require.Nil(t, NewNetworkInfoFromV2(nil))
})
}
func TestNetworkInfo_ToV2(t *testing.T) {
t.Run("nil", func(t *testing.T) {
var x *NetworkInfo
require.Nil(t, x.ToV2())
})
}