iotex-core: Index | Files

package testutil

import ""


Package Files

cleanup.go gas.go network.go signedaction.go timestamp.go wait.go


const TestGasLimit uint64 = 20000

TestGasLimit represents the gas limit used for test actions

const TestGasPriceInt64 = 0

TestGasPriceInt64 represents the gas price for test actions in int64


var ErrTimeout = errors.New("timed out")

ErrTimeout is returned when time is up

var TestGasPrice = big.NewInt(unit.Qev)

TestGasPrice represents the gas price for test actions in big int

func CleanupPath Uses

func CleanupPath(t *testing.T, path string)

CleanupPath detects the existence of test DB file and removes it if found

func RandomPort Uses

func RandomPort() int

RandomPort returns a random port number between 30000 and 50000

func SignalChan Uses

func SignalChan(interval, timeout time.Duration) <-chan struct{}

SignalChan returns a channel that will be written every interval until timeout

func SignedExecution Uses

func SignedExecution(contractAddr string, executorPriKey crypto.PrivateKey, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) (action.SealedEnvelope, error)

SignedExecution return a signed execution

func SignedTransfer Uses

func SignedTransfer(recipientAddr string, senderPriKey crypto.PrivateKey, nonce uint64, amount *big.Int, payload []byte, gasLimit uint64, gasPrice *big.Int) (action.SealedEnvelope, error)

SignedTransfer return a signed transfer

func TimestampNow Uses

func TimestampNow() time.Time

TimestampNow returns current time from new clock

func TimestampNowFromClock Uses

func TimestampNowFromClock(c clock.Clock) time.Time

TimestampNowFromClock get now time from specific clock

func WaitUntil Uses

func WaitUntil(interval, timeout time.Duration, f CheckCondition) error

WaitUntil periodically checks whether the condition specified in CheckCondition function is satisfied If an error is returned, it either comes from CheckCondition function or time is up before the given condition is satisfied

type CheckCondition Uses

type CheckCondition func() (bool, error)

CheckCondition defines a func type that checks whether a certain condition is satisfied

Package testutil imports 13 packages (graph) and is imported by 1 packages. Updated 2019-11-06. Refresh now. Tools for package owners.