github.com/aergoio/aergo@v1.3.1/internal/common/bytes_test.go (about)

     1  package common
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestGobCodec(t *testing.T) {
    10  	a := assert.New(t)
    11  
    12  	x := []int{1, 2, 3}
    13  	b, err := GobEncode(x)
    14  	a.Nil(err)
    15  
    16  	y := []int{0, 0, 0}
    17  	err = GobDecode(b, &y)
    18  	a.Nil(err)
    19  
    20  	for i, v := range x {
    21  		a.Equal(v, y[i])
    22  	}
    23  }