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_dsl/index.html
Module Tezos_alpha_test_helpers.Scenario_dsl
Source
type ('input, 'output) scenarios =
| Action : ('input -> 'output Tezos_base.TzPervasives.tzresult Lwt.t) -> ('input, 'output) scenarios
| Empty : ('t, 't) scenarios
| Concat : (('a, 'b) scenarios * ('b, 'c) scenarios) -> ('a, 'c) scenarios
| Branch : (('a, 'b) scenarios * ('a, 'b) scenarios) -> ('a, 'b) scenarios
| Tag : string -> ('t, 't) scenarios
| Slow : ('t, 't) scenarios
A scenario is a succession of actions. We define a branching path as a way to create multiple tests from the same point. This allows easy compositionality of behaviors with minimal code sharing. The Tag
allows to give meaningful identifiers to the branches. It is good practice to tag each case in a branch (it's not necessary, but since test names must be unique, at most one branch can remain unnamed, and even then it can create conflicting names.)
type ('input, 'output) single_scenario =
| End_scenario : ('t, 't) single_scenario
| Cons : (('input -> 't Tezos_base.TzPervasives.tzresult Lwt.t) * ('t, 'output) single_scenario) -> ('input, 'output) single_scenario
Unfolded scenario type
val cat_ss :
'a 'b 'c. ('a, 'b) single_scenario ->
('b, 'c) single_scenario ->
('a, 'c) single_scenario
val unfold_scenarios :
'input 'output. ('input, 'output) scenarios ->
(('input, 'output) single_scenario * string list * bool) list
val run_scenario :
'input 'output. ('input, 'output) single_scenario ->
'input ->
'output Tezos_base.TzPervasives.tzresult Lwt.t
Useful aliases and operators
Continuation connector: execute a then b
Branching connector: creates two tests with different execution paths
Transforms scenarios into tests
Arbitrary execution
val exec_state :
(('a * 'b) -> ('c, Tezos_base.TzPervasives.tztrace) result Lwt.t) ->
('a * 'b, 'a * 'c) scenarios
Execute a function that does not modify the block, only the state
val exec_unit :
('a -> (unit, Tezos_base.TzPervasives.tztrace) result Lwt.t) ->
('a, 'a) scenarios
Execute a function that does not modify neither the block nor the state. Usually used for checks/asserts
fold f l
folds f
over l
, fails on empty list
fold_tag f l
folds f
over l
, l
has a tag for each of its elements. Fails on empty list.