• Home
  • Raw
  • Download

Lines Matching full:array

17  * @tc.name:array
18 * @tc.desc:test Array
22 var arr = new Array(100);
30 var arr2 = new Array(100);
74 // Test on Array::Splice
75 var arr9 = new Array(9);
83 var arr10 = new Array(9);
91 var arr11 = new Array(9);
99 var arr12 = new Array(9);
107 var arr13 = new Array(9);
115 var arr14 = Array.apply(null, Array(16));
117 var arr15 = Array.apply(null, [1, 2, 3, 4, 5, 6]);
121 print(Array(5).indexOf(a));
130 const v20 = new Array(2);
165 const arrs = new Array(6);
195 print("======== Begin: Array.prototype.reverse() ========");
217 print("======== End: Array.prototype.reverse() ========");
219 print("======== Begin: Array.prototype.indexOf() & Array.prototype.lastIndexOf() ========");
316 // https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.indexof
327 // https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.lastindexof
340 for (let method of [Array.prototype.indexOf, Array.prototype.lastIndexOf]) {
354 print("======== End: Array.prototype.indexOf() & Array.prototype.lastIndexOf() ========");
356 // Test Array.prototype.filter when callbackFn is not callable
373 print(Array.prototype.concat.apply(obj))
392 class MyObserveArrray extends Array {
438 arr = new Array(1026);
442 arr = new Array(1026);
446 arr = new Array(1026);
478 …Error, URIError, String, BigInt, Function, Number, Boolean, Date, RegExp, Array, ArrayBuffer, Data…
489 Array.prototype.length = 3000; class
490 print(Array.prototype.length)
492 let unscopables1 = Array.prototype[Symbol.unscopables];
493 let unscopables2 = Array.prototype[Symbol.unscopables];
505 var arr_copywithin2 = new Array();
507 var arr_copywithin3 = new Array();
514 var arr_copywithin4 = new Array();
549 var arr_every2 = new Array();
551 function testEvery(element, index, array) { argument
553 array.length = 6;
558 function testEvery4(element, index, array) { argument
559 array.pop();
560 array.pop();
561 array.pop();
566 var arr_every3 = new Array();
573 var arr_every4 = new Array();
586 var arr_reduceRight2 = new Array();
588 function testReduceRight(accumulator, element, index, array) { argument
590 array.length = 6;
595 function testReduceRight4(accumulator, element, index, array) { argument
596 array.pop();
597 array.pop();
602 var arr_reduceRight3 = new Array();
609 var arr_reduceRight4 = new Array();
622 var arr_some2 = new Array();
624 function testSome(element, index, array) { argument
626 array.length = 6;
632 var arr_some3 = new Array();
681 var arr_toSorted2 = new Array();
787 v23.filter(Array);
885 * @tc.desc:test Array
898 [Array.from([1, 2, 3]), Array.from([4, 5, 6])],
920 const arr2 = new Array(-1);
927 * @tc.desc:test Array
930 const newArray = Array.from(originalArrays);
931 newArray.forEach(array => {
932 print(array);
936 Array.from([1, 2, 3], "not a function");
942 Array.from([1, 2, 3], () => { throw new Error("Something went wrong"); });
948 Array.from(123);
949 Array.from({});
950 Array.from([1, 2, 3], () => {}, 123);
958 * @tc.desc:test Array
961 originalArrays.forEach((array, index) => {
962 print(Array.isArray(array));
966 print(Array.isArray());
967 print(Array.isArray(123));
968 print(Array.isArray("not an array"));
969 print(Array.isArray(null));
970 print(Array.isArray(undefined));
977 * @tc.desc:test Array
980 const ArrayOf = Array.of(...originalArrays);
984 const arr1 = Array.of(undefined);
985 const arr2 = Array.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
994 * @tc.desc:test Array
1014 * @tc.desc:test Array
1022 print("Concatenated Array:", concatenatedArray);
1026 print("Nested Concatenated Array:", nestedConcatenatedArray);
1029 print("Mixed Concatenated Array:", mixedConcatenatedArray);
1032 print("Spread Concatenated Array:", spreadConcatenatedArray);
1036 * @tc.desc:test Array
1046 print("Copied Array 1:", copiedArray1);
1047 print("Copied Array 2:", copiedArray2);
1048 print("Copied Array 3:", copiedArray3);
1049 print("Copied Array 4:", copiedArray4);
1050 print("Copied Array 5:", copiedArray5);
1059 * @tc.desc:test Array
1102 * @tc.desc:test Array
1115 const array4 = new Array(5);
1118 const array5 = Array.from({ length: 5 }, (_, index) => index + 1);
1121 const array6 = Array.from({ length: 5 }, (_, index) => index + 1);
1124 const array7 = Array(5).fill("hello");
1150 * @tc.desc:test Array
1197 * @tc.desc:test Array
1201 const array = [6, 7, 8, 9, 10, NaN, undefined, null, "", false, {name: "John"}, [1, 2, 3]]; variable
1202 print(array.find(item => item === 5));
1203 print(array.find(item => item === 11));
1204 print(array.find(item => item > 5));
1205 print(array.find(item => item < 0));
1206 print(array.find(item => typeof item === 'string'));
1207 print(array.find(item => typeof item === 'object'));
1208 print(array.find(item => Array.isArray(item)));
1209 print(array.find(item => item));
1210 print(array.find(item => item === null));
1211 print(array.find(item => item === undefined));
1212 print(array.find(item => isNaN(item)));
1213 print(array.find(item => item === false));
1217 const array = [1, 2, 3, 4, 5]; variable
1218 print(array.find());
1224 const array = [1, 2, 3, 4, 5]; variable
1225 print(array.find("not a function"));
1231 let array = null;
1232 print(array.find(item => item === 1));
1238 array = undefined;
1239 print(array.find(item => item === 1));
1246 * @tc.desc:test Array
1250 const array = [6, 7, 8, 9, 10, NaN, undefined, null, "", false, {name: "John"}, [1, 2, 3]]; variable
1251 print(array.findIndex(item => item === 5));
1252 print(array.findIndex(item => item === 11));
1253 print(array.findIndex(item => item > 5));
1254 print(array.findIndex(item => item < 0));
1255 print(array.findIndex(item => typeof item === 'string'));
1256 print(array.findIndex(item => typeof item === 'object'));
1257 print(array.findIndex(item => Array.isArray(item)));
1258 print(array.findIndex(item => item));
1259 print(array.findIndex(item => item === null));
1260 print(array.findIndex(item => item === undefined));
1261 print(array.findIndex(item => isNaN(item)));
1262 print(array.findIndex(item => item === false));
1266 const array = [1, 2, 3, 4, 5]; variable
1267 print(array.findIndex());
1273 const array = [1, 2, 3, 4, 5]; variable
1274 print(array.findIndex("not a function"));
1280 let array = null;
1281 print(array.findIndex(item => item === 1));
1287 array = undefined;
1288 print(array.findIndex(item => item === 1));
1295 * @tc.desc:test Array
1299 const array = [6, 7, 8, 9, 10, NaN, undefined, null, "", false, {name: "John"}, [1, 2, 3]]; variable
1300 print(array.findLast(item => item === 5));
1301 print(array.findLast(item => item === 11));
1302 print(array.findLast(item => item > 5));
1303 print(array.findLast(item => item < 0));
1304 print(array.findLast(item => typeof item === 'string'));
1305 print(array.findLast(item => typeof item === 'object'));
1306 print(array.findLast(item => Array.isArray(item)));
1307 print(array.findLast(item => item));
1308 print(array.findLast(item => item === null));
1309 print(array.findLast(item => item === undefined));
1310 print(array.findLast(item => isNaN(item)));
1311 print(array.findLast(item => item === false));
1315 const array = [1, 2, 3, 4, 5]; variable
1316 print(array.findLast());
1322 const array = [1, 2, 3, 4, 5]; variable
1323 print(array.findLast("not a function"));
1329 let array = null;
1330 print(array.findLast(item => item === 1));
1336 array = undefined;
1337 print(array.findLast(item => item === 1));
1344 * @tc.desc:test Array
1348 const array = [6, 7, 8, 9, 10, NaN, undefined, null, "", false, {name: "John"}, [1, 2, 3]]; variable
1349 print(array.findLastIndex(item => item === 5));
1350 print(array.findLastIndex(item => item === 11));
1351 print(array.findLastIndex(item => item > 5));
1352 print(array.findLastIndex(item => item < 0));
1353 print(array.findLastIndex(item => typeof item === 'string'));
1354 print(array.findLastIndex(item => typeof item === 'object'));
1355 print(array.findLastIndex(item => Array.isArray(item)));
1356 print(array.findLastIndex(item => item));
1357 print(array.findLastIndex(item => item === null));
1358 print(array.findLastIndex(item => item === undefined));
1359 print(array.findLastIndex(item => isNaN(item)));
1360 print(array.findLastIndex(item => item === false));
1364 const array = [1, 2, 3, 4, 5]; variable
1365 print(array.findLastIndex());
1371 const array = [1, 2, 3, 4, 5]; variable
1372 print(array.findLastIndex("not a function"));
1378 let array = null;
1379 print(array.findLastIndex(item => item === 1));
1385 array = undefined;
1386 print(array.findLastIndex(item => item === 1));
1393 * @tc.desc:test Array
1397 const array = [1, 2, [3, 4, [5, 6]], [], [[7], 8], 9, [10]]; variable
1399 print(array.flat());
1400 print(array.flat(2));
1422 const array = [1, 2, [3, 4]]; variable
1423 print(array.flat('string'));
1429 const array = [1, 2, [3, 4]]; variable
1430 print(array.flat(-1));
1437 * @tc.desc:test Array
1441 const array = [1, 2, 3]; variable
1442 print(array.flatMap(x => [x, x * 2]));
1443 print(array.flatMap(x => []));
1444 print(array.flatMap(x => x * 2));
1445 print(array.flatMap((x, index) => [x, index]));
1452 print(array.flatMap(x => x % 2 === 0 ? [x, x * 2] : x));
1457 * @tc.desc:test Array
1460 originalArrays.forEach(array => {
1461 array.forEach(item => {
1467 const array = [1, 2, 3]; variable
1468 array.forEach('not a function');
1475 * @tc.desc:test Array
1479 { array: [1, 2, 3, 4, 5], target: 3 }, property
1480 { array: [1, 2, 3, 4, 5], target: 6 }, property
1481 { array: [NaN, 2, 3], target: NaN }, property
1482 { array: [undefined, 2, 3], target: undefined }, property
1483 { array: ["apple", "banana", "orange"], target: "banana" }, property
1484 { array: ["apple", "banana", "orange"], target: "grape" }, property
1485 { array: [], target: 1 }, property
1486 { array: [true, false, true], target: true }, property
1487 { array: [true, false, true], target: false }, property
1488 { array: [Infinity, -Infinity], target: Infinity }, property
1489 { array: [Infinity, -Infinity], target: -Infinity }, property
1490 { array: [new Map(), new Map()], target: new Map() }, property
1491 { array: [new Set(), new Set()], target: new Set() }, property
1494 testCases.forEach(({ array, target }) => { property
1495 const result = array.includes(target);
1496 print(`Array: [${array.join(', ')}], Target: ${target}, Result: ${result}`);
1501 * @tc.desc:test Array
1518 print("not an array".indexOf(1));
1523 * @tc.desc:test Array
1542 * @tc.desc:test Array
1576 * @tc.desc:test Array
1599 * @tc.desc:test Array
1630 * @tc.desc:test Array
1656 * @tc.desc:test Array
1690 * @tc.desc:test Array
1713 * @tc.desc:test Array
1736 * @tc.desc:test Array
1759 * @tc.desc:test Array
1786 * @tc.desc:test Array
1809 * @tc.desc:test Array
1836 * @tc.desc:test Array
1863 * @tc.desc:test Array
1890 * @tc.desc:test Array
1894 let array = ["apple", "banana", "cherry"]; variable
1895 let string = array.toString();
1909 * @tc.desc:test Array
1936 * @tc.desc:test Array
1994 * @tc.desc:test Array
1999 print(Array.isArray([]));
2000 print(Array.isArray([1]));
2001 print(Array.isArray(new Array()));
2002 print(Array.isArray(new Array("a", "b", "c", "d")));
2003 print(Array.isArray(new Array(3)));
2004 print(Array.isArray(Array.prototype));
2007 print(Array.isArray());
2008 print(Array.isArray({}));
2009 print(Array.isArray(null));
2010 print(Array.isArray(undefined));
2011 print(Array.isArray(17));
2012 print(Array.isArray("Array"));
2013 print(Array.isArray(true));
2014 print(Array.isArray(false));
2015 print(Array.isArray(new Uint8Array(32)));
2016 print(Array.isArray({ __proto__: Array.prototype }));
2028 Array.prototype.__proto__ = null;
2029 var vp = Array.prototype;
2033 Array.prototype.__proto__ = Object.prototype;