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 14===Basic test begin=== 15set size is 5 16true 17true 18false 19keys next:0, done: false 20keys next:1, done: false 21keys next:2, done: false 22keys next:3, done: false 23keys next:4, done: false 24keys next:undefined, done: true 25values next:0, done: false 26values next:1, done: false 27values next:2, done: false 28values next:3, done: false 29values next:4, done: false 30values next:undefined, done: true 31set key[forEach]:key:0, value:0 32set key[forEach]:key:1, value:1 33set key[forEach]:key:2, value:2 34set key[forEach]:key:3, value:3 35set key[forEach]:key:4, value:4 36true 37set key[Symbol.iterator]:0 38set key[Symbol.iterator]:1 39set key[Symbol.iterator]:2 40set key[Symbol.iterator]:3 41set key[Symbol.iterator]:4 42true 43true 44true 45true 46false 47true 48true 49false 50true 51true 52add extension(.): TypeError: Cannot add property in prevent extensions 53add extension([]): TypeError: Cannot add property in prevent extensions 54===Basic test end=== 55===Concurrent modification during iteration Test(iterator) begin=== 56set size is 5 57set key[for-of]: 0 58set key[for-of]: 1 59set key[for-of]: 2 60set key[for-of]: 3 61set key[for-of]: 4 62Add Scenario[for-of] updated size: 6 63Delete Scenario[for-of] updated size: 2 64Clear Scenario[for-of] updated size: 0 65set size is 5 66Add Scenario[next()] updated size: 6 67Delete Scenario[next()] updated size: 5 68Clear Scenario[next()] updated size: 0 69===Concurrent modification during iteration Test(iterator) end=== 70===Concurrent modification during iteration Test(forEach) begin=== 71set size is 5 72set key[forEach]: 0 73set key[forEach]: 1 74set key[forEach]: 2 75set key[forEach]: 3 76set key[forEach]: 4 77Add Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 78Delete Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 79Clear Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 80===Concurrent modification during iteration Test(forEach) end=== 81===Type check begin=== 82sharedSet add[shared] element success 83sharedSet add[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 84sharedSet add[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 85===Type check end=== 86===Class inheritance test begin === 87true 881 89true 90true 91true 923 93SubSendableSet add[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 94SubSendableSet key[for-of]: one 95SubSendableSet key[for-of]: two 96SubSendableSet key[for-of]: three 974 98SubSendableSet Delete Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 99true 100true 101true 1023 103add extension(.): TypeError: Cannot add property in prevent extensions 104add extension([]): TypeError: Cannot add property in prevent extensions 105SubSubSendableSet add[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 106SubSubSendableSet Delete Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 107=== An iterable object to convert to an ArkTS Set begin=== 108set key[forEach]: 0 109set key[forEach]: 1 110set key[forEach]: 2 111set key[forEach]: 3 112set key[forEach]: 4 113===Class inheritance test end === 114