14514f5e3Sopenharmony_ci# Copyright (c) 2024 Huawei Device Co., Ltd. 24514f5e3Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 34514f5e3Sopenharmony_ci# you may not use this file except in compliance with the License. 44514f5e3Sopenharmony_ci# You may obtain a copy of the License at 54514f5e3Sopenharmony_ci# 64514f5e3Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 74514f5e3Sopenharmony_ci# 84514f5e3Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 94514f5e3Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 104514f5e3Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 114514f5e3Sopenharmony_ci# See the License for the specific language governing permissions and 124514f5e3Sopenharmony_ci# limitations under the License. 134514f5e3Sopenharmony_ci 144514f5e3Sopenharmony_ciStart Test at 154514f5e3Sopenharmony_ciAn index of 2 returns 8 164514f5e3Sopenharmony_ciAn index of -2 returns 130 174514f5e3Sopenharmony_ciAn index of 200 returns undefined 184514f5e3Sopenharmony_ciAn index of null returns 5 194514f5e3Sopenharmony_ciAn index of undefined returns 5 204514f5e3Sopenharmony_ciAn index of undefined returns 12 214514f5e3Sopenharmony_ciAn index of undefined returns 5 224514f5e3Sopenharmony_ciAn index of 2871622679 returns undefined 234514f5e3Sopenharmony_ciStart Test entries 244514f5e3Sopenharmony_ci0,a 254514f5e3Sopenharmony_ci1,b 264514f5e3Sopenharmony_ci2,c 274514f5e3Sopenharmony_ciStart Test keys 284514f5e3Sopenharmony_ci0 294514f5e3Sopenharmony_ci1 304514f5e3Sopenharmony_ci2 314514f5e3Sopenharmony_ciStart Test values 324514f5e3Sopenharmony_cia 334514f5e3Sopenharmony_cib 344514f5e3Sopenharmony_cic 354514f5e3Sopenharmony_ciStart Test find 364514f5e3Sopenharmony_ci12 374514f5e3Sopenharmony_ci5 384514f5e3Sopenharmony_ciStart Test includes 394514f5e3Sopenharmony_citrue 404514f5e3Sopenharmony_citrue 414514f5e3Sopenharmony_cifalse 424514f5e3Sopenharmony_ciStart Test index 434514f5e3Sopenharmony_ci3 444514f5e3Sopenharmony_ciStart Test fill 454514f5e3Sopenharmony_ci1,2,0,0 464514f5e3Sopenharmony_ci1,5,5,5 474514f5e3Sopenharmony_ci6,6,6,6 484514f5e3Sopenharmony_ciStart Test pop 494514f5e3Sopenharmony_cipoped: 44 504514f5e3Sopenharmony_ciStart Test randomUpdate 514514f5e3Sopenharmony_ci30 524514f5e3Sopenharmony_ciadd element by index access failed. err: TypeError: Cannot add property in prevent extensions, code: undefined 534514f5e3Sopenharmony_ciadd element by index access failed. err: TypeError: Cannot add property in prevent extensions, code: undefined 544514f5e3Sopenharmony_ciadd element by index access failed. err: BusinessError: The value of index is out of range., code: 10200001 554514f5e3Sopenharmony_ciStart Test randomGet 564514f5e3Sopenharmony_ci5,12,8,130,44 574514f5e3Sopenharmony_ciStart Test randomAdd 584514f5e3Sopenharmony_ciadd element by index access failed. err: BusinessError: The value of index is out of range., code: 10200001 594514f5e3Sopenharmony_ciStart Test create 604514f5e3Sopenharmony_ciStart Test from 614514f5e3Sopenharmony_ciA,B,C 624514f5e3Sopenharmony_ciE,,M,P,T,Y 634514f5e3Sopenharmony_ciCreate from sendable undefined element list success. arr: ,,1 644514f5e3Sopenharmony_cih,e,l,l,o 654514f5e3Sopenharmony_ciStart Test fromTemplate 664514f5e3Sopenharmony_ciartTSTest1: 1,2,3 674514f5e3Sopenharmony_ciarkTSTest2: 1,2,3 684514f5e3Sopenharmony_ciStart Test length 694514f5e3Sopenharmony_ciArray length: 3 704514f5e3Sopenharmony_ciArray length after changed: 3 714514f5e3Sopenharmony_ciStart Test push 724514f5e3Sopenharmony_ciElements pushed: 1,3,5,2,4,6 734514f5e3Sopenharmony_ciStart Test concat 744514f5e3Sopenharmony_ci1,3,5,2,4,6 754514f5e3Sopenharmony_ci1,3,5,2,4,6,100,101,102 764514f5e3Sopenharmony_ci1,3,5,200 774514f5e3Sopenharmony_ci1,3,5,201,202 784514f5e3Sopenharmony_ci1,3,5, 794514f5e3Sopenharmony_cinull 804514f5e3Sopenharmony_ci4 814514f5e3Sopenharmony_ci1,3,5, 824514f5e3Sopenharmony_ciundefined 834514f5e3Sopenharmony_ci4 844514f5e3Sopenharmony_ciStart Test join 854514f5e3Sopenharmony_ciFire,Air,Water 864514f5e3Sopenharmony_ciFireAirWater 874514f5e3Sopenharmony_ciFire-Air-Water 884514f5e3Sopenharmony_ciFirenullAirnullWater 894514f5e3Sopenharmony_ciFire,Air,Water 904514f5e3Sopenharmony_ciStart Test shift 914514f5e3Sopenharmony_ci2 924514f5e3Sopenharmony_ci2 934514f5e3Sopenharmony_ciundefined 944514f5e3Sopenharmony_ciStart Test unshift 954514f5e3Sopenharmony_ci5 964514f5e3Sopenharmony_ci5 974514f5e3Sopenharmony_ciStart Test slice 984514f5e3Sopenharmony_ciant,bison,camel,duck,elephant 994514f5e3Sopenharmony_cicamel,duck,elephant 1004514f5e3Sopenharmony_cicamel,duck 1014514f5e3Sopenharmony_cislice(1.5, 4) element success 1024514f5e3Sopenharmony_cibison,camel,duck 1034514f5e3Sopenharmony_cislice(8, 4) element success 1044514f5e3Sopenharmony_cislice(8, 100) element success 1054514f5e3Sopenharmony_ciant,bison,camel,duck,elephant 1064514f5e3Sopenharmony_ciant,bison,camel,duck,elephant 1074514f5e3Sopenharmony_ciStart Test sort 1084514f5e3Sopenharmony_ciDec,Feb,Jan,March 1094514f5e3Sopenharmony_ci1,10000,21,30,4 1104514f5e3Sopenharmony_ciStart Test indexOf 1114514f5e3Sopenharmony_ci1 1124514f5e3Sopenharmony_ci4 1134514f5e3Sopenharmony_ci-1 1144514f5e3Sopenharmony_ciStart Test forEach 1154514f5e3Sopenharmony_cia 1164514f5e3Sopenharmony_cib 1174514f5e3Sopenharmony_cic 1184514f5e3Sopenharmony_cia[0] = a, a 1194514f5e3Sopenharmony_cia[1] = b, b 1204514f5e3Sopenharmony_cia[2] = c, c 1214514f5e3Sopenharmony_ciStart Test map 1224514f5e3Sopenharmony_ci2,8,18,32 1234514f5e3Sopenharmony_ciStart Test filter 1244514f5e3Sopenharmony_ciexuberant,destruction,present 1254514f5e3Sopenharmony_ci5 1264514f5e3Sopenharmony_ci8 1274514f5e3Sopenharmony_ci44 1284514f5e3Sopenharmony_ciStart Test reduce 1294514f5e3Sopenharmony_ci10 1304514f5e3Sopenharmony_ci20 1314514f5e3Sopenharmony_ci10 1 2 3 4 1324514f5e3Sopenharmony_ciStart Test splice 1334514f5e3Sopenharmony_ciJan,Feb,Oct,March,April,June 1344514f5e3Sopenharmony_ciJan,Feb,Oct,March,May 1354514f5e3Sopenharmony_ciApril,June 1364514f5e3Sopenharmony_ciJan,Feb 1374514f5e3Sopenharmony_ciOct,March,May 1384514f5e3Sopenharmony_ciAdd one element by splice api failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401 1394514f5e3Sopenharmony_ciAdd one element by splice api failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401 1404514f5e3Sopenharmony_ciStart Test staticCreate 1414514f5e3Sopenharmony_ci5,5,5,5,5,5,5,5,5,5 1424514f5e3Sopenharmony_ciCreate with without initialValue failed. err: BusinessError: Parameter error.Not enough parameters., code: 401 1434514f5e3Sopenharmony_ciCreate with negative length failed. err: BusinessError: Parameter error.Invalid array length., code: 401 1444514f5e3Sopenharmony_ciCreate huge sendableArrayWith initialValue success. 1454514f5e3Sopenharmony_ciCreate with exceed max length failed. err: BusinessError: Parameter error.Invalid array length., code: 401 1464514f5e3Sopenharmony_ciStart Test readonlyLength 1474514f5e3Sopenharmony_ci10 1484514f5e3Sopenharmony_ci10 1494514f5e3Sopenharmony_ciStart Test shrinkTo 1504514f5e3Sopenharmony_ci10 1514514f5e3Sopenharmony_ciShrink to array.length: 5,5,5,5,5,5,5,5,5,5 1524514f5e3Sopenharmony_ciShrink to array.length + 1: 5,5,5,5,5,5,5,5,5,5 1534514f5e3Sopenharmony_ciShrink to -1 fail. err: BusinessError: Parameter error.Invalid array length., code: 401 1544514f5e3Sopenharmony_ciShrink to invalid 0x100000000 fail. err: BusinessError: Parameter error.Invalid array length., code: 401 1554514f5e3Sopenharmony_ci1 1564514f5e3Sopenharmony_ci5 1574514f5e3Sopenharmony_ciStart Test growTo 1584514f5e3Sopenharmony_ci5 1594514f5e3Sopenharmony_ciExtendTo to array.length: 5,5,5,5,5 1604514f5e3Sopenharmony_ciExtendTo to array.length - 1: 5,5,5,5,5 1614514f5e3Sopenharmony_ciExtendTo to 0: 5,5,5,5,5 1624514f5e3Sopenharmony_ciExtendTo to -1 fail. err: BusinessError: Parameter error.Invalid array length., code: 401 1634514f5e3Sopenharmony_ciExtendTo to invalid 0x100000000 fail. err: BusinessError: Parameter error.Invalid array length., code: 401 1644514f5e3Sopenharmony_ciExtendTo to 8 without initValue fail. err: BusinessError: Parameter error.Not enough parameters., code: 401 1654514f5e3Sopenharmony_ci8 1664514f5e3Sopenharmony_ci5,5,5,5,5,11,11,11 1674514f5e3Sopenharmony_ciStart Test indexAccess 1684514f5e3Sopenharmony_cielement1: 3 1694514f5e3Sopenharmony_cielement1 assigned to 10: 10 1704514f5e3Sopenharmony_ciIndex access read out of range success. 1714514f5e3Sopenharmony_ciIndex access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001 1724514f5e3Sopenharmony_ciwrite element while iterate array fail. err: BusinessError: Concurrent modification exception, errCode: 10200201 1734514f5e3Sopenharmony_ciStart Test indexStringAccess 1744514f5e3Sopenharmony_ciString index element1: 3 1754514f5e3Sopenharmony_ciString index element1 assigned to 10: 10 1764514f5e3Sopenharmony_ciString Index access read out of range success. 1774514f5e3Sopenharmony_ciString Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001 1784514f5e3Sopenharmony_ciString index write element while iterate array fail. err: BusinessError: Concurrent modification exception, errCode: 10200201 1794514f5e3Sopenharmony_ciStart Test testForIC 1804514f5e3Sopenharmony_ci[IC] Index access read in range success. array: 3 1814514f5e3Sopenharmony_ci[IC] Index access write in range success. 1824514f5e3Sopenharmony_ci[IC] assign readonly length no error. 1834514f5e3Sopenharmony_ci[IC] Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001 1844514f5e3Sopenharmony_ciStart Test testStringForIC 1854514f5e3Sopenharmony_ci[IC] String Index access read in range success. array: 3 1864514f5e3Sopenharmony_ci[IC] String Index access write in range success. 1874514f5e3Sopenharmony_ci[IC] String Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001 1884514f5e3Sopenharmony_ciStart Test arrayFrozenTest 1894514f5e3Sopenharmony_ciarrayFrozenTest [new] single string. arr: ARK 1904514f5e3Sopenharmony_ciAdd prop to array failed. err: TypeError: Cannot add property in prevent extensions 1914514f5e3Sopenharmony_cidefineNotExistProp to array failed. err: TypeError: Cannot define property 1924514f5e3Sopenharmony_ciUpdate function [at] failed. err: TypeError: Cannot assign to read only property 1934514f5e3Sopenharmony_ciUpdate function [at] by defineProperty failed. err: TypeError: Cannot define property 1944514f5e3Sopenharmony_ciarrayFrozenTest [new]. arr: A,R,K 1954514f5e3Sopenharmony_ciAdd prop to array failed. err: TypeError: Cannot add property in prevent extensions 1964514f5e3Sopenharmony_cidefineNotExistProp to array failed. err: TypeError: Cannot define property 1974514f5e3Sopenharmony_ciUpdate function [at] failed. err: TypeError: Cannot assign to read only property 1984514f5e3Sopenharmony_ciUpdate function [at] by defineProperty failed. err: TypeError: Cannot define property 1994514f5e3Sopenharmony_ciarrayFrozenTest static [from]. arr: A,R,K 2004514f5e3Sopenharmony_ciAdd prop to array failed. err: TypeError: Cannot add property in prevent extensions 2014514f5e3Sopenharmony_cidefineNotExistProp to array failed. err: TypeError: Cannot define property 2024514f5e3Sopenharmony_ciUpdate function [at] failed. err: TypeError: Cannot assign to read only property 2034514f5e3Sopenharmony_ciUpdate function [at] by defineProperty failed. err: TypeError: Cannot define property 2044514f5e3Sopenharmony_ciarrayFrozenTest static [create]. arr: A,A,A 2054514f5e3Sopenharmony_ciAdd prop to array failed. err: TypeError: Cannot add property in prevent extensions 2064514f5e3Sopenharmony_cidefineNotExistProp to array failed. err: TypeError: Cannot define property 2074514f5e3Sopenharmony_ciUpdate function [at] failed. err: TypeError: Cannot assign to read only property 2084514f5e3Sopenharmony_ciUpdate function [at] by defineProperty failed. err: TypeError: Cannot define property 2094514f5e3Sopenharmony_ciStart Test sharedArrayFrozenTest 2104514f5e3Sopenharmony_cisharedArrayFrozenTest [new]. arr: A,R,K 2114514f5e3Sopenharmony_ciAdd prop to array failed. err: TypeError: Cannot add property in prevent extensions 2124514f5e3Sopenharmony_cidefineNotExistProp to array failed. err: TypeError: Cannot define property 2134514f5e3Sopenharmony_ciUpdate function [at] failed. err: TypeError: Cannot assign to read only property 2144514f5e3Sopenharmony_ciUpdate function [at] by defineProperty failed. err: TypeError: Cannot define property 2154514f5e3Sopenharmony_ciStart Test arrayFromSet 2164514f5e3Sopenharmony_ciCreate from normal set: foo,bar,baz 2174514f5e3Sopenharmony_ciCreate from shared set: foo,bar,baz 2184514f5e3Sopenharmony_ciStart Test arrayFromNormalMap 2194514f5e3Sopenharmony_ciStart test arrayFromSendableMap 2204514f5e3Sopenharmony_cicreate from sharedMap with non-sendable array failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401 2214514f5e3Sopenharmony_cicreate from sharedMapper.values(): a,b 2224514f5e3Sopenharmony_cicreate from sharedMapper.values(): 1,2 2234514f5e3Sopenharmony_ciStart test arrayFromNotArray 2244514f5e3Sopenharmony_ciNotArray called with length undefined 2254514f5e3Sopenharmony_ciCreate array from notArray failed. err: TypeError: Failed to construct the array., code: undefined 2264514f5e3Sopenharmony_ciStart Test derivedSlice 2274514f5e3Sopenharmony_ciinstanceOf slice result: true 2284514f5e3Sopenharmony_ciStart Test derivedSort 2294514f5e3Sopenharmony_ciinstanceOf derived sort result: true 2304514f5e3Sopenharmony_ciStart Test derivedForEach 2314514f5e3Sopenharmony_cia[0] = March, true 2324514f5e3Sopenharmony_cia[1] = Jan, true 2334514f5e3Sopenharmony_cia[2] = Feb, true 2344514f5e3Sopenharmony_cia[3] = Dec, true 2354514f5e3Sopenharmony_ciStart derivedMap 2364514f5e3Sopenharmony_ciinstanceOf derived map result: true 2374514f5e3Sopenharmony_ciStart Test derivedFill 2384514f5e3Sopenharmony_ci1,2,0,0 2394514f5e3Sopenharmony_ciinstanceOf derived fill result: true 2404514f5e3Sopenharmony_ciStart Test array read out of range 2414514f5e3Sopenharmony_ciarray[0]: 1 2424514f5e3Sopenharmony_ciread out of range success undefined 2434514f5e3Sopenharmony_ciread out of range success 1 2444514f5e3Sopenharmony_ciread out of range success 1 2454514f5e3Sopenharmony_ciread out of range success undefined 2464514f5e3Sopenharmony_ciread out of range success undefined 2474514f5e3Sopenharmony_ciread out of range success undefined 2484514f5e3Sopenharmony_ciread out of range success undefined 2494514f5e3Sopenharmony_ciread out of range success undefined 2504514f5e3Sopenharmony_ciread out of range success undefined 2514514f5e3Sopenharmony_ciStart Test array for of 2524514f5e3Sopenharmony_ci1 2534514f5e3Sopenharmony_ci3 2544514f5e3Sopenharmony_ci5 2554514f5e3Sopenharmony_ci7 2564514f5e3Sopenharmony_ciSendableArray ...from_arr: 1,2,3 2574514f5e3Sopenharmony_ciSendableArray ...from_arr1: 0,1,2,3 2584514f5e3Sopenharmony_ciCreate from SendableArray with non-sendable array error failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401 2594514f5e3Sopenharmony_ciStart Test fromArrayConstructorTest 2604514f5e3Sopenharmony_cia,b,c 2614514f5e3Sopenharmony_ciStart Test DefinePropertyTest 2624514f5e3Sopenharmony_cidefineProperty to array success 2634514f5e3Sopenharmony_cidefineProperty to array failed. err: BusinessError: Key out of length. 2644514f5e3Sopenharmony_cidefineProperty to array success 2654514f5e3Sopenharmony_cidefineProperty to array failed. err: BusinessError: Key out of length. 2664514f5e3Sopenharmony_cidefineProperty to array failed. err: BusinessError: Key out of length. 2674514f5e3Sopenharmony_cidefineProperty to array success 321 2684514f5e3Sopenharmony_cidefineProperty to array failed. err: TypeError: Cannot define property, code: undefined 2694514f5e3Sopenharmony_cidefineProperty to array failed. err: TypeError: Cannot define property, code: undefined 2704514f5e3Sopenharmony_cidefineProperty to array failed. err: TypeError: Cannot define property, code: undefined 2714514f5e3Sopenharmony_cidefineProperty to array failed. err: TypeError: Cannot define property, code: undefined 2724514f5e3Sopenharmony_cidefineProperty to array failed. err: TypeError: Cannot define property, code: undefined 2734514f5e3Sopenharmony_cidefineProperty to array failed. err: TypeError: Cannot define property, code: undefined 2744514f5e3Sopenharmony_ciStart Test SomeTest 2754514f5e3Sopenharmony_citrue 2764514f5e3Sopenharmony_cifalse 2774514f5e3Sopenharmony_ciStart Test EveryTest 2784514f5e3Sopenharmony_citrue 2794514f5e3Sopenharmony_cifalse 2804514f5e3Sopenharmony_citrue 2814514f5e3Sopenharmony_citrue 2824514f5e3Sopenharmony_citrue 2834514f5e3Sopenharmony_citrue 2844514f5e3Sopenharmony_cifalse 2854514f5e3Sopenharmony_cifalse 2864514f5e3Sopenharmony_cifalse 2874514f5e3Sopenharmony_cifalse 2884514f5e3Sopenharmony_cifalse 2894514f5e3Sopenharmony_cifalse 2904514f5e3Sopenharmony_cifalse 2914514f5e3Sopenharmony_cifalse 2924514f5e3Sopenharmony_cifalse 2934514f5e3Sopenharmony_cifalse 2944514f5e3Sopenharmony_cifalse 2954514f5e3Sopenharmony_ci4 2964514f5e3Sopenharmony_ci0 2974514f5e3Sopenharmony_ci5 2984514f5e3Sopenharmony_ci-1 2994514f5e3Sopenharmony_ci-1 3004514f5e3Sopenharmony_ci-1 3014514f5e3Sopenharmony_ci2 302