Module test

Source
Expand description

Operations on the off-chain testing environment.

Macros§

pay_with_call
Prepend contract message call with value transfer. Used for tests in off-chain environment.

Structs§

CallData
The raw ABI respecting input data to a call.
ChainSpec
The chain specification.
DefaultAccounts
The default accounts.
EmittedEvent
Record for an emitted event.

Traits§

ChainExtension
Types implementing this trait can be used as chain extensions.

Functions§

advance_block
Advances the chain by a single block.
assert_contract_termination
Tests if a contract terminates successfully after self.env().terminate() has been called.
callee
Gets the currently set callee.
count_used_storage_cells
Returns the amount of storage cells used by the contract addr.
default_accounts
Returns the default accounts for testing purposes: Alice, Bob, Charlie, Django, Eve and Frank. todo should be default_addresses
get_account_balance
Returns the balance of the account.
get_contract_storage_rw
Returns the total number of reads and writes of the contract’s storage.
get_return_value
Retrieves the value stored by return_value().
is_contract
Returns a boolean to indicate whether an account is a contract
recorded_events
Returns the recorded emitted events in order.
register_chain_extension
Registers a new chain extension.
run_test
Runs the given closure test function with the default configuration for the off-chain environment.
set_account_balance
Sets the balance of the account to the given balance.
set_block_number
Sets the block number for the next advance_block invocation.
set_block_timestamp
Sets the block timestamp for the next advance_block invocation.
set_callee
Sets the callee for the next call.
set_caller
Sets a caller for the next call.
set_clear_storage_disabled
Set to true to disable clearing storage
set_contract
Sets an account as a contract
set_value_transferred
Sets the value transferred from the caller to the callee as part of the call.
transfer_in
Transfers value from the caller account to the contract.
upload_code
Gets a pseudo code hash for a contract ref.