Add message tests for MsgAlert and MsgMemPool.
This commit is contained in:
parent
ff7d582c66
commit
e473fd6eb8
2 changed files with 10 additions and 0 deletions
|
@ -97,6 +97,12 @@ func makeEmptyMessage(command string) (Message, error) {
|
|||
case cmdHeaders:
|
||||
msg = &MsgHeaders{}
|
||||
|
||||
case cmdAlert:
|
||||
msg = &MsgAlert{}
|
||||
|
||||
case cmdMemPool:
|
||||
msg = &MsgMemPool{}
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("unhandled command [%s]", command)
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ func TestMessage(t *testing.T) {
|
|||
msgPong := btcwire.NewMsgPong(123123)
|
||||
msgGetHeaders := btcwire.NewMsgGetHeaders()
|
||||
msgHeaders := btcwire.NewMsgHeaders()
|
||||
msgAlert := btcwire.NewMsgAlert("payload", "signature")
|
||||
msgMemPool := btcwire.NewMsgMemPool()
|
||||
|
||||
tests := []struct {
|
||||
in btcwire.Message // Value to encode
|
||||
|
@ -69,6 +71,8 @@ func TestMessage(t *testing.T) {
|
|||
{msgPong, msgPong, pver, btcwire.MainNet},
|
||||
{msgGetHeaders, msgGetHeaders, pver, btcwire.MainNet},
|
||||
{msgHeaders, msgHeaders, pver, btcwire.MainNet},
|
||||
{msgAlert, msgAlert, pver, btcwire.MainNet},
|
||||
{msgMemPool, msgMemPool, pver, btcwire.MainNet},
|
||||
}
|
||||
|
||||
t.Logf("Running %d tests", len(tests))
|
||||
|
|
Loading…
Reference in a new issue