1/* 2* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15const test = require("./out/build/Release/napitest") 16var assert = require("assert"); 17 18describe('[]', function () { 19 // function testArray(v: string[]): string[]; 20 it('test testArray', function () { 21 let ret = test.testArray(['kkk', 'hhh']); 22 assert.deepStrictEqual(ret, []); 23 }); 24 25 // function testArray1(v: number[]): number[]; 26 it('test testArray1', function () { 27 let ret = test.testArray1([15, 18]); 28 assert.deepStrictEqual(ret, []); 29 }); 30 31 // function testArray2(v: boolean[]): boolean[]; 32 it('test testArray2', function () { 33 let ret = test.testArray2([true, false]); 34 assert.deepStrictEqual(ret, []); 35 }); 36 37 // function fun4(v1: string[], v2: Test[]): number[]; 38 it('test fun4', function () { 39 let ret = test.fun4( 40 ['kkk', 'hhh'], [{ 'name': 'kkk', 'age': 18 }, 41 { 'name': 'kkk', 'age': 18 }]); 42 assert.strictEqual(JSON.stringify(ret), '[]'); 43 }); 44 45 // function fun5(v1: number[], v2: Test[]): string[]; 46 it('test fun5', function () { 47 let ret = test.fun5([12, 18], 48 [{ 'name': 'kkk', 'age': 18 }, { 'name': 'kkk', 'age': 18 }]); 49 assert.strictEqual(JSON.stringify(ret), '[]'); 50 }); 51 52 // function fun6(v1: boolean[], v2: Test[]): boolean[]; 53 it('test fun6', function () { 54 let ret = test.fun6([true, false], 55 [{ 'name': 'kkk', 'age': 18 }, { 'name': 'kkk', 'age': 18 }]); 56 assert.strictEqual(JSON.stringify(ret), '[]'); 57 }); 58 59 // function fun21(v: string, v1: Entry[]): Entry[]; 60 it('test fun21', function () { 61 let ret = test.fun21('sdfghjk', 62 [{ key: [11,12],value: ['aa','bb'],isExit: [true,true]}, 63 { key: [13,14],value: ['cc','dd'],isExit: [false,false]}]); 64 assert.strictEqual(JSON.stringify(ret),'[]'); 65 }); 66}); 67