Skip to content

Commit

Permalink
chore: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed May 20, 2024
1 parent de23f4b commit 1cf3b4e
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,25 +407,23 @@ const testFunction = () => {
deepStrictEqual(f, [101, 202, 303]);
deepStrictEqual(g, person);
logGreen("test function succeed");
// free function memory when it not in use
setTimeout(() => {
freePointer({
paramsType: [funcConstructor({
paramsType: [
DataType.I32,
DataType.Boolean,
DataType.String,
DataType.Double,
arrayConstructor({ type: DataType.StringArray, length: 2 }),
arrayConstructor({ type: DataType.I32Array, length: 3 }),
personType,
],
retType: DataType.Void,
})],
paramsValue: funcExternal,
pointerType: PointerType.RsPointer
})
}, 1000)
// free function memory which malloc in c side when it not in use
freePointer({
paramsType: [funcConstructor({
paramsType: [
DataType.I32,
DataType.Boolean,
DataType.String,
DataType.Double,
arrayConstructor({ type: DataType.StringArray, length: 2 }),
arrayConstructor({ type: DataType.I32Array, length: 3 }),
personType,
],
retType: DataType.Void,
})],
paramsValue: funcExternal,
pointerType: PointerType.RsPointer
})
if (!process.env.MEMORY) {
close("libsum");
}
Expand Down

0 comments on commit 1cf3b4e

Please sign in to comment.