mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
695 B
37 lines
695 B
'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);
|
|
|