Draft: Testing framework: add support for baking multiple operations at once
Motivation and Context
Description
In this MR we include a new module Test.Incremental
that can be used to bake a block incrementally.
We also re-implement transfer functions in terms of creating an incremental with a single op.
Component
-
compiler -
website -
webide -
vscode-plugin -
debugger
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to not work as expected) -
Performance improvement (non-breaking change that improves performance) -
None (change with no changelog)
Changelog
A new module Test.Incremental
is added to the stdlib. It comes with new functions for baking blocks incrementally:
let test_increment =
let () = Test.println "Increment" in
let () = Test.reset_state 10n ([] : tez list) in
let () = Test.log (Test.get_time ()) in
let (taddr, _, _) =
Test.originate_module (contract_of IncDec) initial_storage 0mutez in
let contr = Test.to_contract taddr in
let a_ = Test.nth_bootstrap_account 0 in
let b_ = Test.nth_bootstrap_account 1 in
let c_ = Test.nth_bootstrap_account 2 in
let d_ = Test.nth_bootstrap_account 3 in
let op0 = Test.Incremental.transfer contr (Increment 0) 0mutez a_ in
let op1 = Test.Incremental.transfer contr (Increment 1) 0mutez b_ in
let op2 = Test.Incremental.transfer contr (Increment 2) 0mutez c_ in
let op3 = Test.Incremental.transfer contr (Increment 3) 0mutez d_ in
let ops : Test.Incremental.operation list = [op0; op1; op2; op3] in
let () = Test.Incremental.bake_exn ops in
let () = Test.log (Test.get_time ()) in
assert (Test.get_storage taddr = initial_storage + 6)
All transfers in the example are baked together. See API docs. for further information.
Checklist:
-
If a new syntax has been introduced, put a message on slack ligo-lsp -
Changes follow the existing coding style (use dune @fmt
to check). -
Tests for the changes have been added (for bug fixes / feature). -
Documentation has been updated. -
Changelog description has been added (if appropriate). -
Start titles under ## Changelog
section with #### (if appropriate). -
There is no image or uploaded file in changelog -
Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by E. Rivas