git ssb

0+

wanderer🌟 / js-primea-hypervisor



Tree: 225da49428f17d7ef0fc980e3dbd3cda8967ae99

Files: 225da49428f17d7ef0fc980e3dbd3cda8967ae99 / tests / typeChecking.js

1032 bytesRaw
1const customTypes = require('../customTypes.js')
2const WasmContainer = require('../wasmContainer.js')
3const fs = require('fs')
4
5async function main () {
6 let callerJSON = JSON.parse(fs.readFileSync('./wast/caller.json'))
7 let callerWasm = fs.readFileSync('./wasm/caller.wasm')
8 callerWasm = customTypes.inject(callerWasm, callerJSON)
9
10 let recieverJSON = JSON.parse(fs.readFileSync('./wast/reciever.json'))
11 let recieverWasm = fs.readFileSync('./wasm/reciever.wasm')
12 recieverWasm = customTypes.inject(recieverWasm, recieverJSON)
13
14 const callerContainer = new WasmContainer()
15 callerContainer.onCreation(callerWasm)
16 callerJSON = callerContainer.json
17
18 const recieverContainer = new WasmContainer()
19 recieverContainer.onCreation(recieverWasm)
20 recieverJSON = recieverContainer.json
21
22 const callFuncRef = callerContainer.getFuncRef('call')
23
24 const funcRef = recieverContainer.getFuncRef('receive')
25 callFuncRef.args.push({
26 type: 'funcRef',
27 arg: funcRef
28 })
29
30 callerContainer.onMessage(callFuncRef)
31}
32
33main()
34

Built with git-ssb-web