github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/execution/exec/block_execution_test.go (about) 1 package exec 2 3 import ( 4 "testing" 5 6 "github.com/hyperledger/burrow/event/query" 7 "github.com/stretchr/testify/require" 8 tmproto "github.com/tendermint/tendermint/proto/tendermint/types" 9 ) 10 11 func TestBlockExecution_Marshal(t *testing.T) { 12 be := &BlockExecution{ 13 Header: &tmproto.Header{ 14 Height: 3, 15 AppHash: []byte{2}, 16 ProposerAddress: []byte{1, 2, 33}, 17 }, 18 } 19 bs, err := be.Marshal() 20 require.NoError(t, err) 21 beOut := new(BlockExecution) 22 require.NoError(t, beOut.Unmarshal(bs)) 23 } 24 25 func TestBlockExecution_StreamEvents(t *testing.T) { 26 be := &BlockExecution{ 27 Header: &tmproto.Header{ 28 Height: 2, 29 AppHash: []byte{2}, 30 ProposerAddress: []byte{1, 2, 33}, 31 }, 32 } 33 34 qry, err := query.NewBuilder().AndContains("Height", "2").Query() 35 require.NoError(t, err) 36 match := qry.Matches(be) 37 require.True(t, match) 38 }