1# Copyright (c) 2024 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 14Start Test at 15An index of 2 returns 8 16An index of -2 returns 130 17An index of 200 returns undefined 18An index of null returns 5 19An index of undefined returns 5 20An index of undefined returns 12 21An index of undefined returns 5 22An index of 2871622679 returns undefined 23Start Test entries 240,a 251,b 262,c 27Start Test keys 280 291 302 31Start Test values 32a 33b 34c 35Start Test find 3612 375 38Start Test includes 39true 40true 41false 42Start Test index 433 44Start Test fill 451,2,0,0 461,5,5,5 476,6,6,6 486,1,1,1 492,2,2,2 503,3,3,3 513,4,4,3 523,5,5,3 537,7,7,7 548,8,8,8 5510,10,10,8 5610,11,11,8 5710,11,11,8 5810,11,11,8 59Start Test pop 6070 615,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150 625,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90 635,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80 645,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50 655,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100 665,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30 675,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20 685,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10 695,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44 705,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130,44,10,20,30,100,50,80,90,150,200,5,12,8,130 7160 72Start Test randomUpdate 7330 74add element by index access failed. err: TypeError: Cannot add property in prevent extensions, code: undefined 75add element by index access failed. err: TypeError: Cannot add property in prevent extensions, code: undefined 76add element by index access failed. err: BusinessError: The value of index is out of range., code: 10200001 77Start Test randomGet 785,12,8,130,44 79Start Test randomAdd 80add element by index access failed. err: BusinessError: The value of index is out of range., code: 10200001 81Start Test create 82Start Test from 83A,B,C 84E,,M,P,T,Y 85Create from sendable undefined element list success. arr: ,,1 86h,e,l,l,o 871,2,3 88SA,SB,SC 89SSA,SSB,SSC 90Create from sendable array. err: BusinessError: Parameter error.Only accept sendable value., code: 401 911 921 931 944,3 954,3,2,6,4,3,4 96abcdcde,bcdecde,cdefcde,cfghcde,abcdcdecde,bcdecdecde,cdefcdecde,cfghcdecde 971,3,5 98Start Test fromTemplate 99artTSTest1: 1,2,3 100arkTSTest2: 1,2,3 101Start Test length 102Array length: 3 103Array length after changed: 3 104Start Test push 105Elements pushed: 1,3,5,2,4,6 106Elements pushed: 1,2,3,7,8,9 107Start Test concat 1081,3,5,2,4,6 1091,3,5,2,4,6,100,101,102 1101,3,5,200 1111,3,5,201,202 1121,3,5, 113null 1144 1151,3,5, 116undefined 1174 1181,3,5,1,,5 1196 1201,3,5,1,1,3,5,,5, 12110 122Start Test join 123Fire,Air,Water 124FireAirWater 125Fire-Air-Water 126FirenullAirnullWater 127Fire,Air,Water 128123,3445,789, 129Start Test shift 1302 1312 132undefined 1332,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70 13449 1354,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70 1366,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70 137100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70 13850,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70 13960,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70 14070,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70 1412,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70 1424,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70 1436,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70 144100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70,2,4,6,100,50,60,70 14539 146Start Test unshift 1471,2,3 1483 1495 1504,5,1,2,3 1515 1524,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3 15335 1544,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3 15570 15636 1574,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3 15836 159Start Test slice 160ant,bison,camel,duck,elephant 161camel,duck,elephant 162camel,duck 163slice(1.5, 4) element success 164bison,camel,duck 165slice(8, 4) element success 166slice(8, 100) element success 167ant,bison,camel,duck,elephant 168ant,bison,camel,duck,elephant 169Start Test sort 170Dec,Feb,Jan,March 1711,10000,21,30,4 172Start Test indexOf 1731 1744 175-1 176Start Test forEach 177a 178b 179c 180a[0] = a, a 181a[1] = b, b 182a[2] = c, c 183Start Test map 1842,8,18,32 185Start Test filter 186exuberant,destruction,present 1875 1888 18944 190spray,elite,exuberant,destruction,present,spray,elite,exuberant,destruction,present,spray,elite,exuberant,destruction,present,spray,elite,exuberant,destruction,present,spray,elite,exuberant,destruction,present,spray,elite,exuberant,destruction,present,spray,elite,exuberant,destruction,present,spray,elite,exuberant,destruction,present 191destruction,destruction,destruction,destruction,destruction,destruction,destruction,destruction 192Start Test reduce 19310 19420 19510 1 2 3 4 196Start Test splice 197 198Jan,March,April,June 199Jan,Feb,Oct,March,April,June 200Jan,Feb,Oct,March,May 201April,June 202Jan,Feb 203Oct,March,May 204Add one element by splice api failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401 205Add one element by splice api failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401 206Start Test staticCreate 2075,5,5,5,5,5,5,5,5,5 208Create with without initialValue failed. err: BusinessError: Parameter error.Not enough parameters., code: 401 209Create with negative length failed. err: BusinessError: Parameter error.Invalid array length., code: 401 210Create huge sendableArrayWith initialValue success. 211Create with exceed max length failed. err: BusinessError: Parameter error.Invalid array length., code: 401 212Start Test readonlyLength 21310 21410 215Start Test shrinkTo 21610 217Shrink to array.length: 5,5,5,5,5,5,5,5,5,5 218Shrink to array.length + 1: 5,5,5,5,5,5,5,5,5,5 219Shrink to -1 fail. err: BusinessError: Parameter error.Invalid array length., code: 401 220Shrink to invalid 0x100000000 fail. err: BusinessError: Parameter error.Invalid array length., code: 401 2211 2225 223Start Test growTo 2245 225ExtendTo to array.length: 5,5,5,5,5 226ExtendTo to array.length - 1: 5,5,5,5,5 227ExtendTo to 0: 5,5,5,5,5 228ExtendTo to -1 fail. err: BusinessError: Parameter error.Invalid array length., code: 401 229ExtendTo to invalid 0x100000000 fail. err: BusinessError: Parameter error.Invalid array length., code: 401 230ExtendTo to 8 without initValue fail. err: BusinessError: Parameter error.Not enough parameters., code: 401 2318 2325,5,5,5,5,11,11,11 233Start Test indexAccess 234element1: 3 235element1 assigned to 10: 10 236Index access read out of range success. 237Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001 238write element while iterate array fail. err: BusinessError: Concurrent modification exception, errCode: 10200201 239Start Test indexStringAccess 240String index element1: 3 241String index element1 assigned to 10: 10 242String Index access read out of range success. 243String Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001 244String index write element while iterate array fail. err: BusinessError: Concurrent modification exception, errCode: 10200201 245Start Test testForIC 246[IC] Index access read in range success. array: 3 247[IC] Index access write in range success. 248[IC] assign readonly length no error. 249[IC] Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001 250Start Test testStringForIC 251[IC] String Index access read in range success. array: 3 252[IC] String Index access write in range success. 253[IC] String Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001 254Start Test arrayFrozenTest 255arrayFrozenTest [new] single string. arr: ARK 256Add prop to array failed. err: TypeError: Cannot add property in prevent extensions 257defineNotExistProp to array failed. err: TypeError: Cannot define property 258Update function [at] failed. err: TypeError: Cannot assign to read only property 259Update function [at] by defineProperty failed. err: TypeError: Cannot define property 260arrayFrozenTest [new]. arr: A,R,K 261Add prop to array failed. err: TypeError: Cannot add property in prevent extensions 262defineNotExistProp to array failed. err: TypeError: Cannot define property 263Update function [at] failed. err: TypeError: Cannot assign to read only property 264Update function [at] by defineProperty failed. err: TypeError: Cannot define property 265arrayFrozenTest static [from]. arr: A,R,K 266Add prop to array failed. err: TypeError: Cannot add property in prevent extensions 267defineNotExistProp to array failed. err: TypeError: Cannot define property 268Update function [at] failed. err: TypeError: Cannot assign to read only property 269Update function [at] by defineProperty failed. err: TypeError: Cannot define property 270arrayFrozenTest static [create]. arr: A,A,A 271Add prop to array failed. err: TypeError: Cannot add property in prevent extensions 272defineNotExistProp to array failed. err: TypeError: Cannot define property 273Update function [at] failed. err: TypeError: Cannot assign to read only property 274Update function [at] by defineProperty failed. err: TypeError: Cannot define property 275Start Test sharedArrayFrozenTest 276sharedArrayFrozenTest [new]. arr: A,R,K 277Add prop to array failed. err: TypeError: Cannot add property in prevent extensions 278defineNotExistProp to array failed. err: TypeError: Cannot define property 279Update function [at] failed. err: TypeError: Cannot assign to read only property 280Update function [at] by defineProperty failed. err: TypeError: Cannot define property 281Start Test arrayFromSet 282Create from normal set: foo,bar,baz 283Create from shared set: foo,bar,baz 284Start Test arrayFromNormalMap 285Start test arrayFromSendableMap 286create from sharedMap with non-sendable array failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401 287create from sharedMapper.values(): a,b 288create from sharedMapper.values(): 1,2 289Start test arrayFromNotArray 290NotArray called with length undefined 291Create array from notArray failed. err: TypeError: Failed to construct the array., code: undefined 292Start Test derivedSlice 293instanceOf slice result: true 294Start Test derivedSort 295instanceOf derived sort result: true 296Start Test derivedForEach 297a[0] = March, true 298a[1] = Jan, true 299a[2] = Feb, true 300a[3] = Dec, true 301Start derivedMap 302instanceOf derived map result: true 303Start Test derivedFill 3041,2,0,0 305instanceOf derived fill result: true 306Start Test array read out of range 307array[0]: 1 308read out of range success undefined 309read out of range success 1 310read out of range success 1 311read out of range success undefined 312read out of range success undefined 313read out of range success undefined 314read out of range success undefined 315read out of range success undefined 316read out of range success undefined 317Start Test array for of 3181 3193 3205 3217 322SendableArray ...from_arr: 1,2,3 323SendableArray ...from_arr1: 0,1,2,3 324Create from SendableArray with non-sendable array error failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401 325Start Test fromArrayConstructorTest 326a,b,c 327Start Test DefinePropertyTest 328defineProperty to array success 329defineProperty to array failed. err: BusinessError: Key out of length. 330defineProperty to array success 331defineProperty to array failed. err: BusinessError: Key out of length. 332defineProperty to array failed. err: BusinessError: Key out of length. 333defineProperty to array success 321 334defineProperty to array failed. err: TypeError: Cannot define property, code: undefined 335defineProperty to array failed. err: TypeError: Cannot define property, code: undefined 336defineProperty to array failed. err: TypeError: Cannot define property, code: undefined 337defineProperty to array failed. err: TypeError: Cannot define property, code: undefined 338defineProperty to array failed. err: TypeError: Cannot define property, code: undefined 339defineProperty to array failed. err: TypeError: Cannot define property, code: undefined 340Start Test SomeTest 341true 342false 343false 344true 345true 346false 347true 348true 349Start Test EveryTest 350true 351false 352false 353true 354Start Test isArrayTest 355true 356true 357true 358true 359false 360false 361false 362false 363false 364false 365false 366false 367false 368false 369false 370Start Test lastIndexOf 3714 3720 3735 374-1 375-1 376-1 3772 378Start Test ofTest 3791,2,3,4,2,5 380 3811,2,3,4,5 382Create SendableArray failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401 383Create SendableArray failed. err: TypeError: Failed to create Object., code: undefined 384Start Test copyWithin 3851,2,3,4,2,5 386copyWithin SendableArray failed. err: BusinessError: Target index cannot be undefined., code: 10200011 3871,1,2,3,4,2 3881,1,3,4,2,2 3891,1,3,3,4,2 3901,1,3,3,4,2 3911,1,3,3,4,2 392Start Test findLast 393130 394undefined 395findLast failed. err: TypeError: the predicate is not callable., code: undefined 39644 397Start Test findLastIndex 398findLastIndex failed. err: TypeError: the predicate is not callable., code: undefined 399find index1: 3 400find index2: -1 4014 402Start Test reduceRight 40310 40420 40510 4 3 2 1 406NaN 4071 408undefined 409reduceRight failed. err: TypeError: out of range., code: undefined 410reduceRight failed. err: TypeError: the callbackfun is not callable., code: undefined 411Start Test reverse 4124,3,2,1 4134,3,2,1 414three,two,one 415three,two,one 416Start Test toString 4171,2,3,4 418one,two,three 419,,3,4,5 420Start Test toLocaleString 4211,2,3,4 422one,two,three 423,,3,4,5 4241.000,2.000,3.000,4.000,5.000 4251 000,2 000,3 000,4 000,5 000 426$123,456.79,$2,000.00 427123.456,79 $,2.000,00 $ 428123.456,79 $,2.000,00 $,3,00 $,4,00 $,5,00 $ 429