Files: 72a22f7318aa0ad186ba6c2b134f0d45a091a18d / tests / typeChecking.js
1032 bytesRaw
1 | const customTypes = require('../customTypes.js') |
2 | const WasmContainer = require('../wasmContainer.js') |
3 | const fs = require('fs') |
4 | |
5 | async 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 | |
33 | main() |
34 |
Built with git-ssb-web