mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-24 09:30:36 +00:00
29 lines
515 B
Go
29 lines
515 B
Go
|
package state
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestDecodeEncodeUnspentCoin(t *testing.T) {
|
||
|
unspent := &UnspentCoin{
|
||
|
States: []Coin{
|
||
|
CoinConfirmed,
|
||
|
CoinSpent,
|
||
|
CoinSpent,
|
||
|
CoinSpent,
|
||
|
CoinConfirmed,
|
||
|
},
|
||
|
}
|
||
|
|
||
|
buf := io.NewBufBinWriter()
|
||
|
unspent.EncodeBinary(buf.BinWriter)
|
||
|
assert.Nil(t, buf.Err)
|
||
|
unspentDecode := &UnspentCoin{}
|
||
|
r := io.NewBinReaderFromBuf(buf.Bytes())
|
||
|
unspentDecode.DecodeBinary(r)
|
||
|
assert.Nil(t, r.Err)
|
||
|
}
|