1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
'use strict';
const common = require('../../common');
const assert = require('assert');
// Testing api calls for arrays
const test_array = require(`./build/${common.buildType}/test_array`);
const array = [
1,
9,
48,
13493,
9459324,
{ name: 'hello' },
[
'world',
'node',
'abi'
]
];
assert.strictEqual(test_array.Test(array, array.length + 1),
'Index out of bound!');
assert.throws(
() => {
test_array.Test(array, -2);
},
/Invalid index\. Expects a positive integer\./
);
array.forEach(function(element, index) {
assert.strictEqual(test_array.Test(array, index), element);
});
assert.deepStrictEqual(test_array.New(array), array);
|