# 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=== set 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:0, done: false values next:1, done: false values next:2, done: false values next:3, done: false values next:4, done: false values next:undefined, done: true set key[forEach]:key:0, value:0 set key[forEach]:key:1, value:1 set key[forEach]:key:2, value:2 set key[forEach]:key:3, value:3 set key[forEach]:key:4, value:4 true set key[Symbol.iterator]:0 set key[Symbol.iterator]:1 set key[Symbol.iterator]:2 set key[Symbol.iterator]:3 set key[Symbol.iterator]:4 true true true true false true true false true true add extension(.): TypeError: Cannot add property in prevent extensions add extension([]): TypeError: Cannot add property in prevent extensions ===Basic test end=== ===Concurrent modification during iteration Test(iterator) begin=== set size is 5 set key[for-of]: 0 set key[for-of]: 1 set key[for-of]: 2 set key[for-of]: 3 set key[for-of]: 4 Add Scenario[for-of] updated size: 6 Delete Scenario[for-of] updated size: 2 Clear Scenario[for-of] updated size: 0 set size is 5 Add 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=== set size is 5 set key[forEach]: 0 set key[forEach]: 1 set key[forEach]: 2 set key[forEach]: 3 set key[forEach]: 4 Add 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=== sharedSet add[shared] element success sharedSet add[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 sharedSet add[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 ===Type check end=== ===Class inheritance test begin === true 1 true true true 3 SubSendableSet add[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 SubSendableSet key[for-of]: one SubSendableSet key[for-of]: two SubSendableSet key[for-of]: three 4 SubSendableSet Delete Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 true true true 3 add extension(.): TypeError: Cannot add property in prevent extensions add extension([]): TypeError: Cannot add property in prevent extensions SubSubSendableSet add[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 SubSubSendableSet Delete Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 === An iterable object to convert to an ArkTS Set begin=== set key[forEach]: 0 set key[forEach]: 1 set key[forEach]: 2 set key[forEach]: 3 set key[forEach]: 4 ===Class inheritance test end ===