mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 22:05:18 +00:00
pass tests!
This commit is contained in:
committed by
Ethan Buchman
parent
c84c7250ba
commit
414a8cb0ba
@@ -40,17 +40,17 @@ func TestHeartbeatWriteSignBytes(t *testing.T) {
|
||||
|
||||
hb := &Heartbeat{ValidatorIndex: 1, Height: 10, Round: 1}
|
||||
hb.WriteSignBytes("0xdeadbeef", buf, &n, &err)
|
||||
require.Equal(t, string(buf.Bytes()), `{"chain_id":"0xdeadbeef","heartbeat":{"height":10,"round":1,"sequence":0,"validator_address":"","validator_index":1}}`)
|
||||
require.Equal(t, buf.String(), `{"chain_id":"0xdeadbeef","heartbeat":{"height":10,"round":1,"sequence":0,"validator_address":"","validator_index":1}}`)
|
||||
|
||||
buf.Reset()
|
||||
plainHb := &Heartbeat{}
|
||||
plainHb.WriteSignBytes("0xdeadbeef", buf, &n, &err)
|
||||
require.Equal(t, string(buf.Bytes()), `{"chain_id":"0xdeadbeef","heartbeat":{"height":0,"round":0,"sequence":0,"validator_address":"","validator_index":0}}`)
|
||||
require.Equal(t, buf.String(), `{"chain_id":"0xdeadbeef","heartbeat":{"height":0,"round":0,"sequence":0,"validator_address":"","validator_index":0}}`)
|
||||
|
||||
require.Panics(t, func() {
|
||||
buf.Reset()
|
||||
var nilHb *Heartbeat
|
||||
nilHb.WriteSignBytes("0xdeadbeef", buf, &n, &err)
|
||||
require.Equal(t, string(buf.Bytes()), "null")
|
||||
require.Equal(t, buf.String(), "null")
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user