# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ===Basic test begin=== map size is 5 true true false keys next:0, done: false keys next:1, done: false keys next:2, done: false keys next:3, done: false keys next:4, done: false keys next:undefined, done: true values next:value0, done: false values next:value1, done: false values next:value2, done: false values next:value3, done: false values next:value4, done: false values next:undefined, done: true map key[forEach]:key:0, value:value0 map key[forEach]:key:1, value:value1 map key[forEach]:key:2, value:value2 map key[forEach]:key:3, value:value3 map key[forEach]:key:4, value:value4 true map key[Symbol.iterator]:0,value0 map key[Symbol.iterator]:1,value1 map key[Symbol.iterator]:2,value2 map key[Symbol.iterator]:3,value3 map key[Symbol.iterator]:4,value4 map entries:[0, value0] map entries:[1, value1] map entries:[2, value2] map entries:[3, value3] map entries:[4, value4] true false false true true false true true true false true true ===Basic test end=== ===Concurrent modification during iteration Test(iterator) begin=== map size is 5 map key[for-of]: 0 map key[for-of]: 1 map key[for-of]: 2 map key[for-of]: 3 map key[for-of]: 4 Set Scenario[for-of] updated size: 6 Delete Scenario[for-of] updated size: 2 Clear Scenario[for-of] updated size: 0 map size is 5 Set Scenario[next()] updated size: 6 Delete Scenario[next()] updated size: 5 Clear Scenario[next()] updated size: 0 ===Concurrent modification during iteration Test(iterator) end=== ===Concurrent modification during iteration Test(forEach) begin=== map size is 5 map key[forEach]: 0 map key[forEach]: 1 map key[forEach]: 2 map key[forEach]: 3 map key[forEach]: 4 Set Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 Delete Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 Clear Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 ===Concurrent modification during iteration Test(forEach) end=== ===Type check begin=== sharedMap set[shared] element success sharedMap set[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 sharedMap set[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 ===Type check end=== ===Class inheritance test begin === true 1 add extension(.): TypeError: Cannot add property in prevent extensions add extension([]): TypeError: Cannot add property in prevent extensions SubSendableMap set[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 3 SubSendableMap [key, value][for-of]: [1, one] SubSendableMap [key, value][for-of]: [2, two] SubSendableMap [key, value][for-of]: [3, three] SubSendableMap Delete Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 true 1 SubSubSendableMap set[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 3 SubSubSendableMap [key, value][for-of]: [1, one] SubSubSendableMap [key, value][for-of]: [2, two] SubSubSendableMap [key, value][for-of]: [3, three] SubSubSendableMap Delete Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 === An iterable object to convert to an ArkTS Map begin=== map size is 5 map key[forEach]:key:0, value:value0 map key[forEach]:key:1, value:value1 map key[forEach]:key:2, value:value2 map key[forEach]:key:3, value:value3 map key[forEach]:key:4, value:value4 ===Class inheritance test end ===