[#189] sdk/netmap: Implement NodeState enum

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-05 14:24:52 +03:00 committed by Alex Vanin
parent 53697081ce
commit d4f5c27d47
2 changed files with 71 additions and 0 deletions

View file

@ -19,3 +19,26 @@ func TestNode_NetworkAddress(t *testing.T) {
require.Equal(t, addr, n.NetworkAddress())
}
func TestNodeStateFromV2(t *testing.T) {
for _, item := range []struct {
s NodeState
sV2 netmap.NodeState
}{
{
s: 0,
sV2: netmap.UnspecifiedState,
},
{
s: NodeStateOnline,
sV2: netmap.Online,
},
{
s: NodeStateOffline,
sV2: netmap.Offline,
},
} {
require.Equal(t, item.s, NodeStateFromV2(item.sV2))
require.Equal(t, item.sV2, item.s.ToV2())
}
}