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:
|
case cmdHeaders:
|
||||||
msg = &MsgHeaders{}
|
msg = &MsgHeaders{}
|
||||||
|
|
||||||
|
case cmdAlert:
|
||||||
|
msg = &MsgAlert{}
|
||||||
|
|
||||||
|
case cmdMemPool:
|
||||||
|
msg = &MsgMemPool{}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unhandled command [%s]", command)
|
return nil, fmt.Errorf("unhandled command [%s]", command)
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ func TestMessage(t *testing.T) {
|
||||||
msgPong := btcwire.NewMsgPong(123123)
|
msgPong := btcwire.NewMsgPong(123123)
|
||||||
msgGetHeaders := btcwire.NewMsgGetHeaders()
|
msgGetHeaders := btcwire.NewMsgGetHeaders()
|
||||||
msgHeaders := btcwire.NewMsgHeaders()
|
msgHeaders := btcwire.NewMsgHeaders()
|
||||||
|
msgAlert := btcwire.NewMsgAlert("payload", "signature")
|
||||||
|
msgMemPool := btcwire.NewMsgMemPool()
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
in btcwire.Message // Value to encode
|
in btcwire.Message // Value to encode
|
||||||
|
@ -69,6 +71,8 @@ func TestMessage(t *testing.T) {
|
||||||
{msgPong, msgPong, pver, btcwire.MainNet},
|
{msgPong, msgPong, pver, btcwire.MainNet},
|
||||||
{msgGetHeaders, msgGetHeaders, pver, btcwire.MainNet},
|
{msgGetHeaders, msgGetHeaders, pver, btcwire.MainNet},
|
||||||
{msgHeaders, msgHeaders, 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))
|
t.Logf("Running %d tests", len(tests))
|
||||||
|
|
Loading…
Reference in a new issue