tests

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommitteeAcc *wallet.Account

CommitteeAcc is an account used to sign tx as a committee.

Functions

func AddBlock

func AddBlock(t *testing.T, bc *core.Blockchain, txs ...*transaction.Transaction) *block.Block

AddBlock creates a new block from provided transactions and adds it on bc.

func AddBlockCheckHalt

func AddBlockCheckHalt(t *testing.T, bc *core.Blockchain, txs ...*transaction.Transaction) *block.Block

AddBlockCheckHalt is a convenient wrapper over AddBlock and CheckHalt.

func CheckFault

func CheckFault(t *testing.T, bc *core.Blockchain, h util.Uint256, s string)

CheckFault checks that transaction persisted with FAULT state. Raised exception is also checked to contain s as a substring.

func CheckHalt

func CheckHalt(t *testing.T, bc *core.Blockchain, h util.Uint256, stack ...stackitem.Item) *state.AppExecResult

CheckHalt checks that transaction persisted with HALT state.

func CheckTestInvoke

func CheckTestInvoke(t *testing.T, bc *core.Blockchain, tx *transaction.Transaction, expected interface{})

CheckTestInvoke executes transaction without persisting it's state and compares the result with the expected.

func DeployContract

func DeployContract(t *testing.T, bc *core.Blockchain, path string, data interface{}) util.Uint160

DeployContract compiles and deploys contract to bc. path should contain Go source files. data is an optional argument to `_deploy`.

func NewAccount

func NewAccount(t *testing.T, bc *core.Blockchain) *wallet.Account

NewAccount creates new account and transfers 100.0 GAS to it.

func NewChain

func NewChain(t *testing.T) *core.Blockchain

NewChain creates new blockchain instance with a single validator and setups cleanup functions.

func PrepareInvoke

func PrepareInvoke(t *testing.T, bc *core.Blockchain, signer interface{},
	hash util.Uint160, method string, args ...interface{}) *transaction.Transaction

PrepareInvoke creates new invocation transaction. Signer can be either bool or *wallet.Account. In the first case `true` means sign by committee, `false` means sign by validators.

func TestInvoke

func TestInvoke(bc *core.Blockchain, tx *transaction.Transaction) (*vm.VM, error)

TestInvoke creates a test VM with dummy block and executes transaction in it.

Types

type Contract

type Contract struct {
	Hash     util.Uint160
	NEF      *nef.File
	Manifest *manifest.Manifest
}

Contract contains contract info for deployment.

func ContractInfo

func ContractInfo(sender util.Uint160, ctrPath string) (*Contract, error)

ContractInfo compiles contract and returns it's NEF, manifest and hash.

Jump to

Keyboard shortcuts

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