• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 { fun1, fun2, fun4, fun5,fun6 } = require("./out/build/Release/napitest")
16var assert = require("assert");
17
18describe('any[]', function () {
19
20    // function fun1(v1: any[]): number;
21    it('test fun1', function () {
22        let ret = fun1(['a', 'b', 'c', 'd']);
23        assert.strictEqual(ret, 0);
24    });
25
26    // function fun1(v1: any[]): number;
27    it('test fun1', function () {
28        let ret = fun1([1, 2, 3, 4]);
29        assert.strictEqual(ret, 0);
30    });
31
32    // function fun2(v1: Array<any>): number;
33    it('test fun2', function () {
34        let ret = fun2([true, true, false, false]);
35        assert.strictEqual(ret, 0);
36    });
37
38    // function fun4(v1: Array<any>, v: number): number;
39    it('test fun4 string', function () {
40        let ret = fun4(['a', 'b', 'c', 'd'], 0);
41        assert.strictEqual(ret, 0);
42    });
43
44    // function fun4(v1: Array<any>, v: number): number;
45    it('test fun4 number', function () {
46        let ret = fun4([1, 2, 3, 4], 0);
47        assert.strictEqual(ret, 0);
48    });
49
50    it('test fun4 boolean', function () {
51        let ret = fun4([true,false,false,true], 0);
52        assert.strictEqual(ret, 0);
53    });
54
55    // function fun5(v: number, v1: Array<any>): number;
56    it('test fun5', function () {
57        let ret = fun5(0, ['a', 'b', 'c', 'd']);
58        assert.strictEqual(ret, 0);
59    });
60
61    // function fun6(v: number, v1: any): number;
62    it('test fun6 string', function () {
63        let ret = fun6(0, 'd');
64        assert.strictEqual(ret, 0);
65    });
66
67    // function fun6(v: number, v1: any): number;
68    it('test fun6 number', function () {
69        let ret = fun6(0, 1);
70        assert.strictEqual(ret, 0);
71    });
72
73    // function fun6(v: number, v1: any): number;
74    it('test fun6 boolean', function () {
75        let ret = fun6(0, true);
76        assert.strictEqual(ret, 0);
77    });
78});
79
80