github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/forensics/capture_test.go (about)

     1  package forensics
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/hyperledger/burrow/binary"
     9  )
    10  
    11  func TestCompareCapture(t *testing.T) {
    12  	exp := []*ReplayCapture{{
    13  		Height:        0,
    14  		AppHashBefore: binary.HexBytes("00000000000000000000"),
    15  		AppHashAfter:  binary.HexBytes("00000000000000000000"),
    16  	}, {
    17  		Height:        1,
    18  		AppHashBefore: binary.HexBytes("00000000000000000000"),
    19  		AppHashAfter:  binary.HexBytes("00000000000000000000"),
    20  	}}
    21  	act := []*ReplayCapture{{
    22  		Height:        0,
    23  		AppHashBefore: binary.HexBytes("00000000000000000000"),
    24  		AppHashAfter:  binary.HexBytes("00000000000000000000"),
    25  	}, {
    26  		Height:        1,
    27  		AppHashBefore: binary.HexBytes("00000000000000000000"),
    28  		AppHashAfter:  binary.HexBytes("11111111111111111111"),
    29  	}}
    30  	height, err := CompareCaptures(exp, act)
    31  	require.Error(t, err)
    32  	require.Equal(t, uint64(1), height)
    33  }