github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/execution/names/names_test.go (about)

     1  package names
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/gogo/protobuf/proto"
     7  	"github.com/hyperledger/burrow/crypto"
     8  	"github.com/stretchr/testify/assert"
     9  	"github.com/stretchr/testify/require"
    10  )
    11  
    12  func TestEncodeProtobuf(t *testing.T) {
    13  	entry := &Entry{
    14  		Name:    "Foo",
    15  		Data:    "oh noes",
    16  		Expires: 24423432,
    17  		Owner:   crypto.Address{1, 2, 0, 9, 8, 8, 1, 2},
    18  	}
    19  	encoded, err := proto.Marshal(entry)
    20  	require.NoError(t, err)
    21  	entryOut := new(Entry)
    22  	err = proto.Unmarshal(encoded, entryOut)
    23  	require.NoError(t, err)
    24  	assert.Equal(t, entry, entryOut)
    25  }