From f8fa03505677e4be58c928758a64c85ce007fc59 Mon Sep 17 00:00:00 2001 From: zhangyuang Date: Sun, 2 Mar 2025 00:39:18 +0800 Subject: [PATCH] chore: update test --- tests/index.ts | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/tests/index.ts b/tests/index.ts index c30c7ad..1ee4360 100644 --- a/tests/index.ts +++ b/tests/index.ts @@ -293,6 +293,18 @@ const testRunInNewThread = () => { } const testFunction = () => { + const funcDesc = 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.I32, + }) const func = (a, b, c, d, e, f, g) => { equal(a, 100); equal(b, false); @@ -304,36 +316,14 @@ const testFunction = () => { logGreen("test function succeed"); // 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, - })], + paramsType: [funcDesc], paramsValue: funcExternal, pointerType: PointerType.RsPointer }) return 100 }; const funcExternal = createPointer({ - 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.I32, - })], + paramsType: [funcDesc], paramsValue: [func] }) load({