neoneo-go/pkg/core/state/spent_coin_test.go
Roman Khimov 377fb382aa core: move (un)SpentCoin structs into the state package
As they're all about the state.
2020-03-11 12:22:52 +03:00

28 lines
519 B
Go

package state
import (
"testing"
"github.com/nspcc-dev/neo-go/pkg/io"
"github.com/stretchr/testify/assert"
)
func TestEncodeDecodeSpentCoin(t *testing.T) {
spent := &SpentCoin{
TxHeight: 1001,
Items: map[uint16]uint32{
1: 3,
2: 8,
4: 100,
},
}
buf := io.NewBufBinWriter()
spent.EncodeBinary(buf.BinWriter)
assert.Nil(t, buf.Err)
spentDecode := new(SpentCoin)
r := io.NewBinReaderFromBuf(buf.Bytes())
spentDecode.DecodeBinary(r)
assert.Nil(t, r.Err)
assert.Equal(t, spent, spentDecode)
}