tests/index.jsView |
---|
22 | 22 | writeMem (offset, val) { |
23 | 23 | return this.wasmContainer.setMemory(offset, [val]) |
24 | 24 | } |
25 | 25 | |
| 26 | + numOfReferances () { |
| 27 | + return this.wasmContainer.referanceMap.size |
| 28 | + } |
| 29 | + |
26 | 30 | async callback (cb) { |
27 | 31 | const promise = new Promise((resolve, reject) => { |
28 | 32 | resolve() |
29 | 33 | }) |
45 | 49 | })) |
46 | 50 | instance.message(instance.createMessage()) |
47 | 51 | }) |
48 | 52 | |
| 53 | + tape('referances', async t => { |
| 54 | + t.plan(1) |
| 55 | + const hypervisor = new Hypervisor(node.dag) |
| 56 | + const main = fs.readFileSync(`${__dirname}/wasm/referances.wasm`) |
| 57 | + hypervisor.registerContainer(WasmContainer, { |
| 58 | + env: ContainerTestInterface, |
| 59 | + test: testInterface(t) |
| 60 | + }) |
| 61 | + const ports = hypervisor.createChannel() |
| 62 | + await hypervisor.createInstance(WasmContainer.typeId, new Message({ |
| 63 | + data: main, |
| 64 | + ports: ports |
| 65 | + })) |
| 66 | + }) |
| 67 | + |
49 | 68 | tape('wasm container - mem', async t => { |
50 | 69 | t.plan(1) |
51 | 70 | try { |
52 | 71 | const hypervisor = new Hypervisor(node.dag) |