package octez-protocol-alpha-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/octez-protocol-alpha-libs.test-helpers/Tezos_alpha_test_helpers/Scenario_base/index.html
Module Tezos_alpha_test_helpers.Scenario_base
Source
This module gathers the basic operations used in test scenarios. This includes starting a scenario, baking, checking and manipulating the state, and various wait functions
For assert_failure
, when expected error does not match the actual error.
For assert_failure
, when scenario actually succeeds when expected to fail.
Usual threaded state for the tests. Contains the current block, pending operations and the known State.t
val log :
?level:Tezt_core.Cli.Logs.level ->
?color:Tezt_core.Log.Color.t ->
('a, Format.formatter, unit, ('b, 'b) Scenario_dsl.scenarios) format4 ->
'a
Sets the de facto baker for all future blocks
Exclude a list of delegates from baking
Unsets the baking policy, it returns to default (By_round 0
)
val snapshot_balances :
Tezos_base.TzPervasives.String.Map.key ->
Tezos_base.TzPervasives.String.Map.key list ->
(t, t) Scenario_dsl.scenarios
Creates a snapshot of the current balances for the given account names. Can be used to check that balances at point A and B in the execution of a test are the same (either nothing happened, or a succession of actions resulted in getting the same values as before
val check_snapshot_balances :
?f:
(name:Tezos_base.TzPervasives.String.Map.key ->
old_balance:State_account.balance ->
new_balance:State_account.balance ->
(unit, Tezos_base.TzPervasives.tztrace) result Lwt.t) ->
Tezos_base.TzPervasives.String.Map.key ->
(t, t) Scenario_dsl.scenarios
Check balances against a previously defined snapshot
Save the current issuance rate for future use
Check that f saved_rate current_rate
is true. f
is typically a comparison function
val check_failure_aux :
?loc:string ->
?expected_error:('a -> Tezos_base.TzPervasives.tztrace) ->
('a -> 'b Tezos_base.TzPervasives.tzresult Lwt.t) ->
'a ->
'a Tezos_base.TzPervasives.tzresult Lwt.t
val check_fail_and_rollback :
?loc:string ->
?expected_error:('a -> Tezos_base.TzPervasives.tztrace) ->
('a, 'b) Scenario_dsl.single_scenario ->
'a ->
'a Tezos_base.TzPervasives.tzresult Lwt.t
val assert_failure :
?loc:string ->
?expected_error:('a -> Tezos_base.TzPervasives.tztrace) ->
('a, 'b) Scenario_dsl.scenarios ->
('a, 'a) Scenario_dsl.scenarios
Useful function to test expected failures: runs the given branch until it fails, then rollbacks to before execution. Fails if the given branch Succeeds
val assert_success :
?loc:string ->
('a, 'b) Scenario_dsl.scenarios ->
('a, 'a) Scenario_dsl.scenarios
Check a scenario does not fail, and rolls back to before the assert
Loop
val loop_action :
int ->
('a -> 'a Tezos_base.TzPervasives.tzresult Lwt.t) ->
('a, 'a) Scenario_dsl.scenarios
val check_balance_field :
Tezos_base.TzPervasives.String.Map.key ->
[< `Bonds
| `Liquid
| `Staked
| `Total
| `Unstaked_finalizable
| `Unstaked_frozen_total ] ->
Tezos_protocol_alpha.Protocol.Alpha_context.Tez.t ->
(t, t) Scenario_dsl.scenarios
Check a specific balance field for a specific account is equal to a specific amount
val check_balance_fields :
Tezos_base.TzPervasives.String.Map.key ->
liquid:Tezos_protocol_alpha.Protocol.Alpha_context.Tez.t ->
staked:Tezos_protocol_alpha.Protocol.Alpha_context.Tez.t ->
?unstaked_frozen_total:Tezos_alpha_test_helpers.State_account.Tez.t ->
unit ->
(t, t) Scenario_dsl.scenarios