unittests

package
v0.0.0-...-8f1dc17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CORE_SYMBOL = common.Symbol{Precision: 4, Symbol: "SYS"}
View Source
var CORE_SYMBOL_NAME = "SYS"
View Source
var EPSINON = float64(0.001)

Functions

func CheckNoThrow

func CheckNoThrow(t *testing.T, function func())

func CheckThrowException

func CheckThrowException(t *testing.T, expectException Exception, function func())

func CheckThrowExceptionAndMsg

func CheckThrowExceptionAndMsg(t *testing.T, expectException Exception, expectMsg string, function func())

func CheckThrowMsg

func CheckThrowMsg(t *testing.T, expectMsg string, function func())

func CoreFromString

func CoreFromString(s string) common.Asset

Types

type ActionResult

type ActionResult = string

type BaseTester

type BaseTester struct {
	ActionResult           string
	DefaultExpirationDelta uint32
	DefaultBilledCpuTimeUs uint32
	AbiSerializerMaxTime   common.Microseconds
	//TempDir                tempDirectory
	Control                 *Controller
	BlockSigningPrivateKeys map[string]ecc.PrivateKey //map[ecc.PublicKey]ecc.PrivateKey
	Cfg                     Config
	ChainTransactions       map[common.BlockIdType]types.TransactionReceipt
	LastProducedBlock       map[common.AccountName]common.BlockIdType
}

func (BaseTester) ChainHasTransaction

func (t BaseTester) ChainHasTransaction(txId *common.BlockIdType) bool

func (BaseTester) CreateAccount

func (t BaseTester) CreateAccount(name common.AccountName, creator common.AccountName, multiSig bool, includeCode bool) *types.TransactionTrace

func (BaseTester) CreateAccounts

func (t BaseTester) CreateAccounts(names []common.AccountName, multiSig bool, includeCode bool) []*types.TransactionTrace

func (BaseTester) DeleteAuthority

func (t BaseTester) DeleteAuthority(account common.AccountName, perm common.PermissionName, auths *[]common.PermissionLevel, keys *[]ecc.PrivateKey)

func (BaseTester) DeleteAuthority2

func (t BaseTester) DeleteAuthority2(account common.AccountName, perm common.PermissionName)

func (BaseTester) Error

func (t BaseTester) Error(msg string) ActionResult

func (BaseTester) FindTable

func (t BaseTester) FindTable(code common.Name, scope common.Name, table common.Name) *entity.TableIdObject

func (BaseTester) GetAction

func (t BaseTester) GetAction(code common.AccountName, actType common.AccountName,
	auths []common.PermissionLevel, data *common.Variants) *types.Action

func (BaseTester) GetCurrencyBalance

func (t BaseTester) GetCurrencyBalance(code *common.AccountName, assetSymbol *common.Symbol, account *common.AccountName) common.Asset

func (*BaseTester) GetLastProducedBlockMap

func (t *BaseTester) GetLastProducedBlockMap() map[common.AccountName]common.BlockIdType

func (BaseTester) GetProducerKeys

func (t BaseTester) GetProducerKeys(producerNames *[]common.AccountName) []types.ProducerKey

func (BaseTester) GetResolver

func (t BaseTester) GetResolver() func(name common.AccountName) *abi.AbiSerializer

func (BaseTester) GetRowByAccount

func (t BaseTester) GetRowByAccount(code uint64, scope uint64, table uint64, act uint64) []byte

func (BaseTester) GetTransactionReceipt

func (t BaseTester) GetTransactionReceipt(txId *common.BlockIdType) *types.TransactionReceipt

func (BaseTester) IsSameChain

func (t BaseTester) IsSameChain(other *BaseTester) bool

func (BaseTester) Issue

func (BaseTester) LinkAuthority

func (t BaseTester) LinkAuthority(account common.AccountName, code common.AccountName, req common.PermissionName, rtype common.ActionName)

func (BaseTester) ProduceBlock

func (t BaseTester) ProduceBlock(skipTime common.Microseconds, skipFlag uint32) *types.SignedBlock

func (BaseTester) ProduceBlockNoValidation

func (t BaseTester) ProduceBlockNoValidation(skipTime common.Microseconds, skipFlag uint32) *types.SignedBlock

func (BaseTester) ProduceBlocks

func (t BaseTester) ProduceBlocks(n uint32, empty bool)

func (BaseTester) ProduceBlocksForNrounds

func (t BaseTester) ProduceBlocksForNrounds(numOfRounds int)

func (BaseTester) ProduceBlocksUntileEndOfRound

func (t BaseTester) ProduceBlocksUntileEndOfRound()

func (BaseTester) ProduceEmptyBlock

func (t BaseTester) ProduceEmptyBlock(skipTime common.Microseconds, skipFlag uint32) *types.SignedBlock

func (BaseTester) ProduceMinNumOfBlocksToSpendTimeWoInactiveProd

func (t BaseTester) ProduceMinNumOfBlocksToSpendTimeWoInactiveProd(targetElapsedTime common.Microseconds)

func (BaseTester) PushAction

func (t BaseTester) PushAction(act *types.Action, authorizer common.AccountName) ActionResult

func (BaseTester) PushAction2

func (t BaseTester) PushAction2(code *common.AccountName, acttype *common.AccountName,
	actor common.AccountName, data *common.Variants, expiration uint32, delaySec uint32) *types.TransactionTrace

func (BaseTester) PushAction3

func (t BaseTester) PushAction3(code *common.AccountName, acttype *common.AccountName,
	actors []*common.AccountName, data *common.Variants, expiration uint32, delaySec uint32) *types.TransactionTrace

func (BaseTester) PushAction4

func (t BaseTester) PushAction4(code *common.AccountName, acttype *common.AccountName,
	auths *[]common.PermissionLevel, data *common.Variants, expiration uint32, delaySec uint32) *types.TransactionTrace

func (BaseTester) PushBlock

func (t BaseTester) PushBlock(b *types.SignedBlock) *types.SignedBlock

func (BaseTester) PushBlock2

func (t BaseTester) PushBlock2(b *types.SignedBlock, status types.BlockStatus) *types.SignedBlock

func (BaseTester) PushDummy

func (t BaseTester) PushDummy(from common.AccountName, v *string, billedCpuTimeUs uint32) *types.TransactionTrace

func (BaseTester) PushGenesisBlock

func (t BaseTester) PushGenesisBlock()

func (BaseTester) PushReqAuth

func (t BaseTester) PushReqAuth(from common.AccountName, auths *[]common.PermissionLevel, keys *[]ecc.PrivateKey) *types.TransactionTrace

func (BaseTester) PushReqAuth2

func (t BaseTester) PushReqAuth2(from common.AccountName, role string, multiSig bool) *types.TransactionTrace

func (BaseTester) PushTransaction

func (t BaseTester) PushTransaction(trx *types.SignedTransaction, deadline common.TimePoint, billedCpuTimeUs uint32) (trace *types.TransactionTrace)

func (BaseTester) SetAbi

func (t BaseTester) SetAbi(account common.AccountName, abiJson []byte, signer *ecc.PrivateKey)

func (BaseTester) SetAuthority

func (t BaseTester) SetAuthority(account common.AccountName, perm common.PermissionName, auth types.Authority, parent common.PermissionName, auths *[]common.PermissionLevel, keys *[]ecc.PrivateKey)

func (BaseTester) SetAuthority2

func (t BaseTester) SetAuthority2(account common.AccountName, perm common.PermissionName, auth types.Authority, parent common.PermissionName)

func (BaseTester) SetCode

func (t BaseTester) SetCode(account common.AccountName, wasm []uint8, signer *ecc.PrivateKey)

func (BaseTester) SetCode2

func (t BaseTester) SetCode2(account common.AccountName, wast *byte, signer *ecc.PrivateKey)

func (*BaseTester) SetLastProducedBlockMap

func (t *BaseTester) SetLastProducedBlockMap(lpb map[common.AccountName]common.BlockIdType)

func (BaseTester) SetProducers

func (t BaseTester) SetProducers(producerNames *[]common.AccountName) *types.TransactionTrace

func (BaseTester) SetTransactionHeaders

func (t BaseTester) SetTransactionHeaders(trx *types.Transaction, expiration uint32, delaySec uint32)

func (BaseTester) StringToUint8Vector

func (t BaseTester) StringToUint8Vector(s string) common.HexBytes

func (BaseTester) Success

func (t BaseTester) Success() ActionResult

func (BaseTester) SyncWith

func (t BaseTester) SyncWith(other *BaseTester)

func (BaseTester) ToString

func (t BaseTester) ToString(x common.Variant) string

func (BaseTester) ToUint64

func (t BaseTester) ToUint64(x common.Variant) uint64

func (BaseTester) Transfer

func (t BaseTester) Transfer(from common.AccountName, to common.AccountName, amount common.Asset, memo string, currency common.AccountName) *types.TransactionTrace

func (BaseTester) Transfer2

func (t BaseTester) Transfer2(from common.AccountName, to common.AccountName, amount string, memo string, currency common.AccountName) *types.TransactionTrace

func (BaseTester) Uint64ToUint8Vector

func (t BaseTester) Uint64ToUint8Vector(x uint64) common.HexBytes

func (BaseTester) UnlinkAuthority

func (t BaseTester) UnlinkAuthority(account common.AccountName, code common.AccountName, rtype common.ActionName)

func (BaseTester) WasmAssertMsg

func (t BaseTester) WasmAssertMsg(msg string) ActionResult

type EosioSystemTester

type EosioSystemTester struct {
	ValidatingTester
	// contains filtered or unexported fields
}

func (EosioSystemTester) ActiveAndVoteProducers

func (e EosioSystemTester) ActiveAndVoteProducers() []common.AccountName

func (EosioSystemTester) BidName

func (EosioSystemTester) BuyRam

func (EosioSystemTester) BuyRamBytes

func (e EosioSystemTester) BuyRamBytes(payer common.AccountName, receiver common.AccountName, numBytes uint32) ActionResult

func (EosioSystemTester) ClaimRewards

func (e EosioSystemTester) ClaimRewards(producer common.AccountName) ActionResult

func (EosioSystemTester) CreateAccountWithResources

func (e EosioSystemTester) CreateAccountWithResources(name common.AccountName, creator common.AccountName,
	ramFunds common.Asset, multiSig bool, net common.Asset, cpu common.Asset) *types.TransactionTrace

func (EosioSystemTester) CreateAccountWithResources2

func (e EosioSystemTester) CreateAccountWithResources2(name common.AccountName, creator common.AccountName, ramBytes uint32) *types.TransactionTrace

func (EosioSystemTester) CreateAccountsWithResources

func (e EosioSystemTester) CreateAccountsWithResources(accounts []common.AccountName, creator common.AccountName)

func (EosioSystemTester) CreateCurrency

func (e EosioSystemTester) CreateCurrency(contract common.Name, manager common.Name, maxSupply common.Asset)

func (EosioSystemTester) Cross15PercentThreshold

func (e EosioSystemTester) Cross15PercentThreshold()

func (EosioSystemTester) EsPushAction

func (e EosioSystemTester) EsPushAction(signer *common.AccountName, name *common.ActionName, data *common.Variants, auth bool) ActionResult

func (EosioSystemTester) GetBalance

func (e EosioSystemTester) GetBalance(act common.AccountName) common.Asset

func (EosioSystemTester) GetGlobalState

func (e EosioSystemTester) GetGlobalState() common.Variants

func (EosioSystemTester) GetProducerInfo

func (e EosioSystemTester) GetProducerInfo(act common.AccountName) common.Variants

func (EosioSystemTester) GetRefundRequest

func (e EosioSystemTester) GetRefundRequest(account common.AccountName) common.Variants

func (EosioSystemTester) GetStats

func (e EosioSystemTester) GetStats(symbol common.Symbol) common.Variants

func (EosioSystemTester) GetTokenSupply

func (e EosioSystemTester) GetTokenSupply() common.Asset

func (EosioSystemTester) GetTotalStake

func (e EosioSystemTester) GetTotalStake(act common.AccountName) common.Variants

func (EosioSystemTester) GetVoterInfo

func (e EosioSystemTester) GetVoterInfo(act common.AccountName) common.Variants

func (EosioSystemTester) InitializeMultisig

func (e EosioSystemTester) InitializeMultisig() abi_serializer.AbiSerializer

func (EosioSystemTester) Issue

func (e EosioSystemTester) Issue(to common.Name, amount common.Asset, manager common.Name)

func (EosioSystemTester) Proxy

func (EosioSystemTester) ProxyStake

func (e EosioSystemTester) ProxyStake(acnt common.AccountName, voteStake common.Asset) common.Variants

func (EosioSystemTester) RegProducer

func (e EosioSystemTester) RegProducer(acnt common.AccountName) ActionResult

func (EosioSystemTester) RegProxy

func (EosioSystemTester) RmvProducer

func (e EosioSystemTester) RmvProducer(signer common.AccountName, prodName common.AccountName) ActionResult

func (EosioSystemTester) SellRam

func (e EosioSystemTester) SellRam(account common.AccountName, numBytes uint64) ActionResult

func (EosioSystemTester) SetRam

func (e EosioSystemTester) SetRam(signer common.AccountName, maxRamSize uint64) ActionResult

func (EosioSystemTester) SetupProducerAccounts

func (e EosioSystemTester) SetupProducerAccounts(accounts []common.AccountName) *types.TransactionTrace

func (EosioSystemTester) Stake

func (EosioSystemTester) Stake2Votes

func (e EosioSystemTester) Stake2Votes(stake common.Asset) float64

func (EosioSystemTester) StakeWithTransfer

func (e EosioSystemTester) StakeWithTransfer(from common.AccountName, to common.AccountName, net common.Asset, cpu common.Asset) ActionResult

func (EosioSystemTester) Transfer

func (e EosioSystemTester) Transfer(from common.Name, to common.Name, amount common.Asset, manager common.Name)

func (EosioSystemTester) UnRegProxy

func (e EosioSystemTester) UnRegProxy(acnt common.AccountName) ActionResult

func (EosioSystemTester) UnStake

func (EosioSystemTester) Vote

func (EosioSystemTester) Voter

func (EosioSystemTester) VoterAccountAsset

func (e EosioSystemTester) VoterAccountAsset(acnt common.AccountName, voteStake common.Asset) common.Variants

type ValidatingTester

type ValidatingTester struct {
	BaseTester
	ValidatingControl                 *Controller
	VCfg                              Config
	NumBlocksToProducerBeforeShutdown uint32
	SkipValidate                      bool
}

func NewValidatingTesterTrustedProducers

func NewValidatingTesterTrustedProducers(trustedProducers *AccountNameSet) *ValidatingTester

func (*ValidatingTester) CreateDefaultAccount

func (vt *ValidatingTester) CreateDefaultAccount(name common.AccountName) *types.TransactionTrace

func (ValidatingTester) DefaultProduceBlock

func (vt ValidatingTester) DefaultProduceBlock() *types.SignedBlock

func (ValidatingTester) ProduceBlock

func (vt ValidatingTester) ProduceBlock(skipTime common.Microseconds, skipFlag uint32) *types.SignedBlock

func (ValidatingTester) ProduceBlocks

func (vt ValidatingTester) ProduceBlocks(n uint32, empty bool)

func (ValidatingTester) ProduceEmptyBlock

func (vt ValidatingTester) ProduceEmptyBlock(skipTime common.Microseconds, skipFlag uint32) *types.SignedBlock

func (ValidatingTester) PushAction

func (vt ValidatingTester) PushAction(act *types.Action, authorizer common.AccountName) ActionResult

func (ValidatingTester) Validate

func (vt ValidatingTester) Validate() bool

func (ValidatingTester) ValidatePushBlock

func (vt ValidatingTester) ValidatePushBlock(sb *types.SignedBlock)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL