neoneo-go/pkg/network/payload/version_test.go
2019-08-29 21:23:57 +03:00

22 lines
458 B
Go

package payload
import (
"bytes"
"testing"
"github.com/stretchr/testify/assert"
)
func TestVersionEncodeDecode(t *testing.T) {
version := NewVersion(13337, 3000, "/NEO:0.0.1/", 0, true)
buf := new(bytes.Buffer)
err := version.EncodeBinary(buf)
assert.Nil(t, err)
assert.Equal(t, int(version.Size()), buf.Len())
versionDecoded := &Version{}
err = versionDecoded.DecodeBinary(buf)
assert.Nil(t, err)
assert.Equal(t, version, versionDecoded)
}