Documentation ¶
Index ¶
- Constants
- Variables
- func CleanupPath(t *testing.T, path string)
- func SignalChan(interval, timeout time.Duration) <-chan struct{}
- func SignedExecution(executor *iotxaddress.Address, contractAddr string, nonce uint64, ...) (*action.Execution, error)
- func SignedTransfer(sender *iotxaddress.Address, recipient *iotxaddress.Address, nonce uint64, ...) (*action.Transfer, error)
- func SignedVote(voter *iotxaddress.Address, votee *iotxaddress.Address, nonce uint64, ...) (*action.Vote, error)
- func TimestampNow() uint64
- func TimestampNowFromClock(c clock.Clock) uint64
- func WaitUntil(interval, timeout time.Duration, f CheckCondition) error
- type CheckCondition
Constants ¶
const EnableGasCharge bool = true
EnableGasCharge represents whether we enable gas charge in unit test
const TestGasLimit uint64 = 10000000
TestGasLimit represents the gas limit used for test actions
const TestGasPrice int64 = 0
TestGasPrice represents the gas price for test actions
Variables ¶
var ErrTimeout = errors.New("timed out")
ErrTimeout is returned when time is up
Functions ¶
func CleanupPath ¶
CleanupPath detects the existence of test DB file and removes it if found
func SignalChan ¶
SignalChan returns a channel that will be written every interval until timeout
func SignedExecution ¶ added in v0.4.0
func SignedExecution(executor *iotxaddress.Address, contractAddr string, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) (*action.Execution, error)
SignedExecution return a signed execution
func SignedTransfer ¶ added in v0.4.0
func SignedTransfer(sender *iotxaddress.Address, recipient *iotxaddress.Address, nonce uint64, amount *big.Int, payload []byte, gasLimit uint64, gasPrice *big.Int) (*action.Transfer, error)
SignedTransfer return a signed transfer
func SignedVote ¶ added in v0.4.0
func SignedVote(voter *iotxaddress.Address, votee *iotxaddress.Address, nonce uint64, gasLimit uint64, gasPrice *big.Int) (*action.Vote, error)
SignedVote return a signed vote
func TimestampNow ¶ added in v0.4.0
func TimestampNow() uint64
TimestampNow get now timestamp from new clock
func TimestampNowFromClock ¶ added in v0.4.0
TimestampNowFromClock get now timestamp from specific clock
func WaitUntil ¶
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
Types ¶
type CheckCondition ¶
CheckCondition defines a func type that checks whether a certain condition is satisfied