core: renames entities-> state and removed State prefix
This commit is contained in:
parent
8809fe437d
commit
2d42b14a1d
31 changed files with 221 additions and 222 deletions
48
pkg/core/state/asset_test.go
Normal file
48
pkg/core/state/asset_test.go
Normal file
|
@ -0,0 +1,48 @@
|
|||
package state
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/CityOfZion/neo-go/pkg/core/testutil"
|
||||
"github.com/CityOfZion/neo-go/pkg/core/transaction"
|
||||
"github.com/CityOfZion/neo-go/pkg/crypto/keys"
|
||||
"github.com/CityOfZion/neo-go/pkg/io"
|
||||
"github.com/CityOfZion/neo-go/pkg/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEncodeDecodeAssetState(t *testing.T) {
|
||||
asset := &Asset{
|
||||
ID: testutil.RandomUint256(),
|
||||
AssetType: transaction.Token,
|
||||
Name: "super cool token",
|
||||
Amount: util.Fixed8(1000000),
|
||||
Available: util.Fixed8(100),
|
||||
Precision: 0,
|
||||
FeeMode: feeMode,
|
||||
Owner: keys.PublicKey{},
|
||||
Admin: testutil.RandomUint160(),
|
||||
Issuer: testutil.RandomUint160(),
|
||||
Expiration: 10,
|
||||
IsFrozen: false,
|
||||
}
|
||||
|
||||
buf := io.NewBufBinWriter()
|
||||
asset.EncodeBinary(buf.BinWriter)
|
||||
assert.Nil(t, buf.Err)
|
||||
assetDecode := &Asset{}
|
||||
r := io.NewBinReaderFromBuf(buf.Bytes())
|
||||
assetDecode.DecodeBinary(r)
|
||||
assert.Nil(t, r.Err)
|
||||
assert.Equal(t, asset, assetDecode)
|
||||
}
|
||||
|
||||
func TestAssetState_GetName_NEO(t *testing.T) {
|
||||
asset := &Asset{AssetType: transaction.GoverningToken}
|
||||
assert.Equal(t, "NEO", asset.GetName())
|
||||
}
|
||||
|
||||
func TestAssetState_GetName_NEOGas(t *testing.T) {
|
||||
asset := &Asset{AssetType: transaction.UtilityToken}
|
||||
assert.Equal(t, "NEOGas", asset.GetName())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue