Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Latest commit

 

History

History
49 lines (39 loc) · 988 Bytes

ewasm-test.md

File metadata and controls

49 lines (39 loc) · 988 Bytes

Testing

We make use of the testing module for Wasm, which will let us make assertions about the Wasm runtime state.

requires "test.k" // WASM-TEST
requires "driver.k"

module EWASM-TEST-SYNTAX
   imports WASM-TEST-SYNTAX
   imports EWASM-TEST
endmodule
module EWASM-TEST
  imports WASM-TEST
  imports DRIVER

Grouping sorts.

    syntax EthereumCommand ::= Assertion | Action
 // ---------------------------------------------
    syntax Action ::= "#clearEwasmConfig"
 // -------------------------------------
    rule <k> #clearEwasmConfig => #clearConfig ... </k>
         <eeiK> . => EEI.clearConfig ... </eeiK>

Assertions

    syntax Assertion ::= "#assertReturnData" CallData WasmString
 // ------------------------------------------------------------
    rule <k> #assertReturnData DATA MSG => . ... </k>
         <returnData> BYTES </returnData>
      requires CallData2Bytes(DATA) ==K BYTES
endmodule