mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-29 19:27:36 +00:00
29 lines
611 B
Go
29 lines
611 B
Go
package core
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDecodeEncodeUnspentCoinState(t *testing.T) {
|
|
unspent := &UnspentCoinState{
|
|
states: []state.Coin{
|
|
state.CoinConfirmed,
|
|
state.CoinSpent,
|
|
state.CoinSpent,
|
|
state.CoinSpent,
|
|
state.CoinConfirmed,
|
|
},
|
|
}
|
|
|
|
buf := io.NewBufBinWriter()
|
|
unspent.EncodeBinary(buf.BinWriter)
|
|
assert.Nil(t, buf.Err)
|
|
unspentDecode := &UnspentCoinState{}
|
|
r := io.NewBinReaderFromBuf(buf.Bytes())
|
|
unspentDecode.DecodeBinary(r)
|
|
assert.Nil(t, r.Err)
|
|
}
|