@@ -8,10 +8,13 @@ import {
88 Message ,
99 Step ,
1010 Verbosity ,
11- WASM
11+ WASM ,
12+ WARDuino
1213} from '../../src/index' ;
1314import dump = Message . dump ;
1415import stepOver = Message . stepOver ;
16+ import Inspect = WARDuino . Inspect ;
17+ import State = WARDuino . State ;
1518
1619const framework = Framework . getImplementation ( ) ;
1720
@@ -74,16 +77,16 @@ const DUMP: Step = {
7477 title : 'Send DUMP command' ,
7578 instruction : { kind : Kind . Request , value : Message . dump } ,
7679 expected : [
77- { 'pc' : { kind : 'description' , value : Description . defined } as Expected < string > } ,
78- {
79- 'breakpoints' : {
80- kind : 'comparison' , value : ( state : Object , value : Array < any > ) => {
81- return value . length === 0 ;
82- } , message : 'list of breakpoints should be empty'
83- } as Expected < Array < any > >
84- } ,
85- { 'callstack[0].sp' : { kind : 'primitive' , value : - 1 } as Expected < number > } ,
86- { 'callstack[0].fp' : { kind : 'primitive' , value : - 1 } as Expected < number > } ]
80+ { 'pc' : { kind : 'description' , value : Description . defined } as Expected < string > } ,
81+ {
82+ 'breakpoints' : {
83+ kind : 'comparison' , value : ( state : Object , value : Array < any > ) => {
84+ return value . length === 0 ;
85+ } , message : 'list of breakpoints should be empty'
86+ } as Expected < Array < any > >
87+ } ,
88+ { 'callstack[0].sp' : { kind : 'primitive' , value : - 1 } as Expected < number > } ,
89+ { 'callstack[0].fp' : { kind : 'primitive' , value : - 1 } as Expected < number > } ]
8790} ;
8891
8992debug . test ( {
@@ -92,5 +95,25 @@ debug.test({
9295 steps : [ DUMP ]
9396} ) ;
9497
98+ const reverse = framework . suite ( 'Test Reverse interface' ) ;
99+ reverse . testee ( 'emulator[:8530]' , new EmulatorSpecification ( 8530 ) ) ;
100+
101+ reverse . test ( {
102+ title : 'Test snapshot' ,
103+ program : 'tests/examples/blink.wast' ,
104+ steps : [ {
105+ title : 'Test IO snapshot' ,
106+ instruction : { kind : Kind . Request , value : Message . inspect ( [ Inspect . io ] ) } ,
107+ expected : [ {
108+ 'io' : {
109+ kind : 'comparison' , value : ( state : State ) => state . io ?. length === 0
110+ }
111+ } ] ,
112+ } ,
113+ new Invoker ( 'read' , [ WASM . i32 ( BigInt ( 15 ) ) ] , WASM . i32 ( BigInt ( 0 ) ) ) ,
114+ new Invoker ( 'write' , [ WASM . i32 ( BigInt ( 15 ) ) , WASM . i32 ( BigInt ( 1 ) ) ] , undefined ) ,
115+ new Invoker ( 'read' , [ WASM . i32 ( BigInt ( 15 ) ) ] , WASM . i32 ( BigInt ( 1 ) ) ) ]
116+ } )
117+
95118framework . reporter . verbosity ( Verbosity . debug ) ;
96- framework . analyse ( [ spec , debug ] ) ;
119+ framework . analyse ( [ spec , debug , reverse ] ) ;
0 commit comments