mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-27 13:58:05 +00:00
ec17654986
add dao which takes care about all CRUD operations on storage remove blockchain state since everything is stored on change remove storage operations from structs(entities) move structs to entities package
29 lines
664 B
Go
29 lines
664 B
Go
package core
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/core/entities"
|
|
"github.com/CityOfZion/neo-go/pkg/io"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDecodeEncodeUnspentCoinState(t *testing.T) {
|
|
unspent := &UnspentCoinState{
|
|
states: []entities.CoinState{
|
|
entities.CoinStateConfirmed,
|
|
entities.CoinStateSpent,
|
|
entities.CoinStateSpent,
|
|
entities.CoinStateSpent,
|
|
entities.CoinStateConfirmed,
|
|
},
|
|
}
|
|
|
|
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)
|
|
}
|