1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 1410 151,1,0,0,1,1 16100 17,,0,0, 185 191,2,3,4,5 204 211,2,3,4 224 231,2,3,3 245 252,3,4,5,6 265,4,3,2,1 2710 28undefined 29undefined 30undefined 318 32undefined 339 340 359 362 371 38undefined 399 402 41undefined 421 439 4410 451 462 473 484 495 50undefined 51undefined 52undefined 53undefined 54undefined 559 5610 57undefined 58undefined 59undefined 60undefined 61undefined 62undefined 63undefined 641 652 663 6716 686 69-1 70The NewTarget is undefined 71undefined 721 736 746 75undefined 762 772 786,,4,3,2,1 791,2,3,4,,6 801,2,6,4,5 811,2,3,4,5 82Dec,Feb,Jan,Mar 83Mar,Jan,Feb,Dec 841,2,10,21 851,10,21,2 865,4,3,2,,0 87======== Begin: Array.prototype.reverse() ======== 88arr0.reverse() === arr0 ? true 89arr0.length after reverse() called = 0 90arr1.reverse() === arr1 ? true 91arr1 after reverse() called = 1 92arrWithHoles before reverse() called = ,1,,,4,,,,, 93arrWithHoles.reverse() = ,,,,,4,,,1, 94arrWithHoles after reverse() called = ,,,,,4,,,1, 95======== End: Array.prototype.reverse() ======== 96======== Begin: Array.prototype.indexOf() & Array.prototype.lastIndexOf() ======== 97arr = [0, 10, 20, 80, 40, Hole, undefined, 10, "80", Hole] 98Group 1: 0 <= fromIndex < arr.length: 4,-1,1,7,4,-1,7,1 99Group 2: -arr.length <= fromIndex < 0: -1,4,7,1,4,-1,1,-1,0,1,0,-1 100Group 3: fromIndex >= arr.length: -1,-1,-1,-1,0,0 101Group 4: fromIndex < -arr.length: 0,-1 102Group 5: fromIndex in [Infinity, -Infinity]: 1,-1,-1,7 103Group 6: fromIndex is NaN: 0,1,0,-1 104Group 7: fromIndex is not of type 'number': 7,1,7,7 105Group 8: Strict equality checking: 8,3 106Group 9: Searching undefined and null: 6,6,-1,6,6,-1 107Group 10: fromIndex with side effects: 108 - indexOf: result = -1, accessCount = 6 109 - lastIndexOf: result = -1, accesscount = 6 110Group 11: fromIndex that triggers exceptions: 111Expected TypeError caught in indexOf when fromIndex is bigint. 112Expected TypeError caught in lastIndexOf when fromIndex is bigint. 113Expected TypeError caught in indexOf when fromIndex is symbol. 114Expected TypeError caught in lastIndexOf when fromIndex is symbol. 115======== End: Array.prototype.indexOf() & Array.prototype.lastIndexOf() ======== 116CallbackFn is not callable 117,,baz 118,,baz 119{"0":-1.6304390272817058e+308,"length":1} 120constructor 121get [Symbol.species] 122constructor 1231 1 1240 0 125constructor 126get [Symbol.species] 127constructor 1281 1 1290 0 130constructor 131get [Symbol.species] 132constructor 1331 1 1340 0 135constructor 136get [Symbol.species] 137constructor 1381 1 1390 0 140constructor 141constructor 142constructor 143n 144100 1450 146false 147false 148false 1493000 150true 15110,10,10,10,10,10,10,10,10,10 1523,4,5,6,4,5,6,7,8,9 1533,4,5,6,4,5,6,7,8,9 1540,1,,3,4,5,6,7,8,9 1550,1,2,0,1,2,3,4,5,9 1565,6,2,3,4,5,6,7,8,9 1575,6,2,3,4,5,6,7,8,9 158true 159true 160true 161true 162145 163145 164109 165125 166false 167false 168true 16915 17013 171[object Object] 172Dec,Feb,Jan,Mar 173Dec,Feb,Jan,Mar 1741 175TypeError 176TypeError 177TypeError 178TypeError 179TypeError 180TypeError 181TypeError 1821,2,3 183apple,banana,orange 184true,false,true 185[object Object],[object Object] 186NaN,NaN,NaN 187Infinity,-Infinity 188/pattern1/,/pattern2/ 189[object Map],[object Map] 190[object Set],[object Set] 1911,2,3,4,5,6 192ark_unicodeValue ,ark_unicodeValue 193undefined 194Exception usage, but does not throw an error 195Caught an error: RangeError: Invalid array length 1961,2,3 197apple,banana,orange 198true,false,true 199[object Object],[object Object] 200NaN,NaN,NaN 201Infinity,-Infinity 202/pattern1/,/pattern2/ 203[object Map],[object Map] 204[object Set],[object Set] 2051,2,3,4,5,6 206ark_unicodeValue ,ark_unicodeValue 207Caught an error: TypeError: the mapfn is not callable. 208Caught an error: Error: Something went wrong 209Exception usage, but does not throw an error 210true 211true 212true 213true 214true 215true 216true 217true 218true 219true 220true 221false 222false 223false 224false 225false 226apple,banana,orange 227 2281,2,3,4,5,6,7,8,9,10 229apple,banana,orange 230[object Object],[object Object] 231ark_unicodeValue ,ark_unicodeValue 2321,2,3,4,5,6 2331,2,3 234undefined 2351,2,3 2361,2,3 2371,2,3 238Concatenated Array: 1,two,true,,,[object Object] 239Nested Concatenated Array: 1,two,true,1,2,a,b,true,false,,,[object Object] 240Mixed Concatenated Array: 1,two,true,4,five,[object Object] 241Spread Concatenated Array: 1,two,true,,,[object Object] 242Original Arrays: 1,2,3,apple,banana,orange,true,false,true,[object Object],[object Object],NaN,NaN,NaN,Infinity,-Infinity,/pattern1/,/pattern2/,[object Map],[object Map],[object Set],[object Set],1,2,3,4,5,6,ark_unicodeValue ,ark_unicodeValue 243Copied Array 1: 3,2,3 244Copied Array 2: apple,apple,banana 245Copied Array 3: true,false,true 246Copied Array 4: [object Object],[object Object] 247Copied Array 5: NaN,NaN,NaN 248Index: 0 249Value: 1,2,3 250Index: 1 251Value: apple,banana,orange 252Index: 2 253Value: true,false,true 254Index: 3 255Value: [object Object],[object Object] 256Index: 4 257Value: NaN,NaN,NaN 258Index: 5 259Value: Infinity,-Infinity 260Index: 6 261Value: /pattern1/,/pattern2/ 262Index: 7 263Value: [object Map],[object Map] 264Index: 8 265Value: [object Set],[object Set] 266Index: 9 267Value: 1,2,3,4,5,6 268Index: 10 269Value: ark_unicodeValue ,ark_unicodeValue 270true 271false 272true 273true 274false 275true 276Caught an error: TypeError: the callbackfun is not callable. 277Caught an error: ReferenceError: undefinedVariable is not defined 2780,0,0,0,0 2791,2,0,0,0 2801,0,0,4,5 2810,0,0,0,0 2821,2,0,0,0 2831,0,0,4,5 284hello,hello,hello,hello,hello 2851,0,0 2861,0,3 2872,4 2883,4,5 2891,2,3,4,5 2903 291apple,banana,orange 292[object Object],[object Object] 293Caught an error: TypeError: the callbackfun is not callable. 294Caught an error: TypeError: is not callable 295undefined 296undefined 2976 298undefined 299 300null 3011,2,3 3026 303null 304undefined 305NaN 306false 307Caught an error: TypeError: the predicate is not callable. 308Caught an error: TypeError: the predicate is not callable. 309Caught an error: TypeError: Cannot read property find of null 310Caught an error: ReferenceError: array is not defined 311-1 312-1 3130 314-1 3158 3167 31711 3180 3197 3206 3215 3229 323Caught an error: TypeError: the predicate is not callable. 324Caught an error: TypeError: the predicate is not callable. 325Caught an error: TypeError: Cannot read property findIndex of null 326Caught an error: ReferenceError: array is not defined 327undefined 328undefined 32910 330undefined 331 3321,2,3 3331,2,3 3341,2,3 335null 336undefined 3371,2,3 338false 339Caught an error: TypeError: the predicate is not callable. 340Caught an error: TypeError: the predicate is not callable. 341Caught an error: TypeError: Cannot read property findLast of null 342Caught an error: ReferenceError: array is not defined 343-1 344-1 3454 346-1 3478 34811 34911 35011 3517 3526 35311 3549 355Caught an error: TypeError: the predicate is not callable. 356Caught an error: TypeError: the predicate is not callable. 357Caught an error: TypeError: Cannot read property findLastIndex of null 358Caught an error: ReferenceError: array is not defined 3591,2,3,4,5,6,7,8,9,10 3601,2,3,4,5,6,7,8,9,10 3611,2,3,4,5 3621,2,,3, 3631,2,3,4,5,6 3641,2,3,4,5 3651,string,[object Object],, 3661,NaN,Infinity,2,3,NaN 3671,2,3,4 3681,2,3,4 3691,2,2,4,3,6 370 3712,4,6 3721,0,2,1,3,2 3731,2,3 3741,2,3,4,5,6 3751,2,3,4 3761,2,4,3 3771 3782 3793 380apple 381banana 382orange 383true 384false 385true 386[object Object] 387[object Object] 388NaN 389NaN 390NaN 391Infinity 392-Infinity 393/pattern1/ 394/pattern2/ 395[object Map] 396[object Map] 397[object Set] 398[object Set] 3991,2,3 4004,5,6 401ark_unicodeValue 402ark_unicodeValue 403Caught an error: TypeError: the callbackfun is not callable. 404Array: [1, 2, 3, 4, 5], Target: 3, Result: true 405Array: [1, 2, 3, 4, 5], Target: 6, Result: false 406Array: [NaN, 2, 3], Target: NaN, Result: true 407Array: [, 2, 3], Target: undefined, Result: true 408Array: [apple, banana, orange], Target: banana, Result: true 409Array: [apple, banana, orange], Target: grape, Result: false 410Array: [], Target: 1, Result: false 411Array: [true, false, true], Target: true, Result: true 412Array: [true, false, true], Target: false, Result: true 413Array: [Infinity, -Infinity], Target: Infinity, Result: true 414Array: [Infinity, -Infinity], Target: -Infinity, Result: true 415Array: [[object Map], [object Map]], Target: [object Map], Result: false 416Array: [[object Set], [object Set]], Target: [object Set], Result: false 4172 4180 4194 420-1 4211 4221 423-1 424-1 4251 426-1 427apple,banana,cherry 428apple, banana, cherry 429 430apple 431apple,1,[object Object] 432apple + banana + cherry 4330 4341 4352 436true 4370 438true 4390 4401 4410 4421 4432 4444 4450 4465 447-1 448-1 449-1 4502 4512,4,6,8,10 452 4532,4,NaN,8,NaN 4542,,6 4551,2,3 4562,4,6,8,10,12 4575 4581,2,3,4 459undefined 460 4611 462 463apple 4641,2,3,4 4651,2,3,4,5,6 4661 467[object Object],[object Object] 4681,2,3,4 4691,2,3, 4701,2 47115 4720 4731 474NaN 475edcba 476initialValue 477a 478dundefinedba 479e,d,c,b,a 480 481a 482d,,b,a 483a 484b,c,d,e 485undefined 486 487a 488 489a 490,b,c 491b,c 492 493a 494,b 495true 496false 497false 498true 499true 5001,1,2,3,4,5,5,6,9 501 5021 5031,3,5, 504apple,banana,cherry 505c,d 506a,b,x,y,e 507 508x,y 509a 510x,y 511,3 5121,5 513apple,banana,cherry 5141,2,3,4,5 5151,two,true 5165 517x,y,a,b,c 5182 519x,y 5202 521x,a 5224 523x,1,2, 5247 5255,6,7,1,2,,4 5268 5275,6,7,8,1,2,,4 528e,d,c,b,a 529 530a 531d,,b,a 5321,1,2,3,4,5,5,6,9 533 5341 5351,3,5, 536apple,banana,cherry 537a,b,x,y,e 538a,b,c,d,e 539x,y 540 541x,y 542a 5431,5 5441,,3,5 545true 546true 547true 548true 549true 550true 551false 552false 553false 554false 555false 556false 557false 558false 559false 560false 561true 562