(fn)
| 18 | after(() => lib.close()); |
| 19 | |
| 20 | function withAllocations(fn) { |
| 21 | const allocations = new Set(); |
| 22 | |
| 23 | function alloc(size) { |
| 24 | const ptr = symbols.allocate_memory(BigInt(size)); |
| 25 | allocations.add(ptr); |
| 26 | return ptr; |
| 27 | } |
| 28 | |
| 29 | try { |
| 30 | fn(alloc); |
| 31 | } finally { |
| 32 | for (const ptr of allocations) { |
| 33 | symbols.deallocate_memory(ptr); |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | test('ffi reads and writes integer and float values', () => { |
| 39 | withAllocations(common.mustCall((alloc) => { |
no test coverage detected
searching dependent graphs…