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
48Start Test pop
49poped: 44
50Start Test randomUpdate
5130
52add element by index access failed. err: TypeError: Cannot add property in prevent extensions, code: undefined
53add element by index access failed. err: TypeError: Cannot add property in prevent extensions, code: undefined
54add element by index access failed. err: BusinessError: The value of index is out of range., code: 10200001
55Start Test randomGet
565,12,8,130,44
57Start Test randomAdd
58add element by index access failed. err: BusinessError: The value of index is out of range., code: 10200001
59Start Test create
60Start Test from
61A,B,C
62E,,M,P,T,Y
63Create from sendable undefined element list success. arr: ,,1
64h,e,l,l,o
65Start Test fromTemplate
66artTSTest1: 1,2,3
67arkTSTest2: 1,2,3
68Start Test length
69Array length: 3
70Array length after changed: 3
71Start Test push
72Elements pushed: 1,3,5,2,4,6
73Start Test concat
741,3,5,2,4,6
751,3,5,2,4,6,100,101,102
761,3,5,200
771,3,5,201,202
781,3,5,
79null
804
811,3,5,
82undefined
834
84Start Test join
85Fire,Air,Water
86FireAirWater
87Fire-Air-Water
88FirenullAirnullWater
89Fire,Air,Water
90Start Test shift
912
922
93undefined
94Start Test unshift
955
965
97Start Test slice
98ant,bison,camel,duck,elephant
99camel,duck,elephant
100camel,duck
101slice(1.5, 4) element success
102bison,camel,duck
103slice(8, 4) element success
104slice(8, 100) element success
105ant,bison,camel,duck,elephant
106ant,bison,camel,duck,elephant
107Start Test sort
108Dec,Feb,Jan,March
1091,10000,21,30,4
110Start Test indexOf
1111
1124
113-1
114Start Test forEach
115a
116b
117c
118a[0] = a, a
119a[1] = b, b
120a[2] = c, c
121Start Test map
1222,8,18,32
123Start Test filter
124exuberant,destruction,present
1255
1268
12744
128Start Test reduce
12910
13020
13110 1 2 3 4
132Start Test splice
133Jan,Feb,Oct,March,April,June
134Jan,Feb,Oct,March,May
135April,June
136Jan,Feb
137Oct,March,May
138Add one element by splice api failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401
139Add one element by splice api failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401
140Start Test staticCreate
1415,5,5,5,5,5,5,5,5,5
142Create with without initialValue failed. err: BusinessError: Parameter error.Not enough parameters., code: 401
143Create with negative length failed. err: BusinessError: Parameter error.Invalid array length., code: 401
144Create huge sendableArrayWith initialValue success.
145Create with exceed max length failed. err: BusinessError: Parameter error.Invalid array length., code: 401
146Start Test readonlyLength
14710
14810
149Start Test shrinkTo
15010
151Shrink to array.length: 5,5,5,5,5,5,5,5,5,5
152Shrink to array.length + 1: 5,5,5,5,5,5,5,5,5,5
153Shrink to -1 fail. err: BusinessError: Parameter error.Invalid array length., code: 401
154Shrink to invalid 0x100000000 fail. err: BusinessError: Parameter error.Invalid array length., code: 401
1551
1565
157Start Test growTo
1585
159ExtendTo to array.length: 5,5,5,5,5
160ExtendTo to array.length - 1: 5,5,5,5,5
161ExtendTo to 0: 5,5,5,5,5
162ExtendTo to -1 fail. err: BusinessError: Parameter error.Invalid array length., code: 401
163ExtendTo to invalid 0x100000000 fail. err: BusinessError: Parameter error.Invalid array length., code: 401
164ExtendTo to 8 without initValue fail. err: BusinessError: Parameter error.Not enough parameters., code: 401
1658
1665,5,5,5,5,11,11,11
167Start Test indexAccess
168element1: 3
169element1 assigned to 10: 10
170Index access read out of range success.
171Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001
172write element while iterate array fail. err: BusinessError: Concurrent modification exception, errCode: 10200201
173Start Test indexStringAccess
174String index element1: 3
175String index element1 assigned to 10: 10
176String Index access read out of range success.
177String Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001
178String index write element while iterate array fail. err: BusinessError: Concurrent modification exception, errCode: 10200201
179Start Test testForIC
180[IC] Index access read in range success. array: 3
181[IC] Index access write in range success.
182[IC] assign readonly length no error.
183[IC] Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001
184Start Test testStringForIC
185[IC] String Index access read in range success. array: 3
186[IC] String Index access write in range success.
187[IC] String Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001
188Start Test arrayFrozenTest
189arrayFrozenTest [new] single string. arr: ARK
190Add prop to array failed. err: TypeError: Cannot add property in prevent extensions
191defineNotExistProp to array failed. err: TypeError: Cannot define property
192Update function [at] failed. err: TypeError: Cannot assign to read only property
193Update function [at] by defineProperty failed. err: TypeError: Cannot define property
194arrayFrozenTest [new]. arr: A,R,K
195Add prop to array failed. err: TypeError: Cannot add property in prevent extensions
196defineNotExistProp to array failed. err: TypeError: Cannot define property
197Update function [at] failed. err: TypeError: Cannot assign to read only property
198Update function [at] by defineProperty failed. err: TypeError: Cannot define property
199arrayFrozenTest static [from]. arr: A,R,K
200Add prop to array failed. err: TypeError: Cannot add property in prevent extensions
201defineNotExistProp to array failed. err: TypeError: Cannot define property
202Update function [at] failed. err: TypeError: Cannot assign to read only property
203Update function [at] by defineProperty failed. err: TypeError: Cannot define property
204arrayFrozenTest static [create]. arr: A,A,A
205Add prop to array failed. err: TypeError: Cannot add property in prevent extensions
206defineNotExistProp to array failed. err: TypeError: Cannot define property
207Update function [at] failed. err: TypeError: Cannot assign to read only property
208Update function [at] by defineProperty failed. err: TypeError: Cannot define property
209Start Test sharedArrayFrozenTest
210sharedArrayFrozenTest [new]. arr: A,R,K
211Add prop to array failed. err: TypeError: Cannot add property in prevent extensions
212defineNotExistProp to array failed. err: TypeError: Cannot define property
213Update function [at] failed. err: TypeError: Cannot assign to read only property
214Update function [at] by defineProperty failed. err: TypeError: Cannot define property
215Start Test arrayFromSet
216Create from normal set: foo,bar,baz
217Create from shared set: foo,bar,baz
218Start Test arrayFromNormalMap
219Start test arrayFromSendableMap
220create from sharedMap with non-sendable array failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401
221create from sharedMapper.values(): a,b
222create from sharedMapper.values(): 1,2
223Start test arrayFromNotArray
224NotArray called with length undefined
225Create array from notArray failed. err: TypeError: Failed to construct the array., code: undefined
226Start Test derivedSlice
227instanceOf slice result: true
228Start Test derivedSort
229instanceOf derived sort result: true
230Start Test derivedForEach
231a[0] = March, true
232a[1] = Jan, true
233a[2] = Feb, true
234a[3] = Dec, true
235Start derivedMap
236instanceOf derived map result: true
237Start Test derivedFill
2381,2,0,0
239instanceOf derived fill result: true
240Start Test array read out of range
241array[0]: 1
242read out of range success undefined
243read out of range success 1
244read out of range success 1
245read out of range success undefined
246read out of range success undefined
247read out of range success undefined
248read out of range success undefined
249read out of range success undefined
250read out of range success undefined
251Start Test array for of
2521
2533
2545
2557
256SendableArray ...from_arr: 1,2,3
257SendableArray ...from_arr1: 0,1,2,3
258Create from SendableArray with non-sendable array error failed. err: BusinessError: Parameter error.Only accept sendable value., code: 401
259Start Test fromArrayConstructorTest
260a,b,c
261Start Test DefinePropertyTest
262defineProperty to array success
263defineProperty to array failed. err: BusinessError: Key out of length.
264defineProperty to array success
265defineProperty to array failed. err: BusinessError: Key out of length.
266defineProperty to array failed. err: BusinessError: Key out of length.
267defineProperty to array success 321
268defineProperty to array failed. err: TypeError: Cannot define property, code: undefined
269defineProperty to array failed. err: TypeError: Cannot define property, code: undefined
270defineProperty to array failed. err: TypeError: Cannot define property, code: undefined
271defineProperty to array failed. err: TypeError: Cannot define property, code: undefined
272defineProperty to array failed. err: TypeError: Cannot define property, code: undefined
273defineProperty to array failed. err: TypeError: Cannot define property, code: undefined
274Start Test SomeTest
275true
276false
277Start Test EveryTest
278true
279false
280true
281true
282true
283true
284false
285false
286false
287false
288false
289false
290false
291false
292false
293false
294false
2954
2960
2975
298-1
299-1
300-1
3012
302